Replace Avatar In Template

Examples

Replace Avatar In Template

Template video:
412931bd533c47f3a1990849bca11693
https://app.heygen.com/share/412931bd533c47f3a1990849bca11693

Variables:

{
  "code": 100,
  "data": {
    "scenes": [
      {
        "variables": [
          {
            "name": "avatar_0",
            "properties": [
              {
                "default": "Kayla-inchiffon-20220818",
                "name": "id"
              },
              {
                "default": "Welcome to the new era of video creation with HeyGen! Simply type your scripts to get started!",
                "name": "text"
              },
              {
                "default": "1bd001e7e50f421d891986aad5158bc8",
                "name": "voice_id"
              }
            ],
            "type": "avatar"
          }
        ]
      }
    ],
    "template_id": "412931bd533c47f3a1990849bca11693",
    "video_id": "412931bd533c47f3a1990849bca11693"
  },
  "message": "Success"
}

template generate request:

curl --request POST \
     --url https://api.heygen.com/v1/template.generate \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-api-key: O/rgPJbuWtusgyBOfYBHytyIuL2DeGowXB7rTBwLpxY=' \
     --data '
{
     "template_id": "412931bd533c47f3a1990849bca11693",
     "title": "replace avatar",
     "variables": [
          {
               "properties": {
                    "id": "08_amelia"
               },
               "name": "avatar_0"
          }
     ],
     "test": true
}
'

Result

{
  "code": 100,
  "data": {
    "id": "6b26c2b9977a4aa1ac4a3d841a258b46",
    "status": "completed",
    "video_url": "https://surreal-product.s3.amazonaws.com/aws_pacific/avatar_tmp/90972e09ccb74379a213a7177abc4ba3/2c7928bf-66af-4166-9df0-6fa569b257b7.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAWTIFNQS3KRF4QRED%2F20221014%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20221014T033020Z&X-Amz-Expires=432000&X-Amz-SignedHeaders=host&X-Amz-Signature=5262bfe6de2e3c7a5c165af5ed63f7b60fb126c8126613b18b6cf26be9e99bcf"
  },
  "message": "Success"
}