Voices

Generate speech audio from text

Changed on

Synthesize speech audio from text using a specified voice. Returns a URL to the generated audio file along with duration and optional word-level timestamps.

post/v1/audio/text_to_speech

Request

  • Base URL
    https://api.heygen.com
  • URL
    https://api.heygen.com/v1/audio/text_to_speech
  • Auth
    • API key in header x-api-key
    • or HTTP bearer

Request body

textstring required

Text to synthesize (1-5000 characters). Break tags must express time in seconds (for example, <break time="0.35s"/>); millisecond values are not supported.

voice_idstring required

Voice ID from the voice catalog. The voice must be one the Starfish engine supports: a stock voice, a designed voice, or an instant clone. List them with GET /v3/voices?engine=starfish. A professional HeyGen Voice clone is synthesized by POST /v3/models/audio/tts instead.

input_typestring

Type of the input: 'text' for plain text, 'ssml' for SSML markup. Defaults to 'text'.

speednumber

Speed multiplier (0.5-2.0).

languagestring nullable

Base language code (e.g. 'en', 'pt', 'zh'). Optional — auto-detected from text when omitted.

localestring nullable

BCP-47 locale tag (e.g. 'en-US', 'pt-BR'). When set, language is inferred from locale.

Response

Successful response

Example response

{
  "data": {
    "audio_url": "https://files.heygen.ai/audio/tts_abc123.mp3",
    "duration": 4.5,
    "request_id": "req_abc123",
    "word_timestamps": [
      {
        "word": "Hello",
        "end": 0.35
      }
    ]
  }
}

Changes