{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 臉部特徵與比例偵測",
    "description": "# 概述\nAI 臉部特徵與比例偵測檢視臉部結構，辨識臉型、眼睛、眉毛、嘴唇、鼻子、顴骨形狀等特徵，旨在提供個人化的推薦。\n\n## 整合指南\n* 如何為 AI 臉部特徵與比例偵測拍攝照片\n\n* 正面自拍\n  - 只需一張清晰的照片，直視鏡頭。最好讓頭髮自然垂落，整張臉可見且無遮蓋。將頭髮往後梳以露出額頭，並確保直視前方，拍攝標準的正面視角。\n  - 或者，使用 JS Camera Kit 拍照。遵循自動臉部對齊、光線引導與臉部尺寸偵測，確保照片符合處理所需的標準。\n\n* 如何用 AI 偵測膚況問題\n\n1. **調整來源圖片尺寸**</br>\n  調整您的照片以符合支援的尺寸。細節請參考**[檔案規格與錯誤](#section/overview/File-Specs-and-Errors)**\n\n2. **使用 File API 上傳檔案**</br>\n  使用 ***/s2s/v2.0/file*** API 上傳目標使用者圖片。\n    - 圖片需求\n      - 細節請參考**[檔案規格與錯誤](#section/overview/File-Specs-and-Errors)**。\n    - ***重要***：僅呼叫 File API 並不會上傳您的檔案。您必須**手動上傳**檔案到**File API 回應中提供的網址**。該網址就是您的上傳目的地，請確保檔案成功傳輸到該處後再繼續。<br>\n    在呼叫 AI API 之前，請確保您的檔案已成功上傳。使用 File API 取得上傳網址，然後將檔案上傳到該位置。上傳完成後，您會在回應中取得 ***file_id***，這個 ID 就是您用於存取該檔案相關 AI 功能的依據。\n\n      > **警告：** 請注意，若您未將檔案上傳到 File API 回應中提供的網址，使用 AI API 時會得到 500 Server Error / unknown_internal_error 或 404 Not Found 錯誤。\n\n3. **執行 AI 臉部特徵與比例偵測任務**</br>\n  上傳完成後，您可以使用檔案 ID 選擇多個要分析的臉部特徵。請參考**[輸入與輸出](#section/overview/Inputs-and-Outputs)**。</br>\n  接著，使用\n  檔案 ID 執行增強任務，並取得 ***task_id***。\n\n4. **輪詢以查詢任務狀態直到成功或錯誤**</BR>\n這個 ***task_id*** 用於透過輪詢 GET 'task/face-attr-analysis' 監控任務狀態，以取得目前的引擎狀態。在引擎完成任務之前，狀態會維持為 'running'，此階段不會消耗點數。\n\n    **警告：** 請注意，依據任務的保留期間**輪詢**以查詢任務狀態是強制性的。若在保留期間內沒有輪詢請求，任務將被逾時，即使任務已成功處理（您的點數仍會被消耗）。\n\n    > **警告：** 一旦您查詢已逾時任務的狀態，會得到 ***InvalidTaskId*** 錯誤。因此，執行 AI 任務後，您需要在保留期間內**輪詢**以查詢狀態，直到狀態變為 *success* 或 *error*。\n\n5. **成功後取得 AI 任務的結果**</BR>\n引擎成功處理您的輸入檔案並生成結果影像後，任務會變為 'success' 狀態。您會取得處理後影像的網址，以及一個 dst_id，讓您在無需重新上傳結果圖片的情況下串接另一個 AI 任務。\n點數僅在這種情況下會被消耗。若引擎處理任務失敗，任務狀態會變為 'error'，且不會消耗點數。</BR>\n扣除點數時，系統會優先使用接近到期的點數。若到期日相同，則扣除最早取得的點數。\n\n* 實際範例：\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-01-15/10a4b980-f571-4d08-8f5d-e3ed48db77aa.jpg)\n\n## 輸入與輸出\n* 臉部特徵：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/img_Face_Ratio_sec_01_01_enu_79380baa14.jpg)\n\n| **類別**     | **子類別**   | **請求參數** | **結果參數** | **結果類型** |\n| --- | --- | --- |  --- | --- |\n| **臉** | 臉型 | `faceShape` | `faceshape` | 三角形、菱形、心形、倒三角形、長形、橢圓形、圓形、方形、未知 |\n| **年齡與性別** | 年齡 | `age` | `agegender.age` | 整數 |\n| | 性別 | `gender` | `agegender.gender` | female、male、unknown |\n| **眼睛** | 眼型 | `eyeShape` | `eyelid.left_shape`、`eyelid.right_shape` | 窄、圓、杏仁 |\n| | 眼睛大小 | `eyeSize` | `eyelid.size` | 大、小、平均 |\n| | 眼睛角度 | `eyeAngle` | `eyelid.left_angle`、`eyelid.right_angle` | 下垂、上揚、平均 |\n| | 眼睛距離 | `eyeDistance` | `eyelid.setting` | 靠近、分開、平均 |\n| | 眼皮 | `eyelid` | `eyelid.left_eyelid`、`eyelid.right_eyelid` | 遮眼型、單眼皮、雙眼皮、深邃型 |\n| **眉毛** | 眉型 | `eyebrowShape` | `eyebrow.left_shape`、`eyebrow.right_shape` | 硬角、柔角、平直、圓弧、不明顯 |\n| | 眉毛厚度 | `eyebrowThickness` | `eyebrow.left_body_thickness`、`eyebrow.right_body_thickness` | 濃密、稀疏、平均、未知 |\n| | 眉毛距離 | `eyebrowDistance` | `eyebrow.gap` | 分開、靠近、平均 |\n| | 眉毛長度 | `eyebrowShortness` | `eyebrow.left_shortness`、`eyebrow.right_shortness` | 短、正常 |\n| **嘴唇** | 唇型 | `lipShape` | `lipshape[]` | 弓形、下垂、飽滿、下唇厚、上唇厚、窄、圓、薄、寬、平均 |\n| **鼻子** | 鼻寬 | `noseWidth` | `nose.width` | 窄、寬、平均 |\n| | 鼻長 | `noseLength` | `nose.length` | 長、短、平均 |\n| **顴骨**   | 顴骨 | `cheekbones` | `cheekbone.left`、`cheekbone.right`、`cheekbone.overall` | 平坦顴骨、高顴骨、低顴骨、圓臉頰 |\n\n\n---\n\n* 臉部比例：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/img_Face_Ratio_sec_01_03_2fe8f06b92.jpg)\n\n| **子類別** | **請求參數** | **結果參數** | **結果類型** | **說明** |\n| --- | --- | --- | --- | --- |\n| 水平三等分比例 | `horizontalThird` | `horizontal_third` | 三段百分比；解讀：短／均衡／長；黃金比例：33% : 33% : 33% | 臉部水平比例基於將臉部分為三個等分：從髮際線到眉毛下緣、從眉毛下緣到鼻子下緣、從鼻子下緣到下巴尖端。三者之間的黃金比例（理想比例）為 1:1:1。|\n| 垂直五等分比例 | `verticalFifth` | `vertical_fifth` | 五段百分比；解讀（眼距與眼寬）：窄／均衡／寬；黃金比例：20% : 20% : 20% : 20% : 20% | 臉部垂直比例由將臉部分為五個區塊決定：一隻眼睛的寬度、兩眼之間的距離，以及從眼睛外角到臉部邊緣的間距。這些比例的黃金比例為 1:1:1:1:1。 |\n| 臉部長寬比 | `faceAspectRatio` | `face_aspect_ratio` | `[1, r]`；解讀：短／均衡／長；黃金比例：1 : 1.46 | 臉部長寬比是臉部寬度與高度的關係，理想上遵循 1:1.46 的黃金比例，創造均衡且具美感的視覺。 |\n| 眼睛長寬比 | `eyeAspectRatio` | `left_eye_aspect_ratio` `right_eye_aspect_ratio` | `[1, r]`；解讀：圓／均衡／平；黃金比例：1 : 3 | 眼睛長寬比是眼睛高度與寬度的關係，理想上符合 1:3 的黃金比例，確保最具美感的均衡視覺。\n |\n| 眉峰比例 | `eyebrowArch` | `left_eyebrow_arch_to_eyebrow_width` `right_eyebrow_arch_to_eyebrow_width` | `[1, r]`；解讀：短眉峰／均衡／長眉峰；黃金比例：1 : 1.618 | 眉峰的理想比例取決於眉毛本身的形狀，其最高點（眉峰）符合黃金比例，創造具美感的視覺。 |\n| 眼高到眉毛距離 | `eyeHeightToEyebrowDistance` | `left_eye_height_to_eyebrow_distance` `right_eye_height_to_eyebrow_distance` `overall_eye_height_to_eyebrow_distance` | `[1, r]`；解讀：短／均衡／長；黃金比例：1 : 1.618 | 眼到眉距離是從上眼皮頂部到眉毛最高點的垂直距離。理想上，與眼高相比遵循 1.618:1 的黃金比例，達到眼睛與眉毛之間最和諧的平衡。 |\n| 鼻子長寬比 | `noseAspectRatio` | `nose_aspect_ratio` | `[1, r]`；解讀：寬／均衡／窄；黃金比例：1 : 1.618 | 鼻子長寬比是鼻子寬度與高度的關係，理想上遵循 1:1.618 的黃金比例。 |\n| 鼻寬到嘴寬 | `noseWidthToMouthWidth` | `nose_width_to_mouth_width` | `[1, r]`；解讀：小／均衡／大；黃金比例：1 : 1.618 | 鼻寬到嘴寬比例是鼻子寬度與嘴巴寬度的關係，理想上遵循 1:1.618 的黃金比例，創造均衡且具美感的視覺。 |\n| 鼻到唇到下巴 | `noseToLipToChin` | `nose_to_lip_to_chin` | `[1, r]`；解讀：短／均衡／長（下臉長度）；黃金比例：1 : 1.618 | 鼻到唇到下巴比例是指從鼻底到唇中心的距離為 1，唇中心到下巴的理想距離為 1.618。這個黃金比例遵循臉部對稱原則，創造均衡和諧的下臉。 |\n| 上唇到下唇 | `upperLipToLowerLip` | `upper_lip_to_lower_lip` | `[1, r]`；解讀：上唇飽滿／均衡／下唇飽滿；黃金比例：1 : 1.618 | 上唇到下唇的黃金比例意指下唇厚度應為上唇的 1.618 倍。這個比例創造均衡且具美感的視覺，下唇略為飽滿於上唇。 |\n\n----\n\n* 拍攝建議：\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/AI_Face_Analysis_how_to_shoot_35ca9af08e.png)\n\n> **警告：** 臉部寬度需大於圖片寬度的 60%。\n\n## 檔案規格與錯誤\n* 支援的格式與尺寸\n\n|AI 功能|支援的尺寸|支援的檔案大小|支援的格式|\n|  ----  | ----  | ----  | ----  |\n|AI 臉部特徵與比例偵測|長邊 <= 4096，僅限單人。邊長超過 1080px 的圖片會自動調整尺寸以進行分析。|< 10MB|jpg/jpeg/png|\n\n* 錯誤代碼\n\n|錯誤代碼|說明|\n|  ----  | ----  |\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_face_not_forward_facing | 臉部必須正對鏡頭。 |\n| error_face_angle_upward | 臉部向上偏轉過多—請稍微低頭。 |\n| error_face_angle_downward | 臉部向下偏轉過多—請稍微抬頭。 |\n| error_face_angle_leftward | 臉部向左轉轉過多—請稍微向右轉頭。 |\n| error_face_angle_rightward | 臉部向右轉過多—請稍微向左轉頭。 |\n| error_face_angle_left_tilt | 臉部向左傾斜過多—請輕輕向右傾頭。 |\n| error_face_angle_right_tilt | 臉部向右傾斜過多—請輕輕向左傾頭。 |\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## JS Camera Kit\n{% partial file=\"/_partials/js-camera-kit.md\" /%}\n\n---\n\n## 點數消耗\n\n* 臉部特徵與比例偵測\n\n| AI 功能 | 消耗的點數 |\n|---|---|\n| 1~5 項臉部結構特徵 | 10 |\n| 6~14 項臉部結構特徵 | 20 |\n| 15~28 項臉部結構特徵 | 30 |\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"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/face-attr-analysis": {
      "post": {
        "summary": "執行臉部特徵分析任務。",
        "description": "這個端點啟動臉部特徵分析流程。您必須提供來源檔案（透過網址或檔案 ID），並指定要分析哪些項目。任務會以非同步方式處理，您可以使用這個回應回傳的 task_id 查詢其狀態。\n",
        "tags": [
          "V1.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "face_angle_strictness_level": {
                        "$ref": "#/components/schemas/BasicFaceAttrReqFaceAngleStrictnessLevel"
                      },
                      "features": {
                        "$ref": "#/components/schemas/BasicFaceAttrReqFeatures"
                      }
                    },
                    "required": [
                      "features"
                    ]
                  }
                ]
              }
            }
          }
        },
        "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/face-attr-analysis/{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": {
                  "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": {
                          "allOf": [
                            {
                              "type": "object",
                              "properties": {
                                "face_quality": {
                                  "$ref": "#/components/schemas/BasicFaceAttrRespFaceQuality"
                                },
                                "facialratio": {
                                  "$ref": "#/components/schemas/BasicFaceAttrRespFacialRatio"
                                },
                                "cheekbone": {
                                  "type": "object",
                                  "properties": {
                                    "left": {
                                      "type": "string",
                                      "enum": [
                                        "Flat Cheekbone",
                                        "High Cheekbone",
                                        "Low Cheekbone",
                                        "Round Cheeks"
                                      ]
                                    },
                                    "right": {
                                      "type": "string",
                                      "enum": [
                                        "Flat Cheekbone",
                                        "High Cheekbone",
                                        "Low Cheekbone",
                                        "Round Cheeks"
                                      ]
                                    },
                                    "overall": {
                                      "type": "string",
                                      "enum": [
                                        "Flat Cheekbone",
                                        "High Cheekbone",
                                        "Low Cheekbone",
                                        "Round Cheeks"
                                      ]
                                    }
                                  }
                                },
                                "eyelid": {
                                  "type": "object",
                                  "properties": {
                                    "left_eyelid": {
                                      "type": "string",
                                      "enum": [
                                        "Hooded-lid",
                                        "Single-lid",
                                        "Double-lid",
                                        "Deep-Set"
                                      ]
                                    },
                                    "left_angle": {
                                      "type": "string",
                                      "enum": [
                                        "Downturned",
                                        "Upturned",
                                        "Average"
                                      ]
                                    },
                                    "left_shape": {
                                      "type": "string",
                                      "enum": [
                                        "Narrow",
                                        "Round",
                                        "Almond"
                                      ]
                                    },
                                    "right_eyelid": {
                                      "type": "string",
                                      "enum": [
                                        "Hooded-lid",
                                        "Single-lid",
                                        "Double-lid",
                                        "Deep-Set"
                                      ]
                                    },
                                    "right_angle": {
                                      "type": "string",
                                      "enum": [
                                        "Downturned",
                                        "Upturned",
                                        "Average"
                                      ]
                                    },
                                    "right_shape": {
                                      "type": "string",
                                      "enum": [
                                        "Narrow",
                                        "Round",
                                        "Almond"
                                      ]
                                    },
                                    "setting": {
                                      "type": "string",
                                      "enum": [
                                        "Close-set",
                                        "Wide-Set",
                                        "Average"
                                      ]
                                    },
                                    "size": {
                                      "type": "string",
                                      "description": "可選值：[Big, Small, Average]",
                                      "enum": [
                                        "Big",
                                        "Small",
                                        "Average"
                                      ]
                                    }
                                  }
                                },
                                "eyebrow": {
                                  "type": "object",
                                  "properties": {
                                    "gap": {
                                      "type": "string",
                                      "enum": [
                                        "Far-Apart",
                                        "Close",
                                        "Average"
                                      ]
                                    },
                                    "left_shape": {
                                      "type": "string",
                                      "enum": [
                                        "Hard Angled",
                                        "Soft Angled",
                                        "Straight",
                                        "Rounded",
                                        "Obscured"
                                      ]
                                    },
                                    "left_body_thickness": {
                                      "type": "string",
                                      "enum": [
                                        "Dense",
                                        "Sparse",
                                        "Average",
                                        "Unknown"
                                      ]
                                    },
                                    "left_tail_thickness": {
                                      "type": "string",
                                      "enum": [
                                        "Dense",
                                        "Sparse",
                                        "Average",
                                        "Unknown"
                                      ]
                                    },
                                    "left_thinness": {
                                      "type": "string",
                                      "enum": [
                                        "Thin",
                                        "Normal"
                                      ]
                                    },
                                    "left_shortness": {
                                      "type": "string",
                                      "enum": [
                                        "Short",
                                        "Normal"
                                      ]
                                    },
                                    "right_shape": {
                                      "type": "string",
                                      "enum": [
                                        "Hard Angled",
                                        "Soft Angled",
                                        "Straight",
                                        "Rounded",
                                        "Obscured"
                                      ]
                                    },
                                    "right_body_thickness": {
                                      "type": "string",
                                      "enum": [
                                        "Dense",
                                        "Sparse",
                                        "Average",
                                        "Unknown"
                                      ]
                                    },
                                    "right_tail_thickness": {
                                      "type": "string",
                                      "enum": [
                                        "Dense",
                                        "Sparse",
                                        "Average",
                                        "Unknown"
                                      ]
                                    },
                                    "right_thinness": {
                                      "type": "string",
                                      "enum": [
                                        "Thin",
                                        "Normal"
                                      ]
                                    },
                                    "right_shortness": {
                                      "type": "string",
                                      "enum": [
                                        "Short",
                                        "Normal"
                                      ]
                                    }
                                  }
                                },
                                "faceshape": {
                                  "type": "string",
                                  "enum": [
                                    "Triangle",
                                    "Diamond",
                                    "Heart",
                                    "InvTriangle",
                                    "Oblong",
                                    "Oval",
                                    "Round",
                                    "Square",
                                    "Unknown"
                                  ]
                                },
                                "lipshape": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "enum": [
                                      "Bow",
                                      "Downturned",
                                      "Full",
                                      "Heavy Lower Lip",
                                      "Heavy Upper Lip",
                                      "Narrow",
                                      "Round",
                                      "Thin",
                                      "Wide",
                                      "Average"
                                    ]
                                  }
                                },
                                "nose": {
                                  "type": "object",
                                  "properties": {
                                    "width": {
                                      "type": "string",
                                      "enum": [
                                        "Narrow",
                                        "Broad",
                                        "Average"
                                      ]
                                    },
                                    "length": {
                                      "type": "string",
                                      "enum": [
                                        "Long",
                                        "Short",
                                        "Average"
                                      ]
                                    }
                                  }
                                },
                                "color": {
                                  "type": "object",
                                  "properties": {
                                    "eye_color": {
                                      "type": "string",
                                      "description": "眼色的 hex 值"
                                    },
                                    "eye_color_name": {
                                      "type": "string",
                                      "enum": [
                                        "Amber",
                                        "Brown",
                                        "Green",
                                        "Blue",
                                        "Gray",
                                        "Other"
                                      ]
                                    },
                                    "lip_color": {
                                      "type": "string",
                                      "description": "唇色的 hex 值"
                                    },
                                    "eyebrow_color": {
                                      "type": "string",
                                      "description": "眉色的 hex 值"
                                    },
                                    "hair_color": {
                                      "type": "string",
                                      "format": "color",
                                      "enum": [
                                        "#a0a0a0",
                                        "#722626",
                                        "#000000",
                                        "#FAF0BE",
                                        "#42280E",
                                        "#808080",
                                        "#B56637"
                                      ]
                                    },
                                    "hair_color_name": {
                                      "type": "string",
                                      "enum": [
                                        "Auburn",
                                        "Black",
                                        "Blonde",
                                        "Brown",
                                        "Grey/White",
                                        "Red"
                                      ]
                                    }
                                  }
                                },
                                "agegender": {
                                  "type": "object",
                                  "properties": {
                                    "age": {
                                      "type": "integer"
                                    },
                                    "gender": {
                                      "type": "string",
                                      "enum": [
                                        "female",
                                        "male",
                                        "unknown"
                                      ]
                                    }
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "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": {
      "BasicFaceAttrReqFaceAngleStrictnessLevel": {
        "type": "string",
        "description": "臉部角度偵測的嚴格程度（pitch、yaw、roll）。\n較嚴格的程度可確保更準確的臉部特徵結果。\n預設為 'high'。\n選項：\n  - strict：pitch <= 4 度、yaw <= 6 度、roll <= 4 度\n  - high：pitch、yaw、roll <= 10 度\n  - medium：pitch、yaw、roll <= 15 度\n  - low：pitch、yaw、roll <= 20 度\n  - flexible：pitch、yaw、roll <= 30 度\n",
        "enum": [
          "strict",
          "high",
          "medium",
          "low",
          "flexible"
        ],
        "example": "high"
      },
      "BasicFaceAttrReqFeatures": {
        "description": "AI 臉部分析類別\n\n* 臉部分析\n  - FACE（臉）：faceShape\n  - EYES（眼睛）：eyeShape eyeSize eyeAngle eyeDistance eyelid\n  - BROWS（眉毛）：eyebrowShape eyebrowThickness eyebrowDistance eyebrowShortness\n  - LIPS（嘴唇）：lipShape\n  - NOSE（鼻子）：noseWidth noseLength\n  - CHEEKBONES（顴骨）：cheekbones\n  - AGE & GENDER（年齡與性別）：age gender\n  - COLORS（顏色）：eyeColor hairColor eyebrowColor lipColor\n\n* 臉部比例\n  - horizontalThird\n  - verticalFifth\n  - faceAspectRatio\n  - eyeAspectRatio\n  - eyebrowPosition\n  - eyebrowArch\n  - eyeHeightToEyebrowDistance\n  - noseAspectRatio\n  - noseWidthToMouthWidth\n  - noseToLipToChin\n  - upperLipToLowerLip\n",
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "eyeShape",
            "eyeSize",
            "eyeAngle",
            "eyeDistance",
            "eyelid",
            "eyebrowShape",
            "eyebrowThickness",
            "eyebrowDistance",
            "eyebrowShortness",
            "cheekbones",
            "faceShape",
            "lipShape",
            "noseWidth",
            "noseLength",
            "age",
            "gender",
            "eyeColor",
            "lipColor",
            "eyebrowColor",
            "hairColor",
            "horizontalThird",
            "verticalFifth",
            "faceAspectRatio",
            "eyeAspectRatio",
            "eyebrowPosition",
            "eyebrowArch",
            "eyeHeightToEyebrowDistance",
            "noseAspectRatio",
            "noseWidthToMouthWidth",
            "noseToLipToChin",
            "upperLipToLowerLip"
          ]
        }
      },
      "BasicFaceAttrRespFaceQuality": {
        "type": "object",
        "properties": {
          "has_face": {
            "type": "boolean",
            "example": true
          },
          "area": {
            "type": "string",
            "example": "good"
          },
          "frontal": {
            "type": "string",
            "example": "good"
          },
          "lighting": {
            "type": "string",
            "example": "good"
          },
          "faceangle": {
            "type": "string",
            "example": "good"
          }
        }
      },
      "BasicFaceAttrRespFacialRatio": {
        "type": "object",
        "properties": {
          "horizontal_third": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "example": [
              33,
              33,
              33
            ]
          },
          "vertical_fifth": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "example": [
              20,
              20,
              20,
              20,
              20
            ]
          },
          "face_aspect_ratio": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "臉部寬度與高度的比例",
            "example": [
              1,
              1.46
            ]
          },
          "left_eye_aspect_ratio": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "眼睛高度與寬度的比例",
            "example": [
              1,
              3
            ]
          },
          "right_eye_aspect_ratio": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "眼睛高度與寬度的比例",
            "example": [
              1,
              3
            ]
          },
          "left_eyebrow_arch_to_eyebrow_width": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "眉毛前段寬度（從眉毛起點到眉峰）與眉毛總寬度（從起點到末端）的比例",
            "example": [
              1,
              1.476
            ]
          },
          "right_eyebrow_arch_to_eyebrow_width": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "眉毛前段寬度（從眉毛起點到眉峰）與眉毛總寬度（從起點到末端）的比例",
            "example": [
              1,
              1.523
            ]
          },
          "left_eye_height_to_eyebrow_distance": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "眼睛高度，與眉毛頂端到眼睛底端垂直距離的比例",
            "example": [
              1,
              2.69
            ]
          },
          "right_eye_height_to_eyebrow_distance": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "眼睛高度，與眉毛頂端到眼睛底端垂直距離的比例",
            "example": [
              1,
              2.775
            ]
          },
          "overall_eye_height_to_eyebrow_distance": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "example": [
              1,
              2.733
            ]
          },
          "nose_aspect_ratio": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "鼻子寬度與高度的比例",
            "example": [
              1,
              1.172
            ]
          },
          "nose_width_to_mouth_width": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "鼻子寬度與嘴巴寬度的比例",
            "example": [
              1,
              1.475
            ]
          },
          "nose_to_lip_to_chin": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "鼻尖到嘴唇中間的垂直距離，與嘴唇中間到下巴的垂直距離的比例",
            "example": [
              1,
              2.098
            ]
          },
          "upper_lip_to_lower_lip": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "上唇高度與下唇高度的比例",
            "example": [
              1,
              1.099
            ]
          }
        }
      },
      "BasicRunTaskV2SrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "要執行任務的檔案網址。該網址應可公開存取。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "要執行任務的檔案 ID。檔案 ID 來自上傳檔案 API。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2": {
        "title": "BasicRunTaskV2",
        "anyOf": [
          {
            "title": "Run task with src file url",
            "allOf": [
              {
                "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
              }
            ]
          },
          {
            "title": "Run task with src file 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 無效\n"
          }
        }
      },
      "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\\` - 其他"
      }
    },
    "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"
                }
              }
            }
          }
        }
      }
    }
  }
}