Skip to main content
POST
Stream Speech

Authorizations

x-api-key
string
header
required

HeyGen API key. Obtain from your HeyGen dashboard.

Body

application/json
voice_id
string
required

Identifier of the voice used for speech synthesis.

Minimum string length: 1
text
string
required

Text to synthesize. Instant voices accept caller-supplied IPA, such as Acme. Respelling cues are not supported. Unsupported IPA returns HTTP 400. Pronunciation requires an available pronunciation-capable model. Professional voices accept pauses (seconds, up to 5 per pause, e.g. ); other SSML, and break tags for an instant voice clone, are not supported.

Required string length: 1 - 5000
end_user_id
string | null

Stable, opaque end-user identifier in your application, scoped to the authenticated workspace. Use 1–128 non-whitespace characters without personal information. Used for usage attribution and abuse investigation; does not change billing, authorization, or rate limits.

Required string length: 1 - 128
Pattern: ^\S+$
output_format
SpeechOutputFormat · object | null

Optional audio output: encoding pcm (signed little-endian PCM16), mp3, ulaw, or alaw; mono only. sample_rate_hertz: 8000, 16000, 22050, 24000, 44100, or 48000 for pcm/mp3 (default 44100); ulaw/alaw require 8000 (default). MP3 bitrate_bps: 32000/48000/64000 below 32000 Hz (default 64000), or 64000/96000/128000/192000 at 44100/48000 Hz (default 128000). Omit for the existing WAV file or SSE stream of base64 WAV parts. When supplied, /tts/stream returns raw audio bytes and does not support with_timestamps.

model
enum<string>
default:heygen-voice-1

heygen-voice-1: instant and professional voices. heygen-voice-1-turbo: instant voices at lower latency. heygen-voice-1-turbo-free: instant voices without charge, subject to per-user limits and shared capacity. No latency or availability guarantee. Requests rejected by a limit or capacity check return HTTP 429. Timeouts and service failures can return HTTP 500.

Available options:
heygen-voice-1,
heygen-voice-1-turbo,
heygen-voice-1-turbo-free
pronunciation_dictionary
Pronunciation Dictionary · object | null

Optional term-to-IPA dictionary, such as {"Acme": "/ˈækmi/"}. Use enclosing slashes for each IPA value. Matches whole terms without case sensitivity. Inline pronunciation takes precedence. Supports instant voices on heygen-voice-1 and heygen-voice-1-turbo when pronunciation is available. Omit expressiveness_boost to use 0.5, or supply a value from 0.0 to 1.0.

language
string | null

Language code of text. Regional tags normalize to their supported base language, such as en-US to en. Omit it to detect the language from text. A confident reading that matches the letters of text is used, and the request fails with invalid_parameter if HeyGen Voice does not speak that language. Otherwise the first of these that HeyGen Voice speaks is used: the language the voice was created in, if text is written in that language's script; a less certain reading that a second reading of text without its numbers and brand names agrees with; the usual language of the script text is mostly written in, such as English for Latin letters; and, only when that script has no usual language, the reading itself. If none of them applies, the request fails with invalid_parameter. The Content-Language response header names the language used.

Minimum string length: 1
previous_request_ids
string[] | null

Completed speech request IDs before this text, in playback order, up to three. Use X-Request-Id from completed batch or fully consumed streaming responses within two hours. Requests must use the same workspace, voice, and model. Instant clones only, including Turbo. Unavailable when speech retention is disabled. Only the last three seconds of context are used. Unavailable context falls back to normal synthesis.

Maximum array length: 3
Required string length: 1 - 64
Pattern: ^[A-Za-z0-9_-]+$
next_request_ids
string[] | null

Completed speech request IDs after this text, in playback order, up to three. Use X-Request-Id from completed batch or fully consumed streaming responses within two hours. Requests must use the same workspace, voice, and model. Instant clones only, including Turbo. Unavailable when speech retention is disabled. Only the first three seconds of context are used. Unavailable context falls back to normal synthesis.

Maximum array length: 3
Required string length: 1 - 64
Pattern: ^[A-Za-z0-9_-]+$
expressiveness_boost
number | null

Expressiveness boost for instant voices, from 0.0 to 1.0. Omit for professional voices. Omitted values use 0.5 with pronunciation and 1.0 otherwise.

Required range: 0 <= x <= 1
seed
integer | null

Optional best-effort deterministic generation seed for professional clones. Ignored for instant clones.

Required range: 0 <= x <= 4294967295
speed
number | null

Speech speed multiplier for professional clones. Ignored for instant clones, including Turbo.

Required range: 0.75 <= x <= 1.25
pitch_shift
number | null

Pitch shift in semitones for professional clones. Ignored for instant clones.

Required range: -4 <= x <= 4
pitch_variance
number | null

Pitch variation multiplier for professional clones; 1.0 preserves the voice default. Ignored for instant clones.

Required range: 0.5 <= x <= 2
with_timestamps
boolean
default:false

Include character and word timings after the audio.

Response

Raw audio bytes when output_format is supplied; otherwise a Server-Sent Events stream. Each data: frame contains an audio, alignment, or terminal error event; a clean stream terminates with data: [DONE].

One JSON event carried by the speech SSE stream.

type
string
required

Event type.

Allowed value: "audio"
part_index
integer
required

Zero-based sequence number of this audio part.

Required range: x >= 0
audio
string
required

Base64-encoded standalone WAV audio part.