{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 動画消しゴム",
    "description": "# 概要\n\n**AI 動画消しゴム**\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-02-04/webp_537ec670-48c0-49fc-b96b-8073de21a64b.webp)\n\nAI 動画消しゴム API で、動画から不要な要素を除去できます。観光客で混雑した背景、散らかったデスク、ガラス表面の反射など、マスクした領域を除去します。\n\n\n---\n\n## 統合ガイド\n\n**1. ソース動画とマスク画像の準備**\n入力動画の長さは 60 秒以下である必要があり、出力動画の長辺は 1920 ピクセル以下、フレームレートは 30 フレーム/秒以下である必要があります。\n\n\n**2. ファイルのアップロード**\n以下のエンドポイントを通じて、アップロード URL とファイル ID を取得します。\n\n```\nPOST /s2s/v2.0/file\n```\n\n入力動画:\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/webp_video_object_removal_input_edd43a2470.png)\n\n\n参考入力マスク:\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/webp_video_object_removal_mask_4a1c9fb658.png)\n\n\n**3. AI タスクの実行**\n\n```\nPOST /s2s/v2.0/task/obj-rem-vid\n```\n\nファイル ID または画像 URL を入力としてタスクを送信します。レスポンスには、結果の追跡と取得に使用される task_id が返されます。\n\n\n**4. タスク結果の取得**\n\n```\nGET /s2s/v2.0/task/obj-rem-vid/{task_id}\n```\n\nタスク ID を使用してステータスを追跡し、結果を取得します。\n\n[Webhook](../develop/webhook.md) を設定すると、タスク完了時に成功またはエラーのステータスを含む非同期通知を受信できます。また、タスクエンドポイントを繰り返し呼び出して、ステータスが running から success または error に更新されるまでポーリングすることもできます。\n\n課金は、タスクが正常に完了した場合にのみ発生します。\n\n\n出力動画サンプル:\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/webp_video_object_removal_output_eb7670cd9e.png)\n\n\n---\n\n## ファイル仕様とエラー\n\n* 対応フォーマットと寸法\n\n|AI 機能|対応寸法|対応ファイルサイズ|対応フォーマット|\n|  ----  | ----  | ----  | ----  |\n| AI 動画消しゴム | 入力動画の長さは 60 秒以下である必要があり、出力動画の長辺は 1920 ピクセル以下、フレームレートは 30 フレーム/秒以下である必要があります。 | 長さ制限: 60s | コンテナ: mov, mp4 <br>動画: MPEG-4, MPEG-4 AVC, <br>音声: aac, amr, mp3 |\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n| error_download_video | ソース動画のダウンロードに失敗しました |\n| error_decode_video | ソース動画のデコードに失敗しました |\n| error_unsupported_video | 対応していない動画形式です |\n| exceed_max_filesize | 入力ファイルサイズが最大制限を超えています |\n| error_nsfw_content_detected | ソースファイルで NSFW コンテンツが検出されました |\n| error_decode_mask | マスク画像のデコードに失敗しました |\n| invalid_parameter | パラメータ値が無効です |\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 動画消しゴム V2.1 | 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": "V2.1",
      "description": "AI 動画消しゴム"
    }
  ],
  "paths": {
    "/s2s/v2.0/file/obj-rem-vid": {
      "post": {
        "summary": "新しいファイルを作成します。",
        "description": "新しいファイルをアップロードするには、まず File API を使用する必要があります。URL が発行されるので、その URL を使用してファイルをアップロードします。アップロードが完了すると、同じレスポンス内の file_id を使用して AI 機能を利用開始できます。",
        "tags": [
          "V2.1"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/VideoFileV1.1"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ファイルアップロード情報の取得に成功しました",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/VideoFileResponseV2"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidParameters"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          }
        }
      }
    },
    "/s2s/v2.0/task/obj-rem-vid": {
      "post": {
        "summary": "AI 動画消しゴムタスクを実行します。",
        "description": "AI タスクは非同期です。機能ごとに Webhook がサポートされている場合は、Webhook による完了処理を優先します。Webhook エンドポイントを設定し、Webhook 署名を検証したうえで、`success` または `error` の通知が来たら、受け取った `task_id` を使ってタスクの結果を照会します。設定と検証の詳細は [Webhook 統合ガイド](../develop/webhook.md) を参照してください。\n\nWebhook がサポートされていない場合、または統合に使えない場合は、ポーリングを実装します。AI タスクを送信した後、一定の間隔（例：10 秒ごと）でステータスエンドポイントをポーリングし、`success` または `error` になるまで待ちます。\n",
        "tags": [
          "V2.1"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BasicRunVidTaskV2WithRequiredMsk"
                  },
                  {
                    "type": "object",
                    "required": [
                      "frame_idx"
                    ],
                    "properties": {
                      "frame_idx": {
                        "type": "integer",
                        "description": "提供されたマスク画像に対応する入力動画内のフレームインデックスを指定します。0 から総フレーム数マイナス 1 までの範囲です。",
                        "example": 0
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "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/obj-rem-vid/{task_id}": {
      "get": {
        "summary": "AI 動画消しゴムタスクのステータスを確認します。",
        "tags": [
          "V2.1"
        ],
        "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/VidTaskStatusResponseV2"
                }
              }
            }
          },
          "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": {
      "VideoFileV1.1": {
        "title": "VideoFile 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": "video/mp4",
                  "description": "このファイルのコンテンツ MIME タイプ。現在利用可能な値は enum に記載されています。"
                },
                "file_name": {
                  "type": "string",
                  "example": "my-selfie.mp4",
                  "description": "このファイルの名前"
                },
                "file_size": {
                  "type": "integer",
                  "example": 50000,
                  "description": "このファイルのコンテンツ長（バイト単位）。100MB を超えてはなりません。"
                }
              }
            }
          }
        }
      },
      "BasicVideoFileResponse": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "content_type": {
                  "type": "string",
                  "example": "video/mp4",
                  "description": "このファイルのコンテンツ MIME タイプ。"
                },
                "file_name": {
                  "type": "string",
                  "example": "my-selfie.mp4",
                  "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": "video/mp4",
                          "Content-Length": 50000
                        },
                        "description": "ファイルのアップロード時に含めるヘッダー"
                      },
                      "url": {
                        "type": "string",
                        "example": "https://example.com/presigned-upload-url",
                        "description": "このファイルをアップロードする URL"
                      },
                      "method": {
                        "type": "string",
                        "example": "PUT",
                        "description": "このファイルをアップロードするための HTTP メソッド"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "VideoFileResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 200,
            "description": "レスポンスステータス"
          },
          "data": null
        },
        "$ref": "#/components/schemas/BasicVideoFileResponse"
      },
      "BasicRunTaskV2VidSrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "タスクを実行するファイルの URL。この URL は公開されている必要があります。",
            "example": "https://example.com/cat_video.mp4"
          }
        }
      },
      "BasicRunTaskV2MskFileUrl": {
        "type": "object",
        "properties": {
          "msk_file_url": {
            "type": "string",
            "example": "https://example.com/mask.jpg",
            "description": "マスクファイルの URL。入力画像と完全に同じ幅と高さを持つグレースケールマスク画像である必要があり、白いピクセルは前景を、黒いピクセルは背景を表します。この URL は公開されている必要があります。"
          }
        }
      },
      "BasicRunTaskV2MskFileId": {
        "type": "object",
        "properties": {
          "msk_file_id": {
            "type": "string",
            "example": "eA1CCL3kG4w2s0kpbo2pkah59VfxzIjxahJD2wWm7zw=",
            "description": "マスクファイルの ID。入力画像と完全に同じ幅と高さを持つグレースケールマスク画像である必要があり、白いピクセルは前景を、黒いピクセルは背景を表します。ファイルアップロード API から取得したファイル ID です。"
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "タスクを実行するファイルの ID。ファイルアップロード API から取得したファイル ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunVidTaskV2WithRequiredMsk": {
        "title": "BasicRunVidTaskV2WithRequiredMsk",
        "anyOf": [
          {
            "allOf": [
              {
                "title": "src 動画 URL と msk ファイル URL でタスクを実行",
                "required": [
                  "msk_file_url"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2VidSrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2MskFileUrl"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src 動画 URL と msk ファイル ID でタスクを実行",
                "required": [
                  "msk_file_id"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2VidSrcFileUrl"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2MskFileId"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル ID と msk ファイル URL でタスクを実行",
                "required": [
                  "msk_file_url"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2MskFileUrl"
              }
            ]
          },
          {
            "allOf": [
              {
                "title": "src ファイル ID と msk ファイル ID でタスクを実行",
                "required": [
                  "msk_file_id"
                ]
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              },
              {
                "$ref": "#/components/schemas/BasicRunTaskV2MskFileId"
              }
            ]
          }
        ]
      },
      "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"
      },
      "VidTaskStatusResponseBodySingleUrlResultsV2": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "この結果をダウンロードする URL。有効期間は 2 時間です",
            "example": "https://example.com/sample-result-url"
          }
        }
      },
      "VidTaskStatusResponseV2": {
        "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/VidTaskStatusResponseBodySingleUrlResultsV2"
      }
    },
    "responses": {
      "InvalidParameters": {
        "description": "無効なリクエストパラメータ",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 400,
                  "description": "レスポンスステータス"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid parameter value"
                },
                "error_code": {
                  "type": "string",
                  "example": "InvalidParameters"
                }
              }
            }
          }
        }
      },
      "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"
                }
              }
            }
          }
        }
      }
    }
  }
}