Errors and limits
Status codes and error bodies returned by the Developer API and the public widget API, rate limits, and monthly chat message allowances.
#Developer API errors
The Developer API (/api/v1/agents and /api/v1/chat) returns errors as a flat JSON object with an error string. Some errors add extra fields.
{ "error": "Invalid or revoked API key." }| Status | error message | When it happens |
|---|---|---|
400 | message is required and must not be empty. | message is missing, empty or only spaces. |
400 | message exceeds 4000 character limit. | message is longer than 4,000 characters after trimming. |
400 | streaming is not supported yet — call with stream=false. | You sent "stream": true. |
401 | Invalid or revoked API key. | The X-API-Key header is missing, wrong, revoked or expired. |
402 | A message about the monthly allowance | The account has used its monthly chat messages. See Monthly allowance errors. |
403 | Agent AGENT_ID does not belong to this API key's workspace. | The assistant exists but is in another workspace. |
403 | This API key is not authorised to access agent AGENT_ID. | The key is restricted to other assistants. |
404 | Agent not found or is not active. | Wrong agent_id, or the assistant is turned off. |
404 | Conversation not found. | The conversation_id does not exist or belongs to a different assistant. |
429 | Rate limit exceeded. | Too many requests with this key. Includes retry_after_seconds. |
500 | An internal error occurred. Please try again. | Something failed while answering. |
503 | This assistant is temporarily unavailable. | The service is paused by BotBaseX or the account is suspended. |
Validation happens in this order: the message is checked first (400), then the key (401), then the rate limit (429), then the assistant (404, 403).
If agent_id is missing entirely, the request fails schema validation with a 422 in the standard FastAPI shape ({"detail": [...]}) rather than the flat error shape.
#Monthly allowance errors
When the account's monthly chat messages are used up, /chat returns 402 with structured fields so you can stop retrying until the next month:
{
"error": "You have used all 100 chat messages for this month. Upgrade to Standard or Pro for more.",
"code": "chat_messages_limit_reached",
"resource": "chat_messages",
"used": 100,
"limit": 100,
"plan": "free"
}Do not retry a 402 in a loop. It will keep failing until the allowance resets on the 1st of the next month (UTC) or the account is upgraded.
#Rate limit errors
{ "error": "Rate limit exceeded.", "retry_after_seconds": 12 }Wait retry_after_seconds before sending again.
#Developer API rate limits
| Endpoint | Limit |
|---|---|
POST /api/v1/chat | 60 requests per 60 seconds per API key |
GET /api/v1/agents | No separate per-key limit |
GET /api/v1/health | No separate limit |
Limits are counted per key in a rolling 60-second window. If you need more throughput, spread traffic over several keys only if they serve genuinely separate integrations; the monthly allowance is shared by the whole account anyway.
#Handling errors well
- 400, 403, 404: fix the request; retrying the same call will not help.
- 401: check the key in your environment; it may have been revoked or expired.
- 402: stop and alert yourself; the account needs an upgrade or the new month.
- 429: wait
retry_after_seconds, then retry. - 500, 503: retry a few times with increasing delays (for example 2, 5 and 15 seconds).
#Public widget API
The website widget and hosted chat page use public endpoints under /public/, authenticated by an embed token instead of an API key. You normally never call these yourself, but these errors explain what your visitors may see. They use FastAPI's detail shape:
{ "detail": "Invalid embed token." }| Status | detail | When it happens |
|---|---|---|
401 | Invalid embed token. | The token does not exist. |
403 | This embed token has been revoked. | The website code was revoked. |
403 | Agent is not available. | The assistant is turned off. |
403 | Origin ... is not authorised for this widget. | The page's domain is not in the code's allowed origins. |
403 | A null or unparseable Origin is not authorised for this widget. | Allowed origins are set and the page sent no usable origin (for example a file:// page). |
404 | Conversation not found | The stored conversation no longer matches this assistant. |
422 | Validation details | Empty message, or more than 4,000 characters. |
429 | Rate limit exceeded. Please slow down. | More than 20 requests in 60 seconds for one embed token. |
429 | An object with code: chat_messages_limit_reached | The account's monthly chat messages are used up. |
500 | Chat is temporarily unavailable. Please try again. | Something failed while answering. |
503 | This assistant is temporarily unavailable. | The service is paused, the account is suspended, or the assistant is an advanced type that the plan or trial no longer covers. |
The widget turns these into short, neutral messages for visitors, so no plan or account details are shown to the public. See Website widget troubleshooting.
Production servers may also apply a per-IP limit to /public/ and sign-in routes. When it triggers, the response is 429 with {"detail": "Too many requests. Slow down and retry."} and a Retry-After header.
#Monthly chat message allowance
Every message a visitor or your code sends to an assistant counts as one chat message, whichever channel it comes from: website widget, hosted chat page, Developer API, or the test chat in your dashboard.
| Plan | Chat messages per month |
|---|---|
| Free | 100 |
| Standard | 5,000 |
| Pro | Unlimited |
| 14-day trial | Unlimited |
- The allowance belongs to the account, shared across all its workspaces and assistants.
- Months are calendar months in UTC: the count resets at 00:00 UTC on the 1st.
- A message counts when it is received, before the AI answers, so failed attempts still count.
- You can see usage under Plan in your workspace.
See Plans and the free trial for everything each plan includes.