Convert text to speech using a specified voice
Features
Text To Speech
Synthesize speech from text with voice and gender customization, plus optional webhook callback.
Give priority to the sample audio first, then to the voice ID, and lastly to gender.
POST
Convert text to speech using a specified voice
Convert any given text into realistic speech using your chosen voice and gender.
TextToSpeech enables you to instantly bring written content to life. Perfect for:
Use this endpoint to initiate a new text-to-speech audio generation.
- Creating dynamic audio narrations or voiceovers
- Choosing gender-specific voice stylings for different contexts
- Using webhooks for real-time integration with your workflows
Endpoint
Sample Output
Prompt: When I think of superheroes I think of super humans. I think of Superman, Wolverine and Wonder Woman. Usually they have a cape, or a mask to hide their face just in case. They have X-ray vision and super-human strength. Some can even breathe in outer space. They fly around a while, but always come back to keep our cities safe. They’re here to save humanity from itself. It’s a metaphor for how we look outside ourselves for help, and while the fantasies are fun, I choose to look for me and you. Download AudioTry it Yourself
Visit the TextToSpeech Endpoint Explorer to try your own text samples.
💡 Tip: Set a webhook_url to receive results automatically when your audio is ready.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | String | Yes | The text content to convert to speech |
voice_id | String | Optional | Voice model to apply for synthesis. Either voice_id or sample_audio_url must be provided |
sample_audio_url | String | Optional | URL of Voice you want. Either voice_id or sample_audio_url must be provided |
gender | String | Yes | Gender of the voice (“male”, “female”) |
webhook_url | String | No | URL to receive a callback with generated audio |
💡Note: You must provide eithervoice_idoraudio_url— not both asNone.
content-type: application/json
Sample Request
Python
Sample Response
Success (200 OK)
Webhook Response
Once audio is ready, your webhook will receive:
🎧 Use the audio_url to listen or download your synthesized speech.
Error Codes
- 402 Payment Required: Not enough credits to process the request
- 422 Unprocessable Entity: Invalid or missing fields
- 500 Internal Server Error: Server-side failure during processing
Payload and Request Formation
Authorizations
Body
application/json
- Option 1
- Option 2
Text to convert to speech
An audio URL containing a voice sample of the target speaker without music or overlapping voices. Recommended over voice_id for better output quality.
Voice model ID
Gender preference for the voice (e.g., "male", "female")
Callback URL for async processing