{
  "openapi": "3.0.0",
  "info": {
    "title": "髪型シミュレーション",
    "description": "# 概要\nAI 髪型シミュレーションで、さまざまな髪型を試します。\nカール、ロング、ベリーショートなどのスタイルに対応しています。\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/hair_style_v3_poster_bb1c7aad10.jpg)\n\n---\n\n## 統合ガイド\n\n* API プレイグラウンド\nAPI プレイグラウンドで AI 髪型シミュレーション機能をテストします。\n\nAPI プレイグラウンドにアクセスするには：\n<https://yce.makeupar.com/api-console/en/api-playground/ai-hair-style-generator/>\n\n---\n\n* API ワークフロー\nこのガイドでは、AI 髪型シミュレーション API のワークフローを説明します。\n\n**エンドポイント:** `/s2s/v2.1/task/hair-transfer`\n\n**認証必須:** `Authorization: Bearer YOUR_API_KEY`\n\n**ワークフロー手順:**\n\n1. **画像アップロード準備:**\n   - プロセスはセルフィーの準備から始まります。\n\n2. **プリセットテンプレートのリスト取得、または独自のリファレンス写真の使用**\n    **リファレンスソースの選択**\nスタイル参照には 2 つのオプションがあります。\n\n| オプション | 使用ケース | 実装ヒント |\n|-------|-----------|---------------------|\n| **プリセットテンプレート** (`template_id`) | 迅速な開始（例：「カールボブ」、「サイドスウェプトバングス」） | `/s2s/v2.1/task/template/hair-transfer` を呼び出し、`template_id` を選択します。 |\n| **カスタムリファレンス画像** (`ref_file_url` / `ref_file_id`) | ユーザーが自身のスタイル写真をアップロード、または提供された画像リンクを使用 | 同じファイル API を介してアップロードします。<BR>リファレンス画像がすでにオンラインでホストされている場合は `ref_file_url` を使用します。 |\n\n3. **AI タスクの開始とタスク ID の取得:**\n   - アップロードした画像とスタイル設定を HTTP POST リクエストで `/s2s/v2.0/file` に送信します。\n   - このインタラクションを識別する一意のタスク ID をレスポンスで待ちます。\n\n4. **タスクステータスのポーリング（継続的な確認）:**\n   - 取得した `task_id` を使用して、HTTP GET リクエスト（例：`GET /task/${task_id}`）でタスクステータスを定期的にポーリングします。\n   - 以下を継続的に監視します。\n     - `Task_status = \"success\"`（処理完了）。\n     - `Task_status = \"error\"`（該当する場合は解決または再試行）。\n   - ステータスが成功に遷移したら、ワークフローを適切に更新します。\n\n\n\n---\n\n* 認証\n- **Bearer トークン** を使用して、リクエストヘッダーに API キーを含めます。\n    ```\n    Authorization: Bearer YOUR_API_KEY\n    ```\nAPI キーの確認場所: https://yce.makeupar.com/api-console/en/api-keys/.\n\n---\n\n* API 使用ガイド\n\nこのガイドでは、画像のアップロード、リファレンス画像の準備、および AI 髪型シミュレーション API を使用したバーチャル試着タスクの作成方法について説明します。\n\n***\n\n   * ステップ 1. ファイル API を使用したファイルのアップロード、または有効な画像 URL の提供\n\n**ファイル API** (`/s2s/v2.0/file`) を使用して、対象ユーザーの画像をアップロードします。\n\nすでに公開されている画像 URL がある場合は、ステップ 1〜3 をスキップできます。\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\": \"selfie_01_3dbd1b6683.jpg\",\n        \"file_size\": 547541\n      }\n    ]\n  }'\n```\n\n***\n\n   * ステップ 2. ファイル 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. 提供された URL への画像アップロード\n\nファイル 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**テンプレート API** (`/s2s/v2.1/task/template/hair-transfer`) を使用して、プリセットリファレンステンプレートのリストを取得します。\n\n```bash\ncurl --request GET \\\n  --url 'https://yce-api-01.makeupar.com/s2s/v2.1/task/template/hair-transfer?page_size=20&starting_token=73a3c9e69b89' \\\n  --header 'Authorization: Bearer YOUR_API_KEY'\n```\n\n     * 4.2 リファレンス画像のアップロード\n\n以下が可能になります。\n\n*   ファイル API (`/s2s/v2.0/file`) を使用してリファレンス画像をアップロードする、または\n*   有効な画像 URL を提供する。\n\n**サポートされる画像:**\n\n*   リファレンス画像としての別のセルフィー写真。\n\n詳細な仕様については **[ファイル仕様とエラー](#section/overview/File-Specs-and-Errors)** を参照してください。\n\n***\n\n   * ステップ 5. AI 髪型シミュレーションタスクの作成\n\n**AI タスク API** (`/s2s/v2.1/task/hair-transfer`) を使用して、バーチャル試着タスクを作成します。\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.1/task/hair-transfer \\\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/selfie_03_cccd5d4803.jpeg\",\n    \"ref_file_url\": \"https://plugins-media.makeupar.com/strapi/assets/style_reference_full_body_01_5a000d999f.png\"\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.1/task/hair-transfer/<YOUR_TASK_ID> \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json'\n```\n\n***\n\n   * ステップ 7. 結果の取得\n\n成功したレスポンスには、結果画像のダウンロード URL が含まれます。\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\n無効な API キーエラーレスポンス：\n\n```json\n{\n  \"status\": 401,\n  \"error\": \"Unauthorized\",\n  \"error_code\": \"InvalidAccessToken\"\n}\n```\n\n---\n\nユースケース：\nユースケース：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/hair_style_v1_video_08513beb46.jpg)\n\n撮影方法の提案：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/AI_Hair_Extension_recommendation_ba24bd5d92.png)\n\n## ファイル仕様とエラー\n* サポートされる形式と寸法\n\n|AI 機能|サポートされる寸法|サポートされるファイルサイズ|サポートされる形式|\n|  ----  | ----  | ----  | ----  |\n|AI 髪型シミュレーション|長辺 <= 1024、顔幅 >= 128、顔のポーズ: -10 < pitch < +10, -45 < yaw < +45, -15 < roll < +15、単一の顔のみ、顔全体が見える必要がある|< 10MB|jpg/jpeg|\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n|error_no_shoulder\t|ソース画像に肩が見えません\n|error_large_face_angle\t|アップロードされた画像の顔の角度が大きすぎます\n|error_insufficient_landmarks\t|ソース画像で十分な顔または体のランドマークを検出できません\n|error_hair_too_short\t|入力された髪が短すぎます\n|error_face_pose\t|ソース画像の顔のポーズはサポートされていません\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## FAQ\n**Q: カスタムの髪型を試すことはできますか？**\n\n**A:** はい、独自のリファレンス写真を使用してカスタムの髪型を試すことができます。AI 髪型シミュレーションでは、希望する髪型を指定するための 2 つの方法をサポートしています。\n\n1. **独自のリファレンス画像のアップロード**\n   ファイル API (`/s2s/v2.0/file`) を介して、高解像度のセルフィーやスタイル写真（例：ターゲットの髪型をしている人物）をアップロードできます。アップロード後、AI タスク作成時に返された `file_id` または公開 URL をリファレンスソースとして使用します。\n\n2. **有効な画像 URL の提供**\n   リファレンス画像がすでにオンラインでホストされている場合（例：独自サーバーや CDN 上）、リクエストボディの `ref_file_url` フィールドに HTTPS URL を直接指定できます。\n\n`/s2s/v2.1/task/hair-transfer` を介してタスクを送信する際は、以下を含めます。\n- `src_file_id`（セルフィー）と `ref_file_id`（カスタムリファレンス画像）、\nまたは\n- `src_file_url` と `ref_file_url`。\n\n両方の画像が指定された要件を満たしていることを確認してください。\n- サポートされる形式：JPG/JPEG のみ\n- ファイルサイズは 10 MB 未満\n- 長辺 ≤ 1024 ピクセル\n- 顔幅 ≥ 128 ピクセル\n- 頭のポーズが許容範囲内（pitch: −10°〜+10°, yaw: −45°〜+45°, roll: −15°〜+15°）\n- 単一の顔が見え、髪がはっきり見える正面からの完全なビュー\n\nプリセットテンプレートだけでなく、写真リファレンスからも髪型を指定できます。\n\n---\n\n## ユニット消費量\n\n| AI 機能 | 消費ユニット |\n|---|---|\n| AI Hair Style Virtual Try-On V2.0 | プリセットモードで 1 ユニット <br> カスタムモードで 2 ユニット |\n| AI Hair Style Virtual Try-On V2.1 | プリセットモードで 2 ユニット <br> カスタムモードで 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": "V2.1",
      "description": "最新の AI 技術と新しいスタイルテンプレートにより、プラットフォームは新しい髪型の作成、特定のテンプレートベースのルックの適用、およびユーザー提供の参照画像からのスタイル転送が可能になります。"
    },
    {
      "name": "V2.0",
      "description": "ユーザー提供の参照画像から直接髪型を作成することで、最新のエンジンによる AI ドリブンのスタイル生成とテンプレートベースのアプリケーションもサポートします。"
    },
    {
      "name": "V1.0",
      "description": "AI 技術を使用して、新しい髪型の生成やテンプレートを通じた特定の髪型の適用を行います。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/template/hair-style": {
      "get": {
        "summary": "事前定義されたテンプレートを一覧表示します。",
        "tags": [
          "V1.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/HairStyleTemplateResponse"
          },
          "400": {
            "$ref": "#/components/responses/InvalidParameters"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          }
        }
      }
    },
    "/s2s/v2.0/task/hair-style": {
      "post": {
        "summary": "髪型シミュレーションタスクを実行します。",
        "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/RunWithSingleTemplateAndSrcUrl"
                  }
                ]
              }
            }
          }
        },
        "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/hair-style/{task_id}": {
      "get": {
        "summary": "髪型シミュレーションタスクのステータスを確認します。",
        "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"
          }
        }
      }
    },
    "/s2s/v2.0/task/hair-transfer": {
      "post": {
        "summary": "参照画像付きの髪型シミュレーションタスクを実行します。",
        "description": "AI タスクは非同期です。機能ごとに Webhook がサポートされている場合は、Webhook による完了処理を優先します。Webhook エンドポイントを設定し、Webhook 署名を検証したうえで、`success` または `error` の通知が来たら、受け取った `task_id` を使ってタスクの結果を照会します。設定と検証の詳細は [Webhook 統合ガイド](../develop/webhook.md) を参照してください。\n\nWebhook がサポートされていない場合、または統合に使えない場合は、ポーリングを実装します。AI タスクを送信した後、一定の間隔（例：10 秒ごと）でステータスエンドポイントをポーリングし、`success` または `error` になるまで待ちます。\n",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2WithRequiredRef"
                  }
                ]
              }
            }
          }
        },
        "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/hair-transfer/{task_id}": {
      "get": {
        "summary": "参照画像付きの髪型シミュレーションタスクのステータスを確認します。",
        "tags": [
          "V2.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.1/task/template/hair-transfer": {
      "get": {
        "summary": "v2.1 のプリセットテンプレートを一覧表示します。",
        "tags": [
          "V2.1"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/TemplatePageSize"
          },
          {
            "$ref": "#/components/parameters/TemplateStartingToken"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/HairStyleTemplateResponse"
          },
          "400": {
            "$ref": "#/components/responses/InvalidParameters"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          }
        }
      }
    },
    "/s2s/v2.1/task/hair-transfer": {
      "post": {
        "summary": "髪型シミュレーション v2.1 タスクを実行します。",
        "description": "AI タスクは非同期です。機能ごとに Webhook がサポートされている場合は、Webhook による完了処理を優先します。Webhook エンドポイントを設定し、Webhook 署名を検証したうえで、`success` または `error` の通知が来たら、受け取った `task_id` を使ってタスクの結果を照会します。設定と検証の詳細は [Webhook 統合ガイド](../develop/webhook.md) を参照してください。\n\nWebhook がサポートされていない場合、または統合に使えない場合は、ポーリングを実装します。AI タスクを送信した後、一定の間隔（例：10 秒ごと）でステータスエンドポイントをポーリングし、`success` または `error` になるまで待ちます。\n",
        "tags": [
          "V2.1"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/RunHairTransferTaskV2.1"
                  }
                ]
              }
            }
          }
        },
        "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.1/task/hair-transfer/{task_id}": {
      "get": {
        "summary": "髪型シミュレーション v2.1 タスクのステータスを確認します。",
        "tags": [
          "V2.1"
        ],
        "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": {
      "RunHairTransferTaskV2.1Template": {
        "required": [
          "template_id"
        ],
        "properties": {
          "template_id": {
            "type": "string",
            "description": "テンプレートの ID。まずプリセットテンプレートを一覧表示し、テンプレートの ID を使用します。",
            "example": "good_template_001"
          }
        }
      },
      "RunHairTransferTaskV2.1": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "hair_color": {
                "type": "string",
                "enum": [
                  "ref",
                  "src"
                ],
                "default": "ref",
                "description": "出力画像（ソース/参照）の髪の色を指定します。デフォルトは参照画像の色です。"
              }
            }
          },
          {
            "title": "ref_file_id、ref_file_url、template_id のいずれか 1 つを指定してください",
            "not": {
              "required": [
                "ref_file_url",
                "template_id"
              ]
            }
          },
          {
            "title": "`ref_file_id`、`ref_file_url`、または `template_id` のいずれか 1 つを指定してください",
            "not": {
              "required": [
                "ref_file_id",
                "template_id"
              ]
            }
          },
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "ソースファイル URL と参照ファイル URL でタスクを実行",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "ソースファイル URL と参照ファイル ID でタスクを実行",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "ソースファイル ID と参照ファイル URL でタスクを実行",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "ソースファイル ID と参照ファイル ID でタスクを実行",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "ソースファイル URL とテンプレートでタスクを実行"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunHairTransferTaskV2.1Template"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "ソースファイル ID とテンプレートでタスクを実行"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunHairTransferTaskV2.1Template"
                  }
                ]
              }
            ]
          }
        ]
      },
      "HairStyleTemplate": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Template"
          },
          {
            "type": "object",
            "properties": {
              "keep_users_color": {
                "type": "boolean"
              }
            }
          }
        ]
      },
      "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": "テンプレートのカテゴリー名。"
          }
        }
      },
      "RunWithSingleTemplate": {
        "title": "RunWithSingleTemplate",
        "type": "object",
        "properties": {
          "template_id": {
            "type": "string",
            "description": "テンプレートの ID。事前に定義されたテンプレートを一覧表示し、テンプレートの ID を使用します。",
            "example": "good_template_001"
          }
        },
        "required": [
          "template_id"
        ]
      },
      "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"
              }
            ]
          }
        ]
      },
      "RunWithSingleTemplateAndSrcUrl": {
        "title": "RunWithSingleTemplateAndSrcUrl",
        "allOf": [
          {
            "$ref": "#/components/schemas/RunWithSingleTemplate"
          },
          {
            "$ref": "#/components/schemas/BasicRunTaskV2"
          }
        ]
      },
      "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"
          }
        }
      },
      "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"
      },
      "BasicRunTaskV2RefFileUrl": {
        "type": "object",
        "properties": {
          "ref_file_url": {
            "type": "string",
            "description": "タスクを実行するための参照ファイルの URL。この URL は公開されている必要があります。",
            "example": "https://example.com/accessory.jpg"
          }
        }
      },
      "BasicRunTaskV2RefFileId": {
        "type": "object",
        "properties": {
          "ref_file_id": {
            "type": "string",
            "description": "タスクを実行するための参照ファイルの ID。ファイルアップロード API から取得したファイル ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2WithRequiredRef": {
        "title": "BasicRunTaskV2WithRef",
        "anyOf": [
          {
            "allOf": [
              {
                "title": "src ファイル URL と参照ファイル URL でタスクを実行",
                "required": [
                  "ref_file_url"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル URL と参照ファイル ID でタスクを実行",
                "required": [
                  "ref_file_id"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル ID と参照ファイル URL でタスクを実行",
                "required": [
                  "ref_file_url"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル ID と参照ファイル ID でタスクを実行",
                "required": [
                  "ref_file_id"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
              }
            ]
          }
        ]
      }
    },
    "responses": {
      "HairStyleTemplateResponse": {
        "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/HairStyleTemplate"
                      }
                    },
                    "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"
                }
              }
            }
          }
        }
      }
    },
    "parameters": {
      "TemplatePageSize": {
        "name": "page_size",
        "in": "query",
        "schema": {
          "type": "integer",
          "example": 20,
          "minimum": 1,
          "maximum": 20
        },
        "description": "このページで返される結果の数。有効な値は 1 から 20 の間です。初期値は 20 です。"
      },
      "TemplateStartingToken": {
        "name": "starting_token",
        "in": "query",
        "schema": {
          "type": "string",
          "example": "73a3c9e69b89"
        },
        "description": "現在のページのトークン。最初のページでは `null` で開始し、次のページを開始するには前のレスポンスの `next_token` を使用します"
      }
    }
  }
}