Skip to content

List Users

Retrieve a list of all users in the organisation.

Endpoint

GET /v1/admin/users

Authentication

  • Required: Yes
  • Type: Session-based authentication
  • Required Permission: users:read

Security

  • CSRF protection enabled (requires valid CSRF token)
  • Tenant isolation enforced (only users from the authenticated user's organisation)
  • Requires admin-level permissions

Request

Headers

HeaderRequiredDescription
CookieYesSession cookie (cerberus_session)
X-CSRF-TokenYesCSRF token for request validation

Query Parameters

None (pagination and filtering to be implemented in future versions)

Request Body

None

Response

Success Response (200 OK)

json
{
  "data": [
    {
      "id": "usr_01h2xz9k3m4n5p6q7r8s9t0v1w",
      "email": "[email protected]",
      "firstName": "John",
      "lastName": "Doe",
      "name": "John Doe",
      "phone": "+1234567890",
      "emailVerifiedAt": "2025-01-15T10:30:00.000Z",
      "mfaEnabled": true,
      "blockedAt": null,
      "blockedReason": null,
      "createdAt": "2025-01-10T08:00:00.000Z",
      "updatedAt": "2025-10-26T11:45:00.000Z",
      "roles": [
        {
          "id": "rol_01h2xz9k3m4n5p6q7r8s9t0v1y",
          "name": "Administrator",
          "slug": "admin"
        }
      ],
      "teams": [
        {
          "id": "tem_01h2xz9k3m4n5p6q7r8s9t0v1z",
          "name": "Engineering",
          "slug": "engineering"
        }
      ]
    },
    {
      "id": "usr_01h2xz9k3m4n5p6q7r8s9t0v2x",
      "email": "[email protected]",
      "firstName": "Jane",
      "lastName": "Smith",
      "name": "Jane Smith",
      "phone": null,
      "emailVerifiedAt": "2025-02-01T09:15:00.000Z",
      "mfaEnabled": false,
      "blockedAt": null,
      "blockedReason": null,
      "createdAt": "2025-02-01T09:00:00.000Z",
      "updatedAt": "2025-10-25T15:20:00.000Z",
      "roles": [
        {
          "id": "rol_01h2xz9k3m4n5p6q7r8s9t0v2y",
          "name": "Member",
          "slug": "member"
        }
      ],
      "teams": []
    }
  ],
  "total": 2
}

Response Fields

FieldTypeDescription
dataarrayArray of user objects
totalnumberTotal count of users
data[].idstringUnique user identifier
data[].emailstringUser's email address
data[].firstNamestringUser's first name
data[].lastNamestringUser's last name
data[].namestringUser's full name
data[].phonestring | nullUser's phone number
data[].emailVerifiedAtstring | nullISO 8601 timestamp of email verification
data[].mfaEnabledbooleanWhether MFA is enabled
data[].blockedAtstring | nullISO 8601 timestamp when user was blocked
data[].blockedReasonstring | nullReason for blocking the user
data[].createdAtstringISO 8601 timestamp of user creation
data[].updatedAtstringISO 8601 timestamp of last update
data[].rolesarrayRoles assigned to the user
data[].teamsarrayTeams the user belongs to

Error Responses

401 Unauthorized

User is not authenticated.

json
{
  "type": "https://cerberus-iam.dev/problems/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication required",
  "instance": "/v1/admin/users"
}

403 Forbidden

User lacks the required permission or CSRF token is invalid.

json
{
  "type": "https://cerberus-iam.dev/problems/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "Missing required permission: users:read",
  "instance": "/v1/admin/users"
}

Example Usage

cURL

bash
curl -X GET https://api.cerberus-iam.dev/v1/admin/users \
  -H "Cookie: cerberus_session=abc123..." \
  -H "X-CSRF-Token: xyz789..."

JavaScript (fetch)

javascript
const response = await fetch('https://api.cerberus-iam.dev/v1/admin/users', {
  method: 'GET',
  credentials: 'include',
  headers: {
    'X-CSRF-Token': getCsrfToken(),
  },
});

const { data: users, total } = await response.json();
console.log(`Found ${total} users:`, users);

Python (requests)

python
import requests

response = requests.get(
    'https://api.cerberus-iam.dev/v1/admin/users',
    cookies={'cerberus_session': 'abc123...'},
    headers={'X-CSRF-Token': 'xyz789...'}
)

users_data = response.json()
print(f"Total users: {users_data['total']}")
for user in users_data['data']:
    print(f"- {user['name']} ({user['email']})")

Notes

  • Users are filtered by the authenticated user's organisation (tenant isolation)
  • Soft-deleted users are excluded from the results
  • The endpoint returns all users without pagination (consider implementing pagination for large datasets)
  • Role and team information is included in the response for convenience
  • Phone numbers may be null if not provided
  • Blocked users are included in the results with blockedAt and blockedReason fields populated

Released under the MIT License.