What an API key is
An API key is a secret your server sends as a Bearer token: Authorization: Bearer sk-agent-…. Every key belongs to exactly one assistant and has one purpose. The purpose decides where the key works; anywhere else it is refused.
| Purpose | Badge | Works on | Use it for |
|---|---|---|---|
| Chat (OpenAI-compatible API) | Chat | /v1/…/chat/completions, /v1/models, /v1/visitor-context | Talking to the assistant as a customer would. See Chat API. |
| Console (read the dashboard API) | Console | The dashboard routes listed on Read API, never on /v1 | Reading conversations, leads, tickets and usage, and with write scopes changing them. |
| Send events (your app tells the assistant what happened) | Events | /v1/events only | Your app telling the assistant what happened. See Events API. |
Create a key
GoalA key copied into your server's secrets.
- 1
Open DevelopersAPI keys and click New key
- 2
Pick the Agent
Chat calls with the key reach this assistant. A console key reads its whole workspace.
- 3
Give it a Name
Name it after what uses it, such as
Website backendorOrder system. Without a name it shows as Unnamed key. - 4
Choose the Purpose
For a chat key, also pick the Channel. For a console key, decide on scopes (below).
- 5
Click Create key and copy the key
The dialog Copy your key now shows the full key once. Store it in your server's secret store.
An events key can also be made on an assistant's ConfigureEventsConnect your app tab. The dashboard's search palette also has a Create API key action that opens this dialog.
The New API key dialog
- AgentChoice
- The assistant the key belongs to. Chat calls with this key reach this agent; a console key reads its workspace.
- NameText
- Your label for the key.Default
Unnamed key - PurposeChoice
- What the key may do.Options
Chat (OpenAI-compatible API)Console (read the dashboard API)Send events (your app tells the assistant what happened) - ChannelChoice
- Chat keys only. Conversations made with the key are filed under this channel in Conversations and reports.Default
APIOptionsPhoneWebsiteAPIWhatsApp - Choose scopesSwitch
- Console keys only. Leave this off to grant every read scope. Write scopes are only given when picked.Default
Off - Create keyButton
- Makes the key and shows it once.
Console key scopes
A console key holds scopes. A route that needs a scope the key lacks answers 403 and names the missing scopes. With Choose scopes off, the key gets every read scope, including read:catalog. Write scopes are given only when you tick them.
| Scope | Reads or changes |
|---|---|
read:agent | The assistant, its procedures and its workflow |
read:telemetry, read:usage | Usage and telemetry |
read:conversations | Conversations, transcripts, recordings, comments, notifications |
read:channels | Channels, email connections and drafts, avatar screens |
read:billing | The credit account, plans and usage |
read:members | Workspace members |
read:guardrails | Guardrail rules and hits |
read:calls | Outbound calls |
read:meetings | Meetings an assistant was sent to, with their summaries |
read:leads | Leads and appointments |
read:tickets | Boards and tickets |
read:catalog | Catalogs, items and requests |
write:conversations | Reply, change status, add comments |
write:notifications | Mark notifications read |
write:leads | Add leads, book and change appointments |
write:calls | Place and cancel calls, call a lead |
write:meetings | Send an assistant to a meeting, cancel it or make it leave |
write:tickets | Open, change, move and note tickets |
write:channels | Change channel settings |
write:members, write:billing, write:workspace | Members, billing and workspace changes |
write:catalog | Add and change catalog items |
- A console key reads the whole workspace, so you need access to every assistant to create one.
- Each scope maps to a permission. You cannot give a key a scope your own role does not hold: the dialog says the key reaches more than your role does. Leave those scopes out, or ask an owner or admin.
The key list
- NameShown
- Your label, or Unnamed key.
- AgentShown
- The assistant the key belongs to.
- PurposeShown
- A badge: Chat (grey), Console (blue) or Events (violet).
- ChannelShown
- Where its conversations are filed.
- Last usedShown
- Updated at most once a minute.Default
Never - CreatedShown
- When it was made.
Only the start of a key is ever shown again: sk-agent- and its next eight characters. That is enough to tell keys apart, not to use one.
Revoke a key
GoalThe key stops working everywhere.
- 1
Find the key in the list and click Revoke
- 2
Confirm
Anything using this key stops working at once. This can't be undone. The row stays, marked Revoked.
When a key is refused
| Status | Message | Why |
|---|---|---|
401 | missing bearer token | No Authorization: Bearer header. |
401 | invalid or revoked API key | The key is wrong, revoked, or belongs to another assistant than the one in the path. |
401 | API key is not a chat key | A console or events key was used on the Chat API. |
401 | API key is not a console key | A chat or events key was used on a dashboard route. |
401 | wrong_key | A key that is not an events key was used on /v1/events. |
403 | API key missing scopes: [...] | A console key without the scope the route needs. |