API keys
Scopes, creation, rotation and revocation.
Raw Markdown for agents: api_keys.md. MCP: read_docs("api_keys").
API keys authenticate scripts, integrations and agents against the public REST
API (/v1/) and the operations endpoint POST /api/v1/operations/<key>/invoke/
(also POST /api/v1/operations/invoke/ with {"key", "input"}), as
Authorization: Bearer adl_<env>_...; paths are relative to the API host in
read_docs("getting_started"). Each key carries scopes of the form
<domain>:<read|write|destroy> plus *:read; a write scope includes read.
Who a key acts as:
- A personal key (
api_keys.createwithouttenant_id) acts as its user in every workspace the user is seated in; name an organization withtenant_idor a Space id as with any token. An organization may refuse personal keys (personal_api_keys_disabled) or cap their age (api_key_lifetime_exceeded). - An organization key (
tenant_idof an organization you administer) acts as the organization's own service user, an admin of that organization and nowhere else (api_key_wrong_tenant); limited to spaces, see Rules. It holds no connections: it uses one only through a grant shared in a Space (read_docs("integrations")).
Operations endpoint with an API key (actor api, audited with the key id, same
rate limits and request log as /v1/):
- An operation with a
/v1/route needs the scope of that route. - Any other operation needs
<domain>:readfor a pure read,<domain>:writefor a write or external side effect and<domain>:destroywhen it is irreversible; it must be one an agent may call (not reserved for people in the app or for the platform) in a domain that has API key scopes. - Never with a key (
api_key_not_supported):api_keys.create,api_keys.rotate,integrations.proxy.token, collaboration tickets,inbox.secrets.*, organization administration and operator operations. - Searching and describing operations (
/api/v1/operations/,describe/,context/,docs/) still need an OAuth token (MCP,adlass login) or the app session;/v1/openapi.jsondocuments the REST routes.
Authentication errors:
- 401
unauthorized: the token is notadl_<env>_plus 43 characters of this environment, the key is unknown, or its user is archived or no longer in the organization that issued it. - 401
api_key_revoked: revoked. - 401
api_key_expired: pastexpires_at, or an old secret past its 24-hour rotation grace. - 403:
insufficient_scope(details.required_scope),api_key_wrong_tenant,personal_api_keys_disabled,api_key_lifetime_exceeded,api_key_space_restricted,tenant_suspended.
Operations: api_keys.list, api_keys.get and api_keys.usage read metadata
and request counts (never the secret). api_keys.update renames a key or
narrows its scopes. api_keys.revoke ends a key permanently.
api_keys.create and api_keys.rotate return the secret once; both are for
people signed in to the app (human_only for agents and API keys).
Keys for local scripts (agents): an agent with a shell never sees the secret.
- Agree with the user on
label,purpose(shown on approval),scopes,lifetime_days(default 30, at most 90) andkind:personal(acts as the user in every workspace they belong to) ororganization(withtenant_idof an organization the user administers, optionally limited tospace_idswithspace_role). api_keys.requestanswersrequest_id,approve_url,valid_until(15 minutes),fileand, in the first answer only,claim_tokenandcommands(posix,powershell). A replay of the same idempotency key has no commands: request again with a new key.- The user opens
approve_url, may untick scopes and approves or denies. An approved request can be claimed for 10 minutes. - Poll
api_keys.request_getuntilstatusisapproved, then run the command once, unchanged. It POSTsAuthorization: Claim <token>to/api/v1/keys/claim/and writesADLASS_API_KEY=...andADLASS_API_URL=...into~/.config/adlass/keys/<label>.env(Windows%APPDATA%\adlass\keys\<label>.env), mode 0600, never over an existing file. Load it withset -a; . <file>; set +a; never print or copy it.
- Scopes an agent may request:
<domain>:reador:writeof spaces, documents, records, data, todos, pages, scripts, routines, guides, workflows, queues, integrations, rules, derivations, summaries and watch. Never*:read,:destroy, users, tenant, audit, api_keys, organization, shares, partners, approvals or inbox: a person creates such keys in the app. api_keys.requestis for agent logins (MCP, CLI;agent_clients_onlyotherwise), at most 5 per hour per user. Approve and deny need the app.- Claim answers: 200 the env lines; 401
claim_required(header missing); 404claim_invalid; 409approval_pending,label_taken; 403claim_not_allowed(the user lost the right meanwhile); 410request_denied,request_expired,claim_used; 429rate_limited. - A second claim within 24 hours revokes the key (and its rotations) and
notifies the user: someone else held the token.
claimedwithout a file: revoke the key withapi_keys.revokeand request again. - The claim token is in your context until it is used: the user's approval is the gate, so tell them to approve only a request they just made with you.
Rules:
- Creating and rotating a key in one call needs a Clerk session (the Adlass
app); an API key cannot mint or rotate keys, and an agent asks with
api_keys.request. - Scopes can only be narrowed, never widened. Users, tenant and audit scopes need the admin role.
- An organization key may be limited to some of the organization's spaces
(
space_idsonapi_keys.create, listed asspaces; empty means the whole organization). It then acts as a member of those spaces only, with the role given asspace_role:reader(default) oreditor, which may also write records and documents there (each space inspacesshows itsrole). It cannot create spaces (api_key_space_restricted) and sees nothing that belongs to another space.space_rolewithoutspace_idsis refused. It takes only scopes of space-bound domains (spaces, documents, records, data, pages, queues, routines, guides, workflows, scripts, rules, derivations, summaries, todos, shares);*:readand organization-wide domains are refused. The limit never changes; create a new key instead. - A rotated key keeps its old secret valid for 24 hours (and its spaces and role there); rotating the new key again revokes the old secret at once.
- Never print or store a returned secret anywhere except where the user asked.
Rate limits and 429 (every write and read, data.write included):
- REST: two sliding one-minute windows, the API key (
key, its ownrate_limit_per_minuteor the plan'sapi_requests_per_minute) and the workspace (tenant, the plan'sapi_requests_per_minute: 60 free, 120, 300, 1000, 3000 by plan). Failed authentication has its own window (authentication, 30 per minute per IP). Only accepted requests count; a refused one is given back. - MCP: one window of
mcp_operation_callsper user (300 per minute, reads and writes together), reported inRateLimitheaders of the response. - Shared reads as a guest:
guest_reads_per_hour. Templates:installs_per_hour,install_plan_per_minute,verification_rounds_per_day. Providers answer with their own limit asintegration_rate_limited. - A 429 always carries
Retry-After(seconds),RateLimit-PolicyandRateLimitof the limit that fired (r=0,tequal toRetry-After) and arate_limitobject (name,limit,window_seconds,remaining,reset_seconds,retry_after; MCP:details.rate_limit). Waitretry_afterseconds and repeat the same request with the sameidempotency_key. - Successful responses list every limit that applied (
r= remaining,t= seconds to refill). Keep a bulk load under the smallestqperw; use*_manyanddata.writebatches instead of one call per item. - A cap that waiting does not lift is never a 429:
billing_limit_reachedandbilling_credits_exhausted(402),template_quota_reached,script_run_limit_reached,script_version_limit_reached,script_monthly_budget_exhausted(409),script_capability_budget_exceeded(422).