# Retrieve Template Details

Retrieves the details of a template created under your account by its ID, including all variables available for replacement.

<Callout icon="📘" theme="info">
  Note

  * This API only supports retrieving variables from the **Legacy AI Studio**, and will be **deprecated soon**.
  * Scroll down to the **Response** section below and expand the status code(s) to view the detailed response schema.
  * Refer to the **RESPONSE** section on the right and choose an example to see how the API response appears for each status code.
</Callout>

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "heygen-api",
    "version": "4.0.8"
  },
  "servers": [
    {
      "url": "https://api.heygen.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header",
        "x-default": "<your-api-key>"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v2/template/{template_id}": {
      "get": {
        "summary": "Retrieve Template Details",
        "description": "This API now supports New AI Studio!",
        "operationId": "get-template-v2",
        "parameters": [
          {
            "name": "template_id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Unique identifier of the template. Can be retrieved from the <a href=\"https://docs.heygen.com/reference/list-templates-v2\" target=\"_blank\">List Templates</a> endpoint."
          }
        ],
        "responses": {
          "200": {
            "description": "Template details retrieved successfully - Expand to view the detailed response schema.",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": {
                      "error": null,
                      "data": {
                        "variables": {
                          "firstName": {
                            "name": "firstName",
                            "type": "text",
                            "properties": {
                              "content": ""
                            }
                          },
                          "image": {
                            "name": "image",
                            "type": "image",
                            "properties": {
                              "url": "https://example.com/sample-image.png",
                              "asset_id": null,
                              "fit": "cover"
                            }
                          },
                          "video": {
                            "name": "video",
                            "type": "video",
                            "properties": {
                              "url": "https://example.com/sample-video.mp4",
                              "asset_id": null,
                              "play_style": "loop",
                              "fit": "none",
                              "volume": 1
                            }
                          },
                          "avatar": {
                            "name": "avatar",
                            "type": "character",
                            "properties": {
                              "character_id": "Annie_expressive12_public",
                              "type": "avatar"
                            }
                          },
                          "introduction_audio": {
                            "name": "introduction_audio",
                            "type": "voice",
                            "properties": {
                              "voice_id": "330290724a1b470fb63153f34d4c0183",
                              "locale": null
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Displays error message when the request fails; null if the request is successful."
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "variables": {
                          "type": "object",
                          "description": "A collection of dynamic elements defined in the template.",
                          "properties": {
                            "name": {
                              "type": "object",
                              "description": "Individual variable in the template. ",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "description": "Name of the variable as defined in the template. "
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Type of variable (e.g., `text`, `image`, `video`, `character`, `voice`). "
                                },
                                "properties": {
                                  "type": "object",
                                  "description": "Configuration details for the variable, depending on its type. <br><p><strong>Note:</strong><br> The <code>properties</code> object returned for each variable depends on its type. The following fields are returned for each variable type:</p>  <ul>   <li><strong>Text Variables:</strong> Only the <code>content</code> field is returned.</li>   <li><strong>Image Variables:</strong> Fields such as <code>url</code>, <code>asset_id</code>, and <code>fit</code> are returned.</li>   <li><strong>Video Variables:</strong> Fields such as <code>url</code>, <code>asset_id</code>, <code>play_style</code>, <code>fit</code>, and <code>volume</code> are returned.</li>   <li><strong>Character Variables:</strong> Fields such as <code>character_id</code> and <code>type</code> are returned.</li>   <li><strong>Voice Variables:</strong> Fields such as <code>voice_id</code> and <code>locale</code> are returned.</li> </ul>",
                                  "properties": {
                                    "content": {
                                      "type": "string",
                                      "description": "The text content assigned to the variable."
                                    },
                                    "url": {
                                      "type": "string",
                                      "description": "URL to the image/audio/video resource. "
                                    },
                                    "asset_id": {
                                      "type": "string",
                                      "description": "Unique identifier of the uploaded image/audio/video. "
                                    },
                                    "play_style": {
                                      "type": "string",
                                      "description": "Playback mode (e.g., `loop`, `freeze`, `once`, `fit_to_scene`)"
                                    },
                                    "fit": {
                                      "type": "string",
                                      "description": "How the background video fits to the screen (e.g., `crop`, `contain`, `none`, `cover`). "
                                    },
                                    "volume": {
                                      "type": "string",
                                      "description": "Playback volume level. "
                                    },
                                    "voice_id": {
                                      "type": "string",
                                      "description": "Unique identifier of the voice."
                                    },
                                    "locale": {
                                      "type": "string",
                                      "description": "Voice accents/locales for multilingual voices (e.g., en-US, en-IN, pt-PT, pt-BR). "
                                    },
                                    "character_id": {
                                      "type": "string",
                                      "description": "Unique identifier of the character."
                                    },
                                    "type": {
                                      "type": "string",
                                      "description": "Type of variable. Returned for the `character` type. "
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      },
                      "description": "Contains detailed information about the template, including its variables and their configurations."
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```