API - Error Code 400 or 401

  • Updated

These error codes can have a number of causes.  The response message will indicate the cause of the error.

 

max_character_limit_exceeded

The maximum number of characters per request depends on the model.

  • Turbo v2.5 - up to 40,000 characters (~40 minutes of audio)
  • Turbo v2 - up to 30,000 characters (~30 minutes of audio)
  • Multilingual v1 and v2 - up to 10,000 characters (~10 minutes of audio)
  • English v1 and v2 - up to 10,000 characters (~10 minutes of audio)

 

invalid_api_key

This means that you have not set your API key correctly.  Please make sure you're using "xi-api-key" exactly, with no typos, when setting your API key. 

 

voice_not_found

This means that you have entered the incorrect voice_id.  Please check that you are using the correct voice_id for the voice you want to use.  You can check this in My Voices.

 

quota_exceeded

You have insufficient quota to complete the request.  On the Creator plan and above, you can enable usage-based billing from your Subscription page.

 

Example 400 response detail:

"detail": {
    "status": "max_character_limit_exceeded",
    "message": "This request's text has 627 characters and exceeds the character limit of 333 characters for non signed in accounts."
}

Example 401 response detail:

"detail": {
     "status": "invalid_api_key",
     "message": "Invalid API key"
}