API reference
Users
The admins and operators who sign in to your account’s console, with their roles and the policies they can access.
Users are the people who sign in to the WeGuard console, not the people using managed devices. The API never returns passwords, MFA secrets, recovery codes, tokens or billing data.
The user object
idstring- Unique user id.
objectstring- Always
user. emailstringnullable- The email address the user signs in with.
nullonly for malformed legacy records. firstNamestringnullable- First name.
lastNamestringnullable- Last name.
rolestring- Console role, for example
customer_admin(full access),group_adminorobserver(read-only). New roles may appear. Users without a stored role are reported ascustomer_admin, because that is how the console treats them. mfaEnabledbooleantruewhen the user has completed multi-factor authentication setup, so it is enforced at sign-in. A setup that was started but not finished does not count.emailVerifiedbooleantruewhen the user verified their email address.ssoLinkedbooleantruewhen the user’s login is linked to single sign-on.lastLoginAttimestampnullable- When the user last signed in.
createdAttimestamp- When the user was created.
policyScopeobjectnullable- For roles limited to specific policies, the policies the user can see and manage.
nullforcustomer_admin, who can access everything, and when no policy assignment is recorded for the user. policyScope.allPoliciesbooleantruewhen the user can access every policy.policyIdsis then empty.policyScope.policyIdsarray of strings- Ids of the policies the user can access.
{
"id": "5f2a9c3e1b7d4a6f8e0c2b41",
"object": "user",
"email": "jane@acme.example",
"firstName": "Jane",
"lastName": "Doe",
"role": "group_admin",
"mfaEnabled": true,
"emailVerified": true,
"ssoLinked": false,
"lastLoginAt": "2026-10-06T14:02:11Z",
"createdAt": "2025-02-11T09:00:00Z",
"policyScope": {
"allPolicies": false,
"policyIds": [
"64ff0a1b2c3d4e5f60718293"
]
}
}List users
/ v1/ usersReturns the console users of your account, ordered by id (creation order), as a paginated list.
Query parameters
rolestringoptional- Only return users with this role, for example
observer. Matches a lowercase role name exactly: letters and_, at most 64 characters.customer_adminalso matches users without a stored role. limitintegeroptionaldefault 25- Maximum number of items to return, from
1to100. cursorstringoptional- The
nextCursorfrom the previous page. Send it unchanged, together with the same filters. See Pagination. includeTotalbooleanoptionaldefault false- Set to
trueto also returntotalCount. It runs an extra count, so request it only when you need it.
Example request
curl "https://api-gw.weguard.ai/core/v1/users?role=group_admin&limit=1" \
-H "Authorization: Bearer $WEGUARD_API_KEY"const response = await fetch("https://api-gw.weguard.ai/core/v1/users?role=group_admin&limit=1", {
headers: { Authorization: `Bearer ${process.env.WEGUARD_API_KEY}` },
});
const body = await response.json();
if (!response.ok) {
throw new Error(`${body.code}: ${body.detail} (requestId ${body.requestId})`);
}
console.log(body);import os
import requests
response = requests.get(
"https://api-gw.weguard.ai/core/v1/users",
params={"role": "group_admin", "limit": 1},
headers={"Authorization": f"Bearer {os.environ['WEGUARD_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
print(response.json())Response
A list object whose data holds user objects.
{
"object": "list",
"data": [
{
"id": "5f2a9c3e1b7d4a6f8e0c2b41",
"object": "user",
"email": "jane@acme.example",
"firstName": "Jane",
"lastName": "Doe",
"role": "group_admin",
"mfaEnabled": true,
"emailVerified": true,
"ssoLinked": false,
"lastLoginAt": "2026-10-06T14:02:11Z",
"createdAt": "2025-02-11T09:00:00Z",
"policyScope": {
"allPolicies": false,
"policyIds": [
"64ff0a1b2c3d4e5f60718293"
]
}
}
],
"hasMore": true,
"nextCursor": "YzE6NjUyM2YxYzJhN2I5ZDQwMDEyMzQ1Njc4"
}Errors
roleis not a lowercase role name,limitorincludeTotalis invalid, or a parameter was sent twice.The request includes a query parameter this endpoint does not accept.
The cursor is malformed or was issued for different filters.
The key lacks
users:read.
Retrieve a user
/ v1/ users/ {userId}Returns a single console user by id.
Path parameters
userIdstringrequired- Id of the user. Case-insensitive.
Example request
curl https://api-gw.weguard.ai/core/v1/users/5f2a9c3e1b7d4a6f8e0c2b41 \
-H "Authorization: Bearer $WEGUARD_API_KEY"const response = await fetch("https://api-gw.weguard.ai/core/v1/users/5f2a9c3e1b7d4a6f8e0c2b41", {
headers: { Authorization: `Bearer ${process.env.WEGUARD_API_KEY}` },
});
const body = await response.json();
if (!response.ok) {
throw new Error(`${body.code}: ${body.detail} (requestId ${body.requestId})`);
}
console.log(body);import os
import requests
response = requests.get(
"https://api-gw.weguard.ai/core/v1/users/5f2a9c3e1b7d4a6f8e0c2b41",
headers={"Authorization": f"Bearer {os.environ['WEGUARD_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
print(response.json())Response
Returns a user object.
{
"id": "5f2a9c3e1b7d4a6f8e0c2b41",
"object": "user",
"email": "jane@acme.example",
"firstName": "Jane",
"lastName": "Doe",
"role": "group_admin",
"mfaEnabled": true,
"emailVerified": true,
"ssoLinked": false,
"lastLoginAt": "2026-10-06T14:02:11Z",
"createdAt": "2025-02-11T09:00:00Z",
"policyScope": {
"allPolicies": false,
"policyIds": [
"64ff0a1b2c3d4e5f60718293"
]
}
}Errors
No user with this id exists in your account.
The request includes a query parameter. This endpoint takes none.
The key lacks
users:read.
Common errors
Besides the errors listed for each endpoint, any request can fail authentication, exceed the rate limit, ask for a format other than JSON, or fail with a server error. See Errors for the response format and retry guidance.
The request has no
Authorizationheader.The
Authorizationheader does not use theBearerscheme, or has no key after it. TheWWW-Authenticateheader carrieserror="invalid_request".The key is malformed, does not exist, or its secret does not match. The
WWW-Authenticateheader carrieserror="invalid_token".The key is past its
expiresAt.An account admin revoked the key. Revocation takes effect immediately and cannot be undone.
The WeGuard account that owns the key has been deleted or disabled.
The
Acceptheader excludes JSON.The key has used up its request budget. See Rate limits.
An unexpected error occurred on our side.
A service WeGuard depends on is temporarily unavailable, or reading the data took longer than the time WeGuard allows for it. This can also happen while your key is being checked, so it can be returned before authentication completes. The response carries
Retry-After.