For production, prefer webhooks over polling. Register your endpoint with POST /v3/webhooks/endpoints, subscribe to avatar_video.success and avatar_video.fail, then pass callback_url plus a unique callback_id on every video creation. Match incoming events by callback_id. Keep a polling fallback for local dev where your endpoint is not publicly reachable, or as a safety net if a webhook never arrives.

Context: Official docs (HeyGen cinematic avatar and prompt-to-video): documents that instead of polling you can pass a callback_url in the creation request, and HeyGen will POST to it when the video completes or fails. You register an endpoint via POST /v3/webhooks/endpoints and subscribe to avatar_video.success and avatar_video.fail. The callback_id you pass is echoed back in the webhook payload so you can correlate notifications with your requests. Agents that poll aggressively burn rate budget for no reason.