Skip to content

Authentication and Authorization

Authentication Methods

All Admin APIs use Bearer token authentication. Include the admin API token in the Authorization header:

Terminal window
curl -X GET "https://{tenant-domain}/api/admin/users" \
-H "Authorization: Bearer {admin-api-token}"

API Categories

The Admin API is divided into two main categories based on the target database:

Admin Console APIs (DB_ADMIN)

  • Admin User Management (/api/admin/admins/*)
  • Admin Role Management (/api/admin/admin-roles/*)
  • IP Allowlist (/api/admin/ip-allowlist/*)
  • Admin Audit Log (/api/admin/admin-audit-log/*)

EndUser Management APIs (DB_CORE)

  • EndUser Management (/api/admin/users/*)
  • Session Management (/api/admin/sessions/*)
  • Client Management (/api/admin/clients/*)
  • Access Control APIs (roles, organizations, policies, etc.)
  • Audit & Compliance APIs

Obtaining Admin API Tokens

Admin API tokens can be issued from the admin console:

  1. Log in to the admin console
  2. Navigate to “Settings” → “API Tokens”
  3. Click “Create New Token”
  4. Set the token name and expiration
  5. Select the required permission scopes
  6. Generate the token and store it securely

Role Hierarchy

Admin API permissions are based on a hierarchical role model. Higher roles have all permissions of lower roles.

system_admin (System Administrator)
distributor_admin (Distributor Administrator)
tenant_admin (Tenant Administrator)
user (Regular User)

Permissions by Role

RoleDescriptionMain Permissions
system_adminSystem-wide administratorManage all tenants, system settings
distributor_adminDistributor administratorManage subordinate tenants, create tenants
tenant_adminTenant administratorAll management operations within tenant
userRegular userManage own account only

Permission Scopes

Fine-grained permission scopes can be assigned to API tokens:

User Management Scopes

ScopeDescription
users:readRead user information
users:writeCreate/update users
users:deleteDelete users
users:suspendSuspend/unsuspend users

Client Management Scopes

ScopeDescription
clients:readRead client information
clients:writeCreate/update clients
clients:deleteDelete clients
clients:secretsManage client secrets

Access Control Scopes

ScopeDescription
roles:readRead role information
roles:writeCreate/update/delete roles
roles:assignAssign roles
policies:readRead policies
policies:writeCreate/update/delete policies

Audit & Compliance Scopes

ScopeDescription
audit:readRead audit logs
compliance:readRead compliance information
compliance:writeExecute access reviews

Authorization Errors

If permissions are insufficient, the API returns the following errors:

401 Unauthorized

When authentication credentials are not provided or invalid:

{
"error": "unauthorized",
"error_description": "Authentication required"
}

403 Forbidden

When authentication succeeded but there is no permission for the requested operation:

{
"error": "forbidden",
"error_description": "You do not have permission to perform this operation"
}

Tenant Context

API requests are executed in the tenant context associated with the authentication token. Cross-tenant data access is strictly restricted.

Multi-tenant Management

Users with system_admin or distributor_admin roles can manage multiple tenants. In this case, specify the tenant in the request header:

Terminal window
curl -X GET "https://{domain}/api/admin/users" \
-H "Authorization: Bearer {admin-api-token}" \
-H "X-Tenant-ID: {target-tenant-id}"

Best Practices

Principle of Least Privilege

Grant only the minimum required permission scopes to tokens.

Terminal window
# Bad example: Grant all permissions
# Scopes: *
# Good example: Only required permissions
# Scopes: users:read, users:write

Token Rotation

We recommend rotating API tokens regularly:

  1. Generate a new token
  2. Switch the application to the new token
  3. Revoke the old token

Audit Log Review

Regularly review API token usage. If suspicious activity is detected, revoke the token immediately.