HeyGen Avatar V Serverless API
Studio-quality talking-avatar videos from text or audio.
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) 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
https://api.segmind.com/v1/heygen-avatar-vParameters
aspect_ratiooptionalstringOutput aspect ratio. Use 16:9 for landing pages, 9:16 for shorts/reels, 1:1 for social feed.
"16:9""16:9""9:16""4:5""5:4""1:1""auto"audio_urloptionalstring (uri)Public MP3/WAV URL to lip-sync to instead of prompt+voice. Use for music videos or pre-recorded narration.
avataroptionalstringChoose a ready-made HeyGen Digital Twin avatar (24 options). Use defaults for product demos or pitches.
"Abigail Sofa Front""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 moreavatar_idoptionalstringRaw HeyGen avatar ID; overrides 'avatar'. Pass a Digital Twin ID from heygen-avatar-v-create for custom faces.
backgroundoptionalstringOptional background — hex color (#FFFFFF) or image URL. Leave blank for the avatar's native scene.
captionoptionalbooleanGenerate SRT captions; response becomes JSON with video_url + caption_url. Enable for accessibility or social posts.
falsefitoptionalstringHow the avatar fits the frame. 'cover' fills the frame (recommended); 'contain' preserves entire framing.
"cover""cover""contain"output_formatoptionalstringOutput container — mp4 for standard playback, webm to preserve transparent background channel.
"mp4""mp4""webm"promptoptionalstringText the avatar will speak; mutually exclusive with audio_url. Keep clips under 60s for fastest renders.
remove_backgroundoptionalbooleanStrip background for compositing into other scenes. Pair with output_format=webm for alpha channel.
falseresolutionoptionalstringOutput resolution: 720p (cheap drafts), 1080p (default — best quality/cost), 4k (premium production).
"1080p""720p""1080p""4k"video_urloptionalstring (uri)Reference footage (≥15s, video/mp4) to train a Digital Twin in one call. Adds $1.25 one-time training fee.
voiceoptionalstringText-to-speech voice paired with prompt. Match voice tone to use case — Aaron and Daniel suit explainers.
"Aaron""Aaron""Allison""AstroMesh""Blanka - Lifelike""Camden""Chill Brian""Daniel""Elio""Ida - Lifelike""Jessica Anne Bogart"+10 morevoice_idoptionalstringRaw 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.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out