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": "All sessions for this assistant are currently in use."}}

// 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?
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.Yes, later.
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.
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 busy right now.
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.

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.
  • •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.