API · Reference

Errors

Errors use standard HTTP status codes and a JSON body with a detail field.

The body

// Most errors: a sentence
{"detail": "This key doesn't have the 'delete' permission."}

// Sessions: a code and a sentence
{"detail": {"code": "concurrency_limit", "message": "This agent already runs as many sessions as its concurrency_limit allows. Stop the one you no longer need (GET /v1/sessions lists them), then start again."}}

// Plan limits on setup routes
{"detail": {"error": "agent_limit", "message": "…", "upgrade": true}}

// A request that doesn't match the schema (422)
{"detail": [{"loc": ["body", "agent_id"], "msg": "Field required", "type": "missing"}]}

Read the status code first, then detail: a sentence you can show or log, or an object with a code (or error) your code can branch on.

Status codes

StatusMeaningRetry?
202Not an error: POST /v1/sessions is starting an avatar. No session yet, nothing billed.Yes, after retry_after seconds.
400A malformed request, or a DELETE without ?confirm=true.No, fix the request.
401No key, a malformed Authorization header, or a revoked key.No.
402A plan limit: no balance, free minutes used, a premium feature on a free account.After adding funds.
403The key lacks the permission, or the account is not active.No.
404Not found in your account (agent, session, ticket…).No.
409The current state doesn't allow it: the agent's Brain is being built, or its concurrency limit is reached.Building: later. concurrency_limit: after you stop a session.
422The body or a value is invalid (unknown field, face, backdrop, camera…).No, fix the request.
429Too many requests.Yes, after a short wait.
501A live stage change the avatar host can't do yet.No.
502 / 503The avatar host didn't answer, or every avatar is busy (no_capacity).Yes, with a short back-off.

Session error codes

codeStatusMeaning
insufficient_balance402A paid account's balance is used up.
free_minutes_exhausted402A free account used its 60 minutes this month.
free_concurrency402A free account already has a session running.
paid_feature402A premium voice on a free account.
agent_not_found404No such agent in your account.
session_not_found404No such session, or it isn't live.
agent_building409The agent's Brain is being built.
concurrency_limit409The agent is holding as many sessions as it may, usually because your own earlier session is still running. Stop it (GET /v1/sessions lists them), then start again.
voice_face_mismatch422The voice doesn't suit the face.
unknown_avatar422No face with that id.
invalid_look422A backdrop, camera or face light that isn't valid.
invalid_stage422A live stage change with an unknown camera or backdrop.
rate_limited429More than 20 new sessions a minute.
no_capacity503Every avatar is in a session and none can start right now. When a Retry-After header comes with it, wait that many seconds.
start_failed503The avatar host didn't start the session. Try again.
render_unavailable503Render mode isn't available on the avatar host right now. Try again.
invalid_external_id422external_user_id or external_session_id longer than 128 characters, or not text.
session_live409Asked for the call record of a session that is still running.
invalid_include422The call record's include takes summary and transcript.
invalid_messages422A message breaks a rule: empty or over 2,000 characters, exact without next_pause during a call, two exact messages at start, an unknown field, or messages on a render session.
messages_unavailable503At session start: messages can't be taken by the avatar host right now. No session was started; try again.
context_unavailable501A mid-call message to a session whose avatar host can't take messages.
call_ended409A mid-call message to a call that has ended. Nothing was delivered.
no_ai409A message to a render session: there is no AI of ours to tell.
too_large413Call-scope messages in force would pass 16,000 characters.
too_many_messages42950 messages are already waiting in this call.
host_error502The avatar host didn't answer a mid-call message. Try again.

Creating or changing a tool or hook answers 422 with a sentence that names the field ({"detail": "tool.url: https only"}), 409 for a name the agent already uses or past 50 per agent, and 429 past 10 test calls a minute.

In render mode the socket has its own errors and close codes: see Streaming protocol.

Retrying well

  • •Retry 429, 502 and 503 with a growing wait (1 s, 2 s, 4 s…), a few times at most.
  • •Don't retry 409 concurrency_limit in a loop: a session is still running. Stop the one you no longer need, then start again.
  • •Stopping a session is safe to repeat: stopping one that already ended answers the same way.
  • •Starting a session is not: if a start timed out on your side, list the live sessions before starting another.