openapi: 3.0.0
info:
  title: AI Clothes Virtual Try-On
  description: >
    # Overview

    AI Clothes is a virtual fitting room that lets users try on clothes without
    physically wearing them. Using AI and photo editing technology, these apps
    overlay outfits onto your image so you can see how different styles and fits
    look on your body type. It’s perfect for online shopping, style inspiration,
    or just playing around with fashion ideas. Try on clothes virtually with AI
    Clothes . Upload any clothing reference to swap outfits with you photo for
    an instant virtual wardrobe transformation.


    ---


    ## Integration Guide


    * API Playground

    You can use the API Playground to test the AI Clothes virtual try-on
    feature. This allows you to experiment with your ideas and gain a better
    understanding of the try-on process.


    Access the API Playground at:

    <https://yce.makeupar.com/api-console/en/api-playground/ai-clothes/>


    ---


    * AI Clothes API Usage Guide


    This guide explains how to upload images, prepare reference outfits, and
    create virtual try-on tasks using the AI Clothes API.


    ***

       * Step 1. Upload a File Using the File API

    Use the **File API** (`/s2s/v2.0/file`) to upload a target user image.


    **Image Requirements:**


    *   Upload a high-resolution full-body photo.

    *   Ensure the photo clearly shows the entire body.

    *   Avoid backgrounds with multiple people or distracting objects.


    **Example Request:**


    ```bash

    curl --request POST \
      --url https://yce-api-01.makeupar.com/s2s/v2.0/file \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --header 'content-type: application/json' \
      --data '{
        "files": [
     {
       "content_type": "image/jpg",
       "file_name": "full_body_photo_01_3dbd1b6683.jpg",
       "file_size": 547541
     }
        ]
      }'
    ```


    ***

       * Step 2. Retrieve File API Response

    The response includes:


    *   `file_id` for creating an AI task.

    *   `requests.url` for uploading the actual image file.


    **Sample Response:**


    ```json

    {
      "status": 200,
      "data": {
        "files": [
     {
       "content_type": "image/jpg",
       "file_name": "full_body_photo_01_3dbd1b6683.jpg",
       "file_id": "SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9/13W5TOD8/u/FfjK3xgCQ+hRt9MJXBFaud",
       "requests": [
     {
      "method": "PUT",
      "url": "https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...",
      "headers": {
        "Content-Length": "547541",
        "Content-Type": "image/jpg"
      }
     }
       ]
     }
        ]
      }
    }

    ```


    ***

       * Step 3. Upload Image to Provided URL

    Use the `requests.url` from the File API response to upload the image:


    ```bash

    curl --location --request PUT
    'https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...' \
      --header 'Content-Type: image/jpg' \
      --header 'Content-Length: 547541' \
      --data-binary @'./full_body_photo_01_3dbd1b6683.jpg'
    ```


    ***

       * Step 4. Prepare a Reference Outfit

     * 4.1 Upload a Reference Outfit Image

    You can:


    *   Upload an outfit image using the File API (`/s2s/v2.0/file`), or

    *   Provide a valid image URL.


    **Supported Outfit Images:**


    *   Product image of the clothing.

    *   Full-body photo as an outfit reference.


    Refer to **[File Specs and
    Errors](#section/overview/File-Specs-and-Errors)** for detailed
    specifications.


    ***

       * Step 5. Create an AI Task

    Use the **AI Task API** (`/s2s/v2.0/task/cloth-v4`) to create a virtual
    try-on task.


    **Parameters:**


    *   For the user image: `src_file_id` or `src_file_url`.

    *   For the outfit image: `ref_file_id`, `ref_file_url`, or `template_id`.


    **Example Request:**


    ```bash

    curl --request POST \
      --url https://yce-api-01.makeupar.com/s2s/v2.0/task/cloth-v4 \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --header 'content-type: application/json' \
      --data '{
        "src_file_url": "https://plugins-media.makeupar.com/strapi/assets/clothes_03_cccd5d4803.jpeg",
        "ref_file_url": "https://plugins-media.makeupar.com/strapi/assets/clothes_reference_full_body_01_5a000d999f.png",
        "garment_category": "full_body"
      }'
    ```


    **Sample Response:**


    ```json

    {
      "status": 200,
      "data": {
        "task_id": "SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9_13W5TOD8_u_GPi6NqQ3dhlmN-6ntFwhzT"
      }
    }

    ```


    ***

       * Step 6. Poll for Task Result

    Use the task ID to check the status:


    ```bash

    curl --request GET \
      --url https://yce-api-01.makeupar.com/s2s/v2.0/task/cloth-v4/<YOUR_TASK_ID> \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --header 'content-type: application/json'
    ```


    ***

       * Step 7. Retrieve Result

    A successful response includes a download URL for the result image:


    ```json

    {
      "status": 200,
      "data": {
        "error": null,
        "results": {
     "url": "https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature..."
        },
        "task_status": "success"
      }
    }

    ```


    Invalid API Key error response:


    ```json

    {
      "status": 401,
      "error": "Unauthorized",
      "error_code": "InvalidAccessToken"
    }

    ```


    ---


    Use cases:

    ![](https://plugins-media.makeupar.com/smb/blog/post/2025-05-08/b80f4ae1-c905-4ec0-b491-e42c15e65575.gif)


    ![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/01%20ai%20clothes%20changer.jpg)


    ![](https://plugins-media.makeupar.com/smb/blog/post/2023-12-01/45f451aa-4b4f-466d-9da7-4538573c92af.jpg)


    Suggestions for How to Shoot:

    ![Suggestions for How to
    Shoot](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/AI-Cloth-Guideline.png
    "Suggestions for How to Shoot")



    ## File Specs & Errors

    * Supported Formats & Dimensions


    |Type|Supported Dimensions|Supported File Size|Supported Formats|

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

    |Target user image|1024×768 recommended, 512×384 minimum, max side 4096
    px.</br></br> - Single person only.</br> - The person should occupy at least
    80% of the frame for optimal results.</br> - Images should include the upper
    body only, from the chest upwards. There is no need to show the abdomen, but
    the shoulders should be visible.</br> - The face must be fully visible, with
    no obstructions.</br> - The body must be facing forward in a standing
    position (no sitting or crouching). |< 10MB|jpg/png|

    |Reference image of the clothing |1024×768 recommended, 512×384 minimum, max
    side 4096 px.</br></br> - If Using a Real-Person Clothing Photo as
    Reference</br>&nbsp;&nbsp;&nbsp;- Must feature only one
    person.</br>&nbsp;&nbsp;&nbsp;- The visible clothing area must fully cover
    the intended try-on area.</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Example:
    For full-body try-on, a half-body clothing image is not
    acceptable.</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Example: For
    lower-body try-on, partial pants are not acceptable.</br>&nbsp;&nbsp;&nbsp;-
    The clothing must not be heavily obstructed (e.g. covered by long hair or
    arms).</br>&nbsp;&nbsp;&nbsp;- The face must be fully visible, with no
    obstructions.</br>&nbsp;&nbsp;&nbsp;- The body must be facing forward in a
    standing position (no sitting or crouching). </br></br> - If Using a Product
    Image as Reference</br>&nbsp;&nbsp;&nbsp;- Must be a front-facing product
    shot of a single garment.</br>&nbsp;&nbsp;&nbsp;- Do not use composite
    images (e.g. top and bottom in one photo).</br>&nbsp;&nbsp;&nbsp;- For the
    lower body, only actual worn outfits are supported, not standalone product
    images.|< 10MB|jpg/png|


    * Error Codes


    * Error code (Preprocess)


    | Error code | Description |

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

    | exceed_max_filesize | The SRC or REF image is too large. The long side
    must not exceed 4096 pixels. |

    | error_below_min_image_size | The SRC or REF image is too small. The long
    side must be at least 128 pixels. |

    | error_pose | The pose could not be detected from the uploaded human SRC
    image. |

    | error_invalid_ref | The REF image is invalid, for example, it is empty or
    the subject is not fully visible. |

    | error_apply_region_mismatch | The apply region in the SRC image does not
    match the REF image, so no edits can be applied. |

    | error_invalid_src | When the source image shows only the lower body or
    only the feet. |


    * Error code (Engine)


    | Error code | Description |

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

    | invalid_parameter | - Invalid garment category. <br> - Style_id is not in
    inference_style_list. <br> - Invalid src_keys, dst_keys, or acts. <br> -
    Invalid ref_keys or template_ref_image. <br> - Exactly one of them must be
    provided. |

    | error_download_image | The SRC or REF image could not be downloaded. |

    | exceed_max_filesize | The SRC or REF image is too large. The file size
    must not exceed 10 MB. |

    | error_nsfw_content_detected | Potential NSFW content was detected in the
    result image. |

    | error_editing_failed | The editing process failed because the result image
    is too similar to the source image. |

    | unknown_internal_error | - Failed to load the model. <br> - Invalid
    scheduler algorithm type. <br> - No engine loaded. <br> - The file is not in
    the upload results. |



    * Environment & Dependency


    | Sample Code Language / Tool | Recommended Runtime Versions |

    |---|---|

    | cURL | - bash >= 3.2</br>   - curl >= 7.58 (modern TLS/HTTP
    support)</br>   - jq >= 1.6 (robust JSON parsing) |

    | Node.js (JavaScript) | Node >= 18 (for global fetch) |

    | JavaScript | - Chrome / Edge >= 80</br>   - Firefox >= 74</br>   - Safari
    >= 13.1 |

    | PHP | PHP >= 7.4 (for modern TLS/compat), ext-curl (recommended) or
    allow_url_fopen=On + ext-openssl, ext-json |

    | Python | Python >= 3.10 (for f-strings), requests >= 2.20.0 |

    | Java | Java 11+ (for HttpClient), Jackson Databind >= 2.12.0 |


    ---


    ## Unit Consumption


    | AI Feature | Unit Consumed |

    |---|---|

    | AI Clothes Virtual Try-On V2.0 | 2 |

    | AI Clothes Virtual Try-On V3.0 | 2 |


    ---
  version: ''
  termsOfService: https://www.makeupar.com/perfectbeauty/youcam/terms-of-service-api
  contact:
    email: YouCamOnlineEditor_API@perfectcorp.com
  license:
    name: Privacy policy
    url: https://www.makeupar.com/perfectbeauty/youcam/privacy-policy-api
servers:
  - url: https://yce-api-01.makeupar.com
tags:
  - name: V4.0
    description: >-
      Enhanced capabilities to include virtual try-on for outerwear, including
      jackets and vests. You can now choose from Full Body, Upper Body, Lower
      Body, Shoes, or Outerwear for virtual try-on, or simply select Auto and
      let the AI engine create the perfect outfit for you.
  - name: V3.0
    description: >-
      Upgraded the AI Clothes v3 engine to deliver exceptional fabric realism,
      accurately rendering materials such as leather, knitwear, and satin, while
      restoring intricate garment details with greater precision.
  - name: V2.0
    description: >-
      Generate virtual try-on experiences for clothing items using AI
      technology, supporting template-based and reference image methods.
paths:
  /s2s/v2.0/task/template/cloth:
    get:
      summary: List predefined templates.
      tags:
        - V2.0
      security:
        - BearerAuthenticationV2: []
      parameters:
        - name: page_size
          in: query
          schema:
            type: integer
            example: 20
          description: >-
            Number of results to return in this page. Valid value should be
            between 1 and 20. Default 20.
        - name: starting_token
          in: query
          schema:
            type: string
            example: 73a3c9e69b89
          description: >-
            Token for current page. Start with `null` for the first page, and
            use `next_token` from the previous response to start next page
      responses:
        '200':
          $ref: '#/components/responses/TemplateResponse'
        '400':
          $ref: '#/components/responses/InvalidParameters'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
  /s2s/v2.0/task/cloth:
    post:
      summary: Run an AI Cloths task.
      description: >
        This endpoint initiates the clothing virtual try-on process. You can use
        a template ID or provide reference images (source and reference files).
        The task will be processed asynchronously, and you can check its status
        using the task_id returned in this response.
      tags:
        - V2.0
      security:
        - BearerAuthenticationV2: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunClothsTaskV2'
      responses:
        '200':
          description: Successful execution of the AI Clothes task
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicRunTaskResponseV2'
        '400':
          description: Failed execution of task
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/RunError'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '429':
          $ref: '#/components/responses/TooManyRequests'
  /s2s/v2.0/task/cloth/{task_id}:
    get:
      summary: Check the status of a AI Cloths task.
      tags:
        - V2.0
      security:
        - BearerAuthenticationV2: []
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            example: grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe
          description: ID of task to check
      responses:
        '200':
          description: Successful check of the AI Clothes task status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskStatusResponseV2'
        '400':
          $ref: '#/components/responses/InvalidTaskId'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '500':
          $ref: '#/components/responses/TaskTimeout'
  /s2s/v2.0/task/cloth-v3:
    post:
      summary: Run an AI Cloth V3 task.
      description: >
        AI tasks are asynchronous. Prefer webhook-based completion handling when
        the feature supports webhooks. Configure your webhook endpoint, verify
        webhook signatures, and use the received `task_id` to query the task
        result after a `success` or `error` notification. See the [webhook
        integration guide](/develop/webhook.md) for setup and verification
        details.


        If webhooks are not supported for the feature, or if your integration
        cannot use webhooks, implement polling. After starting an AI task, keep
        polling the task status endpoint at the given `polling_interval` until
        the task status is either `success` or `error`.


        Do not stop polling a running task for longer than the allowed polling
        window. If the task is not polled in time, the task may expire; a later
        status check can return `InvalidTaskId` even if processing finished, and
        the consumed units may still be charged.
      tags:
        - V3.0
      security:
        - BearerAuthenticationV2: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/RunClothV3Task'
      responses:
        '200':
          description: Successful execution of the task
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicRunTaskResponseV2'
        '400':
          description: Failed execution of task
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/RunError'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '429':
          $ref: '#/components/responses/TooManyRequests'
  /s2s/v2.0/task/cloth-v3/{task_id}:
    get:
      summary: Check the status of a AI Cloth V3 task.
      tags:
        - V3.0
      security:
        - BearerAuthenticationV2: []
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            example: grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe
          description: ID of task to check
      responses:
        '200':
          description: Successful check of the task status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskStatusResponseV2'
        '400':
          $ref: '#/components/responses/InvalidTaskId'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '500':
          $ref: '#/components/responses/TaskTimeout'
  /s2s/v2.0/task/cloth-v4:
    post:
      summary: Run an AI Cloth V4 task.
      x-display-name: AI Clothes Virtual Try-On
      x-engine-version: V4.0
      description: >
        AI tasks are asynchronous. Prefer webhook-based completion handling when
        the feature supports webhooks. Configure your webhook endpoint, verify
        webhook signatures, and use the received `task_id` to query the task
        result after a `success` or `error` notification. See the [webhook
        integration guide](/develop/webhook.md) for setup and verification
        details.


        If webhooks are not supported for the feature, or if your integration
        cannot use webhooks, implement polling. After starting an AI task, keep
        polling the task status endpoint at the given `polling_interval` until
        the task status is either `success` or `error`.


        Do not stop polling a running task for longer than the allowed polling
        window. If the task is not polled in time, the task may expire; a later
        status check can return `InvalidTaskId` even if processing finished, and
        the consumed units may still be charged.
      tags:
        - V4.0
      security:
        - BearerAuthenticationV2: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/RunClothV4Task'
      responses:
        '200':
          description: Successful execution of the task
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicRunTaskResponseV2'
        '400':
          description: Failed execution of task
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/RunError'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '429':
          $ref: '#/components/responses/TooManyRequests'
  /s2s/v2.0/task/cloth-v4/{task_id}:
    get:
      summary: Check the status of a AI Cloth V4 task.
      x-display-name: AI Clothes Virtual Try-On
      x-engine-version: V4.0
      tags:
        - V4.0
      security:
        - BearerAuthenticationV2: []
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            example: grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe
          description: ID of task to check
      responses:
        '200':
          description: Successful check of the task status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskStatusResponseV2'
        '400':
          $ref: '#/components/responses/InvalidTaskId'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '500':
          $ref: '#/components/responses/TaskTimeout'
components:
  securitySchemes:
    BearerAuthenticationV2:
      type: http
      scheme: bearer
      description: >-
        Use the standard 'Bearer authentication'. Put your 'API Key' in header:
        `Authorization:Bearer YOUR_API_KEY`. Notice that there is ' ' a space
        between 'Bearer' and the 'YOUR_API_KEY'.
  schemas:
    RunClothsTaskV2Template:
      required:
        - template_id
      properties:
        template_id:
          type: string
          description: >-
            ID of the template. List predefined templates first, and use the id
            of a template.
          example: good_template_001
    RunClothsTaskV2GarmentCategory:
      required:
        - garment_category
      properties:
        garment_category:
          type: string
          enum:
            - full_body
            - lower_body
            - upper_body
            - shoes
            - auto
          description: >-
            The category of garment of reference image. It's required if
            reference image provided. Utilize the "auto" parameter to allow the
            AI engine to automatically identify and classify garment categories.
    RunClothsTaskV2:
      allOf:
        - anyOf:
            - allOf:
                - title: Run task with src file url & ref file url
                  required:
                    - ref_file_url
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileUrl'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileUrl'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
            - allOf:
                - title: Run task with src file url & ref file ID
                  required:
                    - ref_file_id
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileUrl'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileId'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
            - allOf:
                - title: Run task with src file ID & ref file url
                  required:
                    - ref_file_url
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileId'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileUrl'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
            - allOf:
                - title: Run task with src file ID & ref file ID
                  required:
                    - ref_file_id
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileId'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileId'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
            - allOf:
                - title: Run task with src file url and template
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileUrl'
                - $ref: '#/components/schemas/RunClothsTaskV2Template'
            - allOf:
                - title: Run task with src file ID and template
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileId'
                - $ref: '#/components/schemas/RunClothsTaskV2Template'
        - properties:
            change_shoes:
              type: boolean
              default: true
              description: >-
                Control whether shoes should be swapped when a full body
                reference image with shoes is available for processing.
    RunClothV3Task:
      allOf:
        - anyOf:
            - allOf:
                - title: Run task with src file url & ref file url
                  required:
                    - ref_file_url
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileUrl'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileUrl'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
            - allOf:
                - title: Run task with src file url & ref file ID
                  required:
                    - ref_file_id
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileUrl'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileId'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
            - allOf:
                - title: Run task with src file ID & ref file url
                  required:
                    - ref_file_url
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileId'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileUrl'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
            - allOf:
                - title: Run task with src file ID & ref file ID
                  required:
                    - ref_file_id
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileId'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileId'
                - $ref: '#/components/schemas/RunClothsTaskV2GarmentCategory'
        - properties:
            change_shoes:
              type: boolean
              default: true
              description: >
                Control whether shoes should be swapped when a full body
                reference image with shoes is available for processing.

                <br> Have effect when `garment_category` is `full_body` or
                `lower_body`
    RunClothsTaskV4GarmentCategory:
      required:
        - garment_category
      properties:
        garment_category:
          type: string
          enum:
            - full_body
            - lower_body
            - upper_body
            - shoes
            - auto
            - outer
          description: >-
            The category of garment of reference image. It's required if
            reference image provided. Utilize the "auto" parameter to allow the
            AI engine to automatically identify and classify garment categories.
    RunClothV4Task:
      allOf:
        - anyOf:
            - allOf:
                - title: Run task with src file url & ref file url
                  required:
                    - ref_file_url
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileUrl'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileUrl'
                - $ref: '#/components/schemas/RunClothsTaskV4GarmentCategory'
            - allOf:
                - title: Run task with src file url & ref file ID
                  required:
                    - ref_file_id
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileUrl'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileId'
                - $ref: '#/components/schemas/RunClothsTaskV4GarmentCategory'
            - allOf:
                - title: Run task with src file ID & ref file url
                  required:
                    - ref_file_url
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileId'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileUrl'
                - $ref: '#/components/schemas/RunClothsTaskV4GarmentCategory'
            - allOf:
                - title: Run task with src file ID & ref file ID
                  required:
                    - ref_file_id
                - $ref: '#/components/schemas/BasicRunTaskV2SrcFileId'
                - $ref: '#/components/schemas/BasicRunTaskV2RefFileId'
                - $ref: '#/components/schemas/RunClothsTaskV4GarmentCategory'
        - properties:
            change_shoes:
              type: boolean
              default: true
              description: >
                Control whether shoes should be swapped when a full body
                reference image with shoes is available for processing.

                <br> Have effect when `garment_category` is `full_body` or
                `lower_body`
            filter_multi_person:
              type: string
              enum:
                - 'off'
                - normal
                - strict
              default: 'off'
              description: >
                Filter out multi-person cases in the source image and the human
                reference image.

                <br> `off` - No filtering. The engine uses the largest person in
                the image.

                <br> `normal` - Reject when another person is comparable in size
                to the main subject, or is clearly visible on the same plane,
                such as standing nearby with a sharp, recognizable face. Typical
                group or two-person photos. Distant or blurry background people
                are ignored.

                <br> `strict` - Reject when any additional person is visible,
                including small, distant, background, or blurry / out-of-focus
                people.
    Template:
      type: object
      properties:
        id:
          type: string
          description: The ID of the template. Use this as \`template_id\` when run task.
          example: good_template_001
        thumb:
          type: string
          description: The thumbnail of style.
        title:
          type: string
          description: The title of the template.
        category_name:
          type: string
          description: The category name of the template.
    BasicRunTaskV2SrcFileUrl:
      type: object
      required:
        - src_file_url
      properties:
        src_file_url:
          type: string
          description: Url of the file to run task. The url should be publicly accessible.
          example: https://example.com/selfie.jpg
    BasicRunTaskV2RefFileUrl:
      type: object
      properties:
        ref_file_url:
          type: string
          description: >-
            Url of the reference file to run task. The url should be publicly
            accessible.
          example: https://example.com/accessory.jpg
    BasicRunTaskV2RefFileId:
      type: object
      properties:
        ref_file_id:
          type: string
          description: ID of the reference file to run task. File ID from upload file API.
          example: pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE=
    BasicRunTaskV2SrcFileId:
      type: object
      required:
        - src_file_id
      properties:
        src_file_id:
          type: string
          description: ID of file to run task. File ID from upload file API.
          example: pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE=
    BasicRunTaskResponseV2:
      type: object
      properties:
        status:
          type: integer
          description: Response status
          example: 200
        data:
          type: object
          properties:
            task_id:
              type: string
              description: >-
                ID of this task. Task result is valid to query by this ID for 24
                hours.
              example: grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe
    RunError:
      type: object
      properties:
        status:
          type: integer
          description: Response status
          example: 400
        error:
          type: string
          description: Error message
          example: The operation could not be completed
        error_code:
          type: string
          enum:
            - InvalidParameters
            - CreditInsufficiency
            - InvalidStyleGroup
            - InvalidStyle
            - BadRequest
          description: |
            Error code:
              * InvalidParameters - Invalid request parameters
              * CreditInsufficiency - Insufficient unit to run
              * BadRequest - Unexpected request parameter
              * InvalidStyleGroup - Invalid style group id
              * InvalidStyle - Invalid style id
    EngineErrorCode:
      type: string
      nullable: true
      enum:
        - error_exceed_max_image_size
        - exceed_max_filesize
        - invalid_parameter
        - error_download_image
        - error_download_mask
        - error_decode_image
        - error_decode_mask
        - error_nsfw_content_detected
        - error_no_face
        - error_pose
        - error_face_parsing
        - error_inference
        - exceed_nsfw_retry_limits
        - error_upload
        - unknown_internal_error
      description: >
        Errors:

        - \`error_exceed_max_image_size\`  - Input image size exceeds the
        maximum limit

        - \`exceed_max_filesize\` - Input file size exceeds the maximum limit

        - \`invalid_parameter\` - Invalid parameter value

        - \`error_download_image\` - Download source image error

        - \`error_download_mask\` - Download mask image error

        - \`error_decode_image\` - Decode source image error

        - \`error_decode_mask\` - Decode mask image error

        - \`error_nsfw_content_detected\` - NSFW content detected in source
        image

        - \`error_no_face\` - No face detected on source image

        - \`error_pose\` - Failed to detect pose on source image

        - \`error_face_parsing\` - Failed to do face segmentation on source
        image

        - \`error_inference\` - Inference pipeline error

        - \`exceed_nsfw_retry_limits\` - Exceed the retry limits to avoid
        generated NSFW image

        - \`error_upload\` - Upload result image error

        - \`unknown_internal_error\` - Others
    TaskStatusResponseBodySingleUrlResultsV2:
      type: object
      properties:
        url:
          type: string
          description: URL to download this result. Valid for 2 hours
          example: https://example.com/sample-result-url
    TaskStatusResponseV2:
      type: object
      properties:
        status:
          type: integer
          description: Response status
          example: 200
        data:
          type: object
          properties:
            task_status:
              type: string
              enum:
                - running
                - success
                - error
              description: Status of this task
            error:
              $ref: '#/components/schemas/EngineErrorCode'
            error_message:
              type: string
              description: Detailed description of error
            results: null
      $ref: '#/components/schemas/TaskStatusResponseBodySingleUrlResultsV2'
  responses:
    TemplateResponse:
      description: Successful retrieval of styles
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                description: Response status
                example: 200
              data:
                type: object
                properties:
                  templates:
                    type: array
                    items:
                      $ref: '#/components/schemas/Template'
                  next_token:
                    type: string
                    example: 73a3c9e69b89
                    description: Token to query next page.
    InvalidParameters:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 400
                description: Response status
              error:
                type: string
                example: Invalid parameter value
              error_code:
                type: string
                example: InvalidParameters
    InvalidApiKey:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 401
                description: Response status
              error:
                type: string
                example: Invalid API key
    TooManyRequests:
      description: Too many requests
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 429
                description: Response status
              error:
                type: string
                example: Too many requests
    InvalidTaskId:
      description: Invalid task ID
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 400
                description: Response status
              error:
                type: string
                example: Invalid task ID
    TaskTimeout:
      description: Task execution timeout
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 500
                description: Response status
              error:
                type: string
                example: Task execution timed out
