Response envelope
JSON endpoints return a consistent envelope with a booleanerror flag. On success, error is
false and the payload is in data:
error is true, data is omitted, message carries the detail, code is
machine-readable, and request_id identifies the request:
Request IDs
Every response carries anX-Request-Id header, and every JSON error body repeats it as request_id.
Log it with each failure and include it when you contact support: it is how we find your request.
To correlate with your own logs, send your id in X-Request-Id (or X-Client-Request-Id). Any value
of 1-128 characters from A-Z a-z 0-9 - _ . : is echoed back as X-Request-Id; otherwise the
service generates one (req_ followed by 24 hex characters). WebSocket handshake responses carry
X-Request-Id too.
Error codes
Errors add a machine-readablecode next to message. Branch on code, never on the message
text:
Errors from the synthesis service are never passed through: they are mapped to the codes above, and
their messages are ours.
Plan-limit & entitlement denials
Most billing-related denials do not use the standard envelope - they return a flat JSON body. The one exception is the credit check that runs inside synthesis, covered below. Per-resource plan limits (for example creating more voices than your plan allows) return403:
402, and a feature your
plan doesn’t include returns 403. Both carry the unit and the current usage:
error string is the denial reason: quota_exhausted or insufficient_credits (402), or
feature_disabled (403).
A 402 can also come from the credit check inside synthesis (/speak and /stream), after the plan
check has passed. That one uses the standard envelope, with message set to insufficient_credits:
402.
Status codes
Enroll and clone are asynchronous: once the
202 is returned, engine-side failures (such as a
reference clip that’s too short) don’t come back as 422 or 502. The job is marked failed
instead - read its error field with Get job.Common messages
Voice is not enrolled yet
Voice is not enrolled yet
The voice you referenced isn’t ready to use - only voices with status
ready can synthesize. See
Working with voices.Consent attestation is required
Consent attestation is required
/voices/clone and /voices/{id}/enroll
require consent=true in the multipart body, attesting you hold the speaker’s permission to
clone their voice. The attestation is recorded with the voice for audit.text too long (max 10000 chars)
text too long (max 10000 chars)
The
text field exceeds the 10,000-character limit. Split long input into multiple requests.Rate limits (429)
Rate limits (429)
rate_limited and concurrency_limited come from your plan’s limits, not from a fault. Wait the
Retry-After seconds before retrying, and use the RateLimit header to slow down before you hit
the limit. See Rate limits.Synthesis service errors (502 / 503)
Synthesis service errors (502 / 503)
upstream_error (502) means the synthesis service failed or is warming up; retry with
backoff. upstream_busy (503) means it is at capacity; wait Retry-After seconds first. A
422 invalid_input is about your input and is not worth retrying unchanged.Realtime (WebSocket) errors
Realtime (WebSocket) errors
Once the socket is open, errors arrive as
error frames ({type, context_id?, code, message, fatal})
rather than HTTP statuses. invalid_message means a frame you sent was not a JSON text frame of a
known type and was dropped; voice_not_allowed means your access token is restricted to other
voices (only that task_start is rejected); upstream_unavailable means the synthesis engine could not be reached
and the socket closes with 1013 - reconnect with backoff. A refused handshake (for example
429 concurrency_limited) returns the JSON error body above before the upgrade. See
Realtime (WebSocket).
