> ## Documentation Index
> Fetch the complete documentation index at: https://heygen-1fa696a7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Generate your first AI video with the HeyGen API in minutes: authenticate, send one request, and get back an MP4.

<video autoPlay loop muted playsInline className="w-full rounded-xl" poster="/images/quick-start/hero.jpg">
  <source src="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/hero.mp4?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=22664d9ae369c78f2a242bf546d10790" type="video/mp4" data-path="images/quick-start/hero.mp4" />
</video>

## What you can build

<CardGroup cols={3}>
  <Card title="Create Your Avatar" img="https://mintcdn.com/heygen-1fa696a7/jtNbKrZVjrhdYiy4/images/quick-start/create-avatar.jpg?fit=max&auto=format&n=jtNbKrZVjrhdYiy4&q=85&s=04ef12a2ecf3d886ed97f3b19c772139" href="/docs/create-avatar" width="800" height="450" data-path="images/quick-start/create-avatar.jpg">
    A digital twin from video, or an avatar from one photo.
  </Card>

  <Card title="Video Agent" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/video-agent.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=1c6533d789264c8bbe6249f9b05f84d4" href="/docs/video-agent" width="800" height="450" data-path="images/quick-start/video-agent.jpg">
    Prompt to finished video. Edit single scenes after.
  </Card>

  <Card title="HeyGen Video" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/heygen-video.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=920f8647f56bfb7686a5d648ab886daa" href="/docs/models/heygen-video" width="800" height="450" data-path="images/quick-start/heygen-video.jpg">
    Text, image, or reference to a 5–15s clip, up to 2K. **New.**
  </Card>

  <Card title="Avatar Video" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/avatar-video.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=4feb65d73fa23b088b4773d80da2c8ec" href="/generate-avatar-video" width="800" height="450" data-path="images/quick-start/avatar-video.jpg">
    Your avatar, voice, and script, up to Avatar V.
  </Card>

  <Card title="HeyGen Image" img="https://mintcdn.com/heygen-1fa696a7/hfMXXwJzjE7vBSYZ/images/theme/research-3.webp?fit=max&auto=format&n=hfMXXwJzjE7vBSYZ&q=85&s=c8191ba4743fd85050f1af1a93ed4969" href="/docs/models/heygen-image" width="1400" height="788" data-path="images/theme/research-3.webp">
    Your identity, a new look. Portraits from reference photos.
  </Card>

  <Card title="Templates" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/templates.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=5c24152a02f8b08bec7deaac9c377cef" href="/create-template" width="800" height="450" data-path="images/quick-start/templates.jpg">
    Turn any video into a template, then one call per viewer. **New.**
  </Card>

  <Card title="Look Packs" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/look-packs.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=4199a7b749e5117f92f79df3c1b1f827" href="/docs/avatar-look-packs" width="800" height="450" data-path="images/quick-start/look-packs.jpg">
    Dress an avatar in a curated set of looks.
  </Card>

  <Card title="HyperFrames" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/hyperframes.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=d5d4de5ea475b6c64cc429bf671c3e9b" href="/hyperframes" width="800" height="450" data-path="images/quick-start/hyperframes.jpg">
    HTML, CSS, and JS to motion-graphics video.
  </Card>

  <Card title="Instant Voice Clone" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/voice-clone.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=436e475922685090440b943e89966f0b" href="/docs/voices/heygen-voice-instant-clone" width="800" height="450" data-path="images/quick-start/voice-clone.jpg">
    One recording to a HeyGen Voice in seconds. **New.**
  </Card>

  <Card title="Professional Voice Clone" img="https://mintcdn.com/heygen-1fa696a7/LWlugdhQHNDrLynI/images/quick-start/professional-voice-clone.jpg?fit=max&auto=format&n=LWlugdhQHNDrLynI&q=85&s=6b30fe2c60437a2ff01d7f28573dad43" href="/docs/voices/professional-voice-clone" width="800" height="450" data-path="images/quick-start/professional-voice-clone.jpg">
    Studio-grade voice trained on 20+ minutes of audio.
  </Card>

  <Card title="Text to Speech" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/text-to-speech.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=69e12e34951a4049f543cd6d55108e56" href="/docs/voices/heygen-voice-speech" width="800" height="450" data-path="images/quick-start/text-to-speech.jpg">
    Completed or streaming speech from your HeyGen Voice. **New.**
  </Card>

  <Card title="Video Translation" img="https://mintcdn.com/heygen-1fa696a7/rL-bxk8oSp0H1JWc/images/quick-start/video-translation.jpg?fit=max&auto=format&n=rL-bxk8oSp0H1JWc&q=85&s=669b8e0d518c93c27d5523f6e1547c7c" href="/docs/video-translate" width="800" height="450" data-path="images/quick-start/video-translation.jpg">
    175+ languages with voice cloning and lip-sync.
  </Card>
</CardGroup>

## Start with your agent

Paste this into [Claude Code](https://claude.com/claude-code), [Codex](https://openai.com/codex/), or Cursor. It reads the whole API, sets up your key, and makes your first video with you.

```text Prompt for your agent wrap theme={null}
I want to build with the HeyGen API. Run the commands for me where you can, explain each step in one plain sentence, and when I have to do something myself tell me exactly what and wait for me.

Read these first and follow them exactly:
- https://developers.heygen.com/llms.txt (index of every guide and endpoint)
- https://developers.heygen.com/docs/for-ai-agents.md (rules for agents)

Then:
1. API key. Look for HEYGEN_API_KEY in my environment. If it is missing, send me to https://platform.heygen.com/api-keys to create one and have me export it in my terminal myself. Never ask me to paste the key into this chat. Confirm it works with GET /v3/users/me.
2. Ask me what I want to make, and pick the right endpoint from the docs (Video Agent, HeyGen Video, avatar video, HeyGen Image, templates, voice cloning, text to speech, or translation).
3. Make the first call, poll until it finishes, and give me the result URL.
```

## Your first video

<CardGroup cols={2}>
  <Card title="Get your API key" icon="key" href="https://platform.heygen.com/api-keys">
    Create a key in the API dashboard. Every request below needs it.
  </Card>

  <Card title="Try it in the Playground" icon="play" href="/reference/create-video">
    Fire a real request from your browser before writing any code.
  </Card>
</CardGroup>

<Info>
  **Base URL** `https://api.heygen.com` · **Auth header** `X-Api-Key: <your-key>`
</Info>

<Steps>
  <Step title="Authenticate" icon="key">
    Create a key in the [API keys page](https://platform.heygen.com/api-keys). For key rotation, see the [API Key guide](/docs/api-key).

    ```bash theme={null}
    export HEYGEN_API_KEY="your-api-key-here"
    ```
  </Step>

  <Step title="Create a video" icon="wand-magic-sparkles">
    Send a prompt to the [Video Agent](/reference/create-video-agent-session). It scripts, picks the avatar and voice, and renders.

    <Tabs>
      <Tab title="curl">
        ```bash theme={null}
        curl -X POST "https://api.heygen.com/v3/video-agents" \
          -H "X-Api-Key: $HEYGEN_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{"prompt": "A presenter explaining our product launch in 30 seconds"}'
        ```
      </Tab>

      <Tab title="Python">
        ```python theme={null}
        import requests

        resp = requests.post(
            "https://api.heygen.com/v3/video-agents",
            headers={"X-Api-Key": HEYGEN_API_KEY},
            json={"prompt": "A presenter explaining our product launch in 30 seconds"},
        )
        session_id = resp.json()["data"]["session_id"]
        ```
      </Tab>

      <Tab title="Node.js">
        ```javascript theme={null}
        const resp = await fetch("https://api.heygen.com/v3/video-agents", {
          method: "POST",
          headers: {
            "X-Api-Key": process.env.HEYGEN_API_KEY,
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            prompt: "A presenter explaining our product launch in 30 seconds",
          }),
        });
        const { session_id } = (await resp.json()).data;
        ```
      </Tab>
    </Tabs>

    ```json Response theme={null}
    { "data": { "session_id": "sess_abc123", "status": "generating", "video_id": null } }
    ```

    <Tip>
      Watch it build live at `https://app.heygen.com/video-agent/{session_id}`.
    </Tip>
  </Step>

  <Step title="Get the result" icon="circle-check">
    Poll the session for a `video_id`, then the video for its `video_url`. Or skip polling with a [webhook](/docs/webhooks) via `callback_url`.

    <Tabs>
      <Tab title="Python">
        ```python theme={null}
        import time

        # 1. Wait for the video_id to be assigned
        video_id = None
        while not video_id:
            sess = requests.get(
                f"https://api.heygen.com/v3/video-agents/{session_id}",
                headers={"X-Api-Key": HEYGEN_API_KEY},
            ).json()["data"]
            video_id = sess.get("video_id")
            if not video_id:
                time.sleep(5)

        # 2. Poll the video until it's done
        while True:
            video = requests.get(
                f"https://api.heygen.com/v3/videos/{video_id}",
                headers={"X-Api-Key": HEYGEN_API_KEY},
            ).json()["data"]
            if video["status"] in ("completed", "failed"):
                break
            time.sleep(10)

        print(video["video_url"])
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        # 1. Session → video_id
        curl "https://api.heygen.com/v3/video-agents/sess_abc123" \
          -H "X-Api-Key: $HEYGEN_API_KEY"

        # 2. video_id → video_url
        curl "https://api.heygen.com/v3/videos/vid_xyz789" \
          -H "X-Api-Key: $HEYGEN_API_KEY"
        ```
      </Tab>
    </Tabs>

    ```json Response (completed) theme={null}
    { "data": { "id": "vid_xyz789", "status": "completed", "video_url": "https://files.heygen.ai/video/vid_xyz789.mp4", "duration": 32.5 } }
    ```
  </Step>
</Steps>

## Working from an agent or terminal?

Skip the raw HTTP. Both surfaces wrap the same API.

<CardGroup cols={2}>
  <Card title="MCP Server" icon="plug" href="/mcp/overview">
    Plug HeyGen into Claude, Cursor, or any MCP-capable agent. It handles the calls for you.
  </Card>

  <Card title="CLI" icon="terminal" href="/cli">
    `heygen video create`, `heygen video download`. Scriptable from any shell or CI job.
  </Card>
</CardGroup>

## Build with your stack

<CardGroup cols={3}>
  <Card title="Webhooks" icon="bell" color="#6B7280" href="/docs/webhooks" horizontal />

  <Card title="Authentication" icon="lock" color="#6B7280" href="/docs/api-key" horizontal />

  <Card title="Usage Limits" icon="gauge" color="#6B7280" href="/docs/usage-limits" horizontal />
</CardGroup>

<Note>
  Migrating from **v1/v2**? Supported until **October 31, 2026**. See the [version comparison](/endpoint-version-comparison).
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Video status is failed" icon="circle-xmark">
    Inspect `failure_code` and `failure_message` on [`GET /v3/videos/{video_id}`](/reference/get-video). Full catalog in [Error Codes](/docs/error-codes).
  </Accordion>

  <Accordion title="401 Unauthorized" icon="key">
    Confirm the `X-Api-Key` header is set and the key is active in the [API keys page](https://platform.heygen.com/api-keys).
  </Accordion>

  <Accordion title="429 Too Many Requests" icon="gauge-high">
    Rate or concurrency limit hit. Respect `Retry-After` and back off. Enterprise plans get higher limits; see [Usage Limits](/docs/usage-limits).
  </Accordion>

  <Accordion title="400 download_failed" icon="link-slash">
    A URL you passed couldn't be fetched. It must be publicly accessible and point directly at the file.
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.