Authentication
Every call except health and the OpenAPI file needs a Bearer token. There are two kinds:
API clients (servers, scripts, integrations)
An organization owner or admin creates one under Organizations › API clients and ticks its scopes. The secret is shown once. A client acts as the person who created it, sees only its own organization, and stops working if that person no longer runs it. Clauth owners can also make platform clients that reach every organization.
# 1. a 15-minute token curl -s https://auth.example.com/oauth/token -d grant_type=client_credentials \ -d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET -d "scope=users:read access:write" # 2. call the API curl -s https://auth.example.com/api/v1/capabilities -H "Authorization: Bearer $TOKEN"
Personal API tokens (you, from a script or CLI)
Make one in My account › API tokens (7, 30 or 90 days). It acts as you and can never do more than you can in the console; if you lose a role, your tokens lose it too. Tokens that manage other people need 2-step verification on your account. Only personal tokens can call /me.
| Scope | Allows |
|---|---|
users:read | Look up users (machine-to-machine) |
users:write | Manage people: invite, update, lock, disable (API) |
orgs:read | Read organizations and members (API) |
orgs:write | Add and remove members (API) |
apps:read | Read apps, roles and permissions (API) |
apps:write | Sync manifests, rotate and revoke app clients (API) |
access:read | Read grants, access profiles and who has what (API) |
access:write | Change access profiles and people's access (API) |
audit:read | Read the audit log (API) |
connections:read | Read sign-in providers, SMS gateway and email senders (API) |
connections:write | Add and change sign-in providers, SMS gateway and email senders (API) |
agents:read | Read the organization’s agents (API) |
agents:write | Create agents, give them roles, rotate their secrets (API) |
config:read | Export an organization’s setup; read variables (API) |
config:write | Import a setup; set variables and secrets (API) |
authzen | Ask "can this person do X in this app?" (AuthZEN access evaluation) |
scim | Provision people and groups with SCIM 2.0 (HR systems, Google Workspace, Entra, Okta) |
settings:read | Read platform settings (API, platform clients only) |
settings:write | Change platform settings (API, platform clients only) |
me:read / me:write | Your own account (personal tokens only) |
Conventions
- IDs you can read. People by
usr_…id or email, organizations by slug, apps by key, roles and access profiles by key. - Lists return
{"data": […], "next_cursor": "…"}. Send?limit=(up to 200) and?cursor=for the next page. - Safe retries. Send an
Idempotency-Keyheader on POST: the same key within 24 hours returns the first answer instead of doing the work twice. - No lost updates. Single resources send an
ETag. Send it back asIf-Matchon PATCH, PUT or DELETE and you get412if someone changed it in the meantime. - Rate limits per client: 600 reads and 120 writes a minute by default, shown in
RateLimit-*headers. - Audit. Every change is in the audit log as
api, with the client and the person it acts for. - Other records are invisible. Anything outside your organization answers
404, never403, so its existence never leaks.
Errors
Errors are RFC 9457 problem details (application/problem+json). errors lists field problems on a 422. Quote request_id when asking for help.
{ "type": "https://helloclauth.com/docs/api/#error-missing-scope", "title": "Missing scope", "status": 403,
"detail": "This call needs the users:write scope.", "request_id": "01K…" }
| Status | Title | What to do |
|---|---|---|
401 | Invalid token | Get a new token; check it is sent as Authorization: Bearer. |
401 | Not an API client | Use an API client or a personal token, not an app's own client. |
403 | Missing scope | Ask for the scope when requesting the token (the client must be allowed it). |
403 | Personal token needed | /me works with personal API tokens only. |
403 | Client owner lost access | The person who created the client no longer runs the organization: create a new client. |
403 | Organization suspended | Read-only until Clauth restores the organization. |
403 | Forbidden | The rule in detail applies (for example Owner-tier roles need an organization owner). |
404 | Not found | It does not exist or is outside your organization. |
405 | Method not allowed | Check the method in this reference. |
409 | Conflict | The current state does not allow it (detail says why). |
409 | Request in progress | A request with the same Idempotency-Key is still running: wait and retry. |
412 | Changed since read | Read it again (new ETag) and retry. |
422 | Invalid request | Fix the fields listed in errors. |
422 | Unprocessable | The request is valid JSON but breaks a rule (detail says which). |
422 | Idempotency key reused | Use a new Idempotency-Key for a different request body. |
429 | Too many requests | Wait for Retry-After seconds. |
429 | Limit reached | An organization limit (people, apps, invites a day…) was hit. |
500 | Server error | Retry later; quote request_id. |
SCIM provisioning
Let an HR system or identity provider (Google Workspace, Microsoft Entra ID, Okta) keep an organization's people in step. In Organizations › API clients, choose Make SCIM token and paste the base URL and token into the provider. The token works for a year; making a new one turns the old one off.
| Endpoint | What it does |
|---|---|
GET /scim/v2/ServiceProviderConfig, /Schemas, /ResourceTypes | Discovery |
GET|POST /scim/v2/Users | List (filter userName eq "…", externalId eq "…") or add a person. New people get an invite email; someone who already has a Clauth account is linked, not duplicated. |
GET|PUT|PATCH|DELETE /scim/v2/Users/{id} | active: false keeps the membership but removes all access in the organization. DELETE removes the person from this organization only. |
GET|POST /scim/v2/Groups, …/Groups/{id} | Groups are access profiles. Adding someone to a group gives them the roles the profile maps to in every app. |
Teams and profile fields travel in the extension urn:ietf:params:scim:schemas:extension:clauth:2.0:User as {"teams": ["ayala"], "fields": {"employee_no": "E-17"}}. A person's email and name only change through SCIM when this is their only organization. Errors use SCIM's own format. Not supported yet: bulk, sorting, .search, /Me.
AuthZEN — "can this person do X?"
An app's server can ask Clauth directly instead of reading the token, using AuthZEN 1.0. Get a client-credentials token with the authzen scope from the app's own server client (it can only ask about its own app) or from an API client (people in its organization only). Discovery: /.well-known/authzen-configuration.
POST /access/v1/evaluation
{ "subject": { "type": "user", "id": "usr_01K…" },
"action": { "name": "expense.approve" }, // or "role:finance"
"resource": { "type": "app", "id": "xpenses", "properties": { "org": "acme" } } }
→ { "decision": true, "context": { "orgs": ["acme"] } }
POST /access/v1/evaluations answers up to 100 questions at once, with deny_on_first_deny or permit_on_first_permit if you want it to stop early. POST /access/v1/search/action lists every permission the person has in the app. The answers come from the same grants that tokens carry, so they always agree. Leave out org and any of the person's organizations counts.
Connection settings
The config object of POST /connections, by type. Secrets are write-only: reads show ••••••, and a PATCH that leaves a secret out keeps it. Register the callback_url from the response with the provider.
| Type | Owner | config |
|---|---|---|
oidc | org or platform | issuer, client_id, client_secret, scopes; org: domains [list], jit (create accounts for new people from those domains), require (those people must use it); show_button |
oauth | org or platform | authorize_url, token_url, userinfo_url, client_id, client_secret, scopes, id_field / email_field / name_field (dot paths), trust_email; org: as OIDC |
meta | platform | Facebook client_id (App ID), client_secret, show_button. Never links by email: people link Facebook from My account first. |
sms | platform | driver semaphore | twilio | vonage, api_key, api_secret, sender |
email-smtp | org | host, port, encryption tls | ssl, username, password, from_address, from_name — the organization's invites go out through it |
An organization's provider only signs in people who belong to that organization alone (or new people from its domains with jit), so it can never take over someone who also works elsewhere.
JavaScript SDK
@clauth/js signs people in from a browser app (PKCE, state and nonce checks, one renewal across tabs) and @clauth/react wraps it for React. @clauth/react-native drives your own sign-in screens over POST /flow/execute; @clauth/node verifies tokens in your API (JWKS, Express middleware, permission checks, AuthZEN). Source: sdk/ in the Clauth repository.
import { createClauth } from '@clauth/js' const clauth = createClauth({ issuer: 'https://auth.example.com', clientId: '…', redirectUri: 'https://app.example.com/callback' }) await clauth.signIn() // → Clauth await clauth.handleRedirect() // on /callback clauth.can('expense.approve', 'acme') await clauth.fetch('/api/expenses') // Bearer token, renewed when needed
Meta
What this token may do (display only)
This document
Users
List people (filters: status, org, app, q)
One person with orgs, grants, profiles and sign-in methods ({user} = usr_ id or email)
Change name or phone (email: platform clients only)
- name
- string
- phone
- string|null
- string (platform only)
Delete an account everywhere (platform only; frees the email, keeps an anonymised row)
disable | enable | unlock | reset-two-step | two-step-exempt | two-step-required | sign-out | password-reset
Invites
List invites (filters: status, org)
Invite someone into an organization; returns the invite link
- string
- name
- string
- org
- slug
- profiles
- profile keys
- apps
- {app_key: role_key}
- teams
- team keys
- fields
- {key: value}
- require_two_step
- bool
- org_role
- member|developer|admin
- send
- bool (default true)
Revoke a pending invite
New link (the old one stops working) and email
- send
- bool (default true)
Organizations
Organizations this client can see
One organization ({org} = id or slug)
Branding: allowed and chosen level, account name, color, logo, support and legal links
Change the branding (up to the allowed level; `allowed` itself only for Clauth platform clients)
- mode
- clauth|cobrand|whitelabel
- account_name
- string
- color
- #RRGGBB
- support_email
- privacy_url
- https URL
- terms_url
- https URL
- allowed
- clauth|cobrand|whitelabel (platform only)
Members of the organization
Add an existing person (email or usr_ id) or change their org role
- role
- member|developer|admin|owner
Remove from the organization (their profiles, exceptions and grants there go too)
Sign-in
App-native sign-in, one step at a time (no token; public client + PKCE). Start with client_id, redirect_uri, code_challenge, scope; then send flow_id + action: identify (email) → password | send_code (via) → code → totp | send_sms → sms → done (an authorization code for /oauth/token). step "browser" gives a URL when only the browser can continue.
- flow_id
- from the previous answer
- client_id
- always
- action
- identify|password|send_code|code|totp|send_sms|sms
- identify
- password
- password
- via
- email|sms
- code
- code / totp / sms
- redirect_uri
- start
- code_challenge
- start (S256)
- scope
- start
- state
- start
- nonce
- start
Sign-in rules
Sign-in rules of an app: rules in force, where they come from, version
Replace the rules (new version)
- password
- bool
- bool
- connections
- "all" or keys
- email_code
- bool
- sms_code
- bool
- two_step
- default|always
- sms_second_step
- bool
- registration
- invite|open (apps)
- open_domains
- domains
- open_profile
- profile key
- check
- http connection key
- check_fail_open
- bool
Remove these rules so the next level applies
Restore a saved version (as a new version)
- version
- int
Saved versions of these rules
Sign-in rules of an organization (default for its apps): rules in force, where they come from, version
Replace the rules (new version)
- password
- bool
- bool
- connections
- "all" or keys
- email_code
- bool
- sms_code
- bool
- two_step
- default|always
- sms_second_step
- bool
- registration
- invite|open (apps)
- open_domains
- domains
- open_profile
- profile key
- check
- http connection key
- check_fail_open
- bool
Remove these rules so the next level applies
Restore a saved version (as a new version)
- version
- int
Saved versions of these rules
Sign-in rules of the platform: rules in force, where they come from, version
Replace the rules (new version)
- password
- bool
- bool
- connections
- "all" or keys
- email_code
- bool
- sms_code
- bool
- two_step
- default|always
- sms_second_step
- bool
- registration
- invite|open (apps)
- open_domains
- domains
- open_profile
- profile key
- check
- http connection key
- check_fail_open
- bool
Remove these rules so the next level applies
Restore a saved version (as a new version)
- version
- int
Saved versions of these rules
Teams & fields
Profile fields the organization keeps about its people
Add a profile field
- key
- string
- label
- string
- type
- string|number|bool|date|enum
- options
- choices (enum)
- required
- bool
- editable_by
- admin|self
- in_token
- bool (send to apps)
Change a field (key and type are fixed)
- label
- string
- options
- choices
- required
- bool
- editable_by
- admin|self
- in_token
- bool
Delete a field and its values
A member's teams and field values (and missing required fields)
Set a member's teams (exact list) and field values
- teams
- team keys
- fields
- {key: value|null}
Teams (stores, branches, departments) of the organization
Add a team (its key is fixed; apps see it in tokens)
- name
- string
- key
- string
- description
- string
One team with its people
Rename a team
- name
- string
- description
- string
Delete a team
Put a member in the team
Take a member out of the team
Access
Effective grants tokens are built from (filters: org, app, user)
Who has what: people × apps (?format=csv)
What the person gets in each app and why
Set profiles (exact list) and per-app exceptions, then work out grants
- profiles
- profile keys
- apps
- {app_key: "profile"|"none"|role_key}
- reason
- string
Access profiles with their app roles and people
Create an access profile
- name
- string
- key
- string
- description
- string
- apps
- {app_key: role_key|"none"}
One access profile ({profile} = key)
Rename or change the role per app (null = not set)
- name
- string
- description
- string
- apps
- {app_key: role_key|"none"|null}
Delete; holders lose what only this profile gave them
Give the profile to a member
Take the profile away
Connections
Sign-in providers, SMS gateway and email senders (secrets masked; filter: org)
Add a connection: oidc, oauth (org or platform), meta, sms (platform), email-smtp (org)
- type
- oidc|oauth|meta|sms|email-smtp
- name
- button label
- org
- slug (omit = platform)
- config
- issuer, client_id, client_secret, domains, jit, require… (see docs)
One connection, with the redirect URL to register at the provider
Change name, status or config (secrets: leave out to keep)
- name
- string
- status
- active|disabled
- config
- object
Delete a connection
Themes
Built-in styles and designed sign-in themes you can use
Design a theme
- name
- string
- org
- slug (omit = platform)
- base
- classic|daylight|midnight|auto
- accent
- #rrggbb
- background
- #rrggbb
- card
- #rrggbb
- font
- Inter|Manrope|Poppins|…
- heading_font
- font
- radius
- 0–28
- buttons
- rounded|pill|square
- layout
- center|split
- tagline
- string
What a sign-in page will look like (?app=, ?domain=): computed colors, fonts, layout
One designed theme
Change a theme (apps using it change too)
- name
- string
- …
- any setting
Delete a theme (its apps go back to their built-in style)
Apps and domains using the theme
Languages & messages
Languages of the sign-in pages and emails
The wording in one language (built-in + your changes)
Change wording: {"English text": "your text" | null} (platform only)
- <English text>
- your text, or null to undo
Message templates (?org=): invite, login_code, new_device, lockout (email), sms_code (text)
Write a message (an organization: its invite; the platform: all)
- org
- slug (omit = platform)
- locale
- en|fil
- subject
- email subject
- body
- plain text with {{placeholders}}
Go back to the built-in message
- org
- slug
- locale
- en|fil
Agents
One agent ({agent} = agt_ id)
Rename, or suspend / resume (status)
- name
- string
- description
- string
- status
- active|suspended
Delete the agent and revoke its tokens
An organization agent’s role per app (null = none)
- apps
- {app_key: role_key|null}
New credentials (the old ones stop working)
The organization’s agents (AI assistants, bots, scripts)
Create an agent; the response has client_id and client_secret (shown once). It gets tokens with client credentials + audience=<app key>
- name
- string
- description
- string
- apps
- {app_key: role_key}
Config
An organization’s setup as one JSON document (?org=): teams, fields, profiles, sign-in rules, its apps’ roles and look, themes, messages, connections (secrets as ${secret:NAME})
Import a document into an organization. dry_run (default true) lists what would change; dry_run=false applies it
- org
- slug
- document
- an export
- dry_run
- bool
Secret names (?org=); values are never shown
Set a secret (${secret:NAME} in imports), stored encrypted
- value
- string
- org
- slug (omit = platform)
Delete a secret
- org
- slug
Variables (?org=)
Set a variable (${var:NAME} in imports)
- value
- string
- org
- slug (omit = platform)
Delete a variable
- org
- slug
Apps
Apps published by or installed in this client's organization
Register an app (+ its first client; the secret is in this response only)
- name
- string
- key
- string
- type
- web|public|m2m
- redirect_uri
- url
- home_url
- url
- publisher
- org slug (personal/platform tokens)
- orgs
- org slugs to install in
- privacy_url
- url
- terms_url
- url
- support_email
One app with roles, permissions and (publisher only) clients
Change app settings (If-Match supported)
- name
- string
- home_url
- url
- manifest_url
- url
- status
- live|paused|not_connected
- color
- #rrggbb
- visibility
- private|installable
- require_mfa_roles
- role keys
Delete the app (owners/admins of the publisher; send confirm = app key)
- confirm
- the app key
Types the app accepts in authorization_details (RFC 9396)
Register a type with its JSON Schema and optional processor (your server confirms or fills in)
- description
- shown to the person
- schema
- JSON Schema (object)
- processor_url
- https URL
- processor_secret
- HMAC secret
Remove a type
Same as PUT (for multipart uploads from tools that only POST)
Sign-in page look (JSON or multipart with logo files)
- login_theme
- classic|daylight|midnight|auto
- theme
- designed theme key (instead of login_theme)
- accent_color
- #rrggbb
- logo
- png/svg file
- logo_dark
- png/svg file
- remove_logo
- bool
Add a client (secret shown once), or one described by a client ID metadata document (cimd_url)
- type
- web|public|m2m|device
- name
- string
- redirect_uri
- url
- cimd_url
- https URL of a client metadata document
Change a client's name or redirect URLs
- name
- string
- redirect_uris
- urls
- post_logout_redirect_uris
- urls
Turn a client off and revoke its tokens
New client secret (shown once)
Organizations the app is installed in or requested by
Install in an organization you run, or request it elsewhere
- org
- slug
Remove from an organization (its access there goes)
Fetch /.well-known/clauth.json and apply it
Initial access token for dynamic client registration (RFC 7591) at /oauth/register into this app; shown once
- name
- string
- uses
- int
- days
- int (default 30)
Read a client ID metadata document (?url=) before registering it
Roles
Add a permission by hand
- key
- string
- description
- string
Add a role
- key
- string
- name
- string
- description
- string
- tier
- owner|admin|member|viewer
Change a role (manifest roles: tier only)
- name
- string
- description
- string
- tier
- owner|admin|member|viewer
- aliases
- old keys
- assignable
- bool
Delete a role nobody holds
Set the exact permissions of a role
- permissions
- permission keys
Domains
The app's sign-in domain, status and DNS records
Add a sign-in domain (or share one the publisher verified)
- host
- auth.example.com
- share
- bool
Display name, theme (trusted: Clauth owners)
- display_name
- string
- theme
- designed theme key or null
- trusted
- bool
Stop using the domain (last app out deletes it)
Check DNS and certificate now
Me
Your account (personal token)
Change your name or phone
- name
- string
- phone
- string
Your own agents (they act for you, never with more access than you)
Create your own agent in one of your organizations
- name
- string
- org
- slug
- description
- string
Rename, suspend or resume your agent
- name
- string
- status
- active|suspended
Delete your agent
New credentials for your agent
Apps you can open, with your roles
Outside apps you allowed to receive your details
Take that permission back
Your teams and fields in one organization
Change the fields the organization lets you edit
- fields
- {key: value}
Browsers and apps you are signed in to
Sign out one browser (web_…) or app (app_…)
Audit
Audit log (filters: category, event, org, user, since, until)
Settings
Platform settings (platform clients only)
Change platform settings (platform clients only)
- require_mfa_everyone
- bool
- password_min_length
- int
- session_idle_hours
- int
- …
- see GET /settings
Health
The service is up
Database, cache and signing key are ready
Webhooks
Send a delivery again
Everyone with access to the app, with the orgs claim their token carries (?since= for changes). The app’s own server client (users:read) or an API client
Webhook endpoints of the app
Add an endpoint; the signing secret is in this response only
- url
- https URL
- events
- access.granted|access.changed|access.removed|user.updated|user.disabled|user.enabled|invite.accepted (empty = all)
Change URL or events, switch off/on (on = resend recent failures), rotate the secret
- url
- https URL
- events
- list
- status
- active|disabled
- rotate_secret
- bool
Remove an endpoint
Recent deliveries (30 days; ?status=)
Send a ping now and see the answer
Branding
Public: how an app names its sign-in (?app=<key> or ?client_id=<id>): level, account name, button text, logo, color, sign-in and account addresses
OAuth endpoints used with the API
| Endpoint | Use |
|---|---|
POST /oauth/token | Client credentials for API clients |
POST /oauth/introspect | RFC 7662: is this token still active? Your own client's tokens, or another client of the same app |
POST /oauth/revoke | Revoke a token |
POST /oauth/par | RFC 9126: push the sign-in request first, then open /oauth/authorize?client_id=…&request_uri=… (90 s, one use) |
POST /oauth/device | RFC 8628 device sign-in for TVs, POS terminals and CLIs (client type "device"): show user_code, the person approves at /device, poll /oauth/token with grant_type=urn:ietf:params:oauth:grant-type:device_code |
POST /oauth/bc-authorize | CIBA (poll): the app's web client asks for a person's OK (login_hint, binding_message); they approve on their phone; poll /oauth/token with grant_type=urn:openid:params:grant-type:ciba |
POST /oauth/register | Dynamic client registration (RFC 7591/7592) with an initial access token from POST /apps/{app}/registration-tokens; manage it at /oauth/register/{client_id} |
POST /oauth/token + audience | Agents: client credentials with audience=<app key> give a token with sub=agt_…, the agent's roles, and act = its owner |
authorization_details | RFC 9396 on /oauth/authorize (or PAR): types registered per app with a JSON Schema; the person approves each item; a processor may refuse or fill in; approved items come back in the token response and access token |
GET /.well-known/oauth-authorization-server | RFC 8414 server metadata (same as OpenID discovery) |