Templates

Set Template Variables

Changed on

Replaces a template's full set of variables: any variable you omit is removed. Media, character and voice variables bind to a node by element_id, listed under composition in GET /v3/templates/{template_id}. A text variable with match turns that text into a {{name}} placeholder.

put/v3/templates/{template_id}/variables

Request

  • Base URL
    https://api.heygen.com
  • URL
    https://api.heygen.com/v3/templates/{template_id}/variables
  • Auth
    • API key in header x-api-key
    • or HTTP bearer

Path parameters

template_idstring required

Unique template identifier

Request body

expected_edit_versionstring nullable

The template's edit_version from your last GET. When given, the update is rejected with 409 stale_edit_version if the template changed since. Omit to overwrite unconditionally.

variablesobject required

The complete variable set, keyed by variable name (letters, digits, underscores; must start with a letter or underscore; at most 64 characters). An empty object removes every variable.

Example request

{
  "expected_edit_version": "3",
  "variables": {
    "company": {
      "match": "Acme",
      "type": "text"
    },
    "first_name": {
      "element_ids": [
        "t81c0d4b"
      ],
      "match": "John",
      "type": "text"
    },
    "hero_image": {
      "element_id": "i77e5f60",
      "type": "image"
    },
    "narration_voice": {
      "element_id": "t81c0d4b",
      "type": "voice"
    },
    "presenter": {
      "element_id": "a3f9c2e1",
      "type": "character"
    }
  }
}

Response

Successful response

Changes