API v2 Error Reference
Reference every declared API v2 error code, HTTP status, and production trigger.
API v2 errors use a structured error object:
{
"error": {
"code": "VALIDATION_INVALID_BODY",
"message": "Invalid request body"
}
}
Some validation errors also include an optional details field with field-level information:
{
"error": {
"code": "VALIDATION_INVALID_BODY",
"message": "Invalid request body",
"details": {
"fieldErrors": {
"message": ["Too small: expected string to have >=1 characters"]
}
}
}
}
Every v2 response includes an x-request-id header. Include that value when contacting support. Code against error.code; messages and validation details provide human-readable context.
Error Catalog
The table lists API v2 error codes. A dash means the code is reserved and has no production v2 call site, so no HTTP status or trigger is currently defined.
| Code | HTTP status | When it happens | Notes |
|---|---|---|---|
VALIDATION_INVALID_BODY | 400 | A request body, path value, query value, limit, cursor, conversation source, source type, or source-processing input fails validation. | details is included only when the call site supplies it. |
VALIDATION_INVALID_JSON | 400 | The chat, retry, tool-result, or feedback endpoint receives a body that is not valid JSON. | Other management endpoints parse malformed JSON as an invalid body. |
AUTH_MISSING_API_KEY | 401 | An authenticated endpoint receives no Authorization header or the value does not start with Bearer . | The health endpoint is unauthenticated. |
AUTH_INVALID_API_KEY | 401 | The bearer API key cannot be validated. | Use an active workspace API key. |
AUTH_EXPIRED_API_KEY | — | Reserved; not currently emitted by a production v2 route. | No status or trigger is defined. |
SUBSCRIPTION_PLAN_REQUIRED | 403 | The API key is valid, but its workspace does not have the apiAccess plan feature. | Every plan includes API access, including Free. Contact support if you receive this error. |
SUBSCRIPTION_API_RESTRICTED_PLAN | 403 | A caller enables auto-retrain without plan access, or submits a video URL without video-transcription access. | The API key itself remains valid. |
AUTH_INSUFFICIENT_PERMISSIONS | — | Reserved; not currently emitted by a production v2 route. | No status or trigger is defined. |
AGENT_NOT_FOUND | 404 | An agent-scoped request names an agent that does not exist or is not owned by the API key's account. | Ownership failures use the same response as missing agents. |
RESOURCE_NOT_FOUND | 404 | A source read or edit names a missing document for this agent, or an API v2 conversation required by a detail, message, retry, or feedback operation cannot be found. | Check the resource ID and agent ID. |
RESOURCE_CONFLICT | 409 | A source changes while an edit is processing, or a file upload has already been registered. | Read the current source before retrying an edit. |
RESOURCE_DOCUMENT_NOT_FOUND | 404 | A source deletion names a document that does not exist for the agent. | Invalid non-UUID document IDs instead return VALIDATION_INVALID_BODY. |
RESOURCE_MESSAGE_NOT_FOUND | 404 | Feedback names an invalid message ID or a message that is not in the specified API v2 conversation. | Message IDs are positive numeric values serialized as strings in responses. |
RESOURCE_MESSAGE_NOT_ASSISTANT | 422 | Feedback targets a message that is not an AI assistant message. | User messages and tool records cannot receive feedback. |
RESOURCE_TOOL_CALL_NOT_FOUND | 404 | The tool-result endpoint cannot match the supplied toolCallId to a pending client action. | The call is unknown, expired, or belongs to another API v2 conversation. |
QUOTA_CHATBOT_LIMIT | 403 | Agent creation would exceed the workspace's chatbot limit. | Delete an agent or upgrade before retrying. |
QUOTA_STORAGE_LIMIT | 403 | A source edit exceeds the storage limit, text or Q&A source processing reports a storage limit, a new URL cannot fit within storage, or URL job creation reports a quota failure. | Retraining an existing URL does not consume new document storage. |
CHAT_MODEL_NOT_ALLOWED | 403 | An AI settings update selects a model unavailable on the workspace plan. | Choose an allowed model or upgrade the plan. |
CHAT_CREDITS_EXHAUSTED | — | Reserved; not currently emitted by a production v2 route. | No status or trigger is defined. |
CHAT_AGENT_CREDITS_EXHAUSTED | — | Reserved; not currently emitted by a production v2 route. | No status or trigger is defined. |
CHAT_CONVERSATION_MISMATCH | 404 | A chat request supplies a well-formed conversationId (≤128 chars) that does not resolve to an API v2 conversation for the agent. | A conversationId longer than 128 characters is rejected earlier with 400 VALIDATION_INVALID_BODY, not this code. Omitting conversationId starts a new conversation. |
CHAT_RETRY_MESSAGE_NOT_FOUND | 404 | Retry receives a non-positive/non-integer message ID, or the target is not an AI assistant message in the API v2 conversation. | Tool records are not retry targets. |
CHAT_RETRY_NO_USER_MESSAGE | 400 | The retry target has no earlier user message to replay. | Retry regenerates from the user turn immediately before the selected assistant reply. |
INSTAGRAM_NOT_CONNECTED | 404 | An Instagram channel request names an agent with no Instagram connection. | GET /channels/instagram answers { "connected": false } instead of this code. |
INSTAGRAM_RECONNECT_REQUIRED | 409 | Comment-to-DM is set live without the comments permission, or conversation starters are published on a connection that is not connected. | Reconnect the account under Channels → Instagram in the dashboard. |
INSTAGRAM_AUTOMATION_TARGET_TAKEN | 409 | A comment_to_dm or story_leads automation is set live while another live instance already targets the same post or story. | Turn the other instance off, or target a different post or story. Drafts are never rejected. |
INSTAGRAM_AUTOMATION_CATCH_ALL_EXISTS | 409 | A comment_to_dm or story_leads catch-all (postScope / storyScope "any") is set live while a live catch-all of that kind already exists. | Turn the existing catch-all off first, or target a specific post or story. |
INSTAGRAM_SYNC_IN_PROGRESS | 409 | A persistent-menu or conversation-starters PATCH overlaps another sync of the same resource for the same agent. | Retry after the active publish or clear finishes. |
INSTAGRAM_SYNC_FAILED | 502 | A persistent-menu or conversation-starters sync failed. | details.code is an allow-listed failure code; details.http_status and details.meta_code are numeric or null. Meta's message text is never returned, and the stored live snapshot still describes the last confirmed state. |
RATE_LIMIT_TOO_MANY_REQUESTS | 429 | A request exceeds one of the rate limits below, too many file upload URLs are outstanding or were requested in the last hour, or a Backstage request is throttled. | Wait the number of seconds in the Retry-After header, then send the request again. |
INTERNAL_SERVER_ERROR | 500 | URL job creation fails for a non-quota reason, or a non-streaming retry produces no persisted assistant message. | Include x-request-id when reporting the failure. |
Rate limits
Agentkit limits how fast you can call the API. The limits stop runaway scripts and abuse. They are the same on every plan, including Free, and upgrading does not raise them. Your monthly message credits and plan quotas decide how much you can use.
| Limit | What counts | Counted per | Allowed |
|---|---|---|---|
general | Every authenticated request | API key, or user for session authentication | 300 per minute |
chat | POST /agents/{agentId}/chat and POST /agents/{agentId}/conversations/{conversationId}/retry | API key | 30 per minute |
sources | POST /agents/{agentId}/sources/url, /sources/text, /sources/qna, and PATCH /agents/{agentId}/sources/{documentId} | Agent | 60 per minute |
training | POST /agents/{agentId}/train | Agent | 6 per hour |
A chat, source or training request counts against general and against its own limit. Each window starts with the first request and lasts one minute, or one hour for training. The count resets when the window ends. A request with a missing or invalid API key returns 401 and counts against nothing.
A request over a limit returns 429 and does nothing else. It spends no credits and starts no job. details.bucket names the limit you hit:
{
"error": {
"code": "RATE_LIMIT_TOO_MANY_REQUESTS",
"message": "Too many chat requests. Each API key can send 30 chat or retry requests per minute.",
"details": {
"bucket": "chat",
"retryAfterSeconds": 42
}
}
}
The response carries these headers:
| Header | Value |
|---|---|
Retry-After | Seconds to wait before retrying. |
X-RateLimit-Limit | Requests the limit allows per window. |
X-RateLimit-Remaining | Requests left in the window. Always 0 on a 429. |
X-RateLimit-Reset | Unix time in seconds when the window ends. |
Successful responses do not include the X-RateLimit-* headers. File upload URLs have their own limits, described under Sources and training. Those 429 responses, and Backstage ones, send Retry-After without the X-RateLimit-* headers.
A workspace can hold 25 active API keys. See Authentication.