Ir para a navegação

Generate Text-to-Speech

Synthesize speech from a script and get back a hosted audio URL. The returned url can be reused as an audio input in POST /v2/generate to lip sync the synthesized take. voiceId accepts an ElevenLabs voice id (discover via GET /v2/voices) or the id of a voice cloned via POST /v2/voices. Free-tier keys share the monthly ElevenLabs allowance; paid plans are billed per use.

A voiceId that does not resolve returns a 422 with errorCode voice_not_found. If a voice from your own ElevenLabs account stops resolving, the connected API key may be invalid — provider failures surface errorCode elevenlabs_api_key_invalid (reconnect it in Settings > Integrations) or elevenlabs_quota_exceeded (402) when your own ElevenLabs quota is exhausted. Temporary ElevenLabs provider failures return errorCode elevenlabs_service_unavailable: 504 for provider timeouts and 503 for other provider outages. Retry those requests with backoff and include the requestId if you contact support. A voice with an unresolved ElevenLabs restriction returns errorCode voice_verification_required or voice_blocked (both normally 422, or 400 when the pre-synthesis check was unavailable), or voice_access_denied (400). The required action depends on the code and on whether the voice is from your own connected ElevenLabs account — see the Error Handling guide.

Autenticação

x-api-keystring
Autenticação de chave de API via cabeçalho

Solicitação

This endpoint expects an object.
scriptstringObrigatório1-5000 characters

The text to synthesize into speech (1–5,000 characters).

voiceIdstringObrigatório

A voice id to synthesize with — either an ElevenLabs voice id (discover via GET /v2/voices) or the id of a voice cloned via POST /v2/voices.

providerenumObrigatório

The voice provider to synthesize with. Currently elevenlabs.

Valores permitidos:
stabilitydoubleOpcional0-1

Voice stability (0-1). Higher is more consistent, lower is more expressive.

similarityBoostdoubleOpcional0-1

How closely the synthesized audio matches the original voice (0-1).

Resposta

TTS audio generated successfully
idstring
A unique identifier for the synthesized audio.
urlstring

The hosted URL of the synthesized audio. Reuse it as an audio input in POST /v2/generate to keep the same take across generations.

durationdouble
Duration of the synthesized audio in seconds.

Erros

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
422
Unprocessable Entity Error
500
Internal Server Error
503
Service Unavailable Error
504
Gateway Timeout Error