Skip to main content

Generate speech from text

POST 
/text-to-speech/speech

Converts the provided text to speech using the specified voice and returns audio data

Request

Body

required

    voice stringrequired

    The voice ID in the format Provider.ModelId.VoiceId.

    Examples:

    • AWS.Polly.Joanna-Neural
    • Azure.en-US-AvaMultilingualNeural
    • ElevenLabs.eleven_multilingual_v2.Rachel
    • Telnyx.KokoroTTS.af

    Use the GET /text-to-speech/voices endpoint to get a complete list of available voices.

    text stringrequired

    The text to convert to speech

Responses

200: Audio data generated from the provided text

401: Unauthorized

422: Invalid request parameters

Request samples


curl -L 'https://api.telnyx.com/v2/text-to-speech/speech' \
-H 'Content-Type: application/json' \
-H 'Accept: audio/mpeg' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"voice": "string",
"text": "string"
}'

Response samples


{}