1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/heygen-avatar-v-create";
const data = {
"name": "My Digital Twin"
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();Public mp4 URL of reference footage, ≥15 seconds, Content-Type video/mp4. Use a clean, well-lit single-take recording.
Display name for the new Digital Twin. Any string — used for organization in your HeyGen account.
Optional existing identity to attach this look to. Omit to create a new identity for the person.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
heygen-avatar-v-create is the training endpoint for HeyGen's Digital Twin avatars. Pass a short reference video and the API enrolls a new lifelike avatar that mirrors the subject's body language, expressions, and delivery style. The endpoint returns an avatar_id (and avatar_group_id) immediately; HeyGen completes training asynchronously over a few minutes, after which the avatar_id becomes usable with the heygen-avatar-v model to generate talking-head videos at scale.
avatar_id + avatar_group_id in ~3.5 secondsavatar_group_idconsent_reroute_url for branded consent flowsheygen-avatar-v for downstream video generationConfirmed in testing: the endpoint returns an avatar_id immediately and consent_status: "skipped" when no reroute URL is provided. Training itself completes asynchronously on HeyGen's side. Use this model to scale founder-led video, internal training, personalized outreach, and influencer-style campaigns — anywhere you need a reusable digital likeness instead of repeatedly filming the same person. The Digital Twin path is also ideal for multilingual content: train once, generate in any voice.
The single most important parameter is video_url. Shoot the reference footage in 1080p (or higher) at 30fps, keep the subject centered, use even lighting, and record a continuous take of 2–5 minutes for best fidelity. The clip must be at least 15 seconds and served with Content-Type: video/mp4 — shorter or wrongly-typed clips fail with "Footage is too short or too long". Avoid clothing with large logos, harsh shadows, and ambient noise.
How long until the avatar is usable? A few minutes — poll heygen-avatar-v with the returned avatar_id until generations succeed.
What does it cost? $1.25 per training run.
Can I add more looks to one identity? Yes — pass the existing avatar_group_id on subsequent calls.
Do I need a consent video? HeyGen requires consent for production use; pass consent_reroute_url to route subjects through a branded consent page.
What format must the reference be? Public URL serving mp4 with Content-Type: video/mp4, ≥15 seconds, single continuous take.
Can I delete an avatar? Yes, via the HeyGen dashboard — note deletion resets monthly on most plans.