Skip to main content
POST
/
v3
/
video-agents
Create Video Agent Session
curl --request POST \
  --url https://api.heygen.com/v3/video-agents \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "prompt": "<string>",
  "mode": "generate",
  "avatar_id": "<string>",
  "voice_id": "<string>",
  "style_id": "<string>",
  "brand_kit_id": "<string>",
  "files": [
    {
      "type": "<string>",
      "url": "<string>"
    }
  ],
  "callback_url": "<string>",
  "callback_id": "<string>",
  "incognito_mode": false
}
'
import requests

url = "https://api.heygen.com/v3/video-agents"

payload = {
"prompt": "<string>",
"mode": "generate",
"avatar_id": "<string>",
"voice_id": "<string>",
"style_id": "<string>",
"brand_kit_id": "<string>",
"files": [
{
"type": "<string>",
"url": "<string>"
}
],
"callback_url": "<string>",
"callback_id": "<string>",
"incognito_mode": False
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
mode: 'generate',
avatar_id: '<string>',
voice_id: '<string>',
style_id: '<string>',
brand_kit_id: '<string>',
files: [{type: '<string>', url: '<string>'}],
callback_url: '<string>',
callback_id: '<string>',
incognito_mode: false
})
};

fetch('https://api.heygen.com/v3/video-agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.heygen.com/v3/video-agents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'mode' => 'generate',
'avatar_id' => '<string>',
'voice_id' => '<string>',
'style_id' => '<string>',
'brand_kit_id' => '<string>',
'files' => [
[
'type' => '<string>',
'url' => '<string>'
]
],
'callback_url' => '<string>',
'callback_id' => '<string>',
'incognito_mode' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.heygen.com/v3/video-agents"

payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"mode\": \"generate\",\n \"avatar_id\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"style_id\": \"<string>\",\n \"brand_kit_id\": \"<string>\",\n \"files\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"incognito_mode\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.heygen.com/v3/video-agents")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"mode\": \"generate\",\n \"avatar_id\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"style_id\": \"<string>\",\n \"brand_kit_id\": \"<string>\",\n \"files\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"incognito_mode\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.heygen.com/v3/video-agents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"mode\": \"generate\",\n \"avatar_id\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"style_id\": \"<string>\",\n \"brand_kit_id\": \"<string>\",\n \"files\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"incognito_mode\": false\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "session_id": "<string>",
    "created_at": 123,
    "video_id": "v_abc123def456"
  }
}
{
"error": {
"code": "invalid_parameter",
"message": "'prompt' is required and must be 1-10000 characters.",
"param": "prompt",
"doc_url": null
}
}
{
"error": {
"code": "authentication_failed",
"message": "Invalid or expired API key. Verify your x-api-key header.",
"param": null,
"doc_url": null
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Retry after the duration specified in the Retry-After header.",
"param": null,
"doc_url": null
}
}

Authorizations

x-api-key
string
header
required

HeyGen API key. Obtain from your HeyGen dashboard.

Body

application/json

Request body for creating a video from a prompt using Video Agent v3.

All configuration is flat (no nested config object). Files use the type-discriminated AssetInput union for flexible asset inputs.

Supports two modes:

  • generate (default): one-shot — auto-proceeds through storyboard, produces one video.
  • chat: multi-turn — may pause for user input on real decisions (e.g. pick a voice), auto-proceeds on confirmations. Allows revisions and follow-up videos.
prompt
string
required

The message/prompt for video generation (1-10000 characters)

Required string length: 1 - 10000
mode
enum<string>
default:generate

Session mode. 'generate' produces one video (fire-and-forget). 'chat' enables multi-turn interaction — the agent may pause for decisions and allows revisions.

Available options:
generate,
chat
avatar_id
string | null

Specific avatar ID to use

voice_id
string | null

Specific voice ID to use for narration

style_id
string | null

Style ID from GET /v3/video-agents/styles. Applies a curated visual template to the generated video.

brand_kit_id
string | null

Brand kit ID to apply brand colors, fonts, and logos to the generated video.

orientation
enum<string> | null

Video orientation. If not provided, auto-detected from content.

Available options:
landscape,
portrait
files
(AssetUrl · object | AssetId · object | AssetBase64 · object)[] | null

Optional file attachments (max 20 files)

Maximum array length: 20

Asset input via publicly accessible HTTPS URL.

callback_url
string | null

Webhook URL for completion/failure notifications

callback_id
string | null

Optional callback ID included in webhook payload

incognito_mode
boolean
default:false

When enabled, disables memory injection and extraction for this session

Response

Successful response

data
CreateVideoAgentResponse · object

Response from creating a video agent session.

Designed as a session resource for future extensibility — GET /v3/video-agents/{session_id} can return the same shape enriched with more fields (messages, video URL, etc.).