Create Video Batch
Submit up to 100 video creation payloads in one request and return a batch id immediately. Videos are created asynchronously; poll GET /v3/videos/batches/ for per-item video ids and statuses.
curl --request POST \
--url https://api.heygen.com/v3/videos/batches \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"videos": [
{
"type": "<string>",
"avatar_id": "<string>",
"title": "<string>",
"aspect_ratio": "16:9",
"background": {
"value": "<string>",
"url": "<string>",
"asset_id": "<string>"
},
"remove_background": true,
"callback_url": "<string>",
"callback_id": "<string>",
"watermark": {
"image": {
"type": "<string>",
"url": "<string>"
},
"scale": 1,
"opacity": 1,
"placement": {
"position": "bottom_right",
"offset_x": 0,
"offset_y": 0
}
},
"caption": {
"file_format": "srt",
"style": "default"
},
"output_format": "mp4",
"script": "<string>",
"voice_id": "<string>",
"audio_url": "<string>",
"audio_asset_id": "<string>",
"voice_settings": {
"speed": 1,
"pitch": 0,
"volume": 1,
"locale": "<string>",
"engine_settings": {
"engine_type": "<string>",
"similarity_boost": 0.5,
"stability": 0.5,
"style": 0.5,
"use_speaker_boost": true
}
},
"motion_prompt": "<string>",
"engine": {
"type": "<string>",
"reference_look_id": "<string>"
}
}
],
"title": "<string>",
"callback_url": "<string>"
}
'import requests
url = "https://api.heygen.com/v3/videos/batches"
payload = {
"videos": [
{
"type": "<string>",
"avatar_id": "<string>",
"title": "<string>",
"aspect_ratio": "16:9",
"background": {
"value": "<string>",
"url": "<string>",
"asset_id": "<string>"
},
"remove_background": True,
"callback_url": "<string>",
"callback_id": "<string>",
"watermark": {
"image": {
"type": "<string>",
"url": "<string>"
},
"scale": 1,
"opacity": 1,
"placement": {
"position": "bottom_right",
"offset_x": 0,
"offset_y": 0
}
},
"caption": {
"file_format": "srt",
"style": "default"
},
"output_format": "mp4",
"script": "<string>",
"voice_id": "<string>",
"audio_url": "<string>",
"audio_asset_id": "<string>",
"voice_settings": {
"speed": 1,
"pitch": 0,
"volume": 1,
"locale": "<string>",
"engine_settings": {
"engine_type": "<string>",
"similarity_boost": 0.5,
"stability": 0.5,
"style": 0.5,
"use_speaker_boost": True
}
},
"motion_prompt": "<string>",
"engine": {
"type": "<string>",
"reference_look_id": "<string>"
}
}
],
"title": "<string>",
"callback_url": "<string>"
}
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({
videos: [
{
type: '<string>',
avatar_id: '<string>',
title: '<string>',
aspect_ratio: '16:9',
background: {value: '<string>', url: '<string>', asset_id: '<string>'},
remove_background: true,
callback_url: '<string>',
callback_id: '<string>',
watermark: {
image: {type: '<string>', url: '<string>'},
scale: 1,
opacity: 1,
placement: {position: 'bottom_right', offset_x: 0, offset_y: 0}
},
caption: {file_format: 'srt', style: 'default'},
output_format: 'mp4',
script: '<string>',
voice_id: '<string>',
audio_url: '<string>',
audio_asset_id: '<string>',
voice_settings: {
speed: 1,
pitch: 0,
volume: 1,
locale: '<string>',
engine_settings: {
engine_type: '<string>',
similarity_boost: 0.5,
stability: 0.5,
style: 0.5,
use_speaker_boost: true
}
},
motion_prompt: '<string>',
engine: {type: '<string>', reference_look_id: '<string>'}
}
],
title: '<string>',
callback_url: '<string>'
})
};
fetch('https://api.heygen.com/v3/videos/batches', 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/videos/batches",
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([
'videos' => [
[
'type' => '<string>',
'avatar_id' => '<string>',
'title' => '<string>',
'aspect_ratio' => '16:9',
'background' => [
'value' => '<string>',
'url' => '<string>',
'asset_id' => '<string>'
],
'remove_background' => true,
'callback_url' => '<string>',
'callback_id' => '<string>',
'watermark' => [
'image' => [
'type' => '<string>',
'url' => '<string>'
],
'scale' => 1,
'opacity' => 1,
'placement' => [
'position' => 'bottom_right',
'offset_x' => 0,
'offset_y' => 0
]
],
'caption' => [
'file_format' => 'srt',
'style' => 'default'
],
'output_format' => 'mp4',
'script' => '<string>',
'voice_id' => '<string>',
'audio_url' => '<string>',
'audio_asset_id' => '<string>',
'voice_settings' => [
'speed' => 1,
'pitch' => 0,
'volume' => 1,
'locale' => '<string>',
'engine_settings' => [
'engine_type' => '<string>',
'similarity_boost' => 0.5,
'stability' => 0.5,
'style' => 0.5,
'use_speaker_boost' => true
]
],
'motion_prompt' => '<string>',
'engine' => [
'type' => '<string>',
'reference_look_id' => '<string>'
]
]
],
'title' => '<string>',
'callback_url' => '<string>'
]),
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/videos/batches"
payload := strings.NewReader("{\n \"videos\": [\n {\n \"type\": \"<string>\",\n \"avatar_id\": \"<string>\",\n \"title\": \"<string>\",\n \"aspect_ratio\": \"16:9\",\n \"background\": {\n \"value\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\"\n },\n \"remove_background\": true,\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"watermark\": {\n \"image\": {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"scale\": 1,\n \"opacity\": 1,\n \"placement\": {\n \"position\": \"bottom_right\",\n \"offset_x\": 0,\n \"offset_y\": 0\n }\n },\n \"caption\": {\n \"file_format\": \"srt\",\n \"style\": \"default\"\n },\n \"output_format\": \"mp4\",\n \"script\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_url\": \"<string>\",\n \"audio_asset_id\": \"<string>\",\n \"voice_settings\": {\n \"speed\": 1,\n \"pitch\": 0,\n \"volume\": 1,\n \"locale\": \"<string>\",\n \"engine_settings\": {\n \"engine_type\": \"<string>\",\n \"similarity_boost\": 0.5,\n \"stability\": 0.5,\n \"style\": 0.5,\n \"use_speaker_boost\": true\n }\n },\n \"motion_prompt\": \"<string>\",\n \"engine\": {\n \"type\": \"<string>\",\n \"reference_look_id\": \"<string>\"\n }\n }\n ],\n \"title\": \"<string>\",\n \"callback_url\": \"<string>\"\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/videos/batches")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"videos\": [\n {\n \"type\": \"<string>\",\n \"avatar_id\": \"<string>\",\n \"title\": \"<string>\",\n \"aspect_ratio\": \"16:9\",\n \"background\": {\n \"value\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\"\n },\n \"remove_background\": true,\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"watermark\": {\n \"image\": {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"scale\": 1,\n \"opacity\": 1,\n \"placement\": {\n \"position\": \"bottom_right\",\n \"offset_x\": 0,\n \"offset_y\": 0\n }\n },\n \"caption\": {\n \"file_format\": \"srt\",\n \"style\": \"default\"\n },\n \"output_format\": \"mp4\",\n \"script\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_url\": \"<string>\",\n \"audio_asset_id\": \"<string>\",\n \"voice_settings\": {\n \"speed\": 1,\n \"pitch\": 0,\n \"volume\": 1,\n \"locale\": \"<string>\",\n \"engine_settings\": {\n \"engine_type\": \"<string>\",\n \"similarity_boost\": 0.5,\n \"stability\": 0.5,\n \"style\": 0.5,\n \"use_speaker_boost\": true\n }\n },\n \"motion_prompt\": \"<string>\",\n \"engine\": {\n \"type\": \"<string>\",\n \"reference_look_id\": \"<string>\"\n }\n }\n ],\n \"title\": \"<string>\",\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heygen.com/v3/videos/batches")
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 \"videos\": [\n {\n \"type\": \"<string>\",\n \"avatar_id\": \"<string>\",\n \"title\": \"<string>\",\n \"aspect_ratio\": \"16:9\",\n \"background\": {\n \"value\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\"\n },\n \"remove_background\": true,\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"watermark\": {\n \"image\": {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"scale\": 1,\n \"opacity\": 1,\n \"placement\": {\n \"position\": \"bottom_right\",\n \"offset_x\": 0,\n \"offset_y\": 0\n }\n },\n \"caption\": {\n \"file_format\": \"srt\",\n \"style\": \"default\"\n },\n \"output_format\": \"mp4\",\n \"script\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_url\": \"<string>\",\n \"audio_asset_id\": \"<string>\",\n \"voice_settings\": {\n \"speed\": 1,\n \"pitch\": 0,\n \"volume\": 1,\n \"locale\": \"<string>\",\n \"engine_settings\": {\n \"engine_type\": \"<string>\",\n \"similarity_boost\": 0.5,\n \"stability\": 0.5,\n \"style\": 0.5,\n \"use_speaker_boost\": true\n }\n },\n \"motion_prompt\": \"<string>\",\n \"engine\": {\n \"type\": \"<string>\",\n \"reference_look_id\": \"<string>\"\n }\n }\n ],\n \"title\": \"<string>\",\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"batch_id": "<string>"
}
}{
"error": {
"code": "invalid_parameter",
"message": "Invalid payload(s) at index 3.",
"param": "videos",
"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": "request_in_progress",
"message": "A request with this Idempotency-Key is already in progress. Retry shortly.",
"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
HeyGen API key. Obtain from your HeyGen dashboard.
Headers
Optional client-supplied key for safely retrying mutations. Subsequent calls within 24 hours that share this key replay the original response — even if the request body differs slightly (a warning is logged). A retry that arrives while the original is still in flight gets a 409 request_in_progress. Keys must be 1–255 characters from [A-Za-z0-9_:.-]; a UUID is a safe default. Scope is per-endpoint and per-resource: the same key on a different route or path parameter is independent.
1 - 255^[A-Za-z0-9_\-:.]{1,255}$Body
Video creation requests, identical in shape to POST /v3/videos (avatar / image / cinematic_avatar). Max 100 per batch.
1 - 100 elementsCreate a video from a HeyGen avatar (video or photo avatar).
Provide an avatar_id to use a previously created avatar. Supports all
avatar types: studio_avatar, digital_twin, and photo_avatar. Optionally
set engine to select Avatar V for eligible avatars; when omitted, the
server defaults to Avatar IV.
- CreateVideoFromAvatar
- CreateVideoFromImage
- CreateVideoFromCinematicAvatar
Show child attributes
Show child attributes
Display name for the batch, shown in the HeyGen app.
Webhook URL invoked once when every item in the batch reaches a terminal state.
Response
Accepted — submission acknowledged; poll for completion.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.heygen.com/v3/videos/batches \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"videos": [
{
"type": "<string>",
"avatar_id": "<string>",
"title": "<string>",
"aspect_ratio": "16:9",
"background": {
"value": "<string>",
"url": "<string>",
"asset_id": "<string>"
},
"remove_background": true,
"callback_url": "<string>",
"callback_id": "<string>",
"watermark": {
"image": {
"type": "<string>",
"url": "<string>"
},
"scale": 1,
"opacity": 1,
"placement": {
"position": "bottom_right",
"offset_x": 0,
"offset_y": 0
}
},
"caption": {
"file_format": "srt",
"style": "default"
},
"output_format": "mp4",
"script": "<string>",
"voice_id": "<string>",
"audio_url": "<string>",
"audio_asset_id": "<string>",
"voice_settings": {
"speed": 1,
"pitch": 0,
"volume": 1,
"locale": "<string>",
"engine_settings": {
"engine_type": "<string>",
"similarity_boost": 0.5,
"stability": 0.5,
"style": 0.5,
"use_speaker_boost": true
}
},
"motion_prompt": "<string>",
"engine": {
"type": "<string>",
"reference_look_id": "<string>"
}
}
],
"title": "<string>",
"callback_url": "<string>"
}
'import requests
url = "https://api.heygen.com/v3/videos/batches"
payload = {
"videos": [
{
"type": "<string>",
"avatar_id": "<string>",
"title": "<string>",
"aspect_ratio": "16:9",
"background": {
"value": "<string>",
"url": "<string>",
"asset_id": "<string>"
},
"remove_background": True,
"callback_url": "<string>",
"callback_id": "<string>",
"watermark": {
"image": {
"type": "<string>",
"url": "<string>"
},
"scale": 1,
"opacity": 1,
"placement": {
"position": "bottom_right",
"offset_x": 0,
"offset_y": 0
}
},
"caption": {
"file_format": "srt",
"style": "default"
},
"output_format": "mp4",
"script": "<string>",
"voice_id": "<string>",
"audio_url": "<string>",
"audio_asset_id": "<string>",
"voice_settings": {
"speed": 1,
"pitch": 0,
"volume": 1,
"locale": "<string>",
"engine_settings": {
"engine_type": "<string>",
"similarity_boost": 0.5,
"stability": 0.5,
"style": 0.5,
"use_speaker_boost": True
}
},
"motion_prompt": "<string>",
"engine": {
"type": "<string>",
"reference_look_id": "<string>"
}
}
],
"title": "<string>",
"callback_url": "<string>"
}
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({
videos: [
{
type: '<string>',
avatar_id: '<string>',
title: '<string>',
aspect_ratio: '16:9',
background: {value: '<string>', url: '<string>', asset_id: '<string>'},
remove_background: true,
callback_url: '<string>',
callback_id: '<string>',
watermark: {
image: {type: '<string>', url: '<string>'},
scale: 1,
opacity: 1,
placement: {position: 'bottom_right', offset_x: 0, offset_y: 0}
},
caption: {file_format: 'srt', style: 'default'},
output_format: 'mp4',
script: '<string>',
voice_id: '<string>',
audio_url: '<string>',
audio_asset_id: '<string>',
voice_settings: {
speed: 1,
pitch: 0,
volume: 1,
locale: '<string>',
engine_settings: {
engine_type: '<string>',
similarity_boost: 0.5,
stability: 0.5,
style: 0.5,
use_speaker_boost: true
}
},
motion_prompt: '<string>',
engine: {type: '<string>', reference_look_id: '<string>'}
}
],
title: '<string>',
callback_url: '<string>'
})
};
fetch('https://api.heygen.com/v3/videos/batches', 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/videos/batches",
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([
'videos' => [
[
'type' => '<string>',
'avatar_id' => '<string>',
'title' => '<string>',
'aspect_ratio' => '16:9',
'background' => [
'value' => '<string>',
'url' => '<string>',
'asset_id' => '<string>'
],
'remove_background' => true,
'callback_url' => '<string>',
'callback_id' => '<string>',
'watermark' => [
'image' => [
'type' => '<string>',
'url' => '<string>'
],
'scale' => 1,
'opacity' => 1,
'placement' => [
'position' => 'bottom_right',
'offset_x' => 0,
'offset_y' => 0
]
],
'caption' => [
'file_format' => 'srt',
'style' => 'default'
],
'output_format' => 'mp4',
'script' => '<string>',
'voice_id' => '<string>',
'audio_url' => '<string>',
'audio_asset_id' => '<string>',
'voice_settings' => [
'speed' => 1,
'pitch' => 0,
'volume' => 1,
'locale' => '<string>',
'engine_settings' => [
'engine_type' => '<string>',
'similarity_boost' => 0.5,
'stability' => 0.5,
'style' => 0.5,
'use_speaker_boost' => true
]
],
'motion_prompt' => '<string>',
'engine' => [
'type' => '<string>',
'reference_look_id' => '<string>'
]
]
],
'title' => '<string>',
'callback_url' => '<string>'
]),
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/videos/batches"
payload := strings.NewReader("{\n \"videos\": [\n {\n \"type\": \"<string>\",\n \"avatar_id\": \"<string>\",\n \"title\": \"<string>\",\n \"aspect_ratio\": \"16:9\",\n \"background\": {\n \"value\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\"\n },\n \"remove_background\": true,\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"watermark\": {\n \"image\": {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"scale\": 1,\n \"opacity\": 1,\n \"placement\": {\n \"position\": \"bottom_right\",\n \"offset_x\": 0,\n \"offset_y\": 0\n }\n },\n \"caption\": {\n \"file_format\": \"srt\",\n \"style\": \"default\"\n },\n \"output_format\": \"mp4\",\n \"script\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_url\": \"<string>\",\n \"audio_asset_id\": \"<string>\",\n \"voice_settings\": {\n \"speed\": 1,\n \"pitch\": 0,\n \"volume\": 1,\n \"locale\": \"<string>\",\n \"engine_settings\": {\n \"engine_type\": \"<string>\",\n \"similarity_boost\": 0.5,\n \"stability\": 0.5,\n \"style\": 0.5,\n \"use_speaker_boost\": true\n }\n },\n \"motion_prompt\": \"<string>\",\n \"engine\": {\n \"type\": \"<string>\",\n \"reference_look_id\": \"<string>\"\n }\n }\n ],\n \"title\": \"<string>\",\n \"callback_url\": \"<string>\"\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/videos/batches")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"videos\": [\n {\n \"type\": \"<string>\",\n \"avatar_id\": \"<string>\",\n \"title\": \"<string>\",\n \"aspect_ratio\": \"16:9\",\n \"background\": {\n \"value\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\"\n },\n \"remove_background\": true,\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"watermark\": {\n \"image\": {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"scale\": 1,\n \"opacity\": 1,\n \"placement\": {\n \"position\": \"bottom_right\",\n \"offset_x\": 0,\n \"offset_y\": 0\n }\n },\n \"caption\": {\n \"file_format\": \"srt\",\n \"style\": \"default\"\n },\n \"output_format\": \"mp4\",\n \"script\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_url\": \"<string>\",\n \"audio_asset_id\": \"<string>\",\n \"voice_settings\": {\n \"speed\": 1,\n \"pitch\": 0,\n \"volume\": 1,\n \"locale\": \"<string>\",\n \"engine_settings\": {\n \"engine_type\": \"<string>\",\n \"similarity_boost\": 0.5,\n \"stability\": 0.5,\n \"style\": 0.5,\n \"use_speaker_boost\": true\n }\n },\n \"motion_prompt\": \"<string>\",\n \"engine\": {\n \"type\": \"<string>\",\n \"reference_look_id\": \"<string>\"\n }\n }\n ],\n \"title\": \"<string>\",\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heygen.com/v3/videos/batches")
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 \"videos\": [\n {\n \"type\": \"<string>\",\n \"avatar_id\": \"<string>\",\n \"title\": \"<string>\",\n \"aspect_ratio\": \"16:9\",\n \"background\": {\n \"value\": \"<string>\",\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\"\n },\n \"remove_background\": true,\n \"callback_url\": \"<string>\",\n \"callback_id\": \"<string>\",\n \"watermark\": {\n \"image\": {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"scale\": 1,\n \"opacity\": 1,\n \"placement\": {\n \"position\": \"bottom_right\",\n \"offset_x\": 0,\n \"offset_y\": 0\n }\n },\n \"caption\": {\n \"file_format\": \"srt\",\n \"style\": \"default\"\n },\n \"output_format\": \"mp4\",\n \"script\": \"<string>\",\n \"voice_id\": \"<string>\",\n \"audio_url\": \"<string>\",\n \"audio_asset_id\": \"<string>\",\n \"voice_settings\": {\n \"speed\": 1,\n \"pitch\": 0,\n \"volume\": 1,\n \"locale\": \"<string>\",\n \"engine_settings\": {\n \"engine_type\": \"<string>\",\n \"similarity_boost\": 0.5,\n \"stability\": 0.5,\n \"style\": 0.5,\n \"use_speaker_boost\": true\n }\n },\n \"motion_prompt\": \"<string>\",\n \"engine\": {\n \"type\": \"<string>\",\n \"reference_look_id\": \"<string>\"\n }\n }\n ],\n \"title\": \"<string>\",\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"batch_id": "<string>"
}
}{
"error": {
"code": "invalid_parameter",
"message": "Invalid payload(s) at index 3.",
"param": "videos",
"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": "request_in_progress",
"message": "A request with this Idempotency-Key is already in progress. Retry shortly.",
"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
}
}
