Skip to content

Errors

Application-level errors (bad requests, auth failures, missing resources, rate limits) are returned as JSON with a non-2xx status code, in a consistent envelope:

{
"error": {
"type": "invalid_request_error",
"code": "avatar_not_found",
"message": "No avatar with id 'avt_doesnotexist' was found.",
"request_id": "req_5f3a1c9e2b7d"
}
}
FieldDescription
typeBroad error category. Stable, safe to branch on in code.
codeSpecific machine-readable reason within that category.
messageHuman-readable explanation. Don’t parse this; it can change wording without notice.
request_idUnique ID for this request. Include it when contacting support.

Always branch on HTTP status code and error.type (and error.code where you need finer granularity), never on the exact text of message.

HTTP statuserror.typeTypical error.codeMeaning
400invalid_request_erroravatar_not_found, missing_fieldThe request was malformed or referenced something that doesn’t exist.
401authentication_errorinvalid_api_key, missing_api_keyThe Authorization header was missing or the key was invalid.
403permission_errorkey_revokedThe key is valid but not allowed to perform this action.
404not_found_errorsession_not_foundThe path referenced a resource (session, voice) that doesn’t exist or isn’t yours.
409conflict_errorsession_already_endedThe request conflicts with the resource’s current state.
429rate_limit_errorconcurrent_session_limit_exceededYou’re over your concurrency limit. See Limits & concurrency.
500api_error(none)Something went wrong on our end. Safe to retry with backoff.

One exception to the envelope above: 422 responses for malformed request bodies (missing required fields, wrong types) come from automatic request validation and use a different, framework-standard shape:

{
"detail": [
{
"loc": ["body", "avatar_id"],
"msg": "field required",
"type": "missing"
}
]
}

If you get a 422, check detail (an array of field-level issues) rather than error. Every other status code uses the error envelope above.