HeyGen Hub
+00:00 GMT
Avatars
December 30, 2024 · Last updated on January 9, 2025

How to integrate HeyGen Interactive Avatars via API: a step-by-step guide

How to integrate HeyGen Interactive Avatars via API: a step-by-step guide
# API
# Interactive Avatar

How to integrate HeyGen Interactive Avatars via API

How to integrate HeyGen Interactive Avatars via API: a step-by-step guide

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: 

  1. What is HeyGen API?
  2. Setting up your API credentials
  3. Making your first API request
  4. Testing your Avatar
  5. Downloading the video
  6. Build video generation with templates
  7. 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.

some-file-ab1363a6-453c-4634-bb75-f1cf1ba9a33b


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.

some-file-b54dbe57-f9ca-4a39-a79f-ef890cb8a297


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.

some-file-7c589575-a37b-413c-bd88-9322456dc248


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.

some-file-969ffa11-05ae-4a63-8a4a-aafcc20e5f0a


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.’

some-file-a9e6548a-8cce-497c-b218-b516f38b0b32


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.

some-file-38cea273-974c-4b24-865e-4e6e0754ddd6


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.

some-file-f2fd62a4-26e2-4943-b831-c5917f5b0fee


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.

some-file-dd0c7cb3-c7ec-4ec4-8c87-48bd74d64275


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: 

  1. What is HeyGen API?
  2. Setting up your API credentials
  3. Making your first API request
  4. Testing your Avatar
  5. Downloading the video
  6. Build video generation with templates
  7. 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.


Table Of Contents
Dive in
Related
Guide
How to use Interactive Avatars in HeyGen: a comprehensive overview
Dec 13th, 2024 Views 854