---
updatedAt: 2026-09-14T15:53:34.000Z
---

Fetch the complete documentation index at: https://docs.synthesia.io/llms.txt. Use this file to discover all available pages before exploring further. Append .md to any documentation page URL to get its markdown version.

# Guide: Create a video from a template

Automatically produce personalized, professional-looking video content with API templates.

This guide walks through calling Synthesia's API to generate a video from a template with variables. For how to build a template and add each type of variable (script, canvas text, media, or avatar), see [Add variables for programmatic video creation](https://docs.synthesia.io/docs/synthesia-templates#add-variables-for-programmatic-video-creation).

<HTMLBlock>{`
<div style="position: relative; overflow: hidden; aspect-ratio: 1920/1080"><iframe src="https://share.synthesia.io/embeds/videos/bc8e968a-c66e-4d0e-82dc-5fc283dddbdb" loading="lazy" title="Synthesia video player - API template guide video" allow="encrypted-media; fullscreen;" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; border: none; padding: 0; margin: 0; overflow:hidden;"></iframe></div>
`}</HTMLBlock>

## Create a video from a template

**To create a video from a template with Synthesia's API:**

1. Build your template in Synthesia, [adding variables](https://docs.synthesia.io/docs/synthesia-templates#add-variables-for-programmatic-video-creation) for whatever should change between videos.
2. Publish the video as a template, then copy its template ID from your template library.
3. Call the [Create a video from a template endpoint](https://docs.synthesia.io/reference/create-a-video-from-a-template) with:
   * `templateId`: The ID from step 2.
   * `templateData`: An object of key-value pairs, where each key is a variable name and each value is what to replace it with.
4. Optionally, personalize the video's `title` and `description` parameters too.
5. Once Synthesia receives your request, the video is processed and available shortly after.

<Callout icon="⚠️" theme="warn">
  ### Important:

  Variable names are case-sensitive. The casing you use as a key in `templateData` must exactly match the casing you used when naming the variable in your template.
</Callout>

## Supplying values for media variables

For image and video variables, supply a value one of two ways:

* A URL—Synthesia fetches and uses the asset.
* An asset ID, after [uploading the asset](https://docs.synthesia.io/reference/create-an-asset) yourself.

Match the aspect ratio of the replacement image or video to what it's replacing, to avoid unexpected stretching or cropping—see [Add variables for programmatic video creation](https://docs.synthesia.io/docs/synthesia-templates#add-variables-for-programmatic-video-creation) for the specifics per variable type.

## Supplying values for avatar variables

For an avatar variable, supply the target avatar's ID as the value.

**To find an avatar's ID:**

1. Go to the [Avatars](https://docs.synthesia.io/docs/synthesia-avatars) page.
2. Select the three-dot menu in the top-right corner of the avatar you want.
3. Select `Copy ID`.

<Callout icon="📌" theme="default">
  ### Note:

  EXPRESS-2 avatars can't be used with Synthesia's API.
</Callout>

## Special characters in text variable values

By default, special characters in a text variable's value are HTML-escaped when you pass them in your request. For example, `This & that` becomes `This &amp; that`.

To avoid this, pass the escaped entity yourself instead of the raw character. For example:

`templateData: {my_text_variable: 'This &amp; that'}`

See [this list of HTML entities](https://htmlandcssbook.com/extras/html-escape-codes/) for other special characters you might need to escape.

# Sibling pages

* [Guide: Zapier integration](https://docs.synthesia.io/reference/guide-synthesia-zapier.md)
* [Guide: Dub your videos via Synthesia API](https://docs.synthesia.io/reference/upload-large-files-via-temporary-aws-credentials.md)
* [List of supported voices](https://docs.synthesia.io/reference/voices.md)
* [Webhook events](https://docs.synthesia.io/reference/webhook-events.md)
* [Verifying Synthesia Signatures](https://docs.synthesia.io/reference/verifying-synthesia-signatures.md)
* [Script supported XML tags](https://docs.synthesia.io/reference/script-supported-xml-tags.md)

# What's next

* [How do I add a variable to a video? - Synthesia Knowledge Base](https://help.synthesia.io/en/articles/6823627-how-do-i-add-a-variable-to-a-video)