Logo
Search
Docs

Errors

Every status code the Agents API returns, with exact bodies.

Status codes

StatusMeaningWhat to do
401Missing/invalid token — {"message":"Unauthenticated."}Issue a new token in Developer
402Out of prepaid tokensTop up, then retry; check GET /usage
403Feature not enabled — body carries "feature":"ai_chat"Contact your administrator
404Not found, or not yours (agents you cannot access and chats created by other tokens 404 identically)Treat as not found; do not retry
409Email not verified — {"code":"EMAIL_NOT_VERIFIED"}Verify the account email
422Validation failed — {"message":"…","errors":{"field":["…"]}}Fix the listed fields
429Rate limitedBack off and retry

Chat-completions error envelope

POST /chat/completions alone uses the standard completions error shape:

{"error": {"message": "…", "type": "invalid_request_error", "code": 400}}

Types: invalid_request_error (400/404), insufficient_quota (402), api_error (500/502).

Out of tokens (402)

Exact body when the prepaid balance is exhausted while sending a message:

{"error": true, "insufficient_tokens": true, "payer_is_self": true,
 "message": "You are not subscribed or your token limit is reached. Please recharge to continue chatting."}

When a workspace member is spending the workspace owner’s balance, payer_is_self is false and the message reads: “This workspace is out of tokens. Please ask the workspace owner to recharge.”

Generation failure (422)

If the assistant cannot produce a reply, the API returns 422 and rolls back your just-sent message so a retry re-runs cleanly:

{"error": true, "message": "The assistant could not generate a response. Please try again.",
 "content": "<your original message, echoed back>"}

Retry with the same content; you are not charged for failed generations.