{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 波浪捲髮模擬",
    "description": "# 概述\n無論您夢想的是富有彈性的捲圈、鬆弛的波浪，或大膽的捲髮宣言，YouCam API 的捲髮濾鏡讓您在數秒內嘗試全新出色的髮型——全部在家就能完成。\n\n無論您嘗試柔和的波浪或大膽的非洲捲，YouCam 都提供與眾不同的精準度與真實感。它是您在下次前往沙龍前，自信探索新髮型的理想工具。\n\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-04-01/webp_03963789-fb1e-4ad8-be4d-48932e247376.jpg)\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-03-20/b25b228a-259b-4efb-a7c1-31d200b62e8c.jpg)\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|AI 功能|支援的尺寸|支援的檔案大小|支援的格式|\n|  ----  | ----  | ----  | ----  |\n|AI 波浪捲髮模擬|長邊 <= 1024，臉寬 >= 128，臉部姿勢：-10 < pitch < +10，-45 < yaw < +45，-15 < roll < +15，僅限單張臉部，需呈現完整臉部|< 10MB|jpg/jpeg/png|\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\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 波浪捲髮模擬 API 可讓您使用預先定義的範本，將波浪髮型套用到圖片。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/template/hair-curl": {
      "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": {
            "description": "成功取得風格",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateResponseSchema"
                }
              }
            }
          },
          "400": {
            "description": "請求參數無效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInvalidParameters"
                }
              }
            }
          },
          "401": {
            "description": "API Key 無效、已停用或已到期",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInvalidApiKey"
                }
              }
            }
          }
        }
      }
    },
    "/s2s/v2.0/task/hair-curl": {
      "post": {
        "summary": "執行 AI 波浪捲髮模擬任務。",
        "description": "查詢任務狀態請參考輪詢指南。",
        "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": {
                  "$ref": "#/components/schemas/ErrorRunError"
                }
              }
            }
          },
          "401": {
            "description": "API Key 無效、已停用或已到期",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInvalidApiKey"
                }
              }
            }
          },
          "429": {
            "description": "在指定時間內請求過多",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/s2s/v2.0/task/hair-curl/{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": {
            "description": "任務 id 無效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInvalidTaskId"
                }
              }
            }
          },
          "401": {
            "description": "API Key 無效、已停用或已到期",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInvalidApiKey"
                }
              }
            }
          },
          "500": {
            "description": "任務在預期時間內沒有回應",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorTaskTimeout"
                }
              }
            }
          }
        }
      }
    }
  },
  "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` 上傳檔案。完成後，使用 `file_id` 繼續呼叫執行任務的 API。",
                  "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": "上傳這個檔案的網址"
                      },
                      "method": {
                        "type": "string",
                        "example": "PUT",
                        "description": "上傳這個檔案所用的 HTTP 方法"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "FileResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 200,
            "description": "回應狀態"
          },
          "data": {
            "$ref": "#/components/schemas/BasicFileResponse"
          }
        }
      },
      "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": "以來源檔案網址執行任務",
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "要執行任務的檔案網址。該網址應可公開存取。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "title": "以來源檔案 ID 執行任務",
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "要執行任務的檔案 ID。檔案 ID 來自上傳檔案 API。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2": {
        "title": "BasicRunTaskV2",
        "anyOf": [
          {
            "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
          },
          {
            "$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"
              }
            }
          }
        }
      },
      "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": "下載這個結果的網址。有效期限 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"
      },
      "ErrorInvalidParameters": {
        "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"
          }
        }
      },
      "ErrorInvalidApiKey": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "example": 401,
            "description": "回應狀態"
          },
          "error_code": {
            "type": "string",
            "enum": [
              "InvalidApiKey",
              "InactiveApiKey",
              "ExpiredApiKey"
            ],
            "description": "錯誤代碼：\n  * InvalidApiKey - 未提供 API Key，或 API Key 無效\n  * InactiveApiKey - API Key 已停用\n  * ExpiredApiKey - API Key 已到期\n"
          }
        }
      },
      "ErrorRunError": {
        "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"
          }
        }
      },
      "ErrorInvalidTaskId": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "回應狀態",
            "example": 400
          },
          "error_code": {
            "type": "string",
            "enum": [
              "InvalidTaskId"
            ],
            "description": "錯誤代碼：\n  * InvalidTaskId - 任務 id 無效\n"
          }
        }
      },
      "ErrorTaskTimeout": {
        "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' 之間有一個空格。"
      }
    }
  }
}