Access
Every Admin API request carries a bearer access token for the audience auth-admin with the permission each route lists. A backend gets one with the client credentials grant: list auth-admin in the app's APIs and allow the admin:* permissions it needs. A person gets them through a role that grants them, signed in through an app allowed to use auth-admin. The base URL is your issuer, for example https://auth.leantel.dev.
Responses and errors
Responses are JSON. Success is {"status", "message", "data"}; a list adds next_cursor until the last page (pass it back as cursor, with limit up to 100). Every response has an X-Request-ID header. An error is {"status", "message", "error", "error_description", "request_id"}, and an invalid_request about one input adds field.
| Error | Status |
|---|---|
invalid_request | 400 |
invalid_token | 401 |
insufficient_scope | 403 |
forbidden | 403 |
mfa_required | 403 |
insufficient_user_authentication | 401 |
not_found | 404 |
conflict | 409 |
rate_limited | 429 |
server_error | 500 |
Users
People in your workspace, their sessions and sign-in methods.
| Route | Needs | What it does |
|---|---|---|
GET /v1/admin/users?cursor&email&username&phone&external_id&status | admin:users:read | Lists people. Filter by exact email, username, phone, external ID or status. |
POST /v1/admin/users | admin:users:write | Invites a person by email for one of your apps, or creates one with a first password they change when they first sign in. |
POST /v1/admin/users/{uid}/first-password | admin:users:write | Sets a new first password, which the person changes when they next sign in. Their sessions end. |
DELETE /v1/admin/users/{uid}/lockout | admin:users:write | Lets a person locked out after too many wrong passwords sign in again. |
GET /v1/admin/users/{uid} | admin:users:read | One person, with their status, type, roles and sign-in methods. |
PATCH /v1/admin/users/{uid} | admin:users:write | Changes a person's status, type or roles, or sets their external ID once. |
GET /v1/admin/users/passkey-only | admin:users:read | How many people sign in only with a passkey, and whether the count is complete. |
POST /v1/admin/users/{uid}/revoke-sessions | admin:users:write | Signs a person out everywhere. |
GET /v1/admin/users/{uid}/sessions | admin:users:read | A person's live sessions, with device and last activity. |
DELETE /v1/admin/users/{uid}/sessions/{sid} | admin:users:write | Ends one session. |
DELETE /v1/admin/users/{uid} | admin:users:write | Deletes a person and their data. |
GET /v1/admin/users/{uid}/sign-ins?cursor | admin:users:read | A person's sign-ins in the last 30 days, newest first. |
POST /v1/admin/users/{uid}/verification-email | admin:users:write | Sends the confirmation email again. |
POST /v1/admin/users/{uid}/password-reset | admin:users:write | Sends a password reset email. |
GET /v1/admin/users/{uid}/passkeys | admin:users:read | A person's passkeys. |
DELETE /v1/admin/users/{uid}/passkeys/{cred_id} | admin:users:write | Removes a passkey, unless it's the person's last way to sign in. |
DELETE /v1/admin/users/{uid}/federation/{provider} | admin:users:write | Removes a connected Google account, unless it's the person's last way to sign in. |
DELETE /v1/admin/users/{uid}/mfa | admin:users:write | Resets 2-step verification so the person sets it up again. |
POST /v1/admin/users/exports | admin:users:export | Starts an export of everyone in the workspace as CSV. |
GET /v1/admin/users/exports/{export_id} | admin:users:export | The export's status, and a download link when it's ready. |
POST /v1/admin/users/imports | admin:users:write | Imports people from JSON Lines, up to 10,000 rows and 5 MB. |
GET /v1/admin/users/imports/{import_id} | admin:users:write | The import's status and counts. |
Roles and APIs
The permissions your APIs define and the roles that grant them.
| Route | Needs | What it does |
|---|---|---|
GET /v1/admin/roles | admin:users:read | Every role in the workspace with its permissions. |
PUT /v1/admin/roles/{name} | admin:roles:write | Creates or replaces a role. |
DELETE /v1/admin/roles/{name} | admin:roles:write | Deletes a role. A role new people receive by default can't be deleted. |
GET /v1/admin/apis?cursor&limit | admin:clients:read | Your APIs and their permission catalogues. |
GET /v1/admin/apis/{aud} | admin:clients:read | One API by its audience. |
PUT /v1/admin/apis/{aud} | admin:roles:write | Creates an API or replaces its permission catalogue. |
DELETE /v1/admin/apis/{aud} | admin:roles:write | Deletes an API that no app or role still uses. Its audience can't be used again. |
Apps
The apps that sign people in or call your APIs.
| Route | Needs | What it does |
|---|---|---|
GET /v1/admin/clients | admin:clients:read | Your apps. |
POST /v1/admin/clients | admin:clients:write | Creates an app. A client secret is shown once. |
PATCH /v1/admin/clients/{cid} | admin:clients:write | Changes an app's settings. |
DELETE /v1/admin/clients/{cid} | admin:clients:write | Deletes an app. |
POST /v1/admin/clients/{cid}/secret | admin:clients:write | Rotates an app's client secret and shows the new one once. |
Settings and branding
Workspace settings and the logo on your pages.
| Route | Needs | What it does |
|---|---|---|
GET /v1/admin/config | admin:config:read | The workspace settings. Secrets are never returned. |
PATCH /v1/admin/config | admin:config:write | Changes workspace settings, such as branding and the webhook. |
POST /v1/admin/branding/logo/upload | admin:config:write | Starts a logo upload: PNG, JPEG or WebP, up to 1 MB. |
PUT /v1/admin/branding/logo | admin:config:write | Checks the uploaded logo and uses it on your pages. |
Webhooks
The signing secret, test events and deliveries.
| Route | Needs | What it does |
|---|---|---|
POST /v1/admin/webhook/secret | admin:config:write | Rotates the webhook signing secret and shows the new one once. The old one stops at once. |
POST /v1/admin/webhook/test | admin:config:write | Sends a ping event to your webhook URL. |
GET /v1/admin/webhook/deliveries?status&cursor&limit | admin:config:write | Recent webhook deliveries and their errors. |
POST /v1/admin/webhook/deliveries/{delivery_id}/retry | admin:config:write | Sends a failed delivery again. |
Analytics
Activity counts, with no personal data.
| Route | Needs | What it does |
|---|---|---|
GET /v1/admin/analytics/activity?from&to&granularity | admin:analytics:read | Activity counts over a date range, by the granularity you choose. |
GET /v1/admin/analytics/retention?weeks | admin:analytics:read | Retention over the number of weeks you choose. |
GET /v1/admin/analytics/totals | admin:analytics:read | Totals for the workspace. |
OAuth and OpenID Connect
Standard endpoints; read them from the discovery document rather than hard-coding them.
| Route | Needs | What it does |
|---|---|---|
GET /.well-known/openid-configuration | None | The discovery document. Read every endpoint from it instead of hard-coding paths. |
GET /.well-known/jwks.json | None | The public keys that sign tokens (RS256). Cache them and fetch again when a token names an unknown key. |
GET /oauth/authorize | None | Starts sign-in or sign-up in the browser: authorization code with PKCE S256. |
POST /oauth/token | Client authentication | Exchanges a code, refreshes tokens or runs client credentials. Form-encoded. |
POST /oauth/revoke | Client authentication | Revokes a refresh token (RFC 7009). Always answers 200. |
GET /oauth/userinfo | Bearer access token | The signed-in person's claims, for an access token with the openid scope. |
POST /oauth/userinfo | Bearer access token | The same as GET, called with POST. |
GET /oauth/logout | None | Ends the Leantel session and returns to a registered sign-out URL. |