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

The goal of this guide is to give an overview of the API templates feature. It starts by creating a video template to then render videos using it. We'll use the example of an onboarding video to welcome new employees.

Create a video from template

In order to create a video from an existing template with Synthesia API:

  1. In Synthesia start by creating a video that would be targeted to a specific employee to get the overall flow and layout.
  2. Once done, replace the targeted employee name with {{name}} variables in your script and canvas . See the template variable section to learn how to.
  3. Add a variable to a background image.
  4. Publish the video with variable as a new template.
  5. Select your template and copy the template ID from the list of templates in your library.
  6. In the Create a video from a template endpoint two parameters need to be configured:
    1. The templateId with the template ID from the step above
    2. The templateData containing an array of key:value pairs where the key is the variable name you set and the value is the string to replace the variable with.
      Text variables are provided directly. For image and video variables, there are two ways of providing values. First, you may specify a URL in which case we will attempt to fetch and use the asset on your behalf. Alternatively, you may upload the asset and then use the resulting asset ID.
  7. That's all there is to it! Once Synthesia received your request, the video is processed and available shortly after.

Template variables

The next step is to add variables to your video. A variable is a dynamic value that you inline later when you call the create a video from template endpoint.

There are two kinds of variable that can be set: Text variable and Image variable let's take a closer look at them

Text variables

To specify a text variable, your variable name should be wrapped in double curly braces - for example {{variable_name}} . Text variables can be added in two places of your video:

  • In the video script: add a text variable as a part of the script or even make the whole script a text variable.
  • In a video canvas text: personalize textual elements on canvas. Eg. "Welcome to ACME {{name}}"

For our onboarding video, let's replace the name with a variable. We'll do this in the script and canvas text.

Image variables

Image and video variables are handled differently - rather than using the curly brace syntax, the Synthesia interface allows you to specify directly which images and videos should be variables. Images variables can be applied to two video scene elements:

  • [IMG] Canvas images: personalize images on canvas. Eg. submit a different company logo based on your users' email domain.
  • [IMG/VIDEO] Background: personalize the background of a video scene with a template. You can supply both image or video URLs as backgrounds.

To specify an image or video variable, select the asset. In the context menu on the right, you have the option to add a variable. Specify a sensible variable name and you're set.


What kind of image/video resolutions should you use?

For background variables: supply images/videos in 1920x1080 resolution to fit the background perfectly.

For canvas images: make sure to supply all images with the same resolution as the one used when creating the variable on canvas (e.g. all images with 128x128 resolution). This helps you avoid unexpectedly stretched images.