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

# AI Dance Replace v2

> Replace the person in a reference video with the character from your image. The original background, lighting, motion and audio track are kept — only the person is swapped.

By default the whole reference video is used (it must be 5–30 seconds long). Pass `duration` to render only its first N seconds — billing follows that value.

Optionally pass `prompt` to describe the output video (the character's appearance, the motion and the scene).

**Tips** — a full-body image of a single character works best, and the reference video should show one clearly visible person. Everything else in the frame is kept as-is, including any logos, watermarks or text in the original video.

**Pricing** — per second of generated video (rounded up), in tokens (USD at $0.02/token):

| resolution | tokens/s | USD/s | per 5s |
|---|---|---|---|
| 480p | 2 | $0.04 | $0.20 |

Returns an `img_uuid`; poll GET /api/v1/jobs/detail (or use `custom_callback_url`) to get the generated video.



## OpenAPI

````yaml api-reference/video-generations/openapi-ai-dance-replace-v2.json POST /api/v1/videos/generations
openapi: 3.1.0
info:
  title: GoEnhance API - AI Dance Replace v2
  description: Character replacement in a reference video.
  version: 1.0.0
servers:
  - url: https://api.goenhance.ai
security: []
paths:
  /api/v1/videos/generations:
    post:
      tags:
        - VideoGenerations
      summary: AI Dance Replace v2
      description: >-
        Replace the person in a reference video with the character from your
        image. The original background, lighting, motion and audio track are
        kept — only the person is swapped.


        By default the whole reference video is used (it must be 5–30 seconds
        long). Pass `duration` to render only its first N seconds — billing
        follows that value.


        Optionally pass `prompt` to describe the output video (the character's
        appearance, the motion and the scene).


        **Tips** — a full-body image of a single character works best, and the
        reference video should show one clearly visible person. Everything else
        in the frame is kept as-is, including any logos, watermarks or text in
        the original video.


        **Pricing** — per second of generated video (rounded up), in tokens (USD
        at $0.02/token):


        | resolution | tokens/s | USD/s | per 5s |

        |---|---|---|---|

        | 480p | 2 | $0.04 | $0.20 |


        Returns an `img_uuid`; poll GET /api/v1/jobs/detail (or use
        `custom_callback_url`) to get the generated video.
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: false
          example: '{{Authorization}}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  enum:
                    - ai_dance_replace_v2
                  description: Model name. Must be `ai_dance_replace_v2`.
                image_url:
                  type: string
                  format: uri
                  description: >-
                    Character image URL. This character replaces the person in
                    the reference video. A full-body image of a single character
                    works best.
                video_url:
                  type: string
                  format: uri
                  description: >-
                    Reference video URL, 5–30 seconds and at least 16 fps. The
                    person in it is replaced; the background, motion and audio
                    are kept. Videos longer than 30 seconds or shorter than 5
                    seconds are rejected. Use `duration` to render only the
                    first N seconds of it.
                duration:
                  type: integer
                  minimum: 5
                  maximum: 30
                  description: >-
                    Optional. Use only the first N seconds of the reference
                    video. Defaults to the full video length. Must not exceed
                    the actual video length — a longer value is rejected rather
                    than silently clamped. Billing follows this value, so a
                    shorter duration costs proportionally less.
                prompt:
                  type: string
                  maxLength: 2000
                  description: >-
                    Optional. Describe the output video: the character's
                    appearance (clothing, hair, style), the motion and the
                    scene. Defaults to a neutral description.
                resolution:
                  type: string
                  enum:
                    - 480p
                  default: 480p
                  description: >-
                    Output resolution. Only 480p is supported; the aspect ratio
                    follows the reference video.
                custom_callback_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. A publicly accessible HTTPS URL. When the task
                    status changes (processing / success / failed), GoEnhance
                    sends a POST request to this URL. The request body is
                    identical to the response of GET /api/v1/jobs/detail. If
                    your server does not respond with HTTP 200, the notification
                    is retried up to 3 times, with a 3-second timeout per
                    attempt.
                  example: https://your-server.com/goenhance/callback
              required:
                - model
                - image_url
                - video_url
            example:
              model: ai_dance_replace_v2
              image_url: >-
                https://cdn.goenhance.ai/user/goenhance/76115ad445ce26fbd5ad2c649a29e806.jpg
              video_url: >-
                https://cdn.goenhance.ai/user/upload-data/video-to-video/333768e610e442d02e8030693def0b6e.mp4
              prompt: >-
                A young woman with short black hair wearing a red jacket and
                jeans, dancing in the same street scene
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
                  data:
                    type: object
                    properties:
                      img_uuid:
                        type: string
                      cost:
                        type: number
                        description: >-
                          Tokens deducted for this request. This is the amount
                          actually charged, so it already reflects any discount
                          active on your account and can be lower than the
                          listed price. Tokens are deducted when the task is
                          accepted, and refunded automatically if the generation
                          ends in failure.
                        example: 5.82
                    required:
                      - img_uuid
                      - cost
                required:
                  - code
                  - msg
                  - data
              examples:
                '1':
                  summary: Success
                  value:
                    code: 0
                    msg: Success
                    data:
                      img_uuid: c12b656c-747a-44fd-9c80-add79b0c52d5
                      cost: 5.82
                '2':
                  summary: Invalid duration
                  value:
                    code: -1
                    msg: duration (30s) exceeds the reference video length (12s).
                '3':
                  summary: Insufficient tokens
                  value:
                    code: 100
                    msg: tokens is not enough
                quota:
                  summary: API key quota exceeded
                  value:
                    code: 101
                    msg: 'API key quota exceeded: 4990 of 5000 tokens used (monthly)'
          headers: {}
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
                required:
                  - code
                  - msg
          headers: {}
      deprecated: false
      security: []

````

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