{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 换脸",
    "description": "# 概览\n用 AI 视频换脸做出逼真到位的效果，并支持多人脸。我们的人脸换脸人工智能支持一次换一张或多张脸。不管是想做搞怪换脸图，还是需要一套专业工具，我们都能满足。\n\n## 接入指南\n* 如何实现 AI 换脸\n\n   * 第 1 步：上传源图与参考图\n\n      1. 向接口请求上传 URL：\n\n        ```\n        POST https://yce-api-01.makeupar.com/s2s/v2.0/file\n        Authorization: Bearer YOUR_API_KEY\n        Content-Type: application/json\n        ```\n\n        Body：\n\n        ```json\n        {\n            \"files\": [\n            {\n                \"file_name\": \"target.jpg\",\n                \"file_size\": 123456,\n                \"content_type\": \"image/jpeg\"\n            }\n            ]\n        }\n        ```\n        1. 响应会给出一个预签名的**上传 URL** 和一个 `file_id`。\n        2. 用 HTTP PUT 请求把文件上传到该 URL。\n        3. 保存 `file_id` 备用。**目标图**与**参考图**都要重复这一套流程。\n\n      2. 把实际文件上传到**上传 URL**。\n\n---\n\n   * 第 2 步：预处理源图与参考图（人脸检测）\n\n        1. 创建预处理任务：\n\n        ```\n        POST https://yce-api-01.makeupar.com/s2s/v2.0/task/face-swap/pre-process\n        Authorization: Bearer YOUR_API_KEY\n        Content-Type: application/json\n        ```\n\n        Body：\n\n        ```json\n        {\n            \"request_id\": 1,\n            \"payload\": {\n            \"file_sets\": {\n                \"src_ids\": [\"TARGET_FILE_ID\"]\n            },\n            \"actions\": [\n                { \"id\": 0 }\n            ]\n            }\n        }\n        ```\n        1. 接口返回一个 `task_id`。\n        2. 在此接口轮询任务状态：\n\n        ```\n        GET https://yce-api-01.makeupar.com/s2s/v2.0/task/face-swap/pre-process?task_id=TASK_ID\n        ```\n        1. 处理完成后，您会收到一份带边界框的检测到的人脸列表。\n\n---\n\n   * 第 3 步：执行换脸任务\n        1. 指定哪些参考图的脸去替换源图中的哪张脸\n        `face_mapping` 数组定义了**源图**中的人脸如何被**参考图列表**中的人脸替换，作用相当于把源图中检测到的人脸与指定参考图串起来的关联表。\n\n        * 结构\n\n            数组中的每个元素是一个包含两个属性的对象：\n\n            | 参数 | 类型 | 说明 |\n            | :--- | :--- | :--- |\n            | `position` | `integer` | **源图**中检测到的人脸下标（例如 0、1、2）。 |\n            | `index` | `integer` | **参考图列表**中要与之互换的人脸图片下标。 |\n\n                * 逻辑规则\n            1.  **下标映射：** `index` 直接对应您在参考图列表中提供的图片顺序。\n                *   `0`：第一张参考图。\n                *   `1`：第二张参考图。\n            2.  **跳过互换：** 要跳过源图中某张检测到的人脸，把 `index` 与 `position` 都设为 `-1`。\n            3.  **数组顺序：** 数组中各对象的排列顺序需与 `position` 对应。\n\n                * 使用示例\n\n            **场景：**\n            *   **参考图列表：** 提供 2 张图片（Image A、Image B）。\n            *   **源图：** 检测到 3 张脸（Face 0、Face 1、Face 2）。\n\n            **目标：**\n            *   把 **Face 0**（源图）与 **Image 1**（参考图）互换。\n            *   跳过 **Face 1**（源图）。\n            *   把 **Face 2**（源图）与 **Image 0**（参考图）互换。\n\n            **配置：**\n\n            ```json\n            \"face_mapping\": [\n                {\n                    \"index\": 1,  // Use the second reference image\n                    \"position\": 0 // Apply to the first detected face in source\n                },\n                {\n                    \"index\": -1, // Skip swapping\n                    \"position\": -1 // Skip swapping\n                },\n                {\n                    \"index\": 0,  // Use the first reference image\n                    \"position\": 2 // Apply to the third detected face in source\n                }\n            ]\n            ```\n\n        1. 发送主任务请求：\n\n        ```\n        POST https://yce-api-01.makeupar.com/s2s/v2.0/task/face-swap\n        Authorization: Bearer YOUR_API_KEY\n        Content-Type: application/json\n        ```\n\n        Body：\n\n        ```json\n        {\n            \"request_id\": 2,\n            \"payload\": {\n            \"file_sets\": {\n                \"src_ids\": [\"TARGET_FILE_ID\"],\n                \"ref_ids\": [\"REFERENCE_FILE_ID\"]\n            },\n            \"actions\": [\n                {\n                \"id\": 0,\n                \"params\": {\n                    \"face_mapping\": [\n                    { \"index\": 0, \"position\": 0 },\n                    { \"index\": -1, \"position\": -1 }\n                    ]\n                }\n                }\n            ]\n            }\n        }\n        ```\n        1. 响应返回一个 `task_id`。\n\n---\n\n   * 第 4 步：轮询任务状态并取回结果\n        需要实现一个定时循环，在允许的轮询窗口内按固定间隔查询任务状态。\n        1. 在此接口轮询：\n\n        ```\n        GET https://yce-api-01.makeupar.com/s2s/v2.0/task/face-swap?task_id=TASK_ID\n        ```\n        2. 当 `status` 为 `success` 时，响应中包含生成图片的 URL。\n        3. 从该 URL 下载或展示图片。\n\n---\n\n   * 第 5 步：接入您的平台\n\n        * 在**网页前端**，可以直接用 JavaScript 的 fetch 或 Axios 实现。\n        * 在**后端**（Node.js、Python、Java、PHP 等），用标准 HTTP 库调用同样的接口即可。\n        * 任务是异步执行的，请实现重试与错误处理。\n\n---\n\n    * 排障指引\n        1. **Invalid TaskId 报错**\n            </br>**原因：** 若去查询已超时任务的状态，会收到 InvalidTaskId 错误。因此，发起 AI 任务之后，需要在 polling_interval 内持续轮询其状态，直到状态变为 success 或 error。\n            </br>**解决办法：** 为避免任务失效，需要实现一个定时循环，在允许的轮询窗口内按固定间隔查询任务状态。\n\n        2. **为什么源图里有些脸没被检测到**\n            </br>**原因：** 理由：人脸必须清楚可见、没有被覆盖或遮挡，且在图片中足够大\n            </br>**解决办法：** 重新拍一张照片，让脸部更大、清楚可见，没有任何遮盖或遮挡\n\n---\n\n## 输入与输出\n\n* 实际案例：\n多人换脸示例：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/dt_yce_face_swap_S2_img_04_d4b747a41d.jpg)\n\n单人脸换脸示例：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/dt_yce_face_swap_S2_img_05_8e68faff2c.jpg)\n\n* 拍摄建议：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/webp_AI%20Skin%20Analysis_camera_f93315b088.png)\n\n\n## 文件规格与错误码\n* 支持的格式与尺寸\n\n|AI 功能|支持尺寸|支持文件大小|支持格式|\n|  ----  | ----  | ----  | ----  |\n|AI 换脸|输入与输出：长边不得超过 4096 像素|< 10MB|jpg/jpeg/png|\n\n\n* 错误码\n\n| 错误码 | 说明 |\n| ------------------ | ----------- |\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_download_video | 下载源视频出错 |\n| error_decode_video | 解码源视频出错 |\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 | 为避免生成不适宜内容，重试次数已超限 |\n| error_upload | 上传结果图片出错 |\n| error_multiple_people | 人数超出上限 |\n| error_no_shoulder | 源图中看不到肩部 |\n| error_large_face_angle | 上传图片中的脸部角度过大 |\n| error_unsupport_ratio | 输入图片的宽高比不受支持 |\n| unknown_internal_error | 其他内部错误 |\n\n---\n\n## 点数消耗\n\n| AI 功能 | 消耗点数 |\n|---|---|\n| AI 换脸 V1.0 | 1 |\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": "V1.0",
      "description": "AI 换脸接口支持用预置模板或手动对应关系，把目标图片与一张或多张参考图进行换脸。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/face-swap/pre-process": {
      "post": {
        "summary": "执行 AI 换脸人脸检测任务。",
        "description": "当源图中可能存在多个有效目标，或您的接入需要显式指定特效作用在哪个已检测目标上时，请使用预处理任务。若图片只有一个目标，且功能支持默认的 `index` 取值、您的应用也不需要手动挑选目标，这一步可以省略。\n\n预处理任务会在源图中检测候选目标，并把它们的坐标返回在 `data.results.result` 中。结果数组里的每一项对应一个检测到的目标。请查看返回的坐标，与源图中您要处理的脸部或区域对应起来，然后在创建特效任务时，把该项的下标（从 0 开始）作为 `index` 传入。\n\n图中检测到多张脸或多个区域时，请不要不看预处理结果就直接使用默认的 `index` 取值。特效只会作用在 `index` 选中的那个目标上，因此在运行特效任务之前，接入方必须先确认结果中哪一项才是您要处理的目标。\n\n本任务为异步任务。创建任务后，若功能支持 Webhook，请用 Webhook 接收完成通知；否则轮询对应的预处理状态接口，直到 `data.task_status` 变为 `success` 或 `error`。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2"
                  }
                ]
              }
            }
          }
        },
        "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/face-swap/pre-process/{task_id}": {
      "get": {
        "summary": "查询 AI 换脸人脸检测任务的状态。",
        "tags": [
          "V1.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": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/TaskStatusResponsePreProcessBase"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "results": {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string",
                                  "description": "下载该结果的 URL，有效期 2 小时",
                                  "example": "https://example.com/sample-result-url"
                                },
                                "faces": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "bbox": {
                                        "type": "array",
                                        "description": "人脸位置，由 4 个数字组成， 格式为 [x1, y1, x2, y2]， 其中 (x1, y1) 是左上角， (x2, y2) 是右下角。",
                                        "items": {
                                          "type": "integer",
                                          "example": [
                                            0,
                                            0,
                                            100,
                                            100
                                          ]
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    },
    "/s2s/v2.0/task/face-swap": {
      "post": {
        "summary": "执行 AI 换脸 任务。",
        "description": "AI 任务是异步处理的。功能支持 Webhook 时，优先用 Webhook 来接收完成通知。配置好您的 Webhook 端点、校验 Webhook 签名，收到 `success` 或 `error` 通知后，用收到的 `task_id` 查询任务结果。配置与校验的细节请见 [Webhook 接入指南](/develop/webhook.md)。\n\n若功能不支持 Webhook，或您的接入方式用不了 Webhook，就请实现轮询。提交 AI 任务后，按固定间隔（例如每 10 秒）轮询状态接口，直到任务状态变为 `success` 或 `error`。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2WithMultiRequiredRef"
                  },
                  {
                    "type": "object",
                    "required": [
                      "face_mapping"
                    ],
                    "properties": {
                      "face_mapping": {
                        "type": "array",
                        "description": "指定要在目标图片每张已检测到的人脸上替换的参考图标识与人脸位置信息。\n\n对应规则\n  1.  下标对应：`index` 直接对应您参考图中图片的顺序。\n  2.  跳过替换：要跳过源图中某一张人脸，把 `index` 和 `position` 都设为 `-1`。\n  3.  数组顺序：数组中各对象的顺序应按 `position` 对齐。\n\n\n示例场景\n\n场景：\n  参考图：提供 2 张（图 A、图 B）。\n  源图：检测到 3 张人脸（Face 0、Face 1、Face 2）。\n\n\n目标：\n  把 Face 0（源图）与图 1（参考图）替换。\n  跳过 Face 1（源图）。\n  把 Face 2（源图）与图 0（参考图）替换。\n\n\n配置：\n  \"face_mapping\": [\n      {\n          \"index\": 1,  // Use the second reference image\n          \"position\": 0 // Apply to the first detected face in source\n      },\n      {\n          \"index\": -1, // Skip swapping\n          \"position\": -1 // Skip swapping\n      },\n      {\n          \"index\": 0,  // Use the first reference image\n          \"position\": 2 // Apply to the third detected face in source\n      }\n  ]\n",
                        "items": {
                          "type": "object",
                          "properties": {
                            "index": {
                              "type": "integer",
                              "description": "参考图的下标"
                            },
                            "position": {
                              "type": "integer",
                              "description": "目标图片上人脸的编号，取自检测结果中的人脸顺序。"
                            }
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "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/face-swap/{task_id}": {
      "get": {
        "summary": "查询 AI 换脸 任务的状态。",
        "tags": [
          "V1.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 鉴权。把您的 API 密钥放进请求头： `Authorization:Bearer YOUR_API_KEY`。请注意 'Bearer' 与 'YOUR_API_KEY' 之间有一个空格。"
      }
    },
    "schemas": {
      "BasicRunTaskV2SrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "用于运行任务的文件 URL，该 URL 需可公开访问。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "用于运行任务的文件 ID，取自上传文件接口返回的 file_id。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2": {
        "title": "BasicRunTaskV2",
        "anyOf": [
          {
            "title": "用源文件 URL 运行任务",
            "allOf": [
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              }
            ]
          },
          {
            "title": "用源文件 ID 运行任务",
            "allOf": [
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              }
            ]
          }
        ]
      },
      "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\\` - 为避免生成不适宜内容， 重试次数已用尽\n- \\`error_upload\\` - 上传结果图片出错\n- \\`unknown_internal_error\\` - 其他错误\n"
      },
      "TaskStatusResponseBodySingleUrlResultsV2": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "下载该结果的 URL，有效期 2 小时",
            "example": "https://example.com/sample-result-url"
          }
        }
      },
      "TaskStatusResponsePreProcessBase": {
        "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": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TaskStatusResponseBodySingleUrlResultsV2"
                  }
                ]
              }
            }
          }
        }
      },
      "BasicRunTaskV2RefFileUrls": {
        "type": "object",
        "properties": {
          "ref_file_urls": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "description": "用于运行任务的参考文件 URL，该 URL 需可公开访问。",
              "example": "https://example.com/accessory.jpg"
            }
          }
        }
      },
      "BasicRunTaskV2RefFileIds": {
        "type": "object",
        "properties": {
          "ref_file_ids": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "description": "用于运行任务的参考文件 ID 列表，取自上传文件接口返回的 file_id。",
              "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
            }
          }
        }
      },
      "BasicRunTaskV2WithMultiRequiredRef": {
        "title": "BasicRunTaskV2WithRef",
        "anyOf": [
          {
            "allOf": [
              {
                "title": "以源文件 URL 与多张参考文件 URL 运行任务",
                "required": [
                  "ref_file_urls"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrls"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "以源文件 URL 与多张参考文件 ID 运行任务",
                "required": [
                  "ref_file_ids"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileIds"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "以源文件 ID 与多张参考文件 URL 运行任务",
                "required": [
                  "ref_file_urls"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrls"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "以源文件 ID 与多张参考文件 ID 运行任务",
                "required": [
                  "ref_file_ids"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileIds"
              }
            ]
          }
        ]
      },
      "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": {
      "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"
                }
              }
            }
          }
        }
      }
    }
  }
}