Create an API key
1
Open the API keys
In the dashboard, go to Project settings > API. Only owners and admins can access it, and the plan must include API access.
2
Name the key
Click + New API key and name the key after where you’ll use it, such as “Helpdesk sync”.
3
Choose what it can do
Set its expiry, agent access, and permissions. See Key restrictions.
4
Copy the key
Click Generate key and copy the key. It’s only shown once. If you lose it, delete it and generate a new one.
Authenticate requests
Authenticate by passing the key in theAuthorization header as a bearer token. All requests must be made over HTTPS.
Sample request
Response
Key restrictions
You can restrict a key in three ways when you create or edit it in the dashboard.Permissions
With Custom, you choose create, read, update, and delete access for each permission group. Workflows also have publish access, which publishing a workflow and turning one on or off need, because both make it run on your users’ conversations. Read-only keys don’t include it.
Agent access
A key can use all of the project’s AI agents and chatbots, or only the ones you select. A key limited to selected agents:- Can’t see other agents or their conversations, contacts, and other resources. They return 404, as if they don’t exist.
- Can’t use project-wide endpoints: creating or duplicating an agent, listing members, and retrieving or updating the project and its usage.
Expiry
A key can expire after 1 day, 7 days, 30 days, 1 year, or a custom number of days up to 365, or never. Requests with an expired key return 401api_key_expired. Changing a key’s expiry in the dashboard starts the new period from that day.
Rate limits
Each API key can make 500 requests a minute, across all endpoints. Each key has its own limit. Every response includes headers with the key’s current usage:
If the key exceeds the limit, the API returns 429 with a
Retry-After header, the number of seconds to wait:
- Messages per user: Send a user message also enforces the AI agent’s per-user message limits, set in the agent’s settings in the dashboard.
- Invalid keys: 60 requests a minute with invalid or expired keys from one IP address.
- Attachment downloads: 120 requests a minute for message attachment links.
Handling rate limits
- Wait for
Retry-Afterafter a 429, then retry the same request. For aPOST, reuse itsIdempotency-Keyso a request that already ran isn’t repeated. - Slow down before you reach the limit. If
X-RateLimit-Remaininggets low, wait untilX-RateLimit-Reset. - Spread out bulk work, such as importing contacts, instead of sending it all at once. Use bulk endpoints where available, such as Add knowledge base sources in bulk.