Discussions

Ask a Question
Back to all

Template - Using Audio Source as Voice

Hi HeyGen API Team,

I’ve been using your “Using Audio Source as Voice” docs (https://docs.heygen.com/docs/using-audio-source-as-voice) successfully with the /v2/video/generate endpoint to have avatars speak MP3 files instead of text TTS.

Now I want to combine that feature with your template-based videos (so I can keep the layout, overlays, and variable replacements) — i.e. use a template but override the avatar’s speech via an external audio URL or an audio_asset_id.

Is this currently supported? If yes, could you share an example JSON request (using /v2/template/{template_id}/generate) that shows how to supply the audio override for the avatar voice?

For reference:

  • Template ID: a35224bf23cc4931a28590071af218d4
  • Sample working non-template JSON for audio-as-voice:
    {
      "video_inputs": [
        {
          "character": {
            "type": "avatar",
            "avatar_id": "14221280bb51426c87e13c06bca02d7f",
            "avatar_style": "normal"
          },
          "voice": {
            "type": "audio",
            "audio_url": "http://147.182.247.230/tts/mike-2252888042-Coat.mp3"
          }
        }
      ],
      "dimension": {
        "width": 720,
        "height": 1280
      },
      "test": false
    }
    

If template override audio is not supported, could you confirm that and optionally tell me whether it’s planned or restricted?

Thanks for your help — this clarity will help me choose whether to build my own overlay service or stick with templates.

Best,
Daniel