POST
/v1/text-to-voice/create-previews
ElevenLabs API[Deprecated] Generate A Voice Preview From Description
- 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
→ 219 tokens · Vary: Accept
→ 219 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/text-to-voice/create-previews?output_format=mp3_22050_32' \ -H "xi-api-key: $ELEVENLABS_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "voice_description": "string", "text": "string", "auto_generate_text": false, "loudness": 0.5, "quality": 0.9, "seed": 0, "guidance_scale": 5, "should_enhance": false}'Get a free ElevenLabs API key → sponsored
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| output_format | query | string | No | Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. |
| voice_description | body | string | Yes | Description to use for the created voice. |
| text | body | string | No | Text to generate, text length has to be between 100 and 1000. |
| auto_generate_text | body | boolean | No | Whether to automatically generate a text suitable for the voice description. |
| loudness | body | number | No | Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. |
| quality | body | number | No | Higher quality results in better voice output but less variety. |
| seed | body | integer | No | Random number that controls the voice generation. Same seed with same inputs produces same voice. |
| guidance_scale | body | number | No | Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. |
| should_enhance | body | boolean | No | Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False |
Response 200 OK
{
"previews": [
{
"audio_base_64": "string",
"generated_voice_id": "string",
"media_type": "string",
"duration_secs": 0,
"language": "string"
}
],
"text": "string"
}