> ## 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 or Retrain an Audio Voice

> Creates a model-backed audio voice from one or more recordings, or retrains an existing professional voice when `voice_id` is supplied. Retraining requires only `voice_id` and source audio and retains the existing voice's ID, name, language, and mode. The voice is `PENDING` and unavailable for inference while either operation runs. Poll `GET /v3/models/audio/voices/{voice_id}` until its status becomes `ACTIVE` or `FAILED`. `Idempotency-Key` is optional; omitting it means repeated creation requests create separate voices. New voices require an unoccupied professional-voice slot. Each purchased slot provides five pooled trainings per monthly billing period, including initial training; failed trainings do not consume the allowance.



## OpenAPI

````yaml /openapi/external-api.json post /v3/models/audio/voices
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 Agent
    description: Create videos from text prompts using AI
  - name: Videos
    description: Create, list, retrieve, and delete videos
  - name: Templates
    description: Generate videos from reusable templates by replacing their variables
  - name: Voices
    description: Text-to-speech and voice management
  - name: Audio
    description: Search the background-music and sound-effects catalog
  - name: Video Translate
    description: Translate videos into other languages
  - name: AI Clipping
    description: Turn long-form videos into ready-to-share short clips with captions
  - name: Batches
    description: Create and track batches of videos.
  - name: Video Translation Batches
    description: Create and track batches of video translations.
  - name: Lipsync Batches
    description: Create and track batches of lipsyncs.
  - name: Asset Batches
    description: Create and track batches of direct-to-S3 asset uploads.
  - name: User
    description: Account information and billing
  - name: API Keys
    description: Inspect the API key authenticating the current request
  - name: Avatars
    description: List and manage avatars and looks
  - name: Assets
    description: Upload files for use in video creation
  - name: Webhooks
    description: Manage webhook endpoints and events
  - name: Lipsync
    description: Dub or replace audio on existing videos
  - name: Brand
    description: >-
      Brand-related resources — brand kits (colors, fonts, logos) and brand
      glossaries (custom term translations)
  - name: HyperFrames
    description: Render HyperFrames composition zips into video — separate from /v3/videos
  - name: Models
    description: ''
  - name: Filler Word Removal
    description: ''
paths:
  /v3/models/audio/voices:
    post:
      tags:
        - Models
      summary: Create or Retrain an Audio Voice
      description: >-
        Creates a model-backed audio voice from one or more recordings, or
        retrains an existing professional voice when `voice_id` is supplied.
        Retraining requires only `voice_id` and source audio and retains the
        existing voice's ID, name, language, and mode. The voice is `PENDING`
        and unavailable for inference while either operation runs. Poll `GET
        /v3/models/audio/voices/{voice_id}` until its status becomes `ACTIVE` or
        `FAILED`. `Idempotency-Key` is optional; omitting it means repeated
        creation requests create separate voices. New voices require an
        unoccupied professional-voice slot. Each purchased slot provides five
        pooled trainings per monthly billing period, including initial training;
        failed trainings do not consume the allowance.
      operationId: createModelAudioVoice
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateModelAudioVoiceRequest'
      responses:
        '202':
          description: Accepted — submission acknowledged; poll for completion.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CreateModelAudioVoiceResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              examples:
                invalid_audio:
                  summary: Source audio does not satisfy training requirements
                  value:
                    error:
                      code: invalid_parameter
                      message: >-
                        The supplied recordings must contain at least 20 minutes
                        of audio in total.
                      param: audio
                      doc_url: null
                voice_capacity:
                  summary: All purchased professional-voice slots are occupied
                  value:
                    error:
                      code: resource_limit_reached
                      message: >-
                        No professional voice slots are available. Purchase
                        another slot, or delete a voice after its training
                        finishes.
                training_allowance:
                  summary: >-
                    The monthly professional-voice training allowance is
                    exhausted
                  value:
                    error:
                      code: resource_limit_reached
                      message: >-
                        The monthly professional voice training allowance is
                        exhausted. Try again in the next billing period or
                        purchase another slot.
        '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
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              example:
                error:
                  code: forbidden
                  message: >-
                    The professional voice cloning API is not enabled for this
                    account.
                  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: voice_not_found
                  message: Voice not found.
                  param: null
                  doc_url: null
        '409':
          description: >-
            Conflict — either the request conflicts with existing state, or a
            prior request with this `Idempotency-Key` is still in progress
            (`request_in_progress`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/StandardAPIError'
              examples:
                conflict:
                  summary: Resource conflict
                  value:
                    error:
                      code: resource_not_ready
                      message: >-
                        The professional voice must be ACTIVE and have no
                        training in progress before it can be retrained.
                      param: null
                      doc_url: null
                request_in_progress:
                  summary: Concurrent retry with same Idempotency-Key
                  value:
                    error:
                      code: request_in_progress
                      message: >-
                        A request with this Idempotency-Key is already in
                        progress. Retry shortly.
                      param: null
                      doc_url: null
        '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: service_unavailable
                  message: >-
                    Professional voice source audio ingestion is temporarily
                    unavailable. Retry with the same Idempotency-Key.
                  param: null
                  doc_url: null
      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:
    CreateModelAudioVoiceRequest:
      additionalProperties: false
      description: Create or retrain one model-backed audio voice.
      properties:
        mode:
          anyOf:
            - $ref: '#/components/schemas/ModelAudioVoiceMode'
            - type: 'null'
          default: null
          description: >-
            Voice operation mode for a new voice. Ignored when `voice_id` is
            supplied; the existing mode is retained. Currently only
            `professional` is supported.
        voice_id:
          anyOf:
            - maxLength: 64
              minLength: 1
              pattern: ^\S+$
              type: string
            - type: 'null'
          default: null
          description: Existing professional voice to retrain. Omit to create a new voice.
          title: Voice Id
        name:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          default: null
          description: >-
            Display name for a new voice. Ignored when `voice_id` is supplied;
            the existing name is retained.
          title: Name
        language:
          anyOf:
            - maxLength: 32
              minLength: 1
              type: string
            - type: 'null'
          default: null
          description: >-
            Primary language code, such as `en`, for a new voice. Ignored when
            `voice_id` is supplied; the existing language is retained.
          title: Language
        audio:
          description: >-
            Source recordings of the same speaker. Each item may be a public
            HTTPS URL, a HeyGen asset ID, or base64-encoded audio. The
            recordings must contain at least 20 minutes of audio and no more
            than 1.5 GB (1,500,000,000 bytes) in total.
          items:
            discriminator:
              mapping:
                asset_id:
                  $ref: '#/components/schemas/AssetId'
                base64:
                  $ref: '#/components/schemas/AssetBase64'
                url:
                  $ref: '#/components/schemas/AssetUrl'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/AssetUrl'
              - $ref: '#/components/schemas/AssetId'
              - $ref: '#/components/schemas/AssetBase64'
          maxItems: 10
          minItems: 1
          title: Audio
          type: array
      required:
        - audio
      title: CreateModelAudioVoiceRequest
      type: object
    CreateModelAudioVoiceResponse:
      additionalProperties: false
      description: Identifier returned after voice creation or retraining is accepted.
      properties:
        voice_id:
          description: >-
            Stable identifier to use when retrieving the voice and its training
            status.
          title: Voice Id
          type: string
      required:
        - voice_id
      title: CreateModelAudioVoiceResponse
      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'
      required:
        - code
        - message
    ModelAudioVoiceMode:
      description: Supported audio-voice creation implementations.
      enum:
        - professional
      title: ModelAudioVoiceMode
      type: string
    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 the asset upload endpoint
          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: Publicly accessible HTTPS URL for the asset
          title: Url
          type: string
      required:
        - type
        - url
      title: AssetUrl
      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
  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.

````