Skip to main content
POST
Python
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:
  • Creating dynamic audio narrations or voiceovers
  • Choosing gender-specific voice stylings for different contexts
  • Using webhooks for real-time integration with your workflows

Endpoint

Use this endpoint to initiate a new text-to-speech audio generation.

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 Audio

Try 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

💡Note: You must provide either voice_id or audio_url — not both as None.
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

Authorization
string
header
required

Body

application/json
text
string
required

Text to convert to speech

sample_audio_url
string
required

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_id
string

Voice model ID

gender
string

Gender preference for the voice (e.g., "male", "female")

webhook_url
string

Callback URL for async processing

Response

Successfully initiated TTS conversion

success
boolean
task_id
string
conversion_id
string
eta
integer