Skip to main content
POST
Generate Speech

Authorizations

x-api-key
string
header
required

HeyGen API key. Obtain from your HeyGen dashboard.

Body

application/json

Request body for text-to-speech generation.

text
string
required

Text to synthesize (1-5000 characters). Break tags must express time in seconds (for example, ); millisecond values are not supported.

Required string length: 1 - 5000
voice_id
string
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_type
string
default:text

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

speed
number
default:1

Speed multiplier (0.5-2.0).

Required range: 0.5 <= x <= 2
language
string | null

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

locale
string | null

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

Response

Successful response

data
TextToSpeechResponseData · object

Response payload for text-to-speech generation.