{
  "openapi": "3.0.0",
  "info": {
    "title": "ヘアカラー",
    "description": "# 概要\nヘアカラーチェンジャーで、幅広いヘアカラーを試せます。スライダーで選択したカラーの濃淡を調整できます。\n\n   * 画像をアップロード\n\nヘアカラーを変更したい写真をアップロードします。\n\n   * プリセットカラーを選択、またはパターンとパレットでカスタマイズ\n\n predefined なカラープリセットから選択するか、グラデーション（オンブレ）の適用範囲やブレンドを調整できます。\n\n> **警告:** プリセットとパターン＋パレットの両方が指定されている場合、プリセットが優先されます。\n\n> **警告:** 元の画像には、染めたい髪の領域が含まれている必要があります。適用前に確認してください。これはユーザー側の責任となります。\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/hair_color_s2_poster_dt_v2_49198cabc0.png)\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/01_1_1_8365c3b503.jpg)\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/01_2_1_abfcdb7eba.jpg)\n\n## ファイル仕様とエラー\n* 対応フォーマットとサイズ\n\n|AI 機能|対応サイズ|対応ファイルサイズ|対応フォーマット|\n|  ----  | ----  | ----  | ----  |\n|AI ヘアカラー|長辺 < 1920、顔幅 >= 100|< 10MB|jpg/jpeg/png|\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n|error_below_min_image_size|元の画像サイズが最小値より小さい（期待値: 幅 >= 320px、高さ >= 320px）\n|error_exceed_max_image_size|元の画像サイズが最大値より大きい（期待値: 幅 < 1920px、高さ < 1080px）\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## ユニット消費量\n\n| AI 機能 | 消費ユニット |\n|---|---|\n| AI ヘアカラーバーチャル試着 V1.0 | フルモードで 1 ユニット <br> オンブレモードで 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/hair-color": {
      "post": {
        "summary": "ヘアカラータスクを実行します。",
        "description": "このエンドポイントはヘアカラー変更プロセスを開始します。ソースファイル（URL または File ID 経由）を提供し、色設定（プリセット、パターン、またはパレット）を指定する必要があります。タスクは非同期で処理され、このレスポンスで返される task_id を使用してステータスを確認できます。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunHairColorTaskV2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ヘアカラータスクの実行に成功しました",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "タスクの実行に失敗しました",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/responses/RunError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/s2s/v2.0/task/hair-color/{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"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuthenticationV2": {
        "type": "http",
        "scheme": "bearer",
        "description": "標準の 'Bearer authentication' を使用します。ヘッダーに 'API Key' を設定してください: `Authorization:Bearer YOUR_API_KEY`。'Bearer' と 'YOUR_API_KEY' の間にスペースがある点にご注意ください。"
      }
    },
    "schemas": {
      "EngineErrorCode": {
        "type": "string",
        "nullable": true,
        "enum": [
          "exceed_max_filesize",
          "invalid_parameter",
          "error_download_image",
          "error_decode_image",
          "error_nsfw_content_detected",
          "error_inference",
          "unknown_internal_error"
        ],
        "description": "エラー:\n\n- `exceed_max_filesize` - 入力ファイルサイズが最大制限を超えています\n\n- `invalid_parameter` - 無効なパラメータ値\n\n- `error_download_image` - ソース画像のダウンロードエラー\n\n- `error_decode_image` - ソース画像のデコードエラー\n\n- `unknown_internal_error` - その他\n"
      },
      "FileV1.1": {
        "title": "File V1.1",
        "description": "このオブジェクトはファイルを表します。",
        "type": "object",
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "content_type",
                "file_name",
                "file_size"
              ],
              "properties": {
                "content_type": {
                  "type": "string",
                  "example": "image/jpg",
                  "description": "このファイルのコンテンツ MIME タイプ。現在利用可能な値は enum に記載されています。"
                },
                "file_name": {
                  "type": "string",
                  "example": "my-selfie.jpg",
                  "description": "このファイルの名前"
                },
                "file_size": {
                  "type": "integer",
                  "example": 50000,
                  "description": "このファイルのコンテンツ長（バイト単位）。10MB を超えてはなりません。"
                }
              }
            }
          }
        }
      },
      "BasicFileResponse": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "content_type": {
                  "type": "string",
                  "example": "image/jpg",
                  "description": "このファイルのコンテンツ MIME タイプ。"
                },
                "file_name": {
                  "type": "string",
                  "example": "my-selfie.jpg",
                  "description": "このファイルの名前"
                },
                "file_id": {
                  "type": "string",
                  "example": "U8aqJbsXGT537jtGnEDFHqxdDXqh8+oTF/cSkLimzuvVwMP+Jb1XbjPsf7ZgUgLY",
                  "description": "このファイルの ID。他のタスク実行 API でこの `file_id` が必要になります。"
                },
                "requests": {
                  "type": "array",
                  "description": "以下の `url`、`headers`、`method` を使用してファイルをアップロードします。完了後、`file_id` を使用してタスク実行 API の呼び出しを進めます。",
                  "items": {
                    "type": "object",
                    "properties": {
                      "headers": {
                        "type": "object",
                        "example": {
                          "Content-Type": "image/jpg",
                          "Content-Length": 50000
                        },
                        "description": "ファイルアップロード時に含めるヘッダー"
                      },
                      "url": {
                        "type": "string",
                        "example": "https://example.com/presigned-upload-url",
                        "description": "このファイルをアップロードする URL"
                      },
                      "method": {
                        "type": "string",
                        "example": "PUT",
                        "description": "このファイルをアップロードする HTTP メソッド"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "FileResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 200,
            "description": "レスポンスステータス"
          },
          "data": {
            "$ref": "#/components/schemas/BasicFileResponse"
          }
        }
      },
      "BasicRunTaskV2SrcFileUrl": {
        "title": "src file url でタスクを実行",
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "タスクを実行するファイルの URL。URL は公開アクセス可能である必要があります。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "title": "src file ID でタスクを実行",
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "タスクを実行するファイルの ID。ファイルアップロード API からの File ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2": {
        "title": "BasicRunTaskV2",
        "anyOf": [
          {
            "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
          },
          {
            "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
          }
        ]
      },
      "RunHairColorTaskParams": {
        "type": "object",
        "properties": {
          "preset": {
            "type": "string",
            "description": "(省略可; \"pattern\" と \"palettes\" のどちらも提供されない場合は必須)\nデフォルトのヘアカラープリセット。フルモードで利用可能: ['Jet Black',\n'Chocolate Brown', 'Honey Blonde', 'Platinum Blonde', 'Ash Gray',\n'Rose Gold', 'Burgundy', 'Copper Red', 'Lavender', 'Teal Blue']\nオンブレモードで利用可能: ['Dark Brown/Caramel Blonde', 'Jet\nBlack/Silver Gray', 'Ash Brown/Lavender', 'Rose Gold/Peach Blonde',\n'Burgundy/Magenta Pink', 'Deep Blue/Teal Green', 'Plum Purple/Pastel\nLilac', 'Copper Red/Golden Blonde', 'Dark Gray/Ice Blonde',\n'Midnight Blue/Denim Blue']\n",
            "enum": [
              "Jet Black",
              "Chocolate Brown",
              "Honey Blonde",
              "Platinum Blonde",
              "Ash Gray",
              "Rose Gold",
              "Burgundy",
              "Copper Red",
              "Lavender",
              "Teal Blue",
              "Dark Brown/Caramel Blonde",
              "Jet Black/Silver Gray",
              "Ash Brown/Lavender",
              "Rose Gold/Peach Blonde",
              "Burgundy/Magenta Pink",
              "Deep Blue/Teal Green",
              "Plum Purple/Pastel Lilac",
              "Copper Red/Golden Blonde",
              "Dark Gray/Ice Blonde",
              "Midnight Blue/Denim Blue"
            ]
          },
          "pattern": {
            "type": "object",
            "description": "(省略可; \"preset\" が提供されない場合は必須)",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "ombre",
                  "full"
                ],
                "description": "パターンタイプ（必須）"
              },
              "blend_strength": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100,
                "description": "(省略可; ombre には必須) ブレンド強度 (0–100)"
              },
              "line_offset": {
                "type": "number",
                "minimum": -0.99,
                "maximum": 0.99,
                "description": "(省略可; ombre には必須) 垂直オフセット (–0.99 ～ 0.99)。\n0.99: 上部の色が下半分の 99% をカバーします。   –0.99: 下部の色が上半分の 99% をカバーします\n"
              },
              "coloring_section": {
                "type": "string",
                "enum": [
                  "top"
                ],
                "description": "(省略可; ombre には必須) 色を付けるセクション"
              }
            }
          },
          "palettes": {
            "type": "array",
            "description": "(省略可; \"preset\" が指定されていない場合は必須)   フルモードでは配列長 1、\nombre モードでは 2\n",
            "minItems": 1,
            "maxItems": 2,
            "items": {
              "type": "object",
              "required": [
                "color"
              ],
              "properties": {
                "color": {
                  "type": "string",
                  "pattern": "^#([A-Fa-f0-9]{6})$",
                  "description": "16 進数カラーコード"
                },
                "color_intensity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100,
                  "description": "色の強度 (0–100)"
                },
                "shine_intensity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100,
                  "description": "ツヤの強度 (0–100)"
                }
              }
            }
          }
        }
      },
      "RunHairColorTaskV2": {
        "title": "RunHairColorTaskV2",
        "description": "このオブジェクトは、AI ヘアカラータスクの実行を表します。",
        "type": "object",
        "allOf": [
          {
            "$ref": "#/components/schemas/BasicRunTaskV2"
          },
          {
            "$ref": "#/components/schemas/RunHairColorTaskParams"
          }
        ]
      },
      "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"
              }
            }
          }
        }
      },
      "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": {
                "$ref": "#/components/schemas/TaskStatusResponseBodySingleUrlResultsV2"
              }
            }
          }
        }
      }
    },
    "responses": {
      "InvalidParameters": {
        "description": "無効なリクエストパラメータ",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 400,
                  "description": "レスポンスステータス"
                },
                "error": {
                  "type": "string",
                  "description": "エラーメッセージ",
                  "example": "The operation could not be completed"
                },
                "error_code": {
                  "type": "string",
                  "enum": [
                    "InvalidParameters"
                  ]
                }
              }
            }
          }
        }
      },
      "InvalidApiKey": {
        "description": "無効な API キー、または非アクティブな API キー、または期限切れの API キー",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 401,
                  "description": "レスポンスステータス"
                },
                "error_code": {
                  "type": "string",
                  "enum": [
                    "InvalidApiKey",
                    "InactiveApiKey",
                    "ExpiredApiKey"
                  ]
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "一定時間内にリクエストが多すぎます"
      },
      "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": [
              "CreditInsufficiency",
              "InvalidStyleGroup",
              "InvalidStyle",
              "BadRequest",
              "InvalidParameters"
            ]
          }
        }
      },
      "TaskTimeout": {
        "description": "タスクが期待される時間内にレスポンスを返さなかった",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "description": "レスポンスステータス",
                  "example": 500
                },
                "error_code": {
                  "type": "string",
                  "enum": [
                    "TaskTimeout"
                  ]
                }
              }
            }
          }
        }
      },
      "InvalidTaskId": {
        "description": "無効なタスク ID",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "description": "レスポンスステータス",
                  "example": 400
                },
                "error_code": {
                  "type": "string",
                  "enum": [
                    "InvalidTaskId"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}