Reference · Limits

API keys and scopes

What a credential can reach, and how to bound one to a single job. An account can hold several keys, one per integration, each with its own scopes and expiry. Revoking one leaves the others working.

Keys and sessions

Two credentials exist, and they are not interchangeable. A key (ak_…) carries a default project: it is what a script, a backend or a service should carry. A session (ds_…) identifies a user and opens every project of that account: it is what the dashboard sends.

The project a key carries is a default, not a perimeter. It decides which corpus a request reads when the request names no project; a request that names another project of the same account reads that one. What a key restricts is its scopes: they say what kind of action it can take, not which corpus. A key with no entry in the key table (issued before scopes existed) has full access, which is how existing integrations kept working when scopes were introduced.

The plaintext key is returned once, at creation. Only a SHA-256 hash and a 12-character prefix are stored, so a database dump does not expose working credentials and a lost key cannot be recovered: it is revoked and replaced.

Authentication header
Every authenticated call sends Authorization: Bearer <credential>. The credential identifies the tenant; there is no separate tenant parameter on the REST routes.

Available scopes

Scopes are a closed list. An unknown scope is rejected at creation rather than stored and ignored, so a typo fails loudly.

NameTypeDefaultDescription
documents:readscopeList and download documents
documents:writescopeUpload and delete documents: required by POST /api/upload
chat:writescopeSend messages to the chat endpoint
widget:readscopeRead the widget configuration
widget:writescopeModify the widget configuration
analytics:readscopeRead usage and conversation statistics
billing:readscopeRead payments, invoices and subscription state
account:writescopeAccepted by the API; no route restricts on it today
*scopeAll of the above, chosen at key creation

When a scope is missing

A key without the scope a route requires is refused with 403 and a message naming the missing scope: for example uploading with a read-only key returns Cette clé API n'a pas la portée requise : documents:write.