Skip to content

Admin API

Every project has an Admin API at <issuer>/admin/v1 that your own backend can use to manage users.

  1. Create a machine-to-machine application, and give it the Admin API’s scopes: users:read to list and read users, and users:write to create and change them.
  2. Get a token with the client credentials grant:
Terminal window
curl -u "$CLIENT_ID:$CLIENT_SECRET" "$ISSUER/oauth2/token" \
-d grant_type=client_credentials -d resource=urn:idp:admin-api

urn:idp:admin-api is the Admin API’s identifier, which is also shown on the portal’s API resources page. Send the token as Authorization: Bearer <token>, or as Authorization: DPoP <token> with a proof if it’s DPoP-bound. A token stops working as soon as its application is deleted or loses access.

Method and path Scope Does
GET /users?search=&limit=&cursor= users:read Lists users, newest first. limit is 1–100; pass back cursor for the next page.
GET /users/{id} users:read One user, with their profile, roles, groups and sign-in methods.
POST /users users:write Creates a user. Body: email, and optionally password, emailVerified, username and sendSetPasswordEmail.
PATCH /users/{id}/profile users:write Changes attributes. Body: attributes and customAttributes; null clears one.
PUT /users/{id}/access users:write Sets roles and groups. Body: roles and groups.
PUT /users/{id}/username users:write Sets or removes (null) the username.
POST /users/{id}/disable, /enable users:write Stops or allows sign-in. Disabling ends their sessions.
POST /users/{id}/reset-mfa users:write Removes their second-step methods.
PUT /users/{id}/mfa-grace users:write Body: until (an ISO date-time, or null): time to set up two-step verification.
POST /users/{id}/schedule-removal users:write Body: kind (delete or anonymize): after the project’s grace period.
POST /users/{id}/cancel-removal users:write Cancels a scheduled removal.
POST /users/{id}/anonymize users:write Anonymises now.
DELETE /users/{id} users:write Deletes now.

Errors come back as JSON, { "error": "…", "message": "…" }, with a status of 400, 401, 403 (missing scope), 404, 409 (email address or username already taken) or 429. Profile changes are checked against your attribute rules, and go through any user.profile.pre_update hooks you’ve set up.