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

# Wan2.2 Animate Replace

> Use Wan2.2 Animate Replace to swap the subject in a reference video with a single portrait image while preserving motion.

## Query Task Status

After submitting a task, use the unified query endpoint to check progress and retrieve results:

<Card title="Get Task Info" icon="magnifying-glass" href="/models/common/get-task-info">
  Learn how to query task status and retrieve generation results
</Card>

<Tip>
  For production use, we recommend using the `callback_url` parameter to receive automatic notifications when generation completes, rather than polling the status endpoint.
</Tip>

## Related Resources

<CardGroup cols={2}>
  <Card title="Models Overview" icon="store" href="/models/quickstart">
    Explore all available models
  </Card>

  <Card title="Common API" icon="gear" href="/common-api/get-account-credits">
    Check credits and account usage
  </Card>
</CardGroup>


## OpenAPI

````yaml models/wan/2-2-animate-replace.json post /api/v1/client/job/CreateTask
openapi: 3.0.0
info:
  title: Wan2.2 Animate API
  description: crun.ai Wan2.2 animate API Documentation
  version: 1.0.0
  contact:
    name: Technical Support
    email: support@crun.ai
servers:
  - url: https://api.crun.ai
    description: API Server
security:
  - ApiKeyAuth: []
paths:
  /api/v1/client/job/CreateTask:
    post:
      summary: Wan2.2 Animate Replace
      operationId: wan-2-2-animate-replace
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              properties:
                model:
                  type: string
                  enum:
                    - wan/2-2-animate-replace
                  description: |-
                    The model name to use for generation. Required field.

                    - Must be `wan/2-2-animate-replace` for this endpoint
                callback_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. Callback URL for receiving task completion
                    notifications.


                    - System will POST task status and results to this URL when
                    generation completes

                    - Callback payload structure is consistent with the `data`
                    object returned by the task status query

                    - Your callback endpoint should accept POST requests with
                    JSON payload containing results

                    - It should return HTTP 200 on successful receipt
                  example: https://your-domain.com/api/callback
                input:
                  type: object
                  description: Input parameters for Wan2.2 Animate Replace.
                  required:
                    - img_urls
                    - video_urls
                  properties:
                    img_urls:
                      type: array
                      description: >-
                        Single portrait image URL used to replace the person in
                        the reference video.


                        **Image Input Requirements**


                        - **Formats**: JPG, JPEG, PNG, BMP, WEBP

                        - **Resolution**: width and height must each be within
                        [200, 4096] pixels

                        - **Aspect Ratio**: must be within 1:3 to 3:1

                        - **File Size**: up to 5 MB

                        - **Content**: exactly one person, facing the camera,
                        full face visible without occlusion, and with a moderate
                        subject size in frame
                      items:
                        type: string
                        format: uri
                      minItems: 1
                      maxItems: 1
                      example:
                        - https://example.com/portrait.jpg
                    video_urls:
                      type: array
                      description: >-
                        Single reference video URL where the subject will be
                        replaced.


                        **Video Input Requirements**


                        - **Recommendation**: higher reference video resolution
                        and frame rate can improve output video quality

                        - **Formats**: MP4, AVI, MOV

                        - **Duration**: 2 to 30 seconds

                        - **Resolution**: width and height must each be within
                        [200, 2048] pixels

                        - **Aspect Ratio**: must be within 1:3 to 3:1

                        - **File Size**: up to 200 MB

                        - **Content**: exactly one person, facing the camera,
                        full face visible without occlusion, and with a moderate
                        subject size in frame
                      items:
                        type: string
                        format: uri
                      minItems: 1
                      maxItems: 1
                      example:
                        - https://example.com/source-video.mp4
                    resolution:
                      type: string
                      description: |-
                        Output quality mode.

                        - `480P` maps to mode `wan-std`
                        - `720P` maps to mode `wan-pro`
                      enum:
                        - 720P
                        - 480P
                      default: 480P
                      example: 720P
            example:
              model: wan/2-2-animate-replace
              callback_url: https://your-domain.com/api/callback
              input:
                img_urls:
                  - https://example.com/portrait.jpg
                video_urls:
                  - https://example.com/source-video.mp4
                resolution: 720P
      responses:
        '200':
          description: Request successful
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          task_id:
                            type: string
                            description: >-
                              Task ID, can be used with Get Task Details
                              endpoint to query task status
                            example: task_12345678
              example:
                code: 200
                message: success
                data:
                  task_id: task_12345678
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      errors:
                        type: array
                        description: Detailed validation error messages
                        items:
                          type: string
                        example:
                          - >-
                            Value error, Invalid input for model
                            wan/2-2-animate-replace: video_urls must contain
                            exactly 1 item
              example:
                code: 422
                message: Missing Params or Type Error
                errors:
                  - >-
                    Value error, Invalid input for model
                    wan/2-2-animate-replace: video_urls must contain exactly 1
                    item
        '500':
          $ref: '#/components/responses/Error'
components:
  schemas:
    ApiResponse:
      type: object
      properties:
        code:
          type: integer
          enum:
            - 200
            - 401
            - 402
            - 404
            - 422
            - 429
            - 455
            - 500
            - 501
            - 505
          description: >-
            Response status code


            - **200**: Success - Request has been processed successfully

            - **401**: Unauthorized - Authentication credentials are missing or
            invalid

            - **402**: Insufficient Credits - Account does not have enough
            credits to perform the operation

            - **404**: Not Found - The requested resource or endpoint does not
            exist

            - **422**: Validation Error - The request parameters failed
            validation checks

            - **429**: Rate Limited - Request limit has been exceeded for this
            resource

            - **455**: Service Unavailable - System is currently undergoing
            maintenance

            - **500**: Server Error - An unexpected error occurred while
            processing the request

            - **501**: Generation Failed - Content generation task failed

            - **505**: Feature Disabled - The requested feature is currently
            disabled
        message:
          type: string
          description: Response message, error description when failed
          example: success
  responses:
    Error:
      description: Server Error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        All APIs require authentication via API Key.


        Get API Key:

        1. Visit [API Key Management Page](https://crun.ai/user-api-key) to get
        your API Key


        Usage:

        Add to request header:


        x-api-key: YOUR_API_KEY


        Note:

        - Keep your API Key secure and do not share it with others

        - If you suspect your API Key has been compromised, reset it immediately
        in the management page

````