Yes – ElevenLabs’ text-to-speech absolutely has an API, and it’s designed for exactly that kind of automation.
At a high level, you can:
- Send a script (plain text) to their TTS endpoint
- Choose a specific voice + model
- Get back raw audio bytes (e.g. MP3)
- Save those bytes as an audio file in your system
-
Create an API key
In the ElevenLabs dashboard you generate an API key, which you then send in the xi-api-key header. citeturn2view0
-
Pick a voice
Each voice has a voice_id. You either use one of their stock voices or a cloned/custom voice, and you’ll pass that ID in the URL. citeturn3view0
-
Call the Text-to-Speech endpoint
The core REST endpoint for converting text to speech looks like:
POST https://api.elevenlabs.io/v1/text-to-speech/{voice_id}
This converts your text into speech using the chosen voice and returns audio. citeturn4search1turn4search10
Typical headers and JSON body:
Content-Type: application/json
Accept: audio/mpeg # or another supported format
"text": "Your script goes here...",
"model_id": "eleven_multilingual_v2", // or another model
-
Save the returned audio as a file
The response body is the binary audio (e.g. MP3). You just write it to disk on your side—this is where your automation would loop over scripts, call the API, and save each result.
Here’s a small example using requests to send a script and save an MP3:
VOICE_ID = "21m00Tcm4TlvDq8ikWAM" # example voice
URL = f"https://api.elevenlabs.io/v1/text-to-speech/{VOICE_ID}"
"Content-Type": "application/json",
"text": "This is a test script generated automatically.",
"model_id": "eleven_multilingual_v2",
resp = requests.post(URL, headers=headers, json=data)
with open("output.mp3", "wb") as f:
They also provide official Python/TypeScript SDKs (e.g. elevenlabs.text_to_speech.convert(...)) that wrap this same functionality and can directly return audio you can save or stream. citeturn2view0turn0search17
- ✅ Automatically send scripts – yes, you can POST each script programmatically.
- ✅ Have it create audio files – the API returns the audio bytes; you save them as
.mp3/.wav etc.
- ✅ Fully automatable pipeline – you can integrate this into any backend, batch process, or workflow tool.
If you tell me what stack you’re using (Python, Node, n8n, etc.), I can sketch the exact integration flow tailored to that.