Skip to main content

Overview

A template is a video layout you build once in HeyGen Studio, with named slots for text, media, avatars, and voices. Use the API to find your templates, read what each one exposes, and generate videos from them:
Create templates in the HeyGen web editor (HeyGen Studio), or over the API with Create Studio Template via API. The detail endpoint supports templates built in the current editor format (draft version 4).

List Templates

  • Endpoint: GET /v3/templates
  • Purpose: Return a paginated list of API-ready templates in the workspace.
Response

Query Parameters

Get a Template

  • Endpoint: GET /v3/templates/{template_id}
  • Purpose: Return template details including its variable schema (with current default values) and scene list.
Response
The variables object is keyed by variable name, and each value is returned in the same shape a generate request accepts — so you can take this response, replace the default values with your own, and submit it back to render a video. The content, asset, and other fields hold the template’s current defaults; a text variable may come back empty when the template leaves it unfilled.

Variable Types

Every variable has a type discriminator that determines the rest of its fields:

text

image

video

audio

voice

character

Deprecated aliases, still accepted on input and returned alongside avatar_id until a published sunset: avatar_look_id and character_id (same value as avatar_id), and character_type (ignored on input; returned as the kind recorded on the template). Send avatar_id.

Asset input

image, video, and audio variables take an asset object, discriminated by type. Provide one of:

Scenes

scenes lists the template’s scenes in order. Each has a scene_id (usable to restrict a render to a subset of scenes), the script text with variable placeholders left unreplaced, and the variables referenced in that scene. Each scene renders up to 30 minutes. A script or audio value that would drive a scene past that needs splitting across scenes in Studio — see Usage Limits.

Generate a Video

  • Endpoint: POST /v3/templates/{template_id}
  • Purpose: Render a video from the template, replacing its variables with the values you supply.

Quick Example

Response
Generation is asynchronous. Poll GET /v3/videos/{video_id} until status is completed, then read the download URL.

Request Body

Subtitle settings

When you pass subtitles, preset_name is required; the rest override the preset.

From template to video

The typical flow is three steps:
  1. Discover — GET /v3/templates to find the template and its id.
  2. Inspect — GET /v3/templates/{template_id} to read the variable schema and defaults.
  3. Fill and generate — replace the defaults in the variables object with your own values and POST them to POST /v3/templates/{template_id}, then poll GET /v3/videos/{video_id} for the result.