Using Audio Source as Voice

To use audio source as voice, first you need to set your voice type as audio and then provide either an audio_url or an audio_asset_id in the "Voice Settings".

  • Use an Existing Audio Asset from HeyGen: You can select an audio asset directly from HeyGen's library to integrate into your video.
  • Provide a Custom Audio URL: If you have a specific audio source you'd like to use, you can provide a custom audio URL.

Create Your Video

Now that your voice settings are in place, proceed with creating your video. Make sure to provide either an audio_url or an audio_asset_id.

curl -X POST https://api.heygen.com/v2/video/generate \
-H 'X-Api-Key: <your-api-key>' \
-H 'Content-Type: application/json' \
-d '{
  "video_inputs": [
    {
      "character": {
        "type": "avatar",
        "avatar_id": "Monica_inSleeveless _20220819",
        "avatar_style": "normal"
      },
      "voice": {
        "type": "audio",
        "audio_asset_id": "<asset_id>"
      },
      "background": {
        "type": "color",
        "value": "#008000"
      }
    }
  ],
  "test": true,
  "aspect_ratio": "16:9"
}'
{
  "code": 100,
  "data": {
    "video_id": "<video_id>"
  },
  "message": "Success"
}