n8n

How to Automate HeyGen Video Creation?

Create on demand AI videos from simple text and receive a ready to share link when rendering finishes. Great for marketing and sales teams that need quick spokesperson clips for product updates, ads, and outreach without editing software.

The run starts manually. A config step stores the avatar id, voice id, and the script. An HTTP request sends these details to the video generate endpoint. The flow waits ten seconds, then checks the status with the video id. A decision step looks for a completed state. If the video is still processing, the loop waits and checks again. When done, the final step outputs the video_url so you can copy it or pass it to another system.

You need a HeyGen account, API credits, and an API key. Add an HTTP Header credential in n8n named X Api Key and apply it to both HTTP nodes. Paste your avatar and voice ids plus the script in the config node. Expect production time to drop from hours to minutes and scale the number of videos you can ship each week. Adjust the wait time if your queue is busy or if you hit rate limits.

What are the key features?

  • Manual start for controlled test runs and demos
  • Config step stores avatar_id, voice_id, and text in one place
  • HTTP POST creates a new video using the HeyGen API
  • Wait node pauses for 10 seconds to avoid tight polling
  • HTTP GET checks video status using the returned video_id
  • If node loops until the status is completed
  • Final Set step outputs data.video_url for easy sharing
  • Single API key header credential reused across both calls

What are the benefits?

  • Reduce manual production from 2 hours to 5 minutes per video
  • Automate 90% of status checks with a safe polling loop
  • Handle up to 10 times more video requests without extra staff
  • Improve handoff accuracy by extracting the exact video_url
  • Run everything in n8n to avoid switching between tools

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with HeyGen. See the Tools Required section above for links to create accounts with these services.
  3. In your HeyGen account, create an API key and make sure you have API credits available.
  4. In the n8n credentials manager, create an HTTP Header credential. Set the header name to X-Api-Key and the value to your HeyGen API key. Give the credential a clear name.
  5. Open the Create Video HTTP node and select your HeyGen header credential. Open the Get Video Status HTTP node and select the same credential so both calls use the same key.
  6. Open the Config Set node and fill avatar_id, voice_id, and text. Use valid IDs from your HeyGen dashboard and a short script for the first test.
  7. Optionally adjust the Wait node amount to 10 to 30 seconds. Longer waits reduce API calls if your videos take more time to render.
  8. Click Execute workflow and start a test run. In the Create Video output, confirm that data.video_id appears.
  9. Let the loop run. When the If node detects completed, check the Output step for data.video_url. Open the link to confirm the video plays.
  10. Troubleshooting: If you get unauthorized, check the X Api Key header and key value. If status never completes, increase the wait time. If avatar or voice IDs are invalid, replace them with valid IDs from HeyGen. Make sure both HTTP nodes use the same HeyGen credential.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

HeyGen

Sign up

Free: $0 / mo, 10 API credits / mo; watermark included

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.