{
  "openapi": "3.0.0",
  "info": {
    "title": "AI スタジオ写真",
    "description": "# 概要\nAI スタジオ写真では、セルフィーをスタジオ品質のポートレートに変換します。\n* スタジオ不要の利便性：カメラマンやスタジオへの訪問は不要です。いつでもどこでも、スタジオ品質の芸術的な写真を生成できます\n* 迅速な写真変換：高速処理により、高品質な芸術的な写真の結果を即座に得られます。素早い更新に最適です\n* 高品質な芸術的出力：スタジオで撮影したかのような、細部が鮮明で照明が完璧なプロフェッショナル基準の芸術的な写真を提供します\n\nユースケース:\n![AI スタジオ写真](https://bcw-media.s3.ap-northeast-1.amazonaws.com/yce_web_AI_studio_S1_img_19b627b6af.jpg \"AI スタジオ写真\")\n\n![AI スタジオ写真](https://bcw-media.s3.ap-northeast-1.amazonaws.com/yce_web_AI_studio_S2_img_01_2e318817e9.jpg \"AI スタジオ写真\")\n\n\n撮影のヒント：\n![撮影のヒント](https://bcw-media.s3.ap-northeast-1.amazonaws.com/AI_Hair_Extension_recommendation_ba24bd5d92.png \"撮影のヒント\")\n\n\n---\n\n## ファイル仕様とエラー\n\n* 対応フォーマットと寸法\n\n|AI 機能|対応寸法|対応ファイルサイズ|対応フォーマット|\n|  ----  | ----  | ----  | ----  |\n|AI スタジオ写真|入力画像に 1 つの顔が含まれていること、短辺が少なくとも 200 ピクセル、長辺が 1920 ピクセル以下であることを確認してください。複数の顔がある場合、エンジンは最も大きい顔を選択します。出力解像度は 960×1280 (W×H) を超えません|< 10MB|jpg/jpeg/png|\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n|error_below_min_image_size\t|入力画像の解像度が小さすぎます|\n|error_exceed_max_image_size\t|入力画像の解像度が大きすぎます|\n\n---\n\n## ユニット消費量\n\n| AI 機能 | 消費ユニット |\n|---|---|\n| AI スタジオ写真 V3.0 | 画像 2 枚につき 1 ユニット * |\n\n    > *画像数または動画の長さが割り切れない場合、ユニット数は切り上げられます。\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": "V3.0",
      "description": "AI スタジオ写真 API を使用すると、プリセットテンプレートと出力数設定を用いて、ソース画像からスタジオ風の画像を生成できます。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/template/ai-studio": {
      "get": {
        "summary": "プリセットテンプレートを一覧表示します。",
        "tags": [
          "V3.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": {
            "description": "スタイルの取得に成功しました",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateResponseSchema"
                }
              }
            }
          },
          "400": {
            "description": "リクエストパラメータが無効です",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidParametersSchema"
                }
              }
            }
          },
          "401": {
            "description": "API キーが無効、非アクティブ、または期限切れです",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidApiKeySchema"
                }
              }
            }
          }
        }
      }
    },
    "/s2s/v2.0/task/ai-studio": {
      "post": {
        "summary": "AI スタジオ写真タスクを実行します。",
        "description": "タスクステータスの確認方法については、ポーリングガイドを参照してください。ソース画像、テンプレート ID、出力数設定が必要です。",
        "tags": [
          "V3.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/RunWithSingleTemplateAndSrcUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunWithOutputCntCustom200"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "タスクの実行に成功しました",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "タスクの実行に失敗しました",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/RunErrorSchema"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "API キーが無効、非アクティブ、または期限切れです",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidApiKeySchema"
                }
              }
            }
          },
          "429": {
            "description": "一定時間内にリクエスト数が多すぎます",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/s2s/v2.0/task/ai-studio/{task_id}": {
      "get": {
        "summary": "AI スタジオ写真タスクのステータスを確認します。",
        "tags": [
          "V3.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/TaskStatusResponseMultiResV2"
                }
              }
            }
          },
          "400": {
            "description": "無効なタスク ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidTaskIdSchema"
                }
              }
            }
          },
          "401": {
            "description": "無効な API キー、または無効化された API キー、または期限切れの API キー",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidApiKeySchema"
                }
              }
            }
          },
          "500": {
            "description": "タスクが期待される時間内にレスポンスを返さなかった",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskTimeoutSchema"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "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": "テンプレートのカテゴリ名。"
          }
        }
      },
      "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": "次のページをクエリするためのトークン。"
              }
            }
          }
        }
      },
      "RunWithSingleTemplateAndSrcUrl": {
        "title": "RunWithSingleTemplateAndSrcUrl",
        "allOf": [
          {
            "$ref": "#/components/schemas/RunWithSingleTemplate"
          },
          {
            "$ref": "#/components/schemas/BasicRunTaskV2"
          }
        ]
      },
      "RunWithSingleTemplate": {
        "title": "RunWithSingleTemplate",
        "type": "object",
        "properties": {
          "template_id": {
            "type": "string",
            "description": "テンプレートの ID。事前に定義されたテンプレートを一覧表示し、その ID を使用します。",
            "example": "good_template_001"
          }
        },
        "required": [
          "template_id"
        ]
      },
      "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"
          }
        ]
      },
      "RunWithOutputCntCustom200": {
        "type": "object",
        "required": [
          "output_count"
        ],
        "properties": {
          "output_count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "description": "生成される画像の数。1 から 200 の間で指定する必要があります。",
            "example": 20
          }
        }
      },
      "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"
              }
            }
          }
        }
      },
      "EngineErrorCode": {
        "type": "string",
        "nullable": true,
        "enum": [
          "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- `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"
      },
      "TaskStatusResponseBodyMultiUrlResultsV2": {
        "type": "object",
        "properties": {
          "output": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "この結果をダウンロードするための URL。2 時間有効です。",
                  "example": "https://example.com/sample-result-url"
                }
              }
            }
          }
        }
      },
      "TaskStatusResponseMultiResV2": {
        "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/TaskStatusResponseBodyMultiUrlResultsV2"
              }
            }
          }
        }
      },
      "InvalidParametersSchema": {
        "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"
            ],
            "description": "エラーコード:\n  * InvalidParameters - 無効なリクエストパラメータまたはボディ\n"
          }
        }
      },
      "InvalidApiKeySchema": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 401,
            "description": "レスポンスステータス"
          },
          "error_code": {
            "type": "string",
            "enum": [
              "InvalidApiKey",
              "InactiveApiKey",
              "ExpiredApiKey"
            ],
            "description": "エラーコード:\n  * InvalidApiKey - API キーが指定されていないか、無効です\n  * InactiveApiKey - API キーが無効化されています\n  * ExpiredApiKey - API キーの有効期限が切れています\n"
          }
        }
      },
      "RunErrorSchema": {
        "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"
            ],
            "description": "エラーコード:\n  * CreditInsufficiency - 実行に必要なユニットが不足しています\n  * BadRequest - 予期しないリクエストパラメータ\n  * InvalidStyleGroup - 無効なスタイルグループ ID\n  * InvalidStyle - 無効なスタイル ID\n  * InvalidParameters - 無効なリクエストパラメータ\n"
          }
        }
      },
      "InvalidTaskIdSchema": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "レスポンスステータス",
            "example": 400
          },
          "error_code": {
            "type": "string",
            "enum": [
              "InvalidTaskId"
            ],
            "description": "エラーコード:\n  * InvalidTaskId - 無効なタスク ID\n"
          }
        }
      },
      "TaskTimeoutSchema": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "レスポンスステータス",
            "example": 500
          },
          "error_code": {
            "type": "string",
            "enum": [
              "TaskTimeout"
            ],
            "description": "エラーコード:\n  * TaskTimeout - タスクが期待される時間内にレスポンスを返さなかった\n"
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuthenticationV2": {
        "type": "http",
        "scheme": "bearer",
        "description": "標準の 'Bearer authentication' を使用します。ヘッダーに 'API Key' を設定します: `Authorization:Bearer YOUR_API_KEY`。'Bearer' と 'YOUR_API_KEY' の間に半角スペースがあることに注意してください。"
      }
    }
  }
}