Skip to main content

Management API

REST API for programmatic management of your realm's users, applications, roles, and API resources.

Base URL: https://your-domain.com/api/v1/{realmUUID}

Authentication

The Management API uses M2M (Machine-to-Machine) tokens. Get one via the client_credentials grant:

curl -X POST https://your-domain.com/oauth2/{realmUUID}/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "scope=users:read users:write roles:read"

Response:

{
"access_token": "eyJhbGciOiJSUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600
}

Use the token in all API requests:

curl https://your-domain.com/api/v1/{realmUUID}/users \
-H "Authorization: Bearer {access_token}"
tip

Request only the scopes you need. Available scopes: users:read, users:write, users:roles, applications:read, applications:write, roles:read, roles:write, resources:read, resources:write.

Error format

All errors return a consistent JSON structure:

{
"error": "not_found",
"message": "User not found"
}

Common HTTP status codes:

CodeMeaning
400Invalid request body or parameters
401Missing or invalid token
403Token lacks required scope
404Resource not found
422Validation error

Users API

Base: /api/v1/{realmUUID}/users

MethodPathScopeDescription
GET/usersusers:readList users (paginated)
POST/usersusers:writeCreate user
GET/users/{id}users:readGet user by ID
PATCH/users/{id}users:writeUpdate user
DELETE/users/{id}users:writeDelete user
PATCH/users/{id}/passwordusers:writeChange password
PATCH/users/{id}/is-suspendedusers:writeBlock/unblock user
GET/users/{id}/rolesusers:rolesList user roles
POST/users/{id}/rolesusers:rolesAssign roles
DELETE/users/{id}/roles/{roleId}users:rolesRemove role
GET/users/{id}/identitiesusers:readConnected providers

List users

curl "https://your-domain.com/api/v1/{realmUUID}/users?page=1&per_page=20&search=john" \
-H "Authorization: Bearer {token}"
{
"data": [
{
"id": "01HQ...",
"email": "john@example.com",
"name": "John Doe",
"is_suspended": false,
"created_at": "2026-01-15T10:30:00Z"
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 1
}
}

Create user

curl -X POST https://your-domain.com/api/v1/{realmUUID}/users \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"email": "jane@example.com",
"name": "Jane Doe",
"password": "securePassword123"
}'

Update user

curl -X PATCH https://your-domain.com/api/v1/{realmUUID}/users/{id} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"name": "Jane Smith"}'

Change password

curl -X PATCH https://your-domain.com/api/v1/{realmUUID}/users/{id}/password \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"password": "newSecurePassword456"}'

Block/unblock user

curl -X PATCH https://your-domain.com/api/v1/{realmUUID}/users/{id}/is-suspended \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"is_suspended": true}'

Assign roles to user

curl -X POST https://your-domain.com/api/v1/{realmUUID}/users/{id}/roles \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"role_ids": ["role-uuid-1", "role-uuid-2"]}'

Remove role from user

curl -X DELETE https://your-domain.com/api/v1/{realmUUID}/users/{id}/roles/{roleId} \
-H "Authorization: Bearer {token}"

Applications API

Base: /api/v1/{realmUUID}/applications

MethodPathScopeDescription
GET/applicationsapplications:readList applications
POST/applicationsapplications:writeCreate application
GET/applications/{id}applications:readGet application
PATCH/applications/{id}applications:writeUpdate application
DELETE/applications/{id}applications:writeDelete application
GET/applications/{id}/rolesapplications:readList app roles
POST/applications/{id}/rolesapplications:writeAssign roles
DELETE/applications/{id}/roles/{roleId}applications:writeRemove role

Create application

curl -X POST https://your-domain.com/api/v1/{realmUUID}/applications \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"name": "My SPA",
"type": "spa",
"redirect_uris": ["https://myapp.com/callback"]
}'
{
"data": {
"id": "01HQ...",
"name": "My SPA",
"type": "spa",
"client_id": "abc123",
"redirect_uris": ["https://myapp.com/callback"],
"created_at": "2026-01-15T10:30:00Z"
}
}

Assign roles to application

curl -X POST https://your-domain.com/api/v1/{realmUUID}/applications/{id}/roles \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"role_ids": ["role-uuid-1"]}'

Roles API

Base: /api/v1/{realmUUID}/roles

MethodPathScopeDescription
GET/rolesroles:readList roles
POST/rolesroles:writeCreate role
GET/roles/{id}roles:readGet role
PATCH/roles/{id}roles:writeUpdate role
DELETE/roles/{id}roles:writeDelete role
GET/roles/{id}/scopesroles:readList role scopes
POST/roles/{id}/scopesroles:writeAssign scopes
DELETE/roles/{id}/scopes/{scopeId}roles:writeRemove scope

Create role

curl -X POST https://your-domain.com/api/v1/{realmUUID}/roles \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"name": "editor",
"description": "Can edit content"
}'

Assign scopes to role

curl -X POST https://your-domain.com/api/v1/{realmUUID}/roles/{id}/scopes \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"scope_ids": ["scope-uuid-1", "scope-uuid-2"]}'

Resources API

Base: /api/v1/{realmUUID}/resources

MethodPathScopeDescription
GET/resourcesresources:readList API resources
POST/resourcesresources:writeCreate resource
GET/resources/{id}resources:readGet resource
PATCH/resources/{id}resources:writeUpdate resource
DELETE/resources/{id}resources:writeDelete resource
GET/resources/{id}/scopesresources:readList resource scopes
POST/resources/{id}/scopesresources:writeAdd scope
PATCH/resources/{id}/scopes/{scopeId}resources:writeUpdate scope
DELETE/resources/{id}/scopes/{scopeId}resources:writeRemove scope

Create API resource

curl -X POST https://your-domain.com/api/v1/{realmUUID}/resources \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"name": "My API",
"indicator": "https://api.myapp.com"
}'
{
"data": {
"id": "01HQ...",
"name": "My API",
"indicator": "https://api.myapp.com",
"created_at": "2026-01-15T10:30:00Z"
}
}

Add scope to resource

curl -X POST https://your-domain.com/api/v1/{realmUUID}/resources/{id}/scopes \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"name": "read:posts",
"description": "Read blog posts"
}'

Update scope

curl -X PATCH https://your-domain.com/api/v1/{realmUUID}/resources/{id}/scopes/{scopeId} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"description": "Read all blog posts"}'