{
  "openapi": "3.0.0",
  "info": {
    "title": "AI ヘアエクステ",
    "description": "# 概要\nAI で理想のヘアエクステを見つけよう\n長さはロングからエクストラロングまで、スタイル、カラー、前髪など、さまざまな組み合わせをデバイス上で試せます。生成 AI により、ヘアエクステのスタイルがどのように見えるかを確認できます。\n現在の髪の長さに自然に馴染む AI ヘアエクステで、超ロングスタイルを試す絶好の機会です。\n\nユースケース:\n![AI ヘアエクステ](https://bcw-media.s3.ap-northeast-1.amazonaws.com/YCE_web_Hair_Extension_Filter_S2_img_07_098b6e08c4.jpg \"AI Hair Extension\")\n\n![AI ヘアエクステ](https://bcw-media.s3.ap-northeast-1.amazonaws.com/YCE_web_Hair_Extension_Filter_S1_img_01_eab88fe3e2.jpg \"AI Hair Extension\")\n\n撮影時の推奨事項:\n![Suggestions for How to Shoot](https://bcw-media.s3.ap-northeast-1.amazonaws.com/AI_Hair_Extension_recommendation_ba24bd5d92.png \"Suggestions for How to Shoot\")\n\n---\n\n## ファイル仕様とエラー\n\n* 対応フォーマットと寸法\n\n|AI 機能|対応寸法|対応ファイルサイズ|対応フォーマット|\n|  ----  | ----  | ----  | ----  |\n|AI ヘアエクステ|長辺 <= 1024、顔幅 >= 128、顔の姿勢: -10 < pitch < +10, -45 < yaw < +45, -15 < roll < +15、単一の顔のみ、顔全体が写っている必要あり|< 10MB|jpg/jpeg|\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n|error_no_shoulder\t|ソース画像に肩が写っていません\n|error_large_face_angle\t|アップロードされた画像の顔の角度が大きすぎます\n|error_insufficient_landmarks\t|ソース画像で十分な顔または体のランドマークを検出できません\n|error_hair_too_short\t|入力された髪が短すぎます\n|error_face_pose\t|ソース画像の顔の姿勢はサポートされていません\n|error_bald_image\t|入力されたヘアスタイルがハゲています\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"
    }
  ],
  "tags": [
    {
      "name": "V1.0",
      "description": "AI 処理を使用して、アップロードされた画像から AI ヘアエクステの効果を生成します。テンプレートとソース参照に対応しています。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/template/hair-ext": {
      "get": {
        "summary": "事前定義されたテンプレートを一覧表示します。",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 20
            },
            "description": "このページで返す結果の数。有効な値は 1 から 20 の間です。初期値は 20 です。"
          },
          {
            "name": "starting_token",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "73a3c9e69b89"
            },
            "description": "現在のページのトークン。最初のページでは `null` で開始し、次のページを開始するには前回のレスポンスの `next_token` を使用します。"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TemplateResponse"
          },
          "400": {
            "$ref": "#/components/responses/InvalidParameters"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          }
        }
      }
    },
    "/s2s/v2.0/task/hair-ext": {
      "post": {
        "summary": "AI ヘアエクステタスクを実行します。",
        "description": "このエンドポイントは、テンプレートとソース画像を使用してヘアエクステ生成プロセスを開始します。タスクは非同期で処理され、このレスポンスで返される task_id を使用してステータスを確認できます。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunWithSingleTemplateAndSrcUrl"
              }
            }
          }
        },
        "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-ext/{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": {
                  "$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` を使用してファイルをアップロードします。完了後、タスク実行 API の呼び出しを進めるために `file_id` を使用します。",
                  "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": "ソースファイル URL によるタスク実行",
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "タスクを実行するファイルの URL。この URL は公開アクセス可能である必要があります。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "title": "ソースファイル ID によるタスク実行",
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "タスクを実行するファイルの ID。ファイルアップロード API からのファイル ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2": {
        "title": "BasicRunTaskV2",
        "anyOf": [
          {
            "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
          },
          {
            "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
          }
        ]
      },
      "RunWithSingleTemplate": {
        "title": "RunWithSingleTemplate",
        "type": "object",
        "properties": {
          "template_id": {
            "type": "string",
            "description": "テンプレートの ID。まず事前定義されたテンプレートを一覧表示し、テンプレートの ID を使用します。\n",
            "example": "good_template_001"
          }
        },
        "required": [
          "template_id"
        ]
      },
      "RunWithSingleTemplateAndSrcUrl": {
        "title": "RunWithSingleTemplateAndSrcUrl",
        "allOf": [
          {
            "$ref": "#/components/schemas/RunWithSingleTemplate"
          },
          {
            "$ref": "#/components/schemas/BasicRunTaskV2"
          }
        ]
      },
      "BasicRunTaskResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "レスポンスステータス",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "task_id": {
                "type": "string",
                "description": "このタスクの ID。タスク結果はこの ID で 24 時間有効です。",
                "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
              }
            }
          }
        }
      },
      "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"
              }
            }
          }
        }
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "テンプレートの ID。タスク実行時に `template_id` として使用します。",
            "example": "good_template_001"
          },
          "thumb": {
            "type": "string",
            "description": "スタイルのサムネイル。"
          },
          "title": {
            "type": "string",
            "description": "テンプレートのタイトル。"
          },
          "category_name": {
            "type": "string",
            "description": "テンプレートのカテゴリ名。"
          }
        }
      },
      "Style": {
        "type": "object",
        "properties": {
          "style_group_id": {
            "type": "integer",
            "description": "スタイルグループの ID。タスク実行時に `style_group_id` として使用します。"
          },
          "style_id": {
            "type": "integer",
            "description": "スタイルの ID。タスク実行時に `style_ids` として使用します。"
          },
          "info": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "description": "スタイル名"
              },
              "thumb": {
                "type": "string",
                "description": "スタイルのサムネイル"
              }
            },
            "required": [
              "title",
              "thumb"
            ]
          }
        },
        "required": [
          "style_group_id",
          "style_id",
          "info"
        ]
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "カテゴリの ID。"
          },
          "name": {
            "type": "string",
            "description": "カテゴリ名。"
          },
          "styles": {
            "type": "array",
            "description": "このカテゴリに属するスタイル。",
            "items": {
              "$ref": "#/components/schemas/Style"
            }
          },
          "sub_categories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "サブカテゴリの ID。そのコンテンツを照会するためにこの ID を使用します。"
                },
                "name": {
                  "type": "string",
                  "description": "サブカテゴリ名。"
                }
              },
              "required": [
                "id",
                "name"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "styles",
          "sub_categories"
        ]
      },
      "TemplateResponseSchema": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "レスポンスステータス",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "templates": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Template"
                }
              },
              "next_token": {
                "type": "string",
                "example": "73a3c9e69b89",
                "description": "次のページを照会するためのトークン。"
              }
            }
          }
        }
      }
    },
    "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"
                  ]
                }
              }
            }
          }
        }
      },
      "TemplateResponse": {
        "description": "スタイルの取得に成功しました",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/TemplateResponseSchema"
            }
          }
        }
      }
    }
  }
}