{
  "openapi": "3.0.0",
  "info": {
    "title": "顔パーツ補正",
    "description": "# 概要\nAI 顔パーツ補正 API では、目、鼻、唇、顎、顔全体のパーツを補正します。\n美容治療ワークフローのビフォーアフタープレビューに使用します。\n\n* 鼻形成術（隆鼻術）\nオンライン鼻形成シミュレーターで、鼻梁、リフト、小鼻などをシミュレーションします。\n\n* 顎フィラー\n顎フィラーの効果をプレビューします。顎の長さと顎の形を調整します。\n\n* 唇フィラー\n唇フィラーの効果をプレビューします。唇のボリュームと形を調整します。\n\n* 眉リフト手術\n眉リフトの結果をプレビューします。\n\n\n\n## 統合ガイド\nこのガイドでは、以下を説明します：\n\nAI 顔パーツ補正 API のワークフロー：\n\n**エンドポイント:** `/s2s/v2.0/file`\n\n**認証が必要:** `Authorization: Bearer YOUR_API_KEY`\n\n**ワークフローの手順:**\n\n1. **画像アップロードの準備:**\n    - アップロード用のセルフィー画像を準備します。\n    - File API `/s2s/v2.0/file` を呼び出し、アップロード URL と関連する `file_id` を取得します。\n    - 提供されたアップロード URL を使用してセルフィー画像をアップロードします。\n\n2. **複数顔の場合のオプションの前処理:**\n    - 画像内に複数の顔がある場合、セルフィー画像を前処理します。\n\n3. **顔パーツ補正効果の設定:**\n   - まず、目、顔、唇、または鼻に適した顔パーツ補正パラメータを選択します。\n\n4. **AI タスクの開始とタスク ID の取得:**\n   - 選択した効果設定とともに `file_id` を HTTP POST リクエストで `/s2s/v2.0/task/face-reshape` に送信します。\n   - このやり取りを識別する一意のタスク ID をレスポンスで待ちます。\n\n5. **タスクステータスのポーリング（継続的な確認）:**\n   - 取得した `task_id` を使用し、HTTP GET リクエスト（例：`GET /s2s/v2.0/task/face-reshape/${task_id}`）で定期的にタスクステータスをポーリングします。\n   - 以下を継続的に監視します：\n     - `Task_status = \"success\"`（処理完了）。\n     - `Task_status = \"error\"`（該当する場合、解決または再試行）。\n   - ステータスが success に遷移したら、ワークフローを適切に更新します。\n\n\n\n---\n\n* API プレイグラウンド\n\nAPI プレイグラウンドで API を対話的にテストします：\n\n**API プレイグラウンド:**\n[http://yce.makeupar.com/api-console/en/api-playground/ai-face-reshape/](http://yce.makeupar.com/api-console/en/api-playground/ai-face-reshape/)\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\n1. 画像のアップロード\n\n    ファイルをサーバーに直接アップロードするか、AI タスクペイロードに有効な画像 URL を指定します。\n\n    * アップロードエンドポイント\n\n        ```\n        POST /s2s/v2.0/file\n        ```\n\n        すでに公開画像 URL がある場合は、この手順をスキップできます。\n\n---\n\n2. 効果テンプレートの準備\n\n   * 前処理\n        ピクセル座標で検出されたバウンディングボックスを出力します。結果のインデックスを使用して、後で顔パーツ補正 AI タスクを作成します。\n        ```\n        {\n            \"timed\": number,\n            \"result\": [\n                {\n                    \"left\": number,\n                    \"top\": number,\n                    \"width\": number,\n                    \"height\": number\n                }\n            ]\n        }\n        ```\n\n        * 効果テンプレート JSON スキーマ\n        ```\n        {\n            \"version\": \"1.0\",\n            \"index\": 0,\n            \"features\": {},\n            \"global\": {\n            \"skin_smooth_strength\": 50,\n            \"skin_smooth_color_intensity\": 50,\n            },\n        }\n        ```\n        index: 前処理で検出された顔のインデックス。省略可、初期値 0。\n        features: 少なくとも 1 つの非ゼロの顔パーツ補正パラメータが必要。すべてゼロにはできません。\n        skin_smooth_strength: 0~100\n        skin_smooth_color_intensity: 0~100\n\n        * 効果フォーマット\n        - 顔\n        初期範囲: -100~100\n        頬骨と顎の範囲: 0~100\n        すべての機能値が同時にゼロであってはなりません。少なくとも 1 つの機能値は非ゼロである必要があります\n        ```\n        {\n            \"cheekbones\": 0,\n            \"jaw\": 0,\n            \"face_reshape_left\": 0,\n            \"face_reshape_right\": 0,\n            \"face_width\": 0,\n            \"chin_reshape_left\": 0,\n            \"chin_reshape_right\": 0,\n            \"chin_length\": 0,\n        }\n        ```\n\n        - 目\n        初期範囲: -100~100\n        すべての機能値が同時にゼロであってはなりません。少なくとも 1 つの機能値は非ゼロである必要があります\n        ```\n        {\n            \"eye_size_left\": 0,\n            \"eye_size_right\": 0,\n            \"eye_distance\": 0,\n            \"eye_angle\": 0,\n            \"eye_height\": 0,\n            \"eye_width\": 0,\n        }\n        ```\n\n        - 鼻\n        初期範囲: -100~100\n        すべての機能値が同時にゼロであってはなりません。少なくとも 1 つの機能値は非ゼロである必要があります\n        ```\n        {\n            \"nose_bridge_width\": 0,\n            \"nose_lift\": 0,\n            \"nose_size\": 0,\n            \"nose_tip\": 0,\n            \"nose_tip_width\": 0,\n            \"nose_wing\": 0\n        }\n        ```\n\n        - 唇\n        初期範囲: -100~100\n        すべての機能値が同時にゼロであってはなりません。少なくとも 1 つの機能値は非ゼロである必要があります\n        ```\n        {\n            \"lip_size\": 0,\n            \"lip_width\": 0,\n            \"lip_peak\": 0,\n            \"lip_height_top\": 0,\n            \"lip_height_bottom\": 0,\n        }\n        ```\n\n        * ペイロードの例（送信可能）\n        ```\n        {\n        \"src_file_url\": \"https://plugins-media.makeupar.com/strapi/assets/face_reshape_01_85c8ffc055.jpg\",\n        \"version\": \"1.0\",\n        \"source\": \"yco\",\n        \"features\": {\n            \"eye_size_left\": 80,\n            \"eye_size_right\": 80,\n            \"eye_width\": 0,\n            \"eye_height\": 0,\n            \"eye_distance\": 0,\n            \"eye_angle\": 0,\n            \"face_reshape_left\": 0,\n            \"face_reshape_right\": 0,\n            \"chin_reshape_left\": 20,\n            \"chin_reshape_right\": 20,\n            \"chin_length\": 0,\n            \"face_width\": -30,\n            \"cheekbones\": 0,\n            \"jaw\": 0,\n            \"lip_size\": 10,\n            \"lip_width\": 40,\n            \"lip_height_top\": 10,\n            \"lip_height_bottom\": 10,\n            \"lip_peak\": -10,\n            \"nose_size\": 30,\n            \"nose_lift\": -20,\n            \"nose_bridge_width\": 10,\n            \"nose_tip\": -10,\n            \"nose_wing\": 30,\n            \"nose_tip_width\": 30\n        },\n        \"global\": {\n            \"skin_smooth_strength\": 50,\n            \"skin_smooth_color_intensity\": 50\n        }\n        }\n        ```\n\n\n3. 顔パーツ補正 AI タスクの作成と結果のポーリング\n\n    画像と完全な効果ペイロードが用意できたら、タスクを作成します。API はリクエストを非同期で処理します。タスクステータスが `success` または `error` に達するまでポーリングする必要があります。\n\n   * タスク作成エンドポイント\n\n        ```\n        POST /s2s/v2.0/task/face-reshape\n        ```\n\n   * ポーリングエンドポイント\n\n        ```\n        GET /s2s/v2.0/task/face-reshape/{task_id}\n        ```\n\n---\n\n## ファイル仕様とエラー\n\n* AI 顔パーツ補正仕様\n\n**サポートされるセルフィービュー**\n画像の幅と高さの 1/20 より大きい顔の幅と高さを持つセルフィー。\nピッチ、ヨー、ロールの顔角度は 30 度未満。\n\n![](https://plugins-media.makeupar.com/strapi/assets/thumbnail_face_reshape_01_85c8ffc055.jpg)\n\n\n\n**顔カスタマイズパラメータガイド**\n\n| カテゴリ | パラメータ        | 機能                             | 最小 (-100 / 0) | 最大 (100)    |\n| -------- | ---------------- | ------------------------------------ | -------------- | ------------ |\n| 目     | サイズ (左/右)       | 各目の全体的なサイズをスケーリング      | 小さい          | 大きい        |\n| 目     | 幅            | 水平方向の範囲を調整              | 狭い         | 広い         |\n| 目     | 高さ           | 垂直方向の範囲を調整                | 狭い / 平たい  | 丸い / 高い |\n| 目     | 間隔         | 目と目の間の間隔を調整         | 近い      | 遠い     |\n| 目     | 角度            | 回転の傾きを調整              | 内側傾き    | 外側傾き |\n| 顔     | サイズ (左/右)       | 顔の各側のサイズをスケーリング | 小さい          | 大きい        |\n| 顔     | 顎の形 (左/右) | 顎の輪郭の幅を調整           | 狭い         | 広い         |\n| 顔     | 顎の長さ      | 顎の垂直方向の長さを調整         | 短い          | 長い         |\n| 顔     | 幅            | 顔全体の幅を調整         | 狭い         | 広い         |\n| 顔     | 頬骨        | 頬骨の突出を調整         | 元 (0)   | 引き締める    |\n| 顔     | 顎              | 顎ラインの突出を調整           | 元 (0)   | 引き締める    |\n| 唇     | サイズ             | 唇全体のボリュームをスケーリング            | 小さい          | 大きい        |\n| 唇     | 幅            | 水平方向の範囲を調整              | 狭い         | 広い         |\n| 唇     | 上唇の高さ     | 上唇の厚さを調整            | 薄い           | 厚い         |\n| 唇     | 下唇の高さ     | 下唇の厚さを調整         | 薄い           | 厚い         |\n| 唇     | 山形            | キューピッドボウの鋭さを調整        | なめらか         | 明確      |\n| 鼻     | サイズ             | 鼻全体のサイズをスケーリング             | 小さい          | 大きい        |\n| 鼻     | リフト             | 垂直方向の位置を調整            | 低い            | 高い         |\n| 鼻     | 鼻梁           | 鼻梁の幅を調整                 | 狭い         | 広い         |\n| 鼻     | 鼻尖              | 鼻尖の垂直角度を調整    | 上向き             | 下向き         |\n| 鼻     | 小鼻             | 鼻孔の幅を調整                | 狭い         | 広い         |\n| 鼻     | 幅            | 鼻尖の幅を調整        | 狭い         | 広い         |\n\n**注意:** *“左”と“右”はキャラクターの視点であり、視聴者の画面の側ではありません。*\n\n\n---\n\n* サポートされる形式と寸法\n\n|AI 機能|サポートされる寸法|サポートされるファイルサイズ|サポートされる形式|\n|  ----  | ----  | ----  | ----  |\n|AI 顔パーツ補正|長辺 <= 4096|< 10MB|jpg/jpeg/png|\n\n* エラーコード\n\n| エラーコード | 説明 |\n|  ----  | ----  |\n| RUNTIME_ERROR | 顔パーツ補正の実行中に予期しないエラーが発生しました |\n| PHOTO_DETECTION_FAIL | ユーザー写真を正しく処理できませんでした。例えば、手が検出されませんでした |\n| OBJECT_DETECTION_FAIL | オブジェクト写真を正しく処理できませんでした。例えば、製品が検出されませんでした |\n| PHOTO_CHECK_INVALID | ユーザー写真のポーズまたはサイズが無効です |\n| INPUT_ERROR | 入力ファイル形式が正しくありません |\n| INPUT_MAIN_IMAGE_EMPTY | ユーザー画像が必要です |\n\n\n* 環境と依存関係\n\n| サンプルコード言語 / ツール | 推奨ランタイムバージョン |\n|---|---|\n| cURL | - bash >= 3.2</br>   - curl >= 7.58 (モダンな TLS/HTTP サポート)</br>   - jq >= 1.6 (堅牢な JSON 解析) |\n| Node.js (JavaScript) | Node >= 18 (グローバル fetch 用) |\n| JavaScript | - Chrome / Edge >= 80</br>   - Firefox >= 74</br>   - Safari >= 13.1 |\n| PHP | PHP >= 7.4 (モダンな TLS/互換性のため), ext-curl (推奨) または allow_url_fopen=On + ext-openssl, ext-json |\n| Python | Python >= 3.10 (f-strings 用), requests >= 2.20.0 |\n| Java | Java 11+ (HttpClient 用), Jackson Databind >= 2.12.0 |\n\n---\n\n## JS カメラキット\n{% partial file=\"/_partials/js-camera-kit.md\" /%}\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"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/face-reshape/pre-process": {
      "post": {
        "summary": "顔パーツ補正検出タスクを実行します。",
        "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-reshape/pre-process/{task_id}": {
      "get": {
        "summary": "顔パーツ補正検出タスクのステータスを確認します。",
        "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": []
          }
        ],
        "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/TaskStatusResponsePreProcessNoUrlBase"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "results": {
                              "type": "object",
                              "properties": {
                                "timed": {
                                  "type": "number"
                                },
                                "result": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "left": {
                                        "type": "number"
                                      },
                                      "top": {
                                        "type": "number"
                                      },
                                      "width": {
                                        "type": "number"
                                      },
                                      "height": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    },
    "/s2s/v2.0/task/face-reshape": {
      "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/BasicRunTaskV2"
                  },
                  {
                    "type": "object",
                    "required": [
                      "version",
                      "features",
                      "global"
                    ],
                    "properties": {
                      "version": {
                        "type": "string",
                        "description": "機能仕様のバージョン。特に指定がない限り、初期値は `\"1.0\"` です。\n",
                        "default": "1.0",
                        "example": "1.0"
                      },
                      "index": {
                        "type": "integer",
                        "example": 0,
                        "default": 0,
                        "description": "エフェクトを適用する対象オブジェクトのゼロベースインデックスです。複数のオブジェクトを含む画像では、まず前処理タスクを実行し、`data.results.result` 内のオブジェクト座標を確認したうえで、選択したオブジェクトのインデックスを指定します。\n\n前処理ステップでは、エフェクトを適用する前に、入力画像を解析して検出できるすべてのオブジェクトを特定します。検出タスクを実行し、バウンディングボックス座標のリストなど、各オブジェクトの構造化データを返します。このリスト内の各エントリの位置がゼロベースインデックスとして機能し、エフェクトの対象オブジェクトを指定するのに使います。\n\nこの情報は、一般的に `data.results.result` 配下で構造化された形式で返ります。\nこのステップを先に実行すると、以下ができます。\n    * 画像内に存在するオブジェクトの数を把握する\n    * オブジェクトの位置とサイズを確認する\n    * インデックスで正しい対象オブジェクトを選択する\n\n複数のオブジェクトを含む画像では、必ず前処理ステップを実行してください。\n`data.results.result` を確認して、オブジェクトとそのインデックスを特定してください。\n対応するゼロベースインデックスを使って、正しい対象を選択してください。\n"
                      },
                      "features": {
                        "type": "object",
                        "description": "すべてゼロにすることはできません",
                        "minProperties": 1,
                        "allOf": [
                          {
                            "$ref": "#/components/schemas/FaceReshapeFaceFeature"
                          },
                          {
                            "$ref": "#/components/schemas/FaceReshapeEyeFeature"
                          },
                          {
                            "$ref": "#/components/schemas/FaceReshapeNoseFeature"
                          },
                          {
                            "$ref": "#/components/schemas/FaceReshapeLipFeature"
                          }
                        ]
                      },
                      "global": {
                        "type": "object",
                        "description": "肌滑らかさ設定",
                        "properties": {
                          "skin_smooth_strength": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "example": 50
                          },
                          "skin_smooth_color_intensity": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "example": 50
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "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-reshape/{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/TaskStatusResponseV2"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "results": {
                              "type": "object",
                              "properties": {
                                "timed": {
                                  "type": "number"
                                },
                                "timed_apply": {
                                  "type": "number"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "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": {
      "FaceReshapeFaceFeature": {
        "type": "object",
        "properties": {
          "cheekbones": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "jaw": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "face_reshape": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100,
            "description": "顔の両側に適用されます。片側ごとのキー (`face_reshape_left` / `face_reshape_right`) は、その側のこの値を上書きします。片側ごとの `0` は、その側が変更されないことを意味します。"
          },
          "face_reshape_left": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "face_reshape_right": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "face_width": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "chin_reshape": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100,
            "description": "顎の両側に適用されます。片側ごとのキー (`chin_reshape_left` / `chin_reshape_right`) は、その側のこの値を上書きします。片側ごとの `0` は、その側が変更されないことを意味します。"
          },
          "chin_reshape_left": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "chin_reshape_right": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "chin_length": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          }
        },
        "example": {
          "cheekbones": 0,
          "jaw": 0,
          "face_reshape": 0,
          "face_reshape_left": 0,
          "face_reshape_right": 0,
          "face_width": 0,
          "chin_reshape": 0,
          "chin_reshape_left": 0,
          "chin_reshape_right": 0,
          "chin_length": 0
        }
      },
      "FaceReshapeEyeFeature": {
        "type": "object",
        "properties": {
          "eye_size": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100,
            "description": "両目に適用されます。片側ごとのキー (`eye_size_left` / `eye_size_right`) は、その側のこの値を上書きします。片側ごとの `0` は、その側が変更されないことを意味します。"
          },
          "eye_size_left": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "eye_size_right": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "eye_distance": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "eye_angle": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "eye_height": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "eye_width": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          }
        },
        "example": {
          "eye_size": 0,
          "eye_size_left": 0,
          "eye_size_right": 0,
          "eye_distance": 0,
          "eye_angle": 0,
          "eye_height": 0,
          "eye_width": 0
        }
      },
      "FaceReshapeNoseFeature": {
        "type": "object",
        "properties": {
          "nose_bridge_width": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "nose_lift": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "nose_size": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "nose_tip": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "nose_tip_width": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "nose_wing": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          }
        },
        "example": {
          "nose_bridge_width": 0,
          "nose_lift": 0,
          "nose_size": 0,
          "nose_tip": 0,
          "nose_tip_width": 0,
          "nose_wing": 0
        }
      },
      "FaceReshapeLipFeature": {
        "type": "object",
        "properties": {
          "lip_size": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "lip_width": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "lip_peak": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "lip_height_top": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          },
          "lip_height_bottom": {
            "type": "integer",
            "minimum": -100,
            "maximum": 100
          }
        },
        "example": {
          "lip_size": 0,
          "lip_width": 0,
          "lip_peak": 0,
          "lip_height_top": 0,
          "lip_height_bottom": 0
        }
      },
      "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"
      },
      "TaskStatusResponsePreProcessNoUrlBase": {
        "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": "エラーの詳細な説明"
              }
            }
          }
        }
      },
      "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"
      }
    },
    "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"
                }
              }
            }
          }
        }
      }
    }
  }
}