{
  "openapi": "3.0.0",
  "info": {
    "title": "歯ホワイトニング",
    "description": "# 概要\n**歯ホワイトニング API**\n\n歯ホワイトニング API で、写真内の歯を明るくします。\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2023-07-28/f05fda4d-8ca8-4661-b4b5-135067280a10.jpg)\n\n\n\n\n**写真内の黄ばんだ歯を除去する方法**\n\n**スマートホワイトニング**  \nAPI は自動的に歯を検出し、ホワイトニング効果を適用します。\n\n**調整可能なレベル**  \nホワイトニングの度合いを調整できます。\n\n\n\n\n**主な機能**\n\n**迅速な強化**  \n数秒で歯を明るくします。\n\n**正確な AI 検出**  \n歯のみが修正されます。\n\n**調整可能なホワイトニング強度**  \nホワイトニングの強度を調整できます。\n\n**自然な結果**\n\n歯ホワイトニング API は、歯を識別してホワイトニング効果を適用します。強度を調整できます。\n\n---\n\n## 統合ガイド\n\n* セルフィーを撮影する\n\n    *   適切な照明の下でカメラに直接向かいます。\n    *   JS Camera Kit を使用して写真をキャプチャします。\n\n* ***/s2s/v2.0/file*** API を介してアップロード URL とファイル ID を取得する\n\n    ファイル API レスポンスで返されたアップロード URL を使用して、以下のファイルをアップロードします。\n    *   セルフィー写真\n\n* AI タスク ***/s2s/v2.0/task/teeth-whiten*** を実行する\n\n    入力ソースとしてファイル ID または画像 URL を使用して AI タスクを実行します。効果パラメータを必要に応じて設定します。\n\n* タスクステータスのポーリング\n\n    返された **task\\_id** を使用してタスクの進捗を監視します。  \n    **GET /s2s/v2.0/task/teeth-whiten/{task_id}** をポーリングしてエンジンのステータスを確認します。  \n    タスクは完了するまで **“running”** 状態のままです。タスク実行中はユニットは消費されません。\n\n\n\n* **使用例のデモ**\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2022-05-13/26c04462-d183-4392-937b-f6173ff9e814.jpg)\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-07-01/webp_a4cd3779-2966-4b8f-888e-032dffc003c0.webp)\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-11-13/webp_5824c85f-813e-4c14-b036-38cba206ee0b.webp)\n\n## ファイル仕様とエラー\n* 対応フォーマットと寸法\n\n|タイプ|対応寸法|対応ファイルサイズ|対応フォーマット|\n|  ----  | ----  | ----  | ----  |\n|AI Teeth Whitening|セルフィー画像:<br>    *   長辺 ≤ 1920 px <br>    *   短辺 ≥ 320 px |< 10MB|jpg/png|\n\n\n* エラーコード\n\n|エラーコード|説明|\n|  ----  | ----  |\n| error_exceed_max_image_size | 画像の長辺が 1920 ピクセルを超える場合 |\n|error_below_min_image_size|画像の幅または高さが 320 ピクセル未満の場合、使用するには小さすぎます|\n|error_face_position_invalid|画像内で顔全体が完全に可視であり、一部が切り取られていない必要があります|\n|error_face_position_too_small|写真内の顔が小さすぎて適切に分析できません|\n|error_face_position_out_of_boundary|顔が大きすぎるか、写真の端の一部が外れています|\n|error_insufficient_lighting|照明が暗すぎて分析が困難です|\n|error_face_angle_invalid|顔の角度が適切ではありません。正面を向いた撮影では、頭を正面から 10 度以内に保ってください。横を向いた撮影では、角度は 15 度以上である必要があります|\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 Teeth Whitening 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 技術を使用して写真内の歯を白くします。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/teeth-whiten/pre-process": {
      "post": {
        "summary": "歯ホワイトニング検出タスクを実行します。",
        "description": "ソース画像に複数の有効なターゲットが含まれる可能性がある場合、またはエフェクトを適用する検出ターゲットを明示的に選びたい場合は、前処理タスクを使います。単一ターゲットの画像では、機能がデフォルトの `index` 値をサポートしているため、手動でのターゲット選択が不要な場合は前処理をスキップできます。\n\n前処理タスクは、ソース画像内の候補ターゲットを検出し、その座標を `data.results.result` に返します。結果配列の各項目は、検出された 1 つのターゲットを表します。返された座標を確認し、ソース画像内の意図した顔や領域に対応づけたうえで、エフェクトタスクを作成する際にその項目のゼロベース配列インデックスを `index` 値として使います。\n\n複数の顔や領域が検出された画像では、前処理の結果を確認せずにデフォルトの `index` 値に頼らないでください。エフェクトは `index` で選択されたターゲットにしか適用されないため、エフェクトタスクを実行する前に、意図したターゲットに対応する結果項目を確認する必要があります。\n\nこのタスクは非同期です。タスクを作成した後、機能がサポートしている場合は Webhook で完了を処理するか、対応する前処理ステータスエンドポイントをポーリングして `data.task_status` が `success` または `error` になるまで待ちます。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2"
                  }
                ]
              }
            }
          }
        },
        "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/teeth-whiten/pre-process/{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": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/TaskStatusResponsePreProcessNoUrlBase"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "results": {
                              "type": "object",
                              "properties": {
                                "timed": {
                                  "type": "number"
                                },
                                "result": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "left": {
                                        "type": "number"
                                      },
                                      "top": {
                                        "type": "number"
                                      },
                                      "width": {
                                        "type": "number"
                                      },
                                      "height": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    },
    "/s2s/v2.0/task/teeth-whiten": {
      "post": {
        "summary": "歯ホワイトニングタスクを実行します。",
        "description": "AI タスクは非同期です。機能ごとに Webhook がサポートされている場合は、Webhook による完了処理を優先します。Webhook エンドポイントを設定し、Webhook 署名を検証したうえで、`success` または `error` の通知が来たら、受け取った `task_id` を使ってタスクの結果を照会します。設定と検証の詳細は [Webhook 統合ガイド](../develop/webhook.md) を参照してください。\n\nWebhook がサポートされていない場合、または統合に使えない場合は、ポーリングを実装します。AI タスクを送信した後、一定の間隔（例：10 秒ごと）でステータスエンドポイントをポーリングし、`success` または `error` になるまで待ちます。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2"
                  },
                  {
                    "type": "object",
                    "required": [
                      "version",
                      "effect"
                    ],
                    "properties": {
                      "version": {
                        "type": "string",
                        "enum": [
                          "1.0"
                        ]
                      },
                      "index": {
                        "type": "integer",
                        "example": 0,
                        "default": 0,
                        "description": "エフェクトを適用する対象オブジェクトのゼロベースインデックスです。複数のオブジェクトを含む画像では、まず前処理タスクを実行し、`data.results.result` 内のオブジェクト座標を確認したうえで、選択したオブジェクトのインデックスを指定します。\n\n前処理ステップでは、エフェクトを適用する前に、入力画像を解析して検出できるすべてのオブジェクトを特定します。検出タスクを実行し、バウンディングボックス座標のリストなど、各オブジェクトの構造化データを返します。このリスト内の各エントリの位置がゼロベースインデックスとして機能し、エフェクトの対象オブジェクトを指定するのに使います。\n\nこの情報は、一般的に `data.results.result` 配下で構造化された形式で返ります。\nこのステップを先に実行すると、以下ができます。\n    * 画像内に存在するオブジェクトの数を把握する\n    * オブジェクトの位置とサイズを確認する\n    * インデックスで正しい対象オブジェクトを選択する\n\n複数のオブジェクトを含む画像では、必ず前処理ステップを実行してください。\n`data.results.result` を確認して、オブジェクトとそのインデックスを特定してください。\n対応するゼロベースインデックスを使って、正しい対象を選択してください。\n"
                      },
                      "effect": {
                        "type": "object",
                        "required": [
                          "whitening_intensity"
                        ],
                        "properties": {
                          "whitening_intensity": {
                            "type": "integer",
                            "maximum": 100,
                            "minimum": 0
                          },
                          "skin_smooth_strength": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "default": 50
                          },
                          "skin_smooth_color_intensity": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 100,
                            "default": 50
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "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/teeth-whiten/{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": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/TaskStatusResponseV2"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "results": {
                              "type": "object",
                              "properties": {
                                "timed": {
                                  "type": "number"
                                },
                                "timed_apply": {
                                  "type": "number"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "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": {
      "BasicRunTaskV2SrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "タスクを実行するファイルの URL。この URL は公開されている必要があります。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "タスクを実行するファイルの ID。ファイルアップロード API から取得したファイル ID です。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2": {
        "title": "BasicRunTaskV2",
        "anyOf": [
          {
            "title": "src ファイル URL でタスクを実行",
            "allOf": [
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              }
            ]
          },
          {
            "title": "src ファイル ID でタスクを実行",
            "allOf": [
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
              }
            ]
          }
        ]
      },
      "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"
      },
      "TaskStatusResponsePreProcessNoUrlBase": {
        "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": "エラーの詳細な説明"
              }
            }
          }
        }
      },
      "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": null
            }
          }
        },
        "$ref": "#/components/schemas/TaskStatusResponseBodySingleUrlResultsV2"
      }
    },
    "responses": {
      "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"
                }
              }
            }
          }
        }
      }
    }
  }
}