Skip to content

The API uses standard HTTP status codes. A 2xx status means success. Anything else comes with a JSON body holding a readable message in error:

{
  "error": "Text exceeds 5,000 character limit"
}

Show the message to your developers, but branch your code on the status code: messages can be reworded over time.

Status codes

StatusMeaningRetry?
200Success.
400The request is invalid: a field is missing or malformed, or the text is too long.No. Fix the request.
401The API key is missing, wrong or revoked.No. Check the key.
402Your API credit can't cover the request.After you top up.
413The file or request body is too large.No. Send less.
429Too many requests per minute, or too many at once.Yes, after a pause.
500, 503Something went wrong on our side.Yes, with backoff.
502The voice engine didn't return audio.Yes, with backoff.

Failed requests are never charged, so retrying a 429, 500, 502 or 503 is safe. See Going to Production for a retry helper.

Common errors

Text to Speech

StatusErrorWhat to do
400text is requiredSend text, or segments with at least one non-empty line.
400Text exceeds 5,000 character limitSplit the text into several requests.
400segments must be a non-empty arraySend segments as an array of lines.
400A dialogue can have at most 40 linesSplit the dialogue into several requests.
400Pick a voice from your voice library first.With quality: "clone", use the ID of a voice in your library.
400Pick a voice from your voice library for every speaker.With quality: "clone", every line's voiceId must be in your library.
502The voice engine returned no audio. Please try again.Retry.

Speech to Text

StatusErrorWhat to do
400audio is required ...Send the file in a multipart field named audio, or base64 audio in a JSON audio field.
400Unsupported audio format. Use mp3, wav, webm, ogg, m4a, or flac.Convert the file to a supported format.
400Upload error: ... Send the file in the "audio" field.Name the multipart file field audio.
400Audio is empty or not valid base64Check the base64 encoding of the JSON audio field.
413Audio file exceeds 25 MB size limitSend a smaller or more compressed file.

Any endpoint

StatusErrorWhat to do
401Missing or invalid Authorization headerSend your key in the x-api-key header.
401Invalid or revoked API keyCheck the key, or create a new one.
402Insufficient API balance ($0.00). This request needs ...Top up under API Billing.
413request entity too largeKeep JSON bodies under 10 MB.
429Too many requestsWait for the number of seconds in the Retry-After header.
429Too many concurrent API requests (max 5). ...Wait for running requests to finish, or top up to unlock more.
500Internal server errorRetry with backoff. If it persists, contact support.

Was this page helpful?