{
  "openapi": "3.0.0",
  "info": {
    "title": "AI ネックレスバーチャル試着",
    "description": "# 概要\nネックレスのバーチャル試着を作成します。\nAI の首元と鎖骨トラッキングにより、ネックレスの試着プレビューを生成します。\n\n2D 画像からネックレスのバーチャル試着を作成します。3D モデリングは不要です。\n\n## 統合ガイド\n本ガイドでは以下内容を説明します:\n\n*   **エンドポイント:** `/s2s/v2.0/task/2d-vto/necklace`\n*   **認証:** すべてのリクエストに `Authorization: Bearer YOUR_API_KEY` が必要です\n*   **ワークフロー:**\n    1.  **セルフィー画像を準備する:** 画像をアップロードするか、有効な画像 URL を提供します\n    2.  **ネックレス画像を準備する:** 画像をアップロードするか、ネックレス製品の有効な画像 URL を提供します\n    3.  **AI タスクを発行しタスク ID を取得する:** レスポンスから `task_id` を取得します。\n    4.  **ステータスをポーリングする（`GET`）:** `task_id` を使用してタスクのステータスを確認します。`task_status` が `\"success\"` または `\"error\"` になるまでポーリングを続行してください。\n\n---\n\n* API プレイグラウンド\n\nAPI プレイグラウンドで API を対話的にテストします:\n\n**API プレイグラウンド:**\n[http://yce.makeupar.com/api-console/en/api-playground/ai-necklace-virtual-try-on/](http://yce.makeupar.com/api-console/en/api-playground/ai-necklace-virtual-try-on/)\n\n---\n\n* 認証\n- リクエストヘッダーに **Bearer Token** を使用して API キーを含めます:\n    ```\n    Authorization: Bearer YOUR_API_KEY\n    ```\nAPI キーの確認場所: https://yce.makeupar.com/api-console/en/api-keys/.\n\n\n* 1. 画像のアップロード\n\nファイルをサーバーに直接アップロードするか、VTO タスクペイロードに有効な画像 URL を提供できます。\n\n   * アップロードエンドポイント\n\n```\nPOST /s2s/v2.0/file\n```\n\nすでにパブリックな画像 URL を持っている場合は、このステップをスキップできます。\n\nFile API のレスポンスで提供された URL にファイルを直接アップロードし、その後 File API が返した対応する `src_file_id` を使用して AI タスクを呼び出すことができます。または VTO タスクペイロードに有効な画像 URL を `src_file_url` として提供します。`src_file_id` または `src_file_url` がバーチャル試着の対象となります。\n\nまた、`src_file_id` または `src_file_url` に適用するネックレス製品画像を参照として `ref_file_ids` または `ref_file_urls` で提供する必要があります。\n\nAI エンジンでは、セルフィーの自動背景透過に対応しています。ただし、首（`srcmsk_file_id` または `srcmsk_file_url`）のオクルージョンマスク画像ファイルを提供してセグメンテーションを微調整できます。\n\n---\n\n* 2. ネックレス VTO タスクの作成と結果のポーリング\n\n画像とテンプレート ID が揃ったら、タスクを作成します。API はリクエストを非同期で処理します。ステータスが `success` または `error` に達するまでタスクステータスをポーリングする必要があります。\n\n   * タスク作成エンドポイント\n\n```\nPOST /s2s/v2.0/task/2d-vto/necklace\n```\n\n   * ポーリングエンドポイント\n\n```\nGET /s2s/v2.0/task/2d-vto/necklace/{task_id}\n```\n\n---\n\n## ファイル仕様とエラー\n\n* ネックレスバーチャル試着の仕様\n\n**サポートされるネックレスビュー**\n背景を除去した、ネックレスを着用した前面画像。\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/necklace_product_01_124206cfbe_3993a2128d.jpg)\n\n**サポートされるセルフィービュー**\n首が明確に見えており、遮蔽のない前面のセルフィー。頭の水平回転は 20 度以内でサポートされます。頭のサイズは比例したものであり、首の幅は画像幅の少なくとも 15 パーセントを占める必要があります。\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/Necklace_restriction_83410fb6c1.png)\n\n**necklace\\_wearing\\_location: array of two points (optional)**\nネックレスを配置すべき写真内のターゲット位置を指定します。\nデフォルト: null（エンジンのデフォルト）\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/wearing_location_874264bb70.jpg)\n\n**necklace\\_shadow\\_intensity: float (0.0 to 1.0)**\n影の強さを制御します:\n0.0 は影なしを示します\n1.0 は最大限の影を示します\nデフォルト値: 0.15\n\n**necklace\\_ambient\\_light\\_intensity: float (0.0 to 1.0)**\nライティングがセルフィー画像を参照する度合いを定義します:\n0.0 はセルフィー画像のライティングを無視します\n1.0 はセルフィー画像のライティングと影のレンダリングに完全に一致させます\nデフォルト値: 1.0\n\n**ネックレスアンカーポイント: ピクセル座標の 2 点の配列（任意）**\n製品画像内のネックレスチェーンの左右に見える端部のアンカーポイントを指定し、アラインメントに使用します。\nデフォルト: null（エンジンのデフォルト）\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/anchor_point_7f9b254ca4.jpg)\n\n---\n\n* サポートされる形式と寸法\n\n|AI 機能|サポートされる寸法|サポートされるファイルサイズ|サポートされる形式|\n|  ----  | ----  | ----  | ----  |\n|ネックレスバーチャル試着|長辺 <= 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 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": "アップロードされた画像からネックレスのバーチャル試着を生成します。アライメントとシャドウのパラメータをサポートします。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/2d-vto/necklace": {
      "post": {
        "summary": "AI 2D ネックレスバーチャル試着タスクを実行します。",
        "description": "このエンドポイントは、ネックレスのバーチャル試着プロセスを開始します。ソースファイルと参照画像（URL またはファイル ID 経由）、およびアライメント、シャドウ、着用位置のための特定のパラメータを指定する必要があります。タスクは非同期で処理され、このレスポンスで返される `task_id` を使用してステータスを確認できます。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NecklaceRunTaskV2"
              }
            }
          }
        },
        "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/2d-vto/necklace/{task_id}": {
      "get": {
        "summary": "AI 2D ネックレスバーチャル試着タスクのステータスを確認します。",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
            },
            "description": "確認するタスクの ID"
          }
        ],
        "responses": {
          "200": {
            "description": "タスクステータスの確認に成功しました",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskStatusResponseV2"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuthenticationV2": {
        "type": "http",
        "scheme": "bearer",
        "description": "標準の「Bearer 認証」を使用します。ヘッダーに `Authorization:Bearer YOUR_API_KEY` として「API キー」を指定してください。`Bearer` と `YOUR_API_KEY` の間に半角スペースがあることに注意してください。"
      }
    },
    "schemas": {
      "NecklaceRunTaskV2": {
        "allOf": [
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "src ファイル URL & srcmsk ファイル URL & ref ファイル URL でタスクを実行"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2SrcmskFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2RefFileUrls"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "src ファイル URL & srcmsk ファイル URL & ref ファイル ID でタスクを実行"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2SrcmskFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2RefFileIds"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "src ファイル ID & srcmsk ファイル ID & ref ファイル URL でタスクを実行"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2SrcmskFileId"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2RefFileUrls"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "src ファイル ID & srcmsk ファイル ID & ref ファイル ID でタスクを実行"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2SrcmskFileId"
                  },
                  {
                    "$ref": "#/components/schemas/2dVtoRunTaskV2RefFileIds"
                  }
                ]
              }
            ]
          },
          {
            "$ref": "#/components/schemas/2dVtoRunTaskV2SrcInfo"
          },
          {
            "type": "object",
            "required": [
              "object_infos"
            ],
            "properties": {
              "object_infos": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "name"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "参照 URL またはファイル ID。どの参照製品画像をマッチングするかを示します。",
                      "example": "https://example.com/vto_sku.jpg"
                    },
                    "parameter": {
                      "type": "object",
                      "description": "このリストに複数のオブジェクト情報を含めます。",
                      "properties": {
                        "necklace_need_remove_background": {
                          "type": "boolean",
                          "description": "ネックレス画像の背景透過が必要かどうか。",
                          "default": true,
                          "example": true
                        },
                        "necklace_anchor_point": {
                          "type": "array",
                          "description": "アライメントに使用されるネックレス画像のアンカーポイント。<br>型: 整数の 2x2 リスト<br>範囲: [[x, y], [x, y]]（ピクセル座標）<br>初期値: null（エンジンデフォルトを使用）",
                          "default": null,
                          "example": null,
                          "minItems": 2,
                          "maxItems": 2,
                          "items": {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "integer"
                            }
                          }
                        },
                        "necklace_wearing_location": {
                          "type": "array",
                          "description": "ネックレスを配置する写真上のターゲット位置。<br>型: 整数の 2x2 リスト<br>範囲: [[x, y], [x, y]]（ピクセル座標）<br>初期値: null（エンジンデフォルトを使用）",
                          "default": null,
                          "example": null,
                          "minItems": 2,
                          "maxItems": 2,
                          "items": {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                              "type": "integer"
                            }
                          }
                        },
                        "necklace_shadow_intensity": {
                          "type": "number",
                          "description": "ネックレスに適用されるシャドウ強度（高いほど濃いシャドウ）。",
                          "minimum": 0,
                          "maximum": 1,
                          "default": 0.5,
                          "example": 0.5
                        },
                        "necklace_ambient_light_intensity": {
                          "type": "number",
                          "description": "ネックレスの環境光調整強度。",
                          "minimum": 0,
                          "maximum": 1,
                          "default": 0.5,
                          "example": 0.5
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "BasicRunTaskV2SrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "タスクを実行するファイルの URL。この URL は公開されている必要があります。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "2dVtoRunTaskV2SrcmskFileUrl": {
        "type": "object",
        "properties": {
          "srcmsk_file_url": {
            "type": "string",
            "description": "タスクを実行するソースマスクファイルの URL。URL は公開されている必要があります。",
            "example": "https://example.com/src_mask.jpg"
          }
        }
      },
      "2dVtoRunTaskV2RefFileUrls": {
        "type": "object",
        "required": [
          "ref_file_urls"
        ],
        "properties": {
          "ref_file_urls": {
            "type": "array",
            "description": "タスク実行用の参照ファイルの URL です。URL は公開されている必要があります。",
            "example": [
              "https://example.com/vto_sku.jpg"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "2dVtoRunTaskV2RefFileIds": {
        "type": "object",
        "required": [
          "ref_file_ids"
        ],
        "properties": {
          "ref_file_ids": {
            "type": "array",
            "description": "タスク実行用の参照ファイルの ID です。ファイルアップロード API で取得したファイル ID です。",
            "example": [
              "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "タスクを実行するファイルの ID。ファイルアップロード API から取得したファイル ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "2dVtoRunTaskV2SrcmskFileId": {
        "type": "object",
        "properties": {
          "srcmsk_file_id": {
            "type": "string",
            "description": "タスクを実行するソースマスクファイルの ID。ファイルアップロード API から取得したファイル ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "2dVtoRunTaskV2SrcInfo": {
        "type": "object",
        "required": [
          "source_info"
        ],
        "properties": {
          "source_info": {
            "type": "object",
            "description": "ソース画像の情報を含みます。",
            "properties": {
              "name": {
                "type": "string",
                "description": "ソース URL またはファイル ID です。",
                "example": "https://example.com/selfie.jpg"
              },
              "mask_name": {
                "type": "string",
                "description": "ソースマスク URL またはファイル ID です。",
                "example": "https://example.com/src_mask.jpg"
              }
            },
            "required": [
              "name"
            ]
          }
        }
      },
      "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"
                }
              }
            }
          }
        }
      }
    }
  }
}