Discussions
[API Error] 400 "variables is invalid" for Template ID ea934e5fc17249ac954bd22b83f6788e
Hello everyone,
I'm on the HeyGen Pro plan and trying to generate a video via the API. My template ID is ea934e5fc17249ac954bd22b83f6788e.
Whenever I send a POST request to:
POST https://api.heygen.com/v2/template/ea934e5fc17249ac954bd22b83f6788e/generate
I get a 400 Bad Request with:
{"data":null,"error":{"code":"invalid_parameter","message":"variables is invalid: field required"}}
Here’s my JSON body:
{
"caption": false,
"callback_id": "myCallback",
"title": "Test Video",
"dimension": {
"width": 1280,
"height": 720
},
"include_gif": false,
"enable_sharing": false,
"template": {
"template_id": "ea934e5fc17249ac954bd22b83f6788e",
"variables": {
"text_layers": {
"Categorytext": {
"name": "Categorytext",
"type": "text",
"properties": {
"text": "Sample Category"
}
},
"Headlinetext": {
"name": "Headlinetext",
"type": "text",
"properties": {
"text": "Sample Headline"
}
},
"Subtitletext": {
"name": "Subtitletext",
"type": "text",
"properties": {
"text": "Sample Subtitle"
}
}
},
"image_layers": {
"Image_1st": {
"name": "Image_1st",
"type": "image",
"properties": {
"url": "https://example.com/image1.jpg"
}
},
"Image_2nd": {
"name": "Image_2nd",
"type": "image",
"properties": {
"url": "https://example.com/image2.jpg"
}
},
"Image_3rd": {
"name": "Image_3rd",
"type": "image",
"properties": {
"url": "https://example.com/image3.jpg"
}
}
}
}
}
}
I've confirmed the placeholders match exactly what's in the template and removed any unused ones (like Script or audio layers). I also sanitized text to remove special characters, but I still receive the same error.
Is there possibly a hidden placeholder or a required layer I'm missing? Any advice is greatly appreciated.
Additional Info:
Plan: Pro
Template ID: ea934e5fc17249ac954bd22b83f6788e
n8n version: 1.66.0 (if relevant)
Thank you in advance!