Skip to Content
Errors

Errors

Error types, status codes and the error body.

The error body

{
  "type": "error",
  "error": {
    "type": "not_found_error",
    "message": "model: strokes-large"
  },
  "request_id": "req_7Hq2LmN9xP4sTv1KcW8bYd3R"
}
Field
typeAlways error
error.typeOne of the types below
error.messageWhat went wrong, for people
request_idThe request's ID, the same as the request-id header

Error types

Statuserror.typeWhen
400invalid_request_errorThe body isn't valid JSON, a field is missing, invalid or not supported, or the model couldn't process the request
401authentication_errorThe API key is missing, wrong, disabled or deleted
402billing_errorThe organization is out of credits, or the key reached its monthly spend limit
404not_found_errorThe model, stroke or endpoint doesn't exist
410invalid_request_errorA one-time setup token sent to /v1/agent-key was already used
529overloaded_errorThe model is busy. Retry with backoff
500api_errorSomething went wrong on our side. Retry the request
503api_errorThe API is temporarily unavailable. Retry later

These apply to every endpoint: /v1/messages, /v1/chat/completions, /v1/models and /v1/strokes. A streamed reply that fails after it started ends with an error event instead.

There is no 429: the API has no requests-per-minute limit. See Limits and spend.

Messages you may see

error.messageFix
Missing API key. Send it in the x-api-key header.Add the x-api-key header
Invalid API key.Check the key, or create a new one
This API key is disabled. Enable it on the API keys page.Enable the key on the console's API keys page, or use another
Your credit balance is too low. Buy credits or turn on auto-reload on the Billing page.Add credits on the console's Billing page
This key reached its monthly spend limit of $50.00. An owner or admin can raise it on the API keys page.Raise the key's limit, or wait for next month
The request body is not valid JSON.Send a JSON body with content-type: application/json
model: Field requiredAdd model
max_tokens: Must be a positive integerSend a whole number of 1 or more, or leave max_tokens out
max_tokens: 40000 > 32000, which is the maximum allowed for swim-1.0Lower max_tokens to the model's maximum
messages: At least one message is requiredSend at least one message
messages.0: Each message needs a role of "user" or "assistant" and contentGive every message a role and content
stream: Must be a booleanSend true or false
thinking.type: Must be "adaptive", "enabled" or "disabled"Use one of those
top_k: Not supportedLeave top_k out (also container, mcp_servers)
messages.0.content.1: Content blocks of type "document" are not supported in user messagesSend the document's text as a text block
tools.0.input_schema: Field requiredGive every tool an input_schema — see Tools
web_search: Must be a booleanSend true or false
mode: Must be "business", "academic", "creative" or left outSend one of those modes, or omit mode
stroke_id: Must be 1 to 200 letters, digits or . _ : -Use a valid stroke_id (same rule for the stroke-id header)
analyze: Requires at least one sample in voice.samplesAdd at least one sample to voice.samples, or omit analyze: true
output_config.effort: Must be one of low, medium, high, maxUse one of those
The model could not process this request. Check the messages, images, tools and max_tokens.Check the request: an image that can't be read, a malformed tool schema
model: strokes-largeUse a model from GET /v1/models
stroke: user-42No stroke with that ID exists in your organization
The model is overloaded right now. Retry the request in a moment.Retry with backoff

How to handle and retry errors: Errors guide.

On this page