Skip to main content

Response envelope

Every response uses a consistent envelope. Success:
Failuresuccess: false, data: null, and an error object with a machine-readable code:
Always branch on the HTTP status first, then read error.code for specifics.

Common HTTP statuses

Handling errors

Python
Streaming endpoints (/v1/speech/synthesize) signal failures with a non-200 status before the stream starts. Once a 200 NDJSON stream begins, check for an error record/early close if the connection drops mid-stream.

Retries

Retry 429 and 5xx with exponential backoff (e.g. 1s, 2s, 4s) and a cap. Do not retry 4xx other than 429 — fix the request instead.