API keys and security
Create scoped Developer API keys, restrict them by IP and expiry, and rotate, revoke, or delete them safely.
An API key authenticates your backend to one assistant. It carries a set of scopes, an optional expiry, and an optional IP allowlist. Requests never pass an assistant_id; the key decides which assistant answers.
Before you begin
- You have the Assistant Owner role. Other roles cannot manage keys.
- The owner's plan includes API access. Every standard plan does, including Free; see Plans and pricing. Without it, the Developer API page shows Upgrade to use the Developer API.
Create a key
-
Open the Admin Panel, select the assistant, and select Developer API in the sidebar.
-
Select Create API key.
-
Fill in the form:
Field Value Key name 1–100 characters, for example Production backend.Scopes Only what this integration needs (see the table below). Expiration 30 days, 90 days, 1 year, or Never expires. Allowed IP addresses (optional) One IP or CIDR range per line, for example 203.0.113.0/24. Leave empty to allow any IP. -
Select Create API key, then Copy API key, store it in your server-side secret manager, and select I've saved the key.
The full key is shown only once. It has the form ac_<public-id>_<secret><checksum>. The last six characters are a checksum, so a mistyped or truncated key fails at once with INVALID_API_KEY, and secret scanners can recognise leaked keys.
Scopes
| Scope | UI label | Allows |
|---|---|---|
chat:write | Chat | Create chat responses and retrieve them. |
files:write | Files | Upload files for an end user. |
conversations:read | Conversations | Read conversations and their messages. |
feedback:write | Feedback | Rate assistant messages. |
voice:connect | Voice | Create voice sessions. |
users:delete | Delete users | Permanently erase an end user's data. Marked Sensitive. |
A call with a key that lacks the endpoint's scope returns 403 INSUFFICIENT_SCOPE, with the missing scope in details.required_scope.
Send the key
Send the key in the Authorization header over HTTPS on every REST call:
Authorization: Bearer <your-api-key>The Voice WebSocket never receives the API key; your backend creates a voice session and the client sends that session's short-lived token instead (see Voice API).
Edit, rotate, revoke, or delete a key
Each key in the list shows its status (Active, Expires soon, Expired, or Revoked), when it was Last used, and its IP access.
| Action | What it does |
|---|---|
| Edit | Changes the name or the IP allowlist. The secret keeps working. Scopes and expiry cannot be edited; create or rotate a key instead. |
| Rotate | Issues a replacement key with the same name, scopes, IP allowlist, and expiry. Under Current key stops working, choose Immediately, In 1 hour, In 24 hours, or In 7 days. During the grace period both keys work; afterwards the old key returns API_KEY_EXPIRED. |
| Revoke | Blocks the key at once with API_KEY_REVOKED. It cannot be undone. |
| Delete | Removes the key from the list. A deleted key returns INVALID_API_KEY. Usage history is kept. |
For a planned rotation, deploy the new key to every instance and send a test request before the grace period ends. If a key may have leaked, rotate with Immediately or revoke it.
Protect keys and end-user data
- Keep keys out of browsers, mobile and desktop apps, URLs, source control, and logs. A key shipped in an app can be extracted; give native apps a token from your own backend instead.
- Use one key per application and environment, and add an IP allowlist when your servers have fixed outbound IPs.
- Map each signed-in user to a stable
external_user_idon your backend. Do not use an email address, phone number, or secret as the ID. - Conversations, files, and memory are isolated per assistant and
external_user_id. Erase a user withDELETE /v1/users/{external_user_id}(see Chat API). - All keys of an assistant share its rate limits, so more keys do not add capacity (see Errors and limits).
Preview has no separate sandbox. Staging calls create real data and use the owner's credits. Use a separate staging assistant and key.
Last updated on