Leantel

Admin API reference

Manage people, roles, APIs, apps and settings in your workspace from your own backend.

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.

ErrorStatus
invalid_request400
invalid_token401
insufficient_scope403
forbidden403
mfa_required403
insufficient_user_authentication401
not_found404
conflict409
rate_limited429
server_error500

Users

People in your workspace, their sessions and sign-in methods.

RouteNeedsWhat it does
GET /v1/admin/users?cursor&email&username&phone&external_id&statusadmin:users:readLists people. Filter by exact email, username, phone, external ID or status.
POST /v1/admin/usersadmin:users:writeInvites 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-passwordadmin:users:writeSets a new first password, which the person changes when they next sign in. Their sessions end.
DELETE /v1/admin/users/{uid}/lockoutadmin:users:writeLets a person locked out after too many wrong passwords sign in again.
GET /v1/admin/users/{uid}admin:users:readOne person, with their status, type, roles and sign-in methods.
PATCH /v1/admin/users/{uid}admin:users:writeChanges a person's status, type or roles, or sets their external ID once.
GET /v1/admin/users/passkey-onlyadmin:users:readHow many people sign in only with a passkey, and whether the count is complete.
POST /v1/admin/users/{uid}/revoke-sessionsadmin:users:writeSigns a person out everywhere.
GET /v1/admin/users/{uid}/sessionsadmin:users:readA person's live sessions, with device and last activity.
DELETE /v1/admin/users/{uid}/sessions/{sid}admin:users:writeEnds one session.
DELETE /v1/admin/users/{uid}admin:users:writeDeletes a person and their data.
GET /v1/admin/users/{uid}/sign-ins?cursoradmin:users:readA person's sign-ins in the last 30 days, newest first.
POST /v1/admin/users/{uid}/verification-emailadmin:users:writeSends the confirmation email again.
POST /v1/admin/users/{uid}/password-resetadmin:users:writeSends a password reset email.
GET /v1/admin/users/{uid}/passkeysadmin:users:readA person's passkeys.
DELETE /v1/admin/users/{uid}/passkeys/{cred_id}admin:users:writeRemoves a passkey, unless it's the person's last way to sign in.
DELETE /v1/admin/users/{uid}/federation/{provider}admin:users:writeRemoves a connected Google account, unless it's the person's last way to sign in.
DELETE /v1/admin/users/{uid}/mfaadmin:users:writeResets 2-step verification so the person sets it up again.
POST /v1/admin/users/exportsadmin:users:exportStarts an export of everyone in the workspace as CSV.
GET /v1/admin/users/exports/{export_id}admin:users:exportThe export's status, and a download link when it's ready.
POST /v1/admin/users/importsadmin:users:writeImports people from JSON Lines, up to 10,000 rows and 5 MB.
GET /v1/admin/users/imports/{import_id}admin:users:writeThe import's status and counts.

Roles and APIs

The permissions your APIs define and the roles that grant them.

RouteNeedsWhat it does
GET /v1/admin/rolesadmin:users:readEvery role in the workspace with its permissions.
PUT /v1/admin/roles/{name}admin:roles:writeCreates or replaces a role.
DELETE /v1/admin/roles/{name}admin:roles:writeDeletes a role. A role new people receive by default can't be deleted.
GET /v1/admin/apis?cursor&limitadmin:clients:readYour APIs and their permission catalogues.
GET /v1/admin/apis/{aud}admin:clients:readOne API by its audience.
PUT /v1/admin/apis/{aud}admin:roles:writeCreates an API or replaces its permission catalogue.
DELETE /v1/admin/apis/{aud}admin:roles:writeDeletes 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.

RouteNeedsWhat it does
GET /v1/admin/clientsadmin:clients:readYour apps.
POST /v1/admin/clientsadmin:clients:writeCreates an app. A client secret is shown once.
PATCH /v1/admin/clients/{cid}admin:clients:writeChanges an app's settings.
DELETE /v1/admin/clients/{cid}admin:clients:writeDeletes an app.
POST /v1/admin/clients/{cid}/secretadmin:clients:writeRotates an app's client secret and shows the new one once.

Settings and branding

Workspace settings and the logo on your pages.

RouteNeedsWhat it does
GET /v1/admin/configadmin:config:readThe workspace settings. Secrets are never returned.
PATCH /v1/admin/configadmin:config:writeChanges workspace settings, such as branding and the webhook.
POST /v1/admin/branding/logo/uploadadmin:config:writeStarts a logo upload: PNG, JPEG or WebP, up to 1 MB.
PUT /v1/admin/branding/logoadmin:config:writeChecks the uploaded logo and uses it on your pages.

Webhooks

The signing secret, test events and deliveries.

RouteNeedsWhat it does
POST /v1/admin/webhook/secretadmin:config:writeRotates the webhook signing secret and shows the new one once. The old one stops at once.
POST /v1/admin/webhook/testadmin:config:writeSends a ping event to your webhook URL.
GET /v1/admin/webhook/deliveries?status&cursor&limitadmin:config:writeRecent webhook deliveries and their errors.
POST /v1/admin/webhook/deliveries/{delivery_id}/retryadmin:config:writeSends a failed delivery again.

Analytics

Activity counts, with no personal data.

RouteNeedsWhat it does
GET /v1/admin/analytics/activity?from&to&granularityadmin:analytics:readActivity counts over a date range, by the granularity you choose.
GET /v1/admin/analytics/retention?weeksadmin:analytics:readRetention over the number of weeks you choose.
GET /v1/admin/analytics/totalsadmin:analytics:readTotals for the workspace.

OAuth and OpenID Connect

Standard endpoints; read them from the discovery document rather than hard-coding them.

RouteNeedsWhat it does
GET /.well-known/openid-configurationNoneThe discovery document. Read every endpoint from it instead of hard-coding paths.
GET /.well-known/jwks.jsonNoneThe public keys that sign tokens (RS256). Cache them and fetch again when a token names an unknown key.
GET /oauth/authorizeNoneStarts sign-in or sign-up in the browser: authorization code with PKCE S256.
POST /oauth/tokenClient authenticationExchanges a code, refreshes tokens or runs client credentials. Form-encoded.
POST /oauth/revokeClient authenticationRevokes a refresh token (RFC 7009). Always answers 200.
GET /oauth/userinfoBearer access tokenThe signed-in person's claims, for an access token with the openid scope.
POST /oauth/userinfoBearer access tokenThe same as GET, called with POST.
GET /oauth/logoutNoneEnds the Leantel session and returns to a registered sign-out URL.