HeyGen Avatar V Serverless API

Studio-quality talking-avatar videos from text or audio.

~140.25s
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/heygen-avatar-v"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "avatar": "Abigail Sofa Front",
12    "prompt": "Hello! This is an Avatar V demo on Segmind.",
13    "voice": "Aaron",
14    "resolution": "1080p",
15    "aspect_ratio": "16:9",
16    "fit": "cover",
17    "caption": false,
18    "output_format": "mp4",
19    "remove_background": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25    result = response.json()
26    print(json.dumps(result, indent=2))
27else:
28    print(f"Error: {response.status_code}")
29    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/heygen-avatar-v

Parameters

aspect_ratiooptional
string

Output aspect ratio. Use 16:9 for landing pages, 9:16 for shorts/reels, 1:1 for social feed.

Default: "16:9"
Allowed values :
"16:9""9:16""4:5""5:4""1:1""auto"
audio_urloptional
string (uri)

Public MP3/WAV URL to lip-sync to instead of prompt+voice. Use for music videos or pre-recorded narration.

avataroptional
string

Choose a ready-made HeyGen Digital Twin avatar (24 options). Use defaults for product demos or pitches.

Default: "Abigail Sofa Front"
Allowed values (24 total):
"Abigail Sofa Front""Amelia Business Training Front""Anja Office Front""Ann Doctor Sitting""Annie Bar Sitting Front""Artur Office Front""Aubrey Night Scene Front""Blanka Lounge Front""Bojan Business Training Front""Brandon Business Sitting Front"+14 more
avatar_idoptional
string

Raw HeyGen avatar ID; overrides 'avatar'. Pass a Digital Twin ID from heygen-avatar-v-create for custom faces.

backgroundoptional
string

Optional background — hex color (#FFFFFF) or image URL. Leave blank for the avatar's native scene.

captionoptional
boolean

Generate SRT captions; response becomes JSON with video_url + caption_url. Enable for accessibility or social posts.

Default: false
fitoptional
string

How the avatar fits the frame. 'cover' fills the frame (recommended); 'contain' preserves entire framing.

Default: "cover"
Allowed values :
"cover""contain"
output_formatoptional
string

Output container — mp4 for standard playback, webm to preserve transparent background channel.

Default: "mp4"
Allowed values :
"mp4""webm"
promptoptional
string

Text the avatar will speak; mutually exclusive with audio_url. Keep clips under 60s for fastest renders.

remove_backgroundoptional
boolean

Strip background for compositing into other scenes. Pair with output_format=webm for alpha channel.

Default: false
resolutionoptional
string

Output resolution: 720p (cheap drafts), 1080p (default — best quality/cost), 4k (premium production).

Default: "1080p"
Allowed values :
"720p""1080p""4k"
video_urloptional
string (uri)

Reference footage (≥15s, video/mp4) to train a Digital Twin in one call. Adds $1.25 one-time training fee.

voiceoptional
string

Text-to-speech voice paired with prompt. Match voice tone to use case — Aaron and Daniel suit explainers.

Default: "Aaron"
Allowed values (20 total):
"Aaron""Allison""AstroMesh""Blanka - Lifelike""Camden""Chill Brian""Daniel""Elio""Ida - Lifelike""Jessica Anne Bogart"+10 more
voice_idoptional
string

Raw HeyGen voice ID; overrides 'voice'. Use for cloned or premium voices beyond the dropdown list.

Response Type

Returns: Video

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out