How to integrate HeyGen Interactive Avatars via API: a step-by-step guide
How to integrate HeyGen Interactive Avatars via API
Welcome to HeyGen! Today, we're diving into how to integrate HeyGen Interactive Avatars via API, step-by-step.
Whether you're a developer, business owner, or tech enthusiast, this guide will empower you to connect seamlessly with HeyGen’s advanced avatar capabilities. Demo Interactive Avatars here, and then let’s dive into making one of your own!
What’s covered in this guide
In this tutorial, we’ll cover:
- What is HeyGen API?
- Setting up your API credentials
- Making your first API request
- Testing your Avatar
- Downloading the video
- Build video generation with templates
- Customizing with input audio
What is HeyGen API?
The HeyGen API is offered independently of the HeyGen App and provides powerful tools like Video Generation, Video Translation, and Interactive Avatar endpoints.
Every HeyGen App user receives Free Trial access to these features. Paid tiers – Creator, Team and Enterprise – are available for those who need expanded usage.
Create HeyGen account and grab your API credentials
To get started, create a HeyGen account if you haven’t already.
Once registered, you’ll gain access to our API and can begin leveraging HeyGen’s AI to make professional avatar videos.
In HeyGen, click your name and then ‘Space settings.’ Then, click ‘API.’ You’ll then need to copy your API credentials.
Setting up your development environment
Next, ensure your development environment is set up to handle HTTP requests.
We recommend using tools like Postman or a REST client for initial testing.
Making your first API request
Let’s make our first API call! Using your chosen tool, you’ll set up a POST request to HeyGen's avatar endpoint.
In this example, we'll focus on creating a basic interactive avatar.
In this code, replace YOUR_API_KEY with your actual key. The parameters name, voice, and interactionType are customizable. For example, choose from voice options to fit your brand’s tone or set interaction types like text-based or video-based.
Testing your Avatar
After creating your video, you can check its status.
Use the video_status.get endpoint to monitor your video’s progress. When it’s ready, the status will update to ‘completed.’
Downloading the video
Once the status is marked ‘completed,’ you’ll get a download link. Use this to retrieve your video.
Remember, the link expires in 7 days, so be sure to download promptly.
Bulk video generation with templates
If you need to create multiple videos, HeyGen’s Template endpoint lets you generate similar videos in bulk, perfect for scaling up your content creation.
Customizing with input audio
For added flexibility, replace text input with an audio file using the audio_url attribute.
This lets you bring your own voice or music to avatar videos, giving you ultimate control over the sound.
Recap
That’s it! You’ve now integrated HeyGen Interactive Avatars via API. With HeyGen, you’re equipped to create innovative, AI-powered videos programmatically. For detailed documentation and more advanced capabilities, visit our API reference. Happy video-making!
In this tutorial, you learned:
- What is HeyGen API?
- Setting up your API credentials
- Making your first API request
- Testing your Avatar
- Downloading the video
- Build video generation with templates
- Customizing with input audio
We’re looking forward to seeing what you’ll create with HeyGen!
If you’re posting your videos on social media, make sure to tag any videos you create with “at HeyGen” so we can celebrate them with you.