{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 虛擬換裝",
    "description": "# 概述\nAI 虛擬換裝是虛擬試衣間，讓使用者無需實際穿著即可試穿服裝。運用 AI 與照片編輯技術，這些應用將穿搭疊加到您的圖片上，讓你看見不同風格與合身度在您身形上的樣子。非常適合線上購物、風格靈感，或單純玩味時尚想法。用 AI 虛擬換裝服裝。上傳任何服飾參考，與您的照片交換穿搭，即刻完成虛擬衣櫃的轉換。\n\n---\n\n## 整合指南\n\n* API Playground\n您可以使用 API Playground 測試 AI 虛擬換裝功能。這讓您可以實驗自己的想法，並更深入了解試穿流程。\n\n在此存取 API Playground：\n<https://yce.makeupar.com/api-console/en/api-playground/ai-clothes/>\n\n---\n\n* AI 虛擬換裝 API 使用指南\n\n本指南說明如何使用 AI 虛擬換裝 API 上傳圖片、準備參考穿搭，以及建立虛擬試穿任務。\n\n***\n\n   * 步驟 1. 使用 File API 上傳檔案\n\n使用 **File API**（`/s2s/v2.0/file`）上傳目標使用者圖片。\n\n**圖片需求：**\n\n*   上傳高解析度的全身照片。\n*   確保照片清楚呈現整個身體。\n*   避免有多人干擾的物件背景。\n\n**請求範例：**\n\n```bash\ncurl --request POST \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/file \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json' \\\n  --data '{\n    \"files\": [\n {\n   \"content_type\": \"image/jpg\",\n   \"file_name\": \"full_body_photo_01_3dbd1b6683.jpg\",\n   \"file_size\": 547541\n }\n    ]\n  }'\n```\n\n***\n\n   * 步驟 2. 取得 File API 回應\n\n回應包含：\n\n*   用於建立 AI 任務的 `file_id`。\n*   用於上傳實際圖片檔案的 `requests.url`。\n\n**回應範例：**\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"files\": [\n {\n   \"content_type\": \"image/jpg\",\n   \"file_name\": \"full_body_photo_01_3dbd1b6683.jpg\",\n   \"file_id\": \"SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9/13W5TOD8/u/FfjK3xgCQ+hRt9MJXBFaud\",\n   \"requests\": [\n {\n  \"method\": \"PUT\",\n  \"url\": \"https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...\",\n  \"headers\": {\n    \"Content-Length\": \"547541\",\n    \"Content-Type\": \"image/jpg\"\n  }\n }\n   ]\n }\n    ]\n  }\n}\n```\n\n***\n\n   * 步驟 3. 上傳圖片到提供的網址\n\n使用 File API 回應中的 `requests.url` 上傳圖片：\n\n```bash\ncurl --location --request PUT 'https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...' \\\n  --header 'Content-Type: image/jpg' \\\n  --header 'Content-Length: 547541' \\\n  --data-binary @'./full_body_photo_01_3dbd1b6683.jpg'\n```\n\n***\n\n   * 步驟 4. 準備參考穿搭\n\n * 4.1 上傳參考穿搭圖片\n\n您可以：\n\n*   使用 File API（`/s2s/v2.0/file`）上傳穿搭圖片，或\n*   提供有效的圖片網址。\n\n**支援的穿搭圖片：**\n\n*   服裝的產品圖片。\n*   全身照片作為穿搭參考。\n\n詳細規格請參考 **[檔案規格與錯誤](#section/overview/File-Specs-and-Errors)**。\n\n***\n\n   * 步驟 5. 建立 AI 任務\n\n使用 **AI 任務 API**（`/s2s/v2.0/task/cloth-v4`）建立虛擬試穿任務。\n\n**參數：**\n\n*   使用者圖片：`src_file_id` 或 `src_file_url`。\n*   穿搭圖片：`ref_file_id`、`ref_file_url` 或 `template_id`。\n\n**請求範例：**\n\n```bash\ncurl --request POST \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/cloth-v4 \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json' \\\n  --data '{\n    \"src_file_url\": \"https://plugins-media.makeupar.com/strapi/assets/clothes_03_cccd5d4803.jpeg\",\n    \"ref_file_url\": \"https://plugins-media.makeupar.com/strapi/assets/clothes_reference_full_body_01_5a000d999f.png\",\n    \"garment_category\": \"full_body\"\n  }'\n```\n\n**回應範例：**\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"task_id\": \"SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9_13W5TOD8_u_GPi6NqQ3dhlmN-6ntFwhzT\"\n  }\n}\n```\n\n***\n\n   * 步驟 6. 輪詢任務結果\n\n使用任務 ID 查詢狀態：\n\n```bash\ncurl --request GET \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/cloth-v4/<YOUR_TASK_ID> \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json'\n```\n\n***\n\n   * 步驟 7. 取得結果\n\n成功的回應會包含結果圖片的下載網址：\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"error\": null,\n    \"results\": {\n \"url\": \"https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...\"\n    },\n    \"task_status\": \"success\"\n  }\n}\n```\n\nAPI Key 無效的錯誤回應：\n\n```json\n{\n  \"status\": 401,\n  \"error\": \"Unauthorized\",\n  \"error_code\": \"InvalidAccessToken\"\n}\n```\n\n---\n\n應用案例：\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-05-08/b80f4ae1-c905-4ec0-b491-e42c15e65575.gif)\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/01%20ai%20clothes%20changer.jpg)\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2023-12-01/45f451aa-4b4f-466d-9da7-4538573c92af.jpg)\n\n拍攝建議：\n![拍攝建議](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/AI-Cloth-Guideline.png \"拍攝建議\")\n\n\n## 檔案規格與錯誤\n* 支援的格式與尺寸\n\n|類型|支援的尺寸|支援的檔案大小|支援的格式|\n|  ---- | ---- | ---- | ---- |\n|目標使用者圖片|建議 1024×768，最小 512×384，最大邊 4096 px。</br></br> - 僅限單人。</br> - 為達到最佳結果，人物應佔畫面至少 80%。</br> - 圖片應僅包含上半身，從胸部往上。無需呈現腹部，但肩膀應可見。</br> - 臉部必須完全可見，無遮擋。</br> - 身體必須面向前方並採站姿（不可坐著或蹲著）。 |< 10MB|jpg/png|\n|服裝參考圖片 |建議 1024×768，最小 512×384，最大邊 4096 px。</br></br> - 若使用真人服裝照片作為參考</br>&nbsp;&nbsp;&nbsp;- 必須僅包含一人。</br>&nbsp;&nbsp;&nbsp;- 可見的服裝區域必須完整覆蓋預期的試穿區域。</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 範例：全身試穿時，半身服裝圖片不可接受。</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 範例：下半身試穿時，部分褲子不可接受。</br>&nbsp;&nbsp;&nbsp;- 服裝不得被嚴重遮擋（例如被長髮或手臂覆蓋）。</br>&nbsp;&nbsp;&nbsp;- 臉部必須完全可見，無遮擋。</br>&nbsp;&nbsp;&nbsp;- 身體必須面向前方並採站姿（不可坐著或蹲著）。 </br></br> - 若使用產品圖片作為參考</br>&nbsp;&nbsp;&nbsp;- 必須是單一服飾的正面產品照。</br>&nbsp;&nbsp;&nbsp;- 不要使用合成圖片（例如上下裝在同一張照片）。</br>&nbsp;&nbsp;&nbsp;- 下半身僅支援實際穿著的穿搭，不支援獨立的產品圖片。|< 10MB|jpg/png|\n\n* 錯誤代碼\n\n* 錯誤代碼（前處理）\n\n| 錯誤代碼 | 說明 |\n| ---------- | ----------- |\n| exceed_max_filesize | SRC 或 REF 圖片過大。長邊不得超過 4096 像素。 |\n| error_below_min_image_size | SRC 或 REF 圖片過小。長邊至少需 128 像素。 |\n| error_pose | 無法從上傳的人物 SRC 圖片偵測姿勢。 |\n| error_invalid_ref | REF 圖片無效，例如為空，或主體未完全可見。 |\n| error_apply_region_mismatch | SRC 圖片的套用區域與 REF 圖片不符，因此無法套用任何編輯。 |\n| error_invalid_src | 當來源圖片僅顯示下半身或僅顯示腳部時。 |\n\n* 錯誤代碼（引擎）\n\n| 錯誤代碼 | 說明 |\n| ---------- | ----------- |\n| invalid_parameter | - 服飾類別無效。 <br> - Style_id 不在 inference_style_list 中。 <br> - src_keys、dst_keys 或 acts 無效。 <br> - ref_keys 或 template_ref_image 無效。 <br> - 必須提供其中恰好一項。 |\n| error_download_image | 無法下載 SRC 或 REF 圖片。 |\n| exceed_max_filesize | SRC 或 REF 圖片過大。檔案大小不得超過 10 MB。 |\n| error_nsfw_content_detected | 在結果圖片中偵測到潛在的 NSFW 內容。 |\n| error_editing_failed | 編輯過程失敗，因為結果圖片與來源圖片過於相似。 |\n| unknown_internal_error | - 載入模型失敗。 <br> - 排程演算法類型無效。 <br> - 未載入引擎。 <br> - 檔案不在上傳結果中。 |\n| error_multi_person | 在「normal」或「strict」多人篩選設定下，系統在來源或參考圖片中偵測到多人。 |\n\n\n* 環境與相依性\n\n| 範例程式語言 / 工具 | 建議的執行環境版本 |\n|---|---|\n| cURL | - bash >= 3.2</br>   - curl >= 7.58（現代 TLS/HTTP 支援）</br>   - jq >= 1.6（穩健的 JSON 解析） |\n| Node.js（JavaScript） | Node >= 18（支援全域 fetch） |\n| JavaScript | - Chrome / Edge >= 80</br>   - Firefox >= 74</br>   - Safari >= 13.1 |\n| PHP | PHP >= 7.4（現代 TLS/相容性），ext-curl（建議）或 allow_url_fopen=On + ext-openssl、ext-json |\n| Python | Python >= 3.10（支援 f-strings），requests >= 2.20.0 |\n| Java | Java 11+（支援 HttpClient），Jackson Databind >= 2.12.0 |\n\n---\n\n## 點數消耗\n\n| AI 功能 | 消耗的點數 |\n|---|---|\n| AI 虛擬換裝 V2.0 | 2 |\n| AI 虛擬換裝 V3.0 | 2 |\n\n---\n",
    "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": "增強的功能納入外套（包含夾克與背心）的虛擬試穿。您現在可選擇全身、上半身、下半身、鞋子或外套進行虛擬試穿，或直接選擇 Auto，讓 AI 引擎為您創造完美的穿搭。"
    },
    {
      "name": "V3.0",
      "description": "升級的 AI 虛擬換裝 v3 引擎帶來出色的布料真實感，可精準呈現皮革、針織與緞面等材質，同時以更精確的方式還原細緻的服裝細節。"
    },
    {
      "name": "V2.0",
      "description": "使用 AI 技術為服飾項目生成虛擬試穿體驗，支援範本與參考圖片兩種方式。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/template/cloth": {
      "get": {
        "summary": "列出預先定義的範本。",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 20
            },
            "description": "這一頁要回傳的結果數量。有效值應介於 1 到 20 之間。預設為 20。"
          },
          {
            "name": "starting_token",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "73a3c9e69b89"
            },
            "description": "目前頁面的令牌。第一頁以 `null` 開始，並使用上一個回應中的 `next_token` 開始下一頁"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TemplateResponse"
          },
          "400": {
            "$ref": "#/components/responses/InvalidParameters"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          }
        }
      }
    },
    "/s2s/v2.0/task/cloth": {
      "post": {
        "summary": "執行 AI 虛擬換裝任務。",
        "description": "這個端點啟動服飾虛擬試穿流程。您可以使用範本 ID，或提供參考圖片（來源與參考檔案）。任務會以非同步方式處理，您可以使用這個回應回傳的 task_id 查詢其狀態。\n",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunClothsTaskV2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "AI 虛擬換裝任務執行成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "任務執行失敗",
            "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": "查詢 AI 虛擬換裝任務的狀態。",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
            },
            "description": "要查詢的任務 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "成功查詢 AI 虛擬換裝任務的狀態",
            "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": "執行 AI 虛擬換裝 V3 任務。",
        "description": "AI 任務是非同步的。當功能支援 webhook 時，請優先使用以 webhook 為基礎的完成處理。設定您的 webhook 端點、驗證 webhook 簽章，並在收到 `success` 或 `error` 通知後，使用收到的 `task_id` 查詢任務結果。設定與驗證細節請見 [webhook 整合指南](/develop/webhook.md)。\n\n若您的整合不支援 webhook 或無法使用 webhook，請實作輪詢。送出 AI 任務後，以固定間隔（例如每 10 秒）輪詢狀態端點，直到任務狀態為 `success` 或 `error`。\n",
        "tags": [
          "V3.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/RunClothV3Task"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任務執行成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "任務執行失敗",
            "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": "查詢 AI 虛擬換裝 V3 任務的狀態。",
        "tags": [
          "V3.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
            },
            "description": "要查詢的任務 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "成功查詢任務狀態",
            "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": "執行 AI 虛擬換裝 V4 任務。",
        "x-display-name": "AI Clothes Virtual Try-On",
        "x-engine-version": "V4.0",
        "description": "AI 任務是非同步的。當功能支援 webhook 時，請優先使用以 webhook 為基礎的完成處理。設定您的 webhook 端點、驗證 webhook 簽章，並在收到 `success` 或 `error` 通知後，使用收到的 `task_id` 查詢任務結果。設定與驗證細節請見 [webhook 整合指南](/develop/webhook.md)。\n\n若您的整合不支援 webhook 或無法使用 webhook，請實作輪詢。送出 AI 任務後，以固定間隔（例如每 10 秒）輪詢狀態端點，直到任務狀態為 `success` 或 `error`。\n",
        "tags": [
          "V4.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/RunClothV4Task"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任務執行成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "任務執行失敗",
            "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": "查詢 AI 虛擬換裝 V4 任務的狀態。",
        "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"
          }
        ],
        "responses": {
          "200": {
            "description": "成功查詢任務狀態",
            "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": "使用標準的 'Bearer authentication'。請在標頭中放入您的 'API Key'：`Authorization:Bearer YOUR_API_KEY`。請注意 'Bearer' 與 'YOUR_API_KEY' 之間有一個空格。"
      }
    },
    "schemas": {
      "RunClothsTaskV2Template": {
        "required": [
          "template_id"
        ],
        "properties": {
          "template_id": {
            "type": "string",
            "description": "範本的 ID。請先列出預先定義的範本，然後使用某個範本的 id。",
            "example": "good_template_001"
          }
        }
      },
      "RunClothsTaskV2GarmentCategory": {
        "required": [
          "garment_category"
        ],
        "properties": {
          "garment_category": {
            "type": "string",
            "enum": [
              "full_body",
              "lower_body",
              "upper_body",
              "shoes",
              "auto"
            ],
            "description": "參考圖片的服飾類別。提供參考圖片時為必要。請使用 \"auto\" 參數，讓 AI 引擎自動辨識並分類服飾類別。"
          }
        }
      },
      "RunClothsTaskV2": {
        "allOf": [
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "以來源檔案網址與參考檔案網址執行任務",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案網址與參考檔案 ID 執行任務",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案 ID 與參考檔案網址執行任務",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案 ID 與參考檔案 ID 執行任務",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案網址與範本執行任務"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2Template"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案 ID 與範本執行任務"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2Template"
                  }
                ]
              }
            ]
          },
          {
            "properties": {
              "change_shoes": {
                "type": "boolean",
                "default": true,
                "description": "控制當可處理的全身參考圖片包含鞋子時，是否應交換鞋子。"
              }
            }
          }
        ]
      },
      "RunClothV3Task": {
        "allOf": [
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "以來源檔案網址與參考檔案網址執行任務",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案網址與參考檔案 ID 執行任務",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案 ID 與參考檔案網址執行任務",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案 ID 與參考檔案 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": "控制當可處理的全身參考圖片包含鞋子時，是否應交換鞋子。\n<br> 當 `garment_category` 為 `full_body` 或 `lower_body` 時生效\n"
              }
            }
          }
        ]
      },
      "RunClothsTaskV4GarmentCategory": {
        "required": [
          "garment_category"
        ],
        "properties": {
          "garment_category": {
            "type": "string",
            "enum": [
              "full_body",
              "lower_body",
              "upper_body",
              "shoes",
              "auto",
              "outer"
            ],
            "description": "參考圖片的服飾類別。提供參考圖片時為必要。請使用 \"auto\" 參數，讓 AI 引擎自動辨識並分類服飾類別。"
          }
        }
      },
      "RunClothV4Task": {
        "allOf": [
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "以來源檔案網址與參考檔案網址執行任務",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV4GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案網址與參考檔案 ID 執行任務",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV4GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案 ID 與參考檔案網址執行任務",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV4GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以來源檔案 ID 與參考檔案 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": "控制當可處理的全身參考圖片包含鞋子時，是否應交換鞋子。\n<br> 當 `garment_category` 為 `full_body` 或 `lower_body` 時生效\n"
              },
              "filter_multi_person": {
                "type": "string",
                "enum": [
                  "off",
                  "normal",
                  "strict"
                ],
                "default": "off",
                "description": "過濾來源照片與人物參考照片中的多人情況。\n<br> `off` - 不過濾。引擎使用圖片中最大的人物。\n<br> `normal` - 當另一人物與主體大小相近，或在同一平面上清晰可見時拒絕，例如站在附近、臉部清晰可辨識。典型的合照或雙人照片。遠處或模糊的背景人物會被忽略。\n<br> `strict` - 當可見任何額外人物時拒絕，包括细小、遠處、背景，或模糊／失焦的人物。\n"
              }
            }
          }
        ]
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "範本的 ID。執行任務時作為 \\`template_id\\` 使用。",
            "example": "good_template_001"
          },
          "thumb": {
            "type": "string",
            "description": "風格的縮略圖。"
          },
          "title": {
            "type": "string",
            "description": "範本的標題。"
          },
          "category_name": {
            "type": "string",
            "description": "範本的類別名稱。"
          }
        }
      },
      "BasicRunTaskV2SrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "要執行任務的檔案網址。該網址應可公開存取。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2RefFileUrl": {
        "type": "object",
        "properties": {
          "ref_file_url": {
            "type": "string",
            "description": "執行任務所用參考檔案的網址。該網址需可公開存取。",
            "example": "https://example.com/accessory.jpg"
          }
        }
      },
      "BasicRunTaskV2RefFileId": {
        "type": "object",
        "properties": {
          "ref_file_id": {
            "type": "string",
            "description": "執行任務所用參考檔案的 ID。來自上傳檔案 API 的檔案 ID。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "要執行任務的檔案 ID。檔案 ID 來自上傳檔案 API。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "回應狀態",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "task_id": {
                "type": "string",
                "description": "這個任務的 ID。任務結果可以此 ID 查詢，有效期限 24 小時。",
                "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
              }
            }
          }
        }
      },
      "RunError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "回應狀態",
            "example": 400
          },
          "error": {
            "type": "string",
            "description": "錯誤訊息",
            "example": "The operation could not be completed"
          },
          "error_code": {
            "type": "string",
            "enum": [
              "InvalidParameters",
              "CreditInsufficiency",
              "InvalidStyleGroup",
              "InvalidStyle",
              "BadRequest"
            ],
            "description": "錯誤代碼：\n* InvalidParameters - 請求參數無效\n* CreditInsufficiency - 點數不足，無法執行\n* BadRequest - 非預期的請求參數\n* InvalidStyleGroup - 風格群組 id 無效\n* InvalidStyle - 風格 id 無效\n"
          }
        }
      },
      "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": "錯誤：\n- \\`error_exceed_max_image_size\\`  - 輸入圖片尺寸超過上限\n- \\`exceed_max_filesize\\` - 輸入檔案大小超過上限\n- \\`invalid_parameter\\` - 參數值無效\n- \\`error_download_image\\` - 下載來源圖片錯誤\n- \\`error_download_mask\\` - 下載遮罩圖片錯誤\n- \\`error_decode_image\\` - 解析來源圖片錯誤\n- \\`error_decode_mask\\` - 解析遮罩圖片錯誤\n- \\`error_nsfw_content_detected\\` - 在來源圖片中偵測到 NSFW 內容\n- \\`error_no_face\\` - 來源圖片未偵測到臉部\n- \\`error_pose\\` - 無法偵測來源圖片的姿势\n- \\`error_face_parsing\\` - 無法對來源圖片進行臉部分割\n- \\`error_inference\\` - 推論流程錯誤\n- \\`exceed_nsfw_retry_limits\\` - 超過重試上限以避免產生 NSFW 圖片\n- \\`error_upload\\` - 上傳結果圖片錯誤\n- \\`unknown_internal_error\\` - 其他"
      },
      "TaskStatusResponseBodySingleUrlResultsV2": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "下載這個結果的網址。有效期限 2 小時",
            "example": "https://example.com/sample-result-url"
          }
        }
      },
      "TaskStatusResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "回應狀態",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "task_status": {
                "type": "string",
                "enum": [
                  "running",
                  "success",
                  "error"
                ],
                "description": "這個任務的狀態"
              },
              "error": {
                "$ref": "#/components/schemas/EngineErrorCode"
              },
              "error_message": {
                "type": "string",
                "description": "錯誤的詳細說明"
              },
              "results": null
            }
          }
        },
        "$ref": "#/components/schemas/TaskStatusResponseBodySingleUrlResultsV2"
      }
    },
    "responses": {
      "TemplateResponse": {
        "description": "成功取得風格",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "description": "回應狀態",
                  "example": 200
                },
                "data": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Template"
                      }
                    },
                    "next_token": {
                      "type": "string",
                      "example": "73a3c9e69b89",
                      "description": "查詢下一頁的令牌。"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "InvalidParameters": {
        "description": "請求參數無效",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 400,
                  "description": "回應狀態"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid parameter value"
                },
                "error_code": {
                  "type": "string",
                  "example": "InvalidParameters"
                }
              }
            }
          }
        }
      },
      "InvalidApiKey": {
        "description": "API 金鑰無效或缺失",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 401,
                  "description": "回應狀態"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid API key"
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "請求過多",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 429,
                  "description": "回應狀態"
                },
                "error": {
                  "type": "string",
                  "example": "Too many requests"
                }
              }
            }
          }
        }
      },
      "InvalidTaskId": {
        "description": "任務 ID 無效",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 400,
                  "description": "回應狀態"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid task ID"
                }
              }
            }
          }
        }
      },
      "TaskTimeout": {
        "description": "任務執行逾時",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 500,
                  "description": "回應狀態"
                },
                "error": {
                  "type": "string",
                  "example": "Task execution timed out"
                }
              }
            }
          }
        }
      }
    }
  }
}