Prerequisites
A Digital Twin
avatar_id (type: video_avatar). Use GET /v3/avatars/looks?avatar_type=video_avatar to find yours.A
voice_id for the voice you want. Use GET /v3/voices to browse available voices.Step 1 — Find your Digital Twin
List your private Digital Twin looks to get theavatar_id:
id field of the look you want. This is your avatar_id.
Step 2 — Create the video
Send aPOST request to /v3/videos with your Digital Twin ID, a script, and a voice:
Step 3 — Poll for completion
Video generation is asynchronous. PollGET /v3/videos/{video_id} until status is completed:
Status values
| Status | Meaning |
|---|---|
pending | Queued for processing |
processing | Video is being generated |
completed | Ready — video_url is available |
failed | Something went wrong |
video_url with a presigned download link.
Full example
Optional parameters
| Parameter | Type | Description |
|---|---|---|
title | string | Display name in the HeyGen dashboard |
resolution | string | 1080p or 720p |
aspect_ratio | string | 16:9 or 9:16 |
remove_background | boolean | Removes the avatar background (twin must be trained with matting enabled) |
background | object | Set a solid color or image background |
voice_settings | object | Adjust speed (0.5–1.5), pitch (-50 to +50), and locale |
callback_url | string | Webhook URL — receive a POST when the video is ready |
Using webhooks instead of polling
Instead of polling, pass acallback_url when creating the video. HeyGen will send a POST request to that URL when the video completes or fails.
Register a webhook endpoint via
POST /v3/webhooks/endpoints and subscribe to avatar_video.success and avatar_video.fail events for production use.
