{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 画像拡張",
    "description": "# 概要\nAI 画像拡張（アウトペインティング）では、あらゆる比率で画像を拡張できます。スタイルや美観を損なうことなく、元の品質を維持します。背景を自動的に拡大でき、拡張された領域は元の写真と自然に馴染むように処理されます。\n\n![AI 画像拡張](https://bcw-media.s3.ap-northeast-1.amazonaws.com/yce_web_outpainting_S1_img_03_cf19a018d9.jpg \"AI 画像拡張\")\n\nInstagram での投稿や、画像の額装表示など、用途に合わせてさまざまなサイズと比率から選択できます。拡張された領域は元の写真と自然に溶け込むように処理されます。\n\n![AI 画像拡張](https://bcw-media.s3.ap-northeast-1.amazonaws.com/yce_web_outpainting_S1_img_01_1876fb85a5.jpg \"AI 画像拡張\")\n\n\n## ファイル仕様とエラー\n* 対応フォーマットと寸法\n\n| AI 機能 | 対応寸法 | 対応ファイルサイズ | 対応フォーマット |\n| ---- | ---- | ----  | ---- |\n| AI 画像拡張 | 長辺 <= 4096 | < 10MB | jpg/jpeg |\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n| exceed_max_filesize |\t入力ファイルサイズが最大制限を超えています |\n| invalid_parameter |\tパラメータ値が無効です |\n| error_download_image\t| ソース画像のダウンロードに失敗しました |\n| error_decode_image\t| ソース画像のデコードに失敗しました |\n| error_nsfw_content_detected\t| ソース画像に NSFW コンテンツが検出されました |\n\n---\n\n## ユニット消費\n\n| AI 機能 | 消費ユニット |\n|---|---|\n| AI 画像拡張 V2.0 | 2 |\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": "V2.0",
      "description": "AI 画像拡張 API を使用すると、画像の周囲に新しいコンテンツを生成して（アウトペインティング）、画像の寸法を拡張できます。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/out-paint": {
      "post": {
        "summary": "AI 画像拡張タスクを実行します。",
        "description": "タスクステータスの確認については、ポーリングガイドを参照してください。この API は 3 つの主要なパラメータを受け取ります: 入力画像、ピボットポイント、出力画像。",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunOutPaintTaskRequest"
              }
            }
          }
        },
        "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": {
            "description": "一定時間内にリクエストが多すぎます",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/s2s/v2.0/task/out-paint/{task_id}": {
      "get": {
        "summary": "AI 画像拡張タスクのステータスを確認します。",
        "tags": [
          "V2.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": {
    "schemas": {
      "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"
          }
        ]
      },
      "OutPaintTaskParams": {
        "type": "object",
        "required": [
          "output_width",
          "output_height",
          "input_x",
          "input_y",
          "input_width",
          "input_height",
          "crop_input_x",
          "crop_input_y",
          "crop_input_width",
          "crop_input_height"
        ],
        "properties": {
          "output_width": {
            "type": "integer",
            "description": "出力画像の幅。値の範囲: [1 - 4096]",
            "example": 960,
            "minimum": 1,
            "maximum": 4096
          },
          "output_height": {
            "type": "integer",
            "description": "出力画像の高さ。値の範囲: [1 - 4096]",
            "example": 1280,
            "minimum": 1,
            "maximum": 4096
          },
          "input_x": {
            "type": "integer",
            "description": "出力画像内でのソース画像の左位置。インデックスは上から下、左から右の順で並びます。値の範囲: [0 - 4096]",
            "example": 240,
            "minimum": 0,
            "maximum": 4096
          },
          "input_y": {
            "type": "integer",
            "description": "出力画像内でのソース画像の上位置。インデックスは上から下、左から右の順で並びます。値の範囲: [0 - 4096]",
            "example": 320,
            "minimum": 0,
            "maximum": 4096
          },
          "input_width": {
            "type": "integer",
            "description": "ソース画像の幅。input_x + input_width は output_width 以下である必要があります。値の範囲: [1 - 4096]",
            "example": 480,
            "minimum": 1,
            "maximum": 4096
          },
          "input_height": {
            "type": "integer",
            "description": "ソース画像の高さ。input_y + input_height は output_height 以下である必要があります。値の範囲: [1 - 4096]",
            "example": 640,
            "minimum": 1,
            "maximum": 4096
          },
          "crop_input_x": {
            "type": "integer",
            "description": "ソース画像を x 位置から切り取ります。インデックスは上から下、左から右の順で並びます。値の範囲: [0 - 4096]",
            "example": 0,
            "minimum": 0,
            "maximum": 4096
          },
          "crop_input_y": {
            "type": "integer",
            "description": "ソース画像を y 位置から切り取ります。インデックスは上から下、左から右の順で並びます。値の範囲: [0 - 4096]",
            "example": 0,
            "minimum": 0,
            "maximum": 4096
          },
          "crop_input_width": {
            "type": "integer",
            "description": "crop_input_width の幅でソース画像を切り取ります。値の範囲: [1 - 4096]",
            "example": 480,
            "minimum": 1,
            "maximum": 4096
          },
          "crop_input_height": {
            "type": "integer",
            "description": "crop_input_height の高さでソース画像を切り取ります。値の範囲: [1 - 4096]",
            "example": 640,
            "minimum": 1,
            "maximum": 4096
          }
        }
      },
      "RunOutPaintTaskRequest": {
        "title": "RunOutPaintTaskRequest",
        "description": "AI 画像拡張 API は、入力画像、ピボットポイント、出力画像の 3 つの主要なパラメータで動作します。出力画像のサイズは、入力画像のサイズより常に大きくする必要があります。",
        "allOf": [
          {
            "$ref": "#/components/schemas/BasicRunTaskV2"
          },
          {
            "$ref": "#/components/schemas/OutPaintTaskParams"
          }
        ]
      },
      "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"
              }
            }
          }
        }
      },
      "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"
              }
            }
          }
        }
      },
      "TaskStatusResponseBodySingleUrlResultsV2": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "この結果をダウンロードするための URL。2 時間有効です。",
            "example": "https://example.com/sample-result-url"
          }
        }
      },
      "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"
      },
      "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"
          }
        }
      }
    },
    "responses": {
      "InvalidParameters": {
        "description": "無効なリクエストパラメータ",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InvalidParametersSchema"
            }
          }
        }
      },
      "InvalidApiKey": {
        "description": "無効な API キー、非アクティブな API キー、または期限切れの API キー",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InvalidApiKeySchema"
            }
          }
        }
      },
      "RunError": {
        "description": "タスクの実行に失敗しました",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunErrorSchema"
            }
          }
        }
      },
      "InvalidTaskId": {
        "description": "無効なタスク ID",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InvalidTaskIdSchema"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "一定時間内にリクエストが多すぎます"
      },
      "TaskTimeout": {
        "description": "期待される時間内にタスクの応答がありません",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/TaskTimeoutSchema"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuthenticationV2": {
        "type": "http",
        "scheme": "bearer",
        "description": "標準の 'Bearer authentication' を使用します。ヘッダーに 'API Key' を設定してください: `Authorization:Bearer YOUR_API_KEY`。'Bearer' と 'YOUR_API_KEY' の間にスペースがあることに注意してください。"
      }
    }
  }
}