v1

latestOpenAPI 3.1.02026-07-2665164286.3 KB
Voices

Generate Speech

Synthesize speech audio from text using a specified voice. The voice must support the starfish engine — use GET /v3/voices?engine=starfish to find compatible voices. Supports plain text and SSML. Speed range: 0.5–2.0x. Returns a URL to the generated audio file along with duration and optional word-level timestamps.

post/v3/voices/speech

Request body

textstring required

Text to synthesize (1-5000 characters).

voice_idstring required

Voice ID to use. The voice must support the starfish engine. Filter compatible voices by passing engine=starfish to the voice listing endpoint.

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
      }
    ]
  }
}