> ## 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.

# Create HeyGen Video

> Generates a scene with its sound from a prompt using HeyGen Video (`heygen-video-1`). Set `mode` to `text_to_video`, `image_to_video` or `reference_to_video`; reference-to-video takes up to fifteen references in total, and reference videos must be between 1:4 and 4:1. Returns 202 with a `video_id`; poll GET /v3/models/videos/{video_id}. Send an Idempotency-Key to retry safely; without one, each submission creates a new generation. To have an avatar speak a script, use POST /v3/videos.



## OpenAPI

````yaml /openapi/external-api.json post /v3/models/videos
openapi: 3.1.0
info:
  title: HeyGen External API
  version: 1.0.0
  description: >-
    HeyGen's external API for programmatic AI video creation. See
    https://docs.heygen.com for full documentation.
  contact:
    name: HeyGen Product Infra
    url: https://heygen.com
servers:
  - url: https://api.heygen.com
    description: Production
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Video
    description: >-
      Create videos from a prompt or an avatar, then list, fetch, deliver and
      delete them
  - name: Avatar
    description: >-
      Create avatars and looks, record consent, and generate with the Avatar 6
      model
  - name: Voice
    description: Text to speech, speech to speech, and voice cloning
  - name: Audio
    description: Music, sound effects, transcription, stem separation and audio analysis
  - name: Image
    description: Generate images
  - name: Video editing
    description: >-
      Translate, lipsync, clip, analyze and remove filler words or backgrounds
      from existing videos
  - name: Video Agent
    description: Create videos from a prompt with an agent that plans, writes and edits
  - name: Templates
    description: Generate videos from reusable templates by replacing their variables
  - name: HyperFrames
    description: Render HyperFrames compositions into video
  - name: Brand
    description: >-
      Brand kits (colors, fonts, logos) and brand glossaries (term translations
      and pronunciations)
  - name: Assets and folders
    description: Upload files and organize them in folders
  - name: Batches
    description: Submit and track videos, translations, lipsyncs and uploads in bulk
  - name: Webhooks
    description: Manage webhook endpoints and events
  - name: Feedback
    description: Tell HeyGen how a generated result turned out
  - name: Account and usage
    description: Your account, the current API key, request logs and usage
paths:
  /v3/models/videos:
    post:
      tags:
        - Video
      summary: Create HeyGen Video
      description: >-
        Generates a scene with its sound from a prompt using HeyGen Video
        (`heygen-video-1`). Set `mode` to `text_to_video`, `image_to_video` or
        `reference_to_video`; reference-to-video takes up to fifteen references
        in total, and reference videos must be between 1:4 and 4:1. Returns 202
        with a `video_id`; poll GET /v3/models/videos/{video_id}. Send an
        Idempotency-Key to retry safely; without one, each submission creates a
        new generation. To have an avatar speak a script, use POST /v3/videos.
      operationId: createModelVideo
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateModelVideoRequest'
      responses:
        '202':
          description: Accepted — submission acknowledged; poll for completion.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CreateModelVideoResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              example:
                error:
                  code: invalid_parameter
                  message: >-
                    Provide at least one reference image, video, or audio
                    recording.
                  param: reference_images
                  doc_url: null
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              example:
                error:
                  code: unauthorized
                  message: Invalid or expired API key. Verify your x-api-key header.
                  param: null
                  doc_url: null
        '402':
          description: Insufficient credit
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              example:
                error:
                  code: insufficient_credit
                  message: >-
                    Insufficient credits for the video and its references. Add
                    credits or use a shorter video or fewer references.
                  param: null
                  doc_url: null
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              example:
                error:
                  code: asset_not_found
                  message: Asset not found.
                  param: null
                  doc_url: null
        '409':
          $ref: '#/components/responses/IdempotencyInProgress'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              example:
                error:
                  code: rate_limit_exceeded
                  message: >-
                    Too many requests. Retry after the duration specified in the
                    Retry-After header.
                  param: null
                  doc_url: null
          headers:
            Retry-After:
              description: Seconds to wait before retrying
              schema:
                type: integer
        '503':
          description: >-
            Temporarily unavailable — the request did not complete and is safe
            to retry.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              example:
                error:
                  code: resource_not_ready
                  message: >-
                    Asset ingestion is temporarily unavailable. Retry with the
                    same Idempotency-Key.
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Optional client-supplied key for safely retrying mutations. Subsequent
        calls within 24 hours that share this key replay the original response —
        even if the request body differs slightly (a warning is logged). A retry
        that arrives while the original is still in flight gets a 409
        `request_in_progress`. Keys must be 1–255 characters from
        `[A-Za-z0-9_:.-]`; a UUID is a safe default. Scope is per-endpoint and
        per-resource: the same key on a different route or path parameter is
        independent.
      schema:
        type: string
        pattern: ^[A-Za-z0-9_\-:.]{1,255}$
        maxLength: 255
        minLength: 1
      example: 550e8400-e29b-41d4-a716-446655440000
  schemas:
    CreateModelVideoRequest:
      description: >-
        Body of POST /v3/models/videos: one schema per generation mode, selected
        by the required mode field.
      discriminator:
        mapping:
          image_to_video: '#/components/schemas/ImageToVideoRequest'
          reference_to_video: '#/components/schemas/ReferenceToVideoRequest'
          text_to_video: '#/components/schemas/TextToVideoRequest'
        propertyName: mode
      oneOf:
        - $ref: '#/components/schemas/TextToVideoRequest'
        - $ref: '#/components/schemas/ImageToVideoRequest'
        - $ref: '#/components/schemas/ReferenceToVideoRequest'
      title: CreateModelVideoRequest
    CreateModelVideoResponse:
      properties:
        video_id:
          description: Video identifier to use when polling for the result.
          title: Video Id
          type: string
        status:
          const: pending
          default: pending
          description: The request has been accepted for processing.
          title: Status
          type: string
        input_video_duration:
          anyOf:
            - maximum: 15
              minimum: 0
              type: number
            - type: 'null'
          default: null
          description: >-
            Total reference-video duration allocated for billing, in seconds,
            with a shared 15-second budget.
          title: Input Video Duration
      required:
        - video_id
      title: CreateModelVideoResponse
      type: object
    StandardAPIError:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code
          example: invalid_parameter
        message:
          type: string
          description: Human-readable error message
          example: Video not found
        param:
          type:
            - string
            - 'null'
          description: Which request field caused the error
        doc_url:
          type:
            - string
            - 'null'
          description: Link to error documentation
        errors:
          type: array
          description: >-
            Per-item error details for batch/multi-node failures (e.g. graph
            compilation errors by node).
          items:
            $ref: '#/components/schemas/StandardAPIErrorDetail'
        request_id:
          type: string
          description: >-
            Request identifier, also returned in the X-HeyGen-Request-Id
            response header. Include it when contacting support.
          example: 8c4f0b9e1d2a4f6b9e3c7a1d5f2b8e40
      required:
        - code
        - message
    ImageToVideoRequest:
      additionalProperties: false
      properties:
        end_user_id:
          anyOf:
            - maxLength: 128
              minLength: 1
              pattern: ^\S+$
              type: string
            - type: 'null'
          default: null
          description: >-
            Stable, opaque end-user identifier in your application, scoped to
            the authenticated workspace. Use 1–128 non-whitespace characters
            without personal information. Used for usage attribution and abuse
            investigation; does not change billing, authorization, or rate
            limits.
          title: End User Id
          x-mcp-visible: false
        mode:
          const: image_to_video
          description: Animate a first-frame image.
          title: Mode
          type: string
        model:
          const: heygen-video-1
          description: Required video generation model. Only heygen-video-1 is supported.
          title: Model
          type: string
        prompt:
          description: >-
            Instructions for the video to generate. At most 16,000 Unicode
            characters.
          maxLength: 16000
          minLength: 1
          title: Prompt
          type: string
        prompt_enhancement:
          default: quality
          description: >-
            Prompt enhancement mode: turbo, quality, ultraquality, or disabled.
            Defaults to quality.
          enum:
            - turbo
            - quality
            - disabled
            - ultraquality
          title: Prompt Enhancement
          type: string
        resolution:
          default: 768p
          description: >-
            Output resolution: 480p, 768p, 1080p, or 2k. Defaults to 768p. At
            1080p and 2k, text-to-video and reference-to-video require
            aspect_ratio 16:9 or 9:16; image-to-video follows the image
            proportions.
          enum:
            - 480p
            - 768p
            - 1080p
            - 2k
          title: Resolution
          type: string
        duration:
          anyOf:
            - maximum: 30
              minimum: 5
              type: integer
            - const: auto
              type: string
          default: 5
          description: >-
            Requested video duration: whole seconds from 5 through 30, or auto.
            Defaults to 5 when omitted. Durations above 15 seconds require turbo
            or quality prompt enhancement. Auto estimates quoted speech with an
            8-second minimum and the maximum supported by these settings. Over
            MCP, auto is capped at 15 seconds; use an explicit duration for
            longer output. Generation and billing use the resolved duration.
          title: Duration
        aspect_ratio:
          anyOf:
            - enum:
                - '21:9'
                - '16:9'
                - '4:3'
                - '1:1'
                - '3:4'
                - '9:16'
                - adaptive
              type: string
            - type: 'null'
          default: null
          description: >-
            The output follows the image proportions, aligned to supported pixel
            dimensions. Any supplied aspect ratio is ignored.
          title: Aspect Ratio
        seed:
          anyOf:
            - maximum: 4294967295
              minimum: 0
              type: integer
            - type: 'null'
          default: null
          description: Generation seed. A random seed is chosen when omitted.
          title: Seed
        callback_url:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: HTTPS webhook URL for the terminal generation event.
          title: Callback Url
        callback_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          description: Client tracking ID echoed in the terminal webhook event.
          title: Callback Id
        image:
          description: First-frame image.
          discriminator:
            mapping:
              asset_id: '#/components/schemas/AssetId'
              base64: '#/components/schemas/AssetBase64'
              url: '#/components/schemas/AssetUrl'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/AssetUrl'
            - $ref: '#/components/schemas/AssetId'
            - $ref: '#/components/schemas/AssetBase64'
          title: Image
        end_image:
          anyOf:
            - discriminator:
                mapping:
                  asset_id: '#/components/schemas/AssetId'
                  base64: '#/components/schemas/AssetBase64'
                  url: '#/components/schemas/AssetUrl'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/AssetUrl'
                - $ref: '#/components/schemas/AssetId'
                - $ref: '#/components/schemas/AssetBase64'
            - type: 'null'
          default: null
          description: >-
            Optional image to guide the last frame. Requires image as the first
            frame; the output proportions still follow image.
          title: End Image
      required:
        - mode
        - model
        - prompt
        - image
      title: ImageToVideoRequest
      type: object
    ReferenceToVideoRequest:
      additionalProperties: false
      properties:
        end_user_id:
          anyOf:
            - maxLength: 128
              minLength: 1
              pattern: ^\S+$
              type: string
            - type: 'null'
          default: null
          description: >-
            Stable, opaque end-user identifier in your application, scoped to
            the authenticated workspace. Use 1–128 non-whitespace characters
            without personal information. Used for usage attribution and abuse
            investigation; does not change billing, authorization, or rate
            limits.
          title: End User Id
          x-mcp-visible: false
        mode:
          const: reference_to_video
          description: Generate guided by reference images, videos, and audio.
          title: Mode
          type: string
        model:
          const: heygen-video-1
          description: Required video generation model. Only heygen-video-1 is supported.
          title: Model
          type: string
        prompt:
          description: >-
            Instructions for the video to generate. At most 16,000 Unicode
            characters.
          maxLength: 16000
          minLength: 1
          title: Prompt
          type: string
        prompt_enhancement:
          default: quality
          description: >-
            Prompt enhancement mode: turbo, quality, ultraquality, or disabled.
            Defaults to quality.
          enum:
            - turbo
            - quality
            - disabled
            - ultraquality
          title: Prompt Enhancement
          type: string
        resolution:
          default: 768p
          description: >-
            Output resolution: 480p, 768p, 1080p, or 2k. Defaults to 768p. At
            1080p and 2k, text-to-video and reference-to-video require
            aspect_ratio 16:9 or 9:16; image-to-video follows the image
            proportions.
          enum:
            - 480p
            - 768p
            - 1080p
            - 2k
          title: Resolution
          type: string
        duration:
          anyOf:
            - maximum: 30
              minimum: 5
              type: integer
            - const: auto
              type: string
          default: 5
          description: >-
            Whole seconds from 5 through 30, or auto. Defaults to 5. Durations
            above 15 seconds require turbo or quality prompt enhancement. Auto
            estimates quoted speech between 8 and 15 seconds; use an explicit
            duration for longer output. For videos longer than 15 seconds, every
            output second uses the long-video rate; reference input charges stay
            at the base rate.
          title: Duration
        aspect_ratio:
          default: adaptive
          description: >-
            Output aspect ratio. Adaptive uses the first reference image, or the
            first reference video when no images are supplied; audio-only
            references use 16:9. Defaults to adaptive.
          enum:
            - '21:9'
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
            - adaptive
          title: Aspect Ratio
          type: string
        seed:
          anyOf:
            - maximum: 4294967295
              minimum: 0
              type: integer
            - type: 'null'
          default: null
          description: Generation seed. A random seed is chosen when omitted.
          title: Seed
        callback_url:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: HTTPS webhook URL for the terminal generation event.
          title: Callback Url
        callback_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          description: Client tracking ID echoed in the terminal webhook event.
          title: Callback Id
        reference_images:
          description: Reference images. At most nine.
          items:
            discriminator:
              mapping:
                asset_id: '#/components/schemas/AssetId'
                base64: '#/components/schemas/AssetBase64'
                url: '#/components/schemas/AssetUrl'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/AssetUrl'
              - $ref: '#/components/schemas/AssetId'
              - $ref: '#/components/schemas/AssetBase64'
          maxItems: 9
          title: Reference Images
          type: array
        reference_videos:
          description: >-
            Reference videos. At most three, sharing a 15-second budget. Use all
            footage when it fits; otherwise keep up to the first five seconds of
            each video and share the remaining budget equally among videos with
            footage remaining.
          items:
            discriminator:
              mapping:
                asset_id: '#/components/schemas/AssetId'
                base64: '#/components/schemas/AssetBase64'
                url: '#/components/schemas/AssetUrl'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/AssetUrl'
              - $ref: '#/components/schemas/AssetId'
              - $ref: '#/components/schemas/AssetBase64'
          maxItems: 3
          title: Reference Videos
          type: array
        reference_audio:
          description: Reference audio recordings. At most three.
          items:
            discriminator:
              mapping:
                asset_id: '#/components/schemas/AssetId'
                base64: '#/components/schemas/AssetBase64'
                url: '#/components/schemas/AssetUrl'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/AssetUrl'
              - $ref: '#/components/schemas/AssetId'
              - $ref: '#/components/schemas/AssetBase64'
          maxItems: 3
          title: Reference Audio
          type: array
      required:
        - mode
        - model
        - prompt
      title: ReferenceToVideoRequest
      type: object
    TextToVideoRequest:
      additionalProperties: false
      properties:
        end_user_id:
          anyOf:
            - maxLength: 128
              minLength: 1
              pattern: ^\S+$
              type: string
            - type: 'null'
          default: null
          description: >-
            Stable, opaque end-user identifier in your application, scoped to
            the authenticated workspace. Use 1–128 non-whitespace characters
            without personal information. Used for usage attribution and abuse
            investigation; does not change billing, authorization, or rate
            limits.
          title: End User Id
          x-mcp-visible: false
        mode:
          const: text_to_video
          description: Generate from the prompt alone.
          title: Mode
          type: string
        model:
          const: heygen-video-1
          description: Required video generation model. Only heygen-video-1 is supported.
          title: Model
          type: string
        prompt:
          description: >-
            Instructions for the video to generate. At most 16,000 Unicode
            characters.
          maxLength: 16000
          minLength: 1
          title: Prompt
          type: string
        prompt_enhancement:
          default: quality
          description: >-
            Prompt enhancement mode: turbo, quality, ultraquality, or disabled.
            Defaults to quality.
          enum:
            - turbo
            - quality
            - disabled
            - ultraquality
          title: Prompt Enhancement
          type: string
        resolution:
          default: 768p
          description: >-
            Output resolution: 480p, 768p, 1080p, or 2k. Defaults to 768p. At
            1080p and 2k, text-to-video and reference-to-video require
            aspect_ratio 16:9 or 9:16; image-to-video follows the image
            proportions.
          enum:
            - 480p
            - 768p
            - 1080p
            - 2k
          title: Resolution
          type: string
        duration:
          anyOf:
            - maximum: 30
              minimum: 5
              type: integer
            - const: auto
              type: string
          default: 5
          description: >-
            Requested video duration: whole seconds from 5 through 30, or auto.
            Defaults to 5 when omitted. Durations above 15 seconds require turbo
            or quality prompt enhancement. Auto estimates quoted speech with an
            8-second minimum and the maximum supported by these settings. Over
            MCP, auto is capped at 15 seconds; use an explicit duration for
            longer output. Generation and billing use the resolved duration.
          title: Duration
        aspect_ratio:
          default: '16:9'
          description: Output aspect ratio for text-to-video. Defaults to 16:9.
          enum:
            - '21:9'
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
          title: Aspect Ratio
          type: string
        seed:
          anyOf:
            - maximum: 4294967295
              minimum: 0
              type: integer
            - type: 'null'
          default: null
          description: Generation seed. A random seed is chosen when omitted.
          title: Seed
        callback_url:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: HTTPS webhook URL for the terminal generation event.
          title: Callback Url
        callback_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          description: Client tracking ID echoed in the terminal webhook event.
          title: Callback Id
      required:
        - mode
        - model
        - prompt
      title: TextToVideoRequest
      type: object
    StandardAPIErrorDetail:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code
          example: unknown_node_type
        message:
          type: string
          description: Human-readable error message
          example: Unknown node type
        node_id:
          type: string
          description: Graph node id this error pertains to, if applicable
        port:
          type: string
          description: Port name on the node this error pertains to, if applicable
        path:
          type: string
          description: Field path within the item this error pertains to, if applicable
      required:
        - code
        - message
    AssetId:
      additionalProperties: false
      description: Asset input via HeyGen asset ID from the asset upload endpoint.
      properties:
        type:
          const: asset_id
          description: Input type discriminator
          title: Type
          type: string
        asset_id:
          description: >-
            HeyGen asset ID from an asset upload or import; not a third-party
            file ID.
          title: Asset Id
          type: string
      required:
        - type
        - asset_id
      title: AssetId
      type: object
    AssetBase64:
      additionalProperties: false
      description: Asset input via base64-encoded content.
      properties:
        type:
          const: base64
          description: Input type discriminator
          title: Type
          type: string
        media_type:
          description: MIME type of the encoded content (e.g. "image/png")
          title: Media Type
          type: string
        data:
          description: Base64-encoded file content
          title: Data
          type: string
      required:
        - type
        - media_type
        - data
      title: AssetBase64
      type: object
      x-mcp-visible: false
    AssetUrl:
      additionalProperties: false
      description: Asset input via publicly accessible HTTPS URL.
      properties:
        type:
          const: url
          description: Input type discriminator
          title: Type
          type: string
        url:
          description: >-
            Public http(s) URL HeyGen can download without auth or redirects.
            Not a local or sandbox path (/mnt/data/..., file://, sandbox:);
            upload such files and pass asset_id.
          title: Url
          type: string
      required:
        - type
        - url
      title: AssetUrl
      type: object
  responses:
    IdempotencyInProgress:
      description: >-
        A prior request with this Idempotency-Key is still in progress. Wait for
        the original request to complete, then retry.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                $ref: '#/components/schemas/StandardAPIError'
          example:
            error:
              code: request_in_progress
              message: >-
                A request with this Idempotency-Key is already in progress.
                Retry shortly.
              param: null
              doc_url: null
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: HeyGen API key. Obtain from your HeyGen dashboard.
    BearerAuth:
      type: http
      scheme: bearer
      description: OAuth2 bearer token.

````

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