Skip to content

API reference

Errors and error codes

The error envelope, every error code the chat, widget, workflow and ingest endpoints return, its HTTP status and what to do about it.

Reference3 min readUpdated 23 October 2026

Errors come in one of two ways. Before the stream starts, the API answers with an HTTP error status and a JSON envelope. After the stream has started (the status is already 200), a failure arrives as a final error event with the same fields. Handle both.

Error envelope
HTTP/1.1 402 Payment RequiredX-Request-Id: 284662c8227a417d9f66755385919e0e{  "error": {    "code": "OUT_OF_CREDITS",    "message": "You're out of credits. Buy credits to continue.",    "request_id": "284662c8227a417d9f66755385919e0e",    "balance": 0,    "buy_url": "/settings?tab=billing"  }}

code is stable and meant for your code; message is for people and may change. Some errors add fields: OUT_OF_CREDITS adds balance and buy_url, VALIDATION_ERROR adds details. Always log request_id: it finds the request in our logs and your trace.

Chat: before the stream (HTTP status)

StatusCodeWhat to do
400MISSING_AGENT_IDSend X-Agent-Id or agent_id in the body
400MISSING_MESSAGESend a non-empty message
401MISSING_API_KEYSend your secret key in X-Api-Key
401INVALID_API_KEYCheck the key is your sk-so- key, complete, with no spaces
402OUT_OF_CREDITSBuy credits, or turn on auto top-up. See Running out of credits
403AGENT_INACTIVEThe agent is paused. Set it to Active on its Settings tab
404AGENT_NOT_FOUNDThe agent id is wrong or belongs to another account
422VALIDATION_ERRORThe body doesn't match the schema (for example a message over 32,000 characters); see details
429RATE_LIMIT_EXCEEDEDWait X-RateLimit-Reset seconds, then retry. See Rate limits
500INTERNAL_ERRORRetry once; if it persists, send support the request_id

Chat: inside the stream (error event)

CodeMeaningWhat to do
CONVERSATION_NOT_FOUNDThe conversation id is unknown or belongs to another agentStart a new conversation
TIMEOUTThe reply took longer than 120 secondsRetry; shorten tool chains or lower max tokens
LLM_AUTH_ERRORThe model provider rejected the agent's keyFix the key on the agent or LLM keys page
LLM_RATE_LIMITEDYour model provider rate-limited the keyBack off; raise your limits with the provider
LLM_UNAVAILABLEThe provider was down or overloaded (503/529) or unreachableRetry after a short wait
LLM_ERRORAny other provider errorCheck the trace for the provider's message
INTERNAL_ERRORAnything else, including an agent with no provider keyCheck the agent has a key; send support the request_id

Provider errors only ever arrive as error events inside a 200 response, never as an HTTP status. A reply that fails after its credit was spent is refunded.

Widget

StatusCodeMeaning
401SECRET_KEY_NOT_ALLOWEDA secret key was used on the widget. Use the agent's pk-so- key
401MISSING_WIDGET_KEYNo data-widget-key on the script
401INVALID_WIDGET_KEYThe key is malformed, unknown or was rotated
403WIDGET_KEY_SCOPEThe key belongs to a different agent than data-agent-id
403ORIGIN_NOT_ALLOWEDThe website isn't in the key's Allowed websites
403AGENT_INACTIVEThe agent is paused
404AGENT_NOT_FOUND, CONVERSATION_NOT_FOUNDUnknown agent or conversation
429RATE_LIMIT_EXCEEDED120 a minute per key or 12 per visitor exceeded

Workflows

StatusCodeMeaning
400MISSING_RUN, RUN_MODE_MISMATCH, INVALID_INPUTThe body is incomplete, or the input doesn't match the Start step's fields
402OUT_OF_CREDITSNot enough credits to start the run
403TEST_RUN_NOT_ALLOWEDTest runs can only be started from the designer
404WORKFLOW_NOT_FOUND, RUN_NOT_FOUNDWrong id, or not yours
409WORKFLOW_NOT_PUBLISHED, RUN_ALREADY_STARTEDPublish the workflow first; a run can only start once
429RATE_LIMIT_EXCEEDEDMore than 30 runs a minute. Sends Retry-After
429TOO_MANY_RUNNING5 runs already in progress. Sends Retry-After: 10

Knowledge ingestion

StatusCodeMeaning
413FILE_TOO_LARGEThe file is over 50 MB
415UNSUPPORTED_MEDIA_TYPENot a PDF or plain-text file
422EXTRACTION_FAILED, VALIDATION_ERRORNo readable text (for example a scanned PDF), or a bad field
502EMBEDDING_FAILED, CRAWL_FAILEDThe embedding or crawling service failed; credits for failed pages are refunded
503CRAWLER_DISABLEDWebsite crawling is unavailable right now
500INGEST_FAILEDAnything else

Traces and analytics

TRACE_NOT_FOUND (404), INVALID_RANGE (400) and TRACE_BACKEND_UNAVAILABLE (503).

Codes that don't exist

You may see INSUFFICIENT_CREDITS or RATE_LIMITED in older examples elsewhere. The API doesn't send them: use OUT_OF_CREDITS and RATE_LIMIT_EXCEEDED.

Still stuck?

Email us with what you tried and any request id. A person replies.

support@sentientone.ai