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.

CodeHTTP statusWhen it happensNotes
VALIDATION_INVALID_BODY400A 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_JSON400The 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_KEY401An authenticated endpoint receives no Authorization header or the value does not start with Bearer .The health endpoint is unauthenticated.
AUTH_INVALID_API_KEY401The 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_REQUIRED403The 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_PLAN403A 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_FOUND404An 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_FOUND404A 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_CONFLICT409A 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_FOUND404A 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_FOUND404Feedback 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_ASSISTANT422Feedback targets a message that is not an AI assistant message.User messages and tool records cannot receive feedback.
RESOURCE_TOOL_CALL_NOT_FOUND404The 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_LIMIT403Agent creation would exceed the workspace's chatbot limit.Delete an agent or upgrade before retrying.
QUOTA_STORAGE_LIMIT403A 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_ALLOWED403An 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_MISMATCH404A 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_FOUND404Retry 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_MESSAGE400The retry target has no earlier user message to replay.Retry regenerates from the user turn immediately before the selected assistant reply.
INSTAGRAM_NOT_CONNECTED404An Instagram channel request names an agent with no Instagram connection.GET /channels/instagram answers { "connected": false } instead of this code.
INSTAGRAM_RECONNECT_REQUIRED409Comment-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_TAKEN409A 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_EXISTS409A 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_PROGRESS409A 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_FAILED502A 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_REQUESTS429A 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_ERROR500URL 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.

LimitWhat countsCounted perAllowed
generalEvery authenticated requestAPI key, or user for session authentication300 per minute
chatPOST /agents/{agentId}/chat and POST /agents/{agentId}/conversations/{conversationId}/retryAPI key30 per minute
sourcesPOST /agents/{agentId}/sources/url, /sources/text, /sources/qna, and PATCH /agents/{agentId}/sources/{documentId}Agent60 per minute
trainingPOST /agents/{agentId}/trainAgent6 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:

HeaderValue
Retry-AfterSeconds to wait before retrying.
X-RateLimit-LimitRequests the limit allows per window.
X-RateLimit-RemainingRequests left in the window. Always 0 on a 429.
X-RateLimit-ResetUnix 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.