Quick Start
Welcome to HeyGen API!
HeyGen API expands what you can do with HeyGen.
You can integrate HeyGen API with your product programmatically or generate a video with just a few codes.
Prerequisite: Create a HeyGen account
Create a HeyGen account
After you create a HeyGen account, you are able to make professional avatar videos by leveraging HeyGen's powerful AI capabilities.
Create an API key
After you have registered the HeyGen account, proceed to the account settings and scroll down to the API Keys section and activate your API key.
HeyGen API is only available for paying customers, please subscribe to a pro plan to use HeyGen API. Or activate a trial token for testing on your account page. See below about how to activate your trial token:
(Optional) Add webhook to listen to events from HeyGen
You can configure your webhook endpoint under your account page
You can also configure it with our webhook APIs.
Create your first video
See detailed API reference
We will create the first video in βtestβ mode. Test videos are free and not counted toward your quota. Video created in test mode will be watermarked.
curl -X POST 'https://api.heygen.com/v1/video.generate' \
-H 'X-Api-Key: <your-api-key>' \
-H 'Content-Type: application/json' \
-d '{
"background": "#ffffff",
"clips": [
{
"avatar_id": "Daisy-inskirt-20220818",
"avatar_style": "normal",
"input_text": "Welcome to HeyGen API",
"offset": {
"x": 0,
"y": 0
},
"scale": 1,
"voice_id": "1bd001e7e50f421d891986aad5158bc8"
}
],
"ratio": "16:9",
"test": true,
"version": "v1alpha"
}'
We will send you a response where you can find an ID of the newly created video. You can also use the input_audio attribute to pass a public audio URL instead of using the input_text attribute.
Create videos from templates: you can create videos from templates as well. Check here to see how.
Wait for the video
See detailed API reference
After you create your video, you can retrieve its status. When the video is ready, the status becomes completed.
curl -X GET 'https://api.heygen.com/v1/video_status.get?video_id={VIDEO_ID}' \
-H 'X-Api-Key: <your-api-key>'
Download the video
Once your video is ready, you can find a link in the response for you to download the video.
curl ${DOWNLOAD_URL} --output first_video.mp4
Explore HeyGen APIs
Please check our detailed API reference here
Updated 24 days ago