Templates
Update Template
Renames a template. Other properties are edited in the HeyGen editor or through PUT /v3/templates//variables. Returns the template detail.
PATCH
/
v3
/
templates
/
{template_id}
Update Template
curl --request PATCH \
--url https://api.heygen.com/v3/templates/{template_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Q4 outreach v2"
}
'import requests
url = "https://api.heygen.com/v3/templates/{template_id}"
payload = { "name": "Q4 outreach v2" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Q4 outreach v2'})
};
fetch('https://api.heygen.com/v3/templates/{template_id}', 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/templates/{template_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Q4 outreach v2'
]),
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/templates/{template_id}"
payload := strings.NewReader("{\n \"name\": \"Q4 outreach v2\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.heygen.com/v3/templates/{template_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q4 outreach v2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heygen.com/v3/templates/{template_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Q4 outreach v2\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "77e650952c024c6188a35e23e7088617",
"name": "Quarterly Update",
"thumbnail_url": "<string>",
"aspect_ratio": "16:9",
"created_at": 1711929600,
"updated_at": 1711929600,
"variables": {},
"source_video_id": "<string>",
"scene_ids": [
"<string>"
],
"scenes": [
{
"scene_id": "<string>",
"script": "<string>",
"variables": [
{
"name": "<string>",
"variable_type": "<string>"
}
]
}
],
"elements": [
{
"element_id": "<string>",
"element_type": "avatar",
"scene_id": "<string>",
"bindable_as": [
"text"
],
"current": {
"avatar_look_id": "<string>",
"character_type": "avatar",
"voice_id": "<string>",
"text": "<string>",
"url": "<string>",
"play_style": "<string>",
"volume": 123
},
"variable": "<string>",
"text_variables": [
"<string>"
]
}
]
}
}{
"error": {
"code": "invalid_parameter",
"message": "Video not found",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "unknown_node_type",
"message": "Unknown node type",
"node_id": "<string>",
"port": "<string>",
"path": "<string>"
}
]
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired API key. Verify your x-api-key header.",
"param": null,
"doc_url": null
}
}{
"error": {
"code": "resource_access_denied",
"message": "Template creation is restricted by your workspace settings. Ask a workspace admin to allow it.",
"param": null,
"doc_url": null
}
}{
"error": {
"code": "template_not_found",
"message": "Template not found.",
"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
ApiKeyAuthBearerAuth
HeyGen API key. Obtain from your HeyGen dashboard.
Path Parameters
Unique template identifier
Body
application/json
Request body for PATCH /v3/templates/{template_id}.
New template name
Required string length:
1 - 255Example:
"Q4 outreach v2"
Response
Successful response
Template detail including its variable schema, scenes, and bindable elements.
Show child attributes
Show child attributes
⌘I
Update Template
curl --request PATCH \
--url https://api.heygen.com/v3/templates/{template_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Q4 outreach v2"
}
'import requests
url = "https://api.heygen.com/v3/templates/{template_id}"
payload = { "name": "Q4 outreach v2" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Q4 outreach v2'})
};
fetch('https://api.heygen.com/v3/templates/{template_id}', 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/templates/{template_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Q4 outreach v2'
]),
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/templates/{template_id}"
payload := strings.NewReader("{\n \"name\": \"Q4 outreach v2\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.heygen.com/v3/templates/{template_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Q4 outreach v2\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heygen.com/v3/templates/{template_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Q4 outreach v2\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "77e650952c024c6188a35e23e7088617",
"name": "Quarterly Update",
"thumbnail_url": "<string>",
"aspect_ratio": "16:9",
"created_at": 1711929600,
"updated_at": 1711929600,
"variables": {},
"source_video_id": "<string>",
"scene_ids": [
"<string>"
],
"scenes": [
{
"scene_id": "<string>",
"script": "<string>",
"variables": [
{
"name": "<string>",
"variable_type": "<string>"
}
]
}
],
"elements": [
{
"element_id": "<string>",
"element_type": "avatar",
"scene_id": "<string>",
"bindable_as": [
"text"
],
"current": {
"avatar_look_id": "<string>",
"character_type": "avatar",
"voice_id": "<string>",
"text": "<string>",
"url": "<string>",
"play_style": "<string>",
"volume": 123
},
"variable": "<string>",
"text_variables": [
"<string>"
]
}
]
}
}{
"error": {
"code": "invalid_parameter",
"message": "Video not found",
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"code": "unknown_node_type",
"message": "Unknown node type",
"node_id": "<string>",
"port": "<string>",
"path": "<string>"
}
]
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired API key. Verify your x-api-key header.",
"param": null,
"doc_url": null
}
}{
"error": {
"code": "resource_access_denied",
"message": "Template creation is restricted by your workspace settings. Ask a workspace admin to allow it.",
"param": null,
"doc_url": null
}
}{
"error": {
"code": "template_not_found",
"message": "Template not found.",
"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
}
}
