{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 顔交換",
    "description": "# 概要\nAI 顔交換では、写真内の顔を交換します。1 つまたは複数の顔の交換に対応しています。\n\n## 統合ガイド\n* AI 顔交換の実装方法\n\n   * ステップ 1: ソース画像と参照画像のアップロード\n\n      1. API からアップロード 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        ボディ:\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. 指定された URL に対して HTTP PUT リクエストでファイルをアップロードします。\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        ボディ:\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. API は `task_id` を返します。\n        2. タスクのステータスを次の URL でポーリングします:\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            配列内の各要素は、2 つのプロパティを含むオブジェクトです:\n\n            | パラメータ | 型 | 説明 |\n            | :--- | :--- | :--- |\n            | `position` | `integer` | **ソース画像**内で検出された顔のインデックス（例: 0, 1, 2）。 |\n            | `index` | `integer` | 交換対象となる**参照画像リスト**内の顔画像のインデックス。 |\n\n                * ロジックルール\n            1.  **インデックスマッピング:** `index` は、参照リストに提供された画像の順序に直接対応します。\n                *   `0`: 1 番目の参照画像。\n                *   `1`: 2 番目の参照画像。\n            2.  **交換のスキップ:** ソース内で検出された特定の顔の交換をスキップするには、`index` と `position` の両方を `-1` に設定します。\n            3.  **配列の順序:** 配列内のオブジェクトの順序は、`position` に基づいて一致させる必要があります。\n\n                * 使用例\n\n            **シナリオ:**\n            *   **参照リスト:** 2 枚の画像を提供（画像 A、画像 B）。\n            *   **ソース画像:** 3 つの顔が検出される（顔 0、顔 1、顔 2）。\n\n            **目標:**\n            *   **顔 0**（ソース）を**画像 1**（参照）と交換する。\n            *   **顔 1**（ソース）の交換をスキップする。\n            *   **顔 2**（ソース）を**画像 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        ボディ:\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. 次の URL でポーリングします:\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        * **Web フロントエンド**では、fetch または Axios を使用して JavaScript で直接実装できます。\n        * **バックエンド**（Node.js、Python、Java、PHP など）では、標準的な HTTP ライブラリを使用して同じエンドポイントを使用できます。\n        * タスクは非同期で実行されるため、リトライとエラーハンドリングを実装してください。\n\n---\n\n    * デバッグガイド\n        1. **Invalid TaskId エラー**\n            </br>**理由:** タイムアウトしたタスクのステータスを確認しようとすると、InvalidTaskId エラーが発生します。したがって、AI タスクが開始されたら、ステータスが success または error に変わるまで、polling_interval 内でステータスをポーリングする必要があります。\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 | NSFW 画像の生成を避けるためのリトライ制限を超えました |\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 顔交換 API を使用すると、事前定義されたテンプレートまたは手動マッピングを使用して、ターゲット画像と 1 つ以上の参照画像の間で顔を交換できます。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/face-swap/pre-process": {
      "post": {
        "summary": "AI 顔交換の顔検出タスクを実行します。",
        "description": "ソース画像に複数の有効なターゲットが含まれる可能性がある場合、またはエフェクトを適用する検出ターゲットを明示的に選びたい場合は、前処理タスクを使います。単一ターゲットの画像では、機能がデフォルトの `index` 値をサポートしているため、手動でのターゲット選択が不要な場合は前処理をスキップできます。\n\n前処理タスクは、ソース画像内の候補ターゲットを検出し、その座標を `data.results.result` に返します。結果配列の各項目は、検出された 1 つのターゲットを表します。返された座標を確認し、ソース画像内の意図した顔や領域に対応づけたうえで、エフェクトタスクを作成する際にその項目のゼロベース配列インデックスを `index` 値として使います。\n\n複数の顔や領域が検出された画像では、前処理の結果を確認せずにデフォルトの `index` 値に頼らないでください。エフェクトは `index` で選択されたターゲットにしか適用されないため、エフェクトタスクを実行する前に、意図したターゲットに対応する結果項目を確認する必要があります。\n\nこのタスクは非同期です。タスクを作成した後、機能がサポートしている場合は 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\nWebhook がサポートされていない場合、または統合に使えない場合は、ポーリングを実装します。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": "ターゲット画像で検出された各顔に対して交換する、指定された参照画像 ID と顔位置情報。\n\nロジックルール\n  1.  インデックスマッピング: `index` は、参照リストで提供される画像の順序に直接対応します。\n  2.  交換のスキップ: ソースで検出された特定の顔の交換をスキップするには、`index` と `position` の両方を `-1` に設定します。\n  3.  配列の順序: 配列内のオブジェクトの順序は、`position` に基づいて一致させる必要があります。\n\n\n使用例シナリオ\n\nシナリオ:\n  参照リスト: 2 枚の画像を提供 (画像 A、画像 B)。\n  ソース画像: 3 つの顔が検出される (顔 0、顔 1、顔 2)。\n\n\n目標:\n  顔 0 (ソース) を画像 1 (参照) と交換。\n  顔 1 (ソース) の交換をスキップ。\n  顔 2 (ソース) を画像 0 (参照) と交換。\n\n\n設定:\n  \"face_mapping\": [\n      {\n          \"index\": 1,  // 2 番目の参照画像を使用\n          \"position\": 0 // ソースで最初に検出された顔に適用\n      },\n      {\n          \"index\": -1, // 交換をスキップ\n          \"position\": -1 // 交換をスキップ\n      },\n      {\n          \"index\": 0,  // 1 番目の参照画像を使用\n          \"position\": 2 // ソースで 3 番目に検出された顔に適用\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 authentication' を使用します。ヘッダーに 'API Key' を設定してください: `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。ファイルアップロード API から取得したファイル ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2": {
        "title": "BasicRunTaskV2",
        "anyOf": [
          {
            "title": "src ファイル URL でタスクを実行",
            "allOf": [
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              }
            ]
          },
          {
            "title": "src ファイル 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"
          }
        }
      },
      "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` - その他\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。ファイルアップロード API から取得したファイル ID です。",
              "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
            }
          }
        }
      },
      "BasicRunTaskV2WithMultiRequiredRef": {
        "title": "BasicRunTaskV2WithRef",
        "anyOf": [
          {
            "allOf": [
              {
                "title": "src ファイル URL と参照ファイル URL でタスクを実行",
                "required": [
                  "ref_file_urls"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrls"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル URL と参照ファイル ID でタスクを実行",
                "required": [
                  "ref_file_ids"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileIds"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル ID と参照ファイル URL でタスクを実行",
                "required": [
                  "ref_file_urls"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrls"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル 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"
                }
              }
            }
          }
        }
      }
    }
  }
}