Templates enable you to add and customize existing text, images, videos, and elements, while avatar videos consist only of avatars without these elements. If you plan to use it within a workflow and need richer content, templates are likely a better fit for your use case compared to simple talking avatar videos. 🌟
**Quick Comparison:**
- **Avatar Videos:** Avatar videos are centered around avatars delivering content without any additional elements. They are ideal for straightforward, avatar-focused communication.
- **Template Videos:** In contrast, template videos offer a wide canvas for creativity. They enable you to customize existing text, images, videos, and elements seamlessly. If you need a richer, more versatile content format for your workflow, templates are the perfect choice. They empower you to create captivating, multifaceted content that stands out.
> _Template V2 API supports Instant Avatars in Template._
# Quick Start
Let's get started quickly to see how to create a template, add placeholders, and create a new video by dynamically changing these placeholders using the Template API.
## Creating Template through the Interface
To create templates, visit HeyGen [Template](https://app.heygen.com/templates) page and click on [Create Template](https://app.heygen.com/template/edit/draft). You can place a placeholder in your template by using curly brackets `{}`.

As shown, we've placed a `{{name}}` placeholder within our _scene_ and _script_. In this tutorial, we'll set a value for this placeholder using the Template API and create a new video.
## Get List of Your Templates
[See detailed API reference](ref:list-templates-v2)
Using the following API request you will get a list of your templates that you have created in the HeyGen interface, obtain your `template_id` from here.
```bash Request
curl --location 'https://api.heygen.com/v2/templates' \
--header 'accept: application/json' \
--header 'x-api-key: <your-api-key>'
```
```json Response
{
"error": null,
"data": {
"templates": [
{
"template_id": "<template_id>",
"name": "<name>",
"thumbnail_image_url": "<thumbnail_image_url>"
},
...
]
}
}
```
## Retrieving Video Elements
[See detailed API reference](ref:get-templates-v2)
To retrieve video elements for a specific template, use this API request to get the _variable_ you want to change.
```bash Request
curl --location 'https://api.heygen.com/v2/template/<template_id>' \
--header 'accept: application/json' \
--header 'x-api-key: <your-api-key>'
```
```json Response
{
"error": null,
"data": {
"variables": {
"name": {
"name": "name",
"type": "text",
"properties": {
"content": ""
}
}
}
}
}
```
## Modifying Template Elements and Generating Videos
[See detailed API reference](ref:generate-from-templates-v2)
To change template elements and generate videos, you will need to submit an API request as follows. In the request body, _specify the elements you want to modify_ by providing the appropriate object within the _variables_ section.
```bash Request
curl --location 'https://api.heygen.com/v2/template/<template_id>/generate' \
--header 'X-Api-Key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"test": true,
"caption": false,
"title": "New Video",
"variables": {
"name": {
"name": "name",
"type": "text",
"properties": {
"content": "John"
}
}
}
}'
```
```json Response
{
"error": null,
"data": {
"video_id": "<video_id>"
}
}
```
You will receive a `video_id` after your request. To check the video's status and retrieve further details, you can use the [video_status](ref:video-status) API endpoint. Here is the result:
[block:embed]
{
"html": false,
"url": "https://app.heygen.com/share/a2d74f3d68b4482190db7fcaa3fe49b7",
"title": "HeyGen | New Video",
"favicon": null,
"provider": "app.heygen.com",
"href": "https://app.heygen.com/share/a2d74f3d68b4482190db7fcaa3fe49b7",
"iframe": true
}
[/block]
Explore the guides below for detailed information on how to _modify_ and _customize_ template content:
* ✏️ Replace Text and Script in Template (Here)
* 🖼️ [Replace Image in Template](guide:replace-image-in-template)
* 🎥 [Replace Video in Template](guide:replace-video-in-template)
* 🔳 [Fit Property in Template](guide:fit-property-in-template)
* 🔄 [Video Playback Styles in Template](guide:video-playback-styles-in-template)
> Please note that we currently do not support changing Avatars in Template V2 API.
# Conclusion
In summary, **HeyGen's Template API** empowers users to effortlessly generate customized videos from templates. The process begins with creating a template through the web interface. Users can then use this template to generate tailored videos, replacing variables as needed. This approach provides a versatile tool for video creation and personalization. So, whether your goal is to _captivate your audience_ or _communicate your message more effectively_, templates offer the versatility you need to succeed.