POST
/v1/flows/text-to-speech
ElevenLabs APICreate Speech Generation
- Base URL
- https://api.elevenlabs.io
- Auth
- xi-api-key: <ELEVENLABS_API_KEY>
- Last verified
- 2026-09-03 · upstream hash matched
Actions
Agents: curl -H "Accept: text/markdown" this URL
→ 215 tokens · Vary: Accept
→ 215 tokens · Vary: Accept
Critical gotchas
Authentication uses the non-standard xi-api-key header, not Authorization: Bearer. Sending a Bearer token returns HTTP 401.
Text-to-speech responses are raw binary audio, not JSON. Write the body to a file (--output speech.mp3) rather than parsing it.
cURL
curl -X POST 'https://api.elevenlabs.io/v1/flows/text-to-speech' \ -H "xi-api-key: $ELEVENLABS_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "webhook": { "type": "all" }, "text": "string", "voice": "string", "output_format": "mp3_44100_128", "pronunciation_dictionary_locators": [ { "pronunciation_dictionary_id": "string", "version_id": "string" } ], "model_id": "string", "language_code": "string", "voice_settings": { "stability": 0, "similarity_boost": 0, "speed": 0 }}'Get a free ElevenLabs API key → sponsored
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| webhook | body | object | No | Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. |
| text | body | string | Yes | The text to synthesize into speech. |
| voice | body | string | Yes | The ID of the voice to speak with. |
| output_format | body | string | No | The audio encoding of the output, as `codec_sampleRateHz_bitrateKbps`. `mp3_44100_192` requires the Creator tier or above. |
| pronunciation_dictionary_locators | body | object[] | No | Pronunciation dictionaries to apply to the text, in order of precedence. Up to 3. |
| model_id | body | string | Yes | The model to use for the generation. |
| language_code | body | string | No | ISO 639-1 language code to enforce on the output. Omit to detect the language from the text. |
| voice_settings | body | object | No | Overrides for the voice's saved settings, applied to this generation only. |
Response 200 OK
{
"id": "JWr5N6X9ZTqf8jD2LmQb",
"status": "pending"
}