{
  "openapi": "3.0.0",
  "info": {
    "title": "カラコンバーチャル試着",
    "description": "# 概要\nカラコンバーチャル試着では、虹彩を検出し、レンズの不透明度とブレンドをシミュレートして目の色を変えます。\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2022-01-25/2a348e5b-6a2b-4f08-bc54-1d16a0777e87.jpg)\n\n**コンタクトレンズバーチャルシミュレーション**\n\nAI 駆動のバーチャル試着ツールで、目の色を変えます。虹彩を検出し、色調調整を適用します。\n\n**リアルな出力**  \n自然な目の反射を保持します。\n\n**コンタクトフィルターシミュレーション**  \n異なる虹彩のベースカラーにわたって不透明度とブレンドを再現します。\n\n---\n\n## 統合ガイド\n\n* セルフィーを撮影する\n\n    *   適切な照明の下でカメラに直接向きます。\n    *   JS Camera Kit を使用して写真をキャプチャします。\n\n* レンズスタイルの切り抜き画像を準備する\n\n*   **1 つの明確なレンズスタイル画像**を提供します：\n\n    *   形式：**PNG**（推奨：背景透過済み）\n    *   寸法：**200 × 200 ≤ W × H ≤ 600 × 600**\n    *   ファイルサイズ：**< 10 MB**\n\n    **サンプル：**\n\n    ![](https://d3ss46vukfdtpo.cloudfront.net/static/media/01.00ccf3ac.png)\n    ![](https://d3ss46vukfdtpo.cloudfront.net/static/media/02.c8beb3fc.png)\n\n* ***/s2s/v2.0/file*** API を介してアップロード URL とファイル ID を取得する\n\n    ファイル API レスポンスで返されたアップロード URL を使用して、以下のファイルをアップロードします：\n    *   セルフィー写真\n    *   レンズスタイル画像\n\n* AI タスク ***/s2s/v2.0/task/eye-color-vto*** を実行する\n\n    ファイル ID または画像 URL を入力ソースとして使用して AI タスクを実行します。効果パラメータを必要に応じて設定します。\n\n* タスクステータスのポーリング\n\n    返された **task\\_id** を使用してタスクの進捗を監視します。  \n    **GET /task/eye-color-vto** をポーリングしてエンジンのステータスを確認します。  \n    タスクは完了するまで **“running”** 状態のままです。タスク実行中はユニットは消費されません。\n\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/webp_9535461b-69fc-4432-b56b-2d7c4cd0bf3b_b1ef78e813.jpg)\n\n\n\n* **サンプルアプリケーションシナリオ**\n\n    - ステップ 1: 色を選ぶ\n    試着したい色合いを選択します。\n\n    - ステップ 2: バーチャル試着カメラを開く\n    バーチャル試着ツールを起動します。\n\n    - ステップ 3: ライブカメラを使用または写真をアップロードする\n    ライブカメラで撮影するか、写真をアップロードしてカラーコンタクトレンズをバーチャルに試着します。\n\n    ![](https://plugins-media.makeupar.com/smb/blog/post/2025-03-28/2732a9f0-9cae-4639-b765-15866550b109.jpg)\n\n## ファイル仕様とエラー\n* 対応形式と寸法\n\n|タイプ|対応寸法|対応ファイルサイズ|対応形式|\n|  ----  | ----  | ----  | ----  |\n|AI カラコンバーチャルシミュレーション|セルフィー画像:<br>    *   長辺 ≤ 1920 px <br>    *   短辺 ≥ 320 px <br><br>レンズスタイル画像:<br>    *   ファイル形式: PNG <br>    *   解像度: 200 × 200 ≤ W × H ≤ 600 × 600 px|< 10MB|jpg/png|\n\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n|error_below_min_image_size|画像の幅または高さが 320 ピクセル未満の場合、使用するには小さすぎます|\n|error_face_position_invalid|画像内で顔全体が完全に可視であり、一部が切れていない必要があります|\n|error_face_position_too_small|写真内の顔が小さすぎて適切に分析できません|\n|error_face_position_out_of_boundary|顔が大きすぎるか、写真の端の一部が外れています|\n|error_insufficient_lighting|照明が暗すぎて分析が困難です|\n|error_face_angle_invalid|顔の角度が適切ではありません。正面を向いた撮影では、頭を正面から 10 度以内に保ってください。横を向いた撮影では、角度が 15 度以上である必要があります|\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 Camera Kit\n{% partial file=\"/_partials/js-camera-kit.md\" /%}\n\n---\n\n## ユニット消費\n\n| AI 機能 | 消費ユニット |\n|---|---|\n| カラコンバーチャル試着 V1.0 | 1 |\n\n---\n",
    "version": "",
    "termsOfService": "https://www.makeupar.com/perfectbeauty/youcam/terms-of-service-api",
    "contact": {
      "email": "YouCamOnlineEditor_API@perfectcorp.com"
    },
    "license": {
      "name": "Privacy policy",
      "url": "https://www.makeupar.com/perfectbeauty/youcam/privacy-policy-api"
    }
  },
  "servers": [
    {
      "url": "https://yce-api-01.makeupar.com"
    }
  ],
  "tags": [
    {
      "name": "V1.0",
      "description": "バーチャル試着のための AI 駆動型カラコン機能。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/eye-color-vto": {
      "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/BasicRunTaskV2WithRequiredRef"
                  },
                  {
                    "type": "object",
                    "required": [
                      "version",
                      "effect"
                    ],
                    "properties": {
                      "version": {
                        "type": "string",
                        "enum": [
                          "1.0"
                        ]
                      },
                      "effect": {
                        "type": "object",
                        "required": [
                          "intensity"
                        ],
                        "properties": {
                          "intensity": {
                            "type": "integer",
                            "maximum": 100,
                            "minimum": 1
                          },
                          "enlargement": {
                            "type": "integer",
                            "maximum": 100,
                            "minimum": 0,
                            "default": 0
                          },
                          "skin_smooth_strength": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "default": 50
                          },
                          "skin_smooth_color_intensity": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "default": 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/eye-color-vto/{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": {
                  "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 認証' を使用します。ヘッダーに 'API キー' を設定してください: `Authorization:Bearer YOUR_API_KEY`。'Bearer' と 'YOUR_API_KEY' の間にスペースが 1 つ必要です。"
      }
    },
    "schemas": {
      "BasicRunTaskV2SrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "タスクを実行するファイルの URL。この URL は公開されている必要があります。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "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="
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_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"
              }
            ]
          }
        ]
      },
      "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"
      }
    },
    "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"
                }
              }
            }
          }
        }
      }
    }
  }
}