> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs-beta-7agmae.voicedub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate dub

> Start generating the final dub. Requires the dub to be preprocessed first. Consumes 10 API credits per minute of audio. Check requiredCredits after /preprocess finishes.



## OpenAPI

````yaml post /v1/me/dubs/{dubId}/generate
openapi: 3.1.0
info:
  title: VoiceDub API
  description: API for creating AI voice dubs and training custom voice models
  version: 1.0.0
  contact:
    name: VoiceDub Support
    email: help@voicedub.ai
    url: https://voicedub.ai
servers:
  - url: https://api.voicedub.ai
    description: Production server
security:
  - apiKeyAuth: []
tags:
  - name: Dubs
    description: Operations for creating and managing voice dubs
  - name: Voices
    description: Operations for creating and managing voice models
  - name: User
    description: Operations for managing user account and settings
paths:
  /v1/me/dubs/{dubId}/generate:
    post:
      tags:
        - Dubs
      summary: Generate dub
      description: >-
        Start generating the final dub. Requires the dub to be preprocessed
        first. Consumes 10 API credits per minute of audio. Check
        requiredCredits after /preprocess finishes.
      operationId: generateDub
      parameters:
        - in: path
          name: dubId
          description: UUID of the dub to generate
          schema:
            type: string
            format: uuid
            description: UUID of the dub to generate
            example: 123e4567-e89b-12d3-a456-426614174000
          required: true
      responses:
        '200':
          description: Generation started successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateDubResponse'
        '400':
          description: Bad request - dub is not preprocessed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DubNotPreprocessedError'
        '404':
          description: Dub not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DubNotFoundError'
components:
  schemas:
    GenerateDubResponse:
      type: object
      properties:
        dub:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: Unique identifier for the dub
              example: 123e4567-e89b-12d3-a456-426614174000
            voiceId:
              type:
                - string
                - 'null'
              format: uuid
              description: Voice model used for the dub
              example: 123e4567-e89b-12d3-a456-426614174001
            link:
              type:
                - string
                - 'null'
              description: Original audio/video link if provided (null if not provided)
              example: https://example.com/audio.mp3
            separate:
              type: boolean
              description: Whether vocals were separated from backing track
              example: true
            status:
              type: string
              enum:
                - new
                - preprocessing
                - preprocessed
                - queued
                - starting
                - processing
                - finalizing
                - done
                - error
              description: Current processing status of the dub
              example: queued
              openapi:
                description: Current processing status of the dub
                example: done
            inputDuration:
              type:
                - integer
                - 'null'
              description: >-
                Duration of input audio in milliseconds (null before
                preprocessed)
              example: 180000
              openapi:
                description: >-
                  Duration of input audio in milliseconds (null before
                  preprocessed)
                example: 180000
            inputSource:
              type: string
              enum:
                - upload
                - link
              description: Source type of the input audio
              example: upload
            pitchShift:
              type: integer
              description: Pitch shift applied in semitones
              example: 0
            errorCode:
              type:
                - string
                - 'null'
              description: Error code if processing failed (null for now)
              example: null
            errorMessage:
              type:
                - string
                - 'null'
              description: Error message if processing failed (null for now)
              example: null
            apiCreditsUsed:
              type: integer
              description: API credits consumed for this dub (0 before /generate is called)
              example: 30
              openapi:
                description: >-
                  API credits consumed for this dub (0 before /generate is
                  called)
                example: 30
            apiCreditsLeft:
              type:
                - integer
                - 'null'
              description: >-
                Remaining API credits after this dub (null before /generate is
                called)
              example: 90
              openapi:
                description: >-
                  Remaining API credits after this dub (null before /generate is
                  called)
                example: 90
            completedAt:
              type:
                - string
                - 'null'
              description: >-
                Timestamp when dub processing completed (null if status is not
                "done" or "error")
              example: null
              openapi:
                description: >-
                  Timestamp when dub processing completed (null if status is not
                  "done" or "error")
                example: '2024-01-15T10:30:00.000Z'
            createdAt:
              type: string
              description: Timestamp when dub was created
              example: '2024-01-15T10:00:00.000Z'
            updatedAt:
              type: string
              description: Timestamp when dub was last updated
              example: '2024-01-15T10:30:00.000Z'
            dubUrl:
              type:
                - string
                - 'null'
              default: null
              description: Download URL for the completed dub (null if status is not done)
              example: null
              openapi:
                description: >-
                  Download URL for the completed dub (null if status is not
                  done)
                example: >-
                  https://example.com/dubs/123e4567-e89b-12d3-a456-426614174000.mp3
            requiredCredits:
              type:
                - number
                - 'null'
              default: null
              description: >-
                Number of credits required to process this dub (null before
                preprocessed)
              example: 30
              openapi:
                description: >-
                  Number of credits required to process this dub (null before
                  preprocessed)
                example: 30
          required:
            - id
            - voiceId
            - link
            - separate
            - status
            - inputDuration
            - inputSource
            - pitchShift
            - errorCode
            - errorMessage
            - apiCreditsUsed
            - apiCreditsLeft
            - completedAt
            - createdAt
            - updatedAt
            - dubUrl
            - requiredCredits
      required:
        - dub
    DubNotPreprocessedError:
      type: object
      properties:
        code:
          type: string
          const: dub_is_not_in_preprocessed_state
          description: Error code
          example: dub_is_not_in_preprocessed_state
        message:
          type: string
          description: Human-readable error message
          example: Dub must be in preprocessed state before generating
      required:
        - code
        - message
    DubNotFoundError:
      type: object
      properties:
        code:
          type: string
          const: not_found
          description: Error code
          example: not_found
        message:
          type: string
          description: Human-readable error message
          example: Dub not found
      required:
        - code
        - message
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'API key in the format: "Api-Key <your-api-key>"'

````