Skip to Content

Authentication & permissions

API keys, how permissions work, and what the different failures mean.

Use a workspace Voice key for Voice API requests. Kejue Inference uses separate product-bound keys; a Voice key cannot call Inference, even when it has wildcard permissions.

Send the key as a Bearer credential:

Authorization: Bearer kejue_<prefix>_<secret>

New API keys start with kejue_. Existing sonus_ keys continue to work with the same permissions, expiration, and revocation behavior; no rotation is required for the rebrand.

Create keys in Settings → API keys or with POST /v1/api-keys. The full credential appears once; later reads return metadata and the non-secret prefix. DELETE /v1/api-keys/{id} revokes idempotently.

Expiry. A key made in the dashboard expires after 90 days unless you pick another lifetime (30 days, 1 year, or no expiry) when you create it. Through the API, send expires_in_days or expires_at to set a lifetime; send neither and the key never expires. A key keeps the lifetime it was created with: changing the dashboard default does not touch existing keys. The key list shows each key's expiry date, and an expired key gets 401 unauthorized. Keep keys in a secret manager, one per integration per environment — never in a URL, prompt, webhook payload, source file, or log.

Assistants connected through the Kejue Voice MCP server use OAuth access tokens (kejue_oat_…) instead. They act as the member who signed in, across the teams that member approved; pick the team per request with the Kejue-Org-Id header.

Existing sonus_oat_… tokens and the Sonus-Org-Id header remain supported. Use one header name per request; conflicting aliases are rejected. The header selects an existing team UUID — the rebrand does not change organization IDs.

Discover what a key can do

  • GET /v1/auth/me — the current actor, workspace, effective permissions, and runtime capabilities.
  • GET /v1/rbac/catalog — the closed permission vocabulary; api_key_scope_available marks what can be delegated to keys.

Cache catalog data briefly at most — new capabilities appear without changing existing scope semantics.

Permissions

A permission is <resource>:<action>:

FormMeaning
*Every API-key-eligible permission in the workspace
<resource>:*Every supported action for one resource
<resource>:<action>One exact action

Actions are independent — agents:update does not include agents:read. Most resources use create / read / update / delete; sensitive workflows get narrower actions: agents:deploy, calls:place-outbound, calls:download-recording, calls:legal-hold, contacts:manage-memory, eval-runs:execute-live-tools, pii-access:unmask. Each operation's exact required permission is declared in the API reference — don't infer it from the verb or URL.

Delegation can never escalate

Creating a key, editing a role, or assigning one enforces a single subset rule: you cannot grant a permission you do not hold (wildcards evaluate against your own effective permissions). A violation returns 403 forbidden with the missing entries in details.missing_permissions — so a credential can never upgrade itself. Keep a separately-controlled key-management credential for rotation and issue narrow keys to applications.

Key management permissions: api-keys:read / create / delete. The one-time key value is unrecoverable — if it's lost, revoke and recreate.

When authentication fails

HTTP / codeMeaningWhat to do
401 unauthorizedThe credential itself was rejected (missing, malformed, expired, revoked)Replace or fix the credential; don't retry it
403 forbiddenValid credential, missing permissionCheck details.required_permission
403 entitlement_requiredPermission present, workspace feature gate offCheck details.feature
429 authentication_rate_limitedKey-verification pressure or repeated failures for one key prefixWait Retry-After; stop retrying a key you know is invalid
503 authentication_unavailableAn internal auth dependency failedWait Retry-After and retry the same credential — it was not judged invalid
404 *_not_foundMissing and cross-workspace resources are deliberately indistinguishableVerify the ID and workspace

We never convert an internal outage into a false "invalid token": only genuine credential rejection returns 401, so 503 authentication_unavailable must never trigger key rotation.

Two-factor authentication

API keys are never gated on MFA. A key is a machine identity bounded by its scopes; no public API-key route returns mfa_enrollment_required.

MFA is a property of human dashboard sessions. GET /auth/me reports it under mfa: enrolled (a confirmed authenticator exists), policy (off / optional / required), and enrollment_required (this session is confined to enrollment until a factor is set up — enforced server-side, not by a dashboard redirect). Set the workspace policy via mfa_policy on the current organization.

What's deliberately not here

Login, logout, password changes, MFA enrollment, workspace switching, provider callbacks, and platform-operator routes are session-only or differently trusted — absent from the public contract, so granting * cannot expose them. See Workspace and Roles & members.

On this page