# AI 虛擬試妝

# 概述
AI 虛擬試妝 API 以我們專利的臉部分析技術為基礎，提供強大且極其逼真的虛擬改造型體驗。此服務讓您的應用程式能以前所未有的自訂能力，在使用者提供的自拍圖片上套用栩栩如生的彩妝特效。
**主要功能：**
* **極其逼真的渲染：** 運用革命性的 3D 人臉 AI 技術，達成最真實的改造型效果。
* **專利技術：** 由無抖動、無延遲的深度學習演算法驅動，針對所有年齡與族裔最佳化。
* **即時精準：** 超精準的臉部追蹤，可適應各種光線條件。
* **栩栩如生的對應：** 精確對應現實產品的顏色、質地（從 matte 到 metallic）與妝效。
* 核心概念
  * 色彩混合
我們的 AI 使用深度學習，精確對應現實彩妝產品的顏色。這確保消費者能確信他們看到的虛擬顏色，就是他們打算購買產品的真實顏色。
  * 質地與妝效對應
此技術模擬逼真的質地與妝效，提供高度準確的改造型體驗。從 matte 到 metallic、shimmer 到 satin，AI 運用先進演算法即時無縫渲染這些特效。
  * 光線平衡
智慧 3D AI 引擎會偵測使用者照片或影片串流中的光線條件。它會校正圖片以達到栩栩如生的彩妝套用，無論環境如何，都確保一致且高品質的結果。



---

## 整合指南
彩妝虛擬試戴服務以非同步任務運作。您必須先提供圖片網址與期望特效清單，啟動彩妝處理任務。伺服器會回傳 `task_id`。接著您定期輪詢狀態端點，以取得最終結果或任何錯誤。
* **端點：** `/v2.0/task/makeup-vto`
* **認證：** 所有請求都需要 `Authorization: Bearer <TOKEN>`
* **工作流程：**
  1. **準備自拍：**
 上傳圖片，或使用既有臉部圖片的檔案網址。
  2. **啟動任務（`POST`）：**
 提交您的圖片 id/網址與彩妝設定。
  3. **取得任務 ID：**
 從回應中取得
`task_id`
。
  4. **輪詢狀態（`GET`）：**
 使用
`task_id`
 查詢任務狀態。持續輪詢，直到
`task_status`
 為
`"success"`
 或
`"error"`
。
* API Playground

使用我們的官方 playground 進行互動式探索與測試：
**API Playground：**
[http://yce.makeupar.com/api-console/en/api-playground/ai-makeup-virtual-try-on/](http://yce.makeupar.com/api-console/en/api-playground/ai-makeup-virtual-try-on/)


---

* 認證

- 使用
**Bearer Token**
 將您的 API key 納入請求標頭：

```
Authorization: Bearer <API Key>
```

您可以在 https://yce.makeupar.com/api-console/en/api-keys/ 找到您的 API Key。
*   1. 上傳自拍

您可以透過兩種方式之一提供來源圖片：
  - **使用現有的公開圖片網址**
無需上傳，您可以在啟動 AI 任務時直接提供可公開存取的圖片網址。
  - **透過 File API 上傳**
使用端點：

```
POST /s2s/v2.0/file
```
這會回傳用於後續任務執行的 `file_id`。
    - ***重要***：僅呼叫 File API 並不會上傳您的檔案。您必須**手動上傳**檔案到**File API 回應中提供的網址**。該網址就是您的上傳目的地，請確保檔案成功傳輸到該處後再繼續。
在呼叫 AI API 之前，請確保您的檔案已成功上傳。使用 File API 取得上傳網址，然後將檔案上傳到該位置。上傳完成後，您會在回應中取得 ***file_id***，這個 ID 就是您用於存取該檔案相關 AI 功能的依據。
> **警告：** 請注意，若您未將檔案上傳到 File API 回應中提供的網址，使用 AI API 時會得到 500 Server Error / unknown_internal_error 或 404 Not Found 錯誤。
*   1. 啟動彩妝任務

`POST /s2s/v2.0/task/makeup-vto`
在提供的圖片上啟動新的虛擬彩妝任務。這個端點為非同步，會回傳 `task_id`。
* 請求標頭

| 標頭 | 值 |
|  --- | --- |
| Content-Type | `application/json` |
| Authorization | `Bearer YOUR_API_KEY` |

* 請求內容範例


```json
{
  "src_file_url": "https://plugins-media.makeupar.com/strapi/assets/sample_Image_1_202b6bf6e6.jpg",
  "effects": [
    {
      "category": "blush",
      "pattern": { "name": "2colors6" },
      "palettes": [
        { "color": "#FF0000", "texture": "matte", "colorIntensity": 50 },
        { "color": "#F2A53E", "texture": "matte", "colorIntensity": 50 }
      ]
    },
    {
      "category": "eye_liner",
      "pattern": { "name": "3colors5" },
      "palettes": [
        { "color": "#000000", "texture": "matte", "colorIntensity": 50 },
        { "color": "#BA0656", "texture": "matte", "colorIntensity": 50 },
        { "color": "#089085", "texture": "matte", "colorIntensity": 50 }
      ]
    }
  ],
  "version": "1.0"
}
```
* 請求內容 Schema

| 欄位 | 類型 | 說明 |
|  --- | --- | --- |
| `src_file_url` | string（URL） | 要處理的自拍圖片之可公開存取的網址。 |
| `effects` | Effect 陣列 | 要套用的彩妝特效物件陣列。細節請參考[彩妝特效 Schema](#makeup-effect-schemas)。 |
| `version` | string | 特效內容結構的 API 版本。請使用 `"1.0"`。 |

* 成功的回應（
`200 OK`
）

回傳包含任務識別碼的 JSON 物件。

**回應內容 Schema：**

```json
{
  "status": 200,
  "data": {
    "task_id": "<string>"
  }
}
```
**回應範例：**

```json
{
  "status": 200,
  "data": {
    "task_id": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
  }
}
```
* 錯誤回應（
`400 Bad Request`
、
`401 InvalidApiKey`
 等）

會回傳標準的錯誤物件，並附帶描述失敗原因的訊息。

**錯誤回應範例：**

```json
{
  "status": 400,
  "error": "The operation could not be completed",
  "error_code": "CreditInsufficiency"
}
```


---

*   1. 取得任務狀態與結果

`GET /s2s/v2.0/task/makeup-vto/<task_id>`
取得進行中或已完成任務的目前狀態與結果。
* 請求標頭

| 標頭 | 值 |
|  --- | --- |
| Authorization | `Bearer YOUR_API_KEY` |

* 路徑參數

| 參數 | 類型 | 說明 |
|  --- | --- | --- |
| task_id | string | 從啟動任務端點回傳的識別碼。 |

* 成功的回應（
`200 OK`
）

包含狀態的 JSON 物件，若已完成則包含結果。

**回應內容 Schema：**

```json
{
  "data": {
    "task_status": "<string>", // 'success', 'error', or a processing state (e.g., 'queued', 'processing')
    "results": [ // 僅在 task_status 為 'success' 時出現
      {
        "download_url": "<string>" // 下載處理後影像的 URL
      }
    ],
    "failure_reason": "<string>" // 僅在 task_status 為 'error' 時出現
  }
}
```
**成功回應範例：**

```json
{
  "status": 200,
  "data": {
    "task_status": "success",
    "results": {
      "url": "https://s3.storage.prod/processed/image_123.jpg?token=..."
    }
  }
}
```
**引擎錯誤回應範例：**
API 查詢已成功送出；然而，執行 AI 任務時發生錯誤。

```json
{
  "status": 200,
  "data": {
    "task_status": "error",
    "error": "exceed_max_filesize",
    "error_message": "string",
  }
}
```
> 請注意，若發生錯誤，無論是查詢錯誤或引擎錯誤，都不會消耗點數。

**進行中回應範例：**

```json
{
  "status": 200,
  "data": {
    "task_status": "running"
  }
}
```
* 錯誤回應
* `404 InvalidTaskId`
：
`task_id`
 不存在或無效。
* `401 InvalidApiKey`
：API key 無效或缺失。
* `500 TaskTimeout`
：任務已成功完成或失敗，且已超過保留期限。

**查詢錯誤回應範例：**

```json
{
  "status": 401,
  "error_code": "InvalidApiKey"
}
```
> 請注意，若發生錯誤，無論是查詢錯誤或引擎錯誤，都不會消耗點數。



---

## 輸入與輸出
* 彩妝特效 Schema

本節定義 AI 彩妝任務請求內容的完整結構與限制。每個特效都是上層 `effects` 陣列中的一個物件。
* 特效容器（上層）


```json
{
  "version": "1.0",
  "effects": []                    // array<Effect> — Contains makeup effect objects
}
```
* 彩妝特效類別
  * `skin_smooth`


```json
{
  "category": "skin_smooth",           // string, const "skin_smooth"
  "skinSmoothStrength": 50,            // integer, range: 0..100
  "skinSmoothColorIntensity": 50       // integer, range: 0..100
}
```
> **注意！** 若請求中未包含 `skin_smooth` 特效，AI 彩妝引擎會自動套用預設的 Skin Smooth 值 50。
若您希望套用彩妝但不進行肌膚平滑，請將所有 `skinSmoothStrength` 與 `skinSmoothColorIntensity` 參數設為 0。不過，為了獲得最佳結果與最高品質的融合，建議保留預設啟用的肌膚平滑。

* `blush`


```json
{
  "category": "blush",                 // string, const "blush"
  "pattern": {                         // object
    "name": ""                         // string — 必須等於 blush.json 中的 `label`
  },
  "palettes": [                        // array<BlushPalette>, minItems: (see colorNum in pattern)
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "texture": "matte",              // string, enum ["matte","satin","shimmer"]
      "glowStrength": 50,              // integer, range: 0..100 — REQUIRED if texture="satin"
      "shimmerColor": "#fc288f",       // string, hex color "#RRGGBB" — REQUIRED if texture="shimmer"
      "shimmerDensity": 50,            // integer, range: 0..100 — REQUIRED if texture="shimmer"
      "colorIntensity": 50             // integer, range: 0..100
    }
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/blush.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "1 color",
    "label": "1color1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/483/a53cd4f4-43b6-4e19-b85a-ec7a95c6a47f.jpg",
    "tags": [
      { "id": 100, "name": "Blush 3D" },
      { "id": 103, "name": "Oblong" }
    ],
    "colorNum": 1
  },
  {
    "category": "2 colors",
    "label": "2colors1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/147/a8d86a4b-8aa0-48d7-a716-63ec78dfb30b.jpg",
    "tags": [
      { "id": 100, "name": "Blush 3D" }
    ],
    "colorNum": 2
  },
  {
    "category": "3 colors",
    "label": "3colors1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/734/af8b625b-ae3a-4211-9413-f22c16a5f174.jpg",
    "tags": [
      { "id": 100, "name": "Blush 3D" },
      { "id": 104, "name": "Round" }
    ],
    "colorNum": 3
  }
]
```
* `bronzer`


```json
{
  "category": "bronzer",               // string, const "bronzer"
  "pattern": { "name": "" },           // object — name 必須等於 bronzer.json 中的 `label`
  "palettes": [
    { "color": "#ff0000", "colorIntensity": 50 }  // hex color, int range: 0..100
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/bronzer.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "Bronzer",
    "label": "Bronzer1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/973/22ff2c07-d584-4ae6-8281-c095cd121a52.jpg",
    "tags": [],
    "colorNum": 1
  }
]
```
* `concealer`


```json
{
  "category": "concealer",             // string, const "concealer"
  "palettes": [
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "colorIntensity": 50,            // integer, range: 0..100
      "colorUnderEyeIntensity": 50,    // integer, range: 0..100
      "coverageLevel": 50              // integer, range: 0..100
    }
  ]
}
```
* `contour`


```json
{
  "category": "contour",               // string, const "contour"
  "pattern": { "name": "" },           // object — name 必須等於 contour.json 中的 `label`
  "palettes": [
    { "color": "#ff0000", "colorIntensity": 50 }  // hex color, int range: 0..100
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/contour.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "Heart face",
    "label": "HeartFace2",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/731/49a1b3b9-b393-4bf4-b486-1493fe468436.jpg",
    "tags": []
  },
  {
    "category": "Invtriangle",
    "label": "Invtriangle1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/858/a94c8cca-5f8c-4b8b-a02d-94edb6a4ad7f.jpg",
    "tags": []
  },
  {
    "category": "Oval face",
    "label": "OvalFace6",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/906/644368a3-7eee-4ad9-829e-e2b3d4320fec.jpg",
    "tags": []
  },
  {
    "category": "Round face",
    "label": "RoundFace4",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/106/3e455b5f-7e2d-46f7-8627-dc137051c144.jpg",
    "tags": []
  },
  {
    "category": "Triangle face",
    "label": "TriangleFace2",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/528/18765180-c254-4411-a25c-c1d78f5c3d77.jpg",
    "tags": []
  }
]
```
* `eyebrows`


```json
{
  "category": "eyebrows",              // string, const "eyebrows"
  "pattern": {
    "type": "shape",                   // string, enum ["shape","color"], default: "shape"
    "name": "",                        // string，type="shape" 時必要 — eyebrows.json 的 label
    "curvature": 0,                    // integer, range: -100..100 (shape only)
    "thickness": 0,                    // integer, range: -100..100 (shape only)
    "definition": 0                    // integer, range: 0..100 (shape only)
  },
  "palettes": [
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "colorIntensity": 50,            // integer, range: 0..100
      "texture": "matte",              // string, enum ["matte","shimmer"]
      "shimmerColor": "#fc288f",       // string, hex color "#RRGGBB" — REQUIRED if texture="shimmer"
      "shimmerIntensity": 50,          // integer, range: 0..100 — REQUIRED if texture="shimmer"
      "shimmerSize": 50,               // integer, range: 0..100 — REQUIRED if texture="shimmer"
      "shimmerDensity": 50             // integer, range: 0..100 — REQUIRED if texture="shimmer"
    }
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/eyebrows.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "Arrow",
    "label": "Arrow1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/490/1fb96bf9-979e-4327-a8c4-8c503f541f1a.jpg",
    "tags": []
  },
  {
    "category": "Curved",
    "label": "Curved1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/389/1ccb300e-c7ed-4995-920e-7d1bf8da1fad.jpg",
    "tags": []
  },
  {
    "category": "Drama",
    "label": "Drama2",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/196/5fb14bec-553d-4841-bba7-ca7e5e27c12e.jpg",
    "tags": []
  },
  {
    "category": "High Arch",
    "label": "HighArch1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/609/7a8676dc-6f6a-4b12-aab0-c50328e448c5.jpg",
    "tags": []
  },
  {
    "category": "Original",
    "label": "Original2",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/300/123551e9-ca94-4732-89ed-5b3866678555.jpg",
    "tags": []
  },
  {
    "category": "Soft Arch",
    "label": "SoftArch1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/121/2552ebf0-2705-43f7-b295-4fac21e18009.jpg",
    "tags": []
  },
  {
    "category": "Straight",
    "label": "Straight1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/1/7734e777-8e51-41f1-abaf-205f0ed5e3b4.jpg",
    "tags": []
  },
  {
    "category": "Thin",
    "label": "Thin1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/734/6ee10843-a251-4aa0-9183-db7f981d714d.jpg",
    "tags": []
  },
  {
    "category": "Upward",
    "label": "Upward4",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/751/76578317-f475-49c7-bd96-910ccad617ef.jpg",
    "tags": []
  }
]
```
* `eye_liner`


```json
{
  "category": "eye_liner",             // string, const "eye_liner"
  "pattern": { "name": "" },           // object — name 必須等於 eyeliner.json 中的 label
  "palettes": [
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "texture": "matte",              // string, enum ["matte","shimmer","metallic"]
      "shimmerColor": "#fc288f",       // string, hex color "#RRGGBB" — REQUIRED if texture in ["shimmer","metallic"]
      "shimmerIntensity": 50,          // integer, range: 0..100 — REQUIRED if texture in ["shimmer","metallic"]
      "metallicIntensity": 50,         // integer, range: 0..100 — REQUIRED if texture="metallic"
      "colorIntensity": 50             // integer, range: 0..100
    }
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/eyeliner.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "2 colors",
    "label": "2colors1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/419/71d9429a-dc08-4e80-9c46-6e55631ef766.jpg",
    "tags": [
      {
        "id": 28,
        "name": "Drama"
      }
    ],
    "colorNum": 2
  },
  {
    "category": "3 colors",
    "label": "3colors2",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/208/056aa6cd-8678-470c-b111-b7653d7ddf93.jpg",
    "tags": [
      {
        "id": 28,
        "name": "Drama"
      }
    ],
    "colorNum": 3
  },
  {
    "category": "1 color",
    "label": "Arabic3",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/726/1919aad4-21a2-493a-a5f8-48bc99a61ba5.jpg",
    "tags": [
      {
        "id": 26,
        "name": "Arabic"
      }
    ],
    "colorNum": 1
  }
]
```
* `eye_shadow`


```json
{
  "category": "eye_shadow",            // string, const "eye_shadow"
  "pattern": { "name": "" },           // object — name 必須等於 eyeshadow.json 中的 label
  "palettes": [
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "texture": "matte",              // string, enum ["matte","shimmer","metallic"]
      "shimmerColor": "#fc288f",       // string, hex color "#RRGGBB" — REQUIRED if texture in ["shimmer","metallic"]
      "shimmerIntensity": 50,          // integer, range: 0..100 — REQUIRED if texture in ["shimmer","metallic"]
      "metallicIntensity": 50,         // integer, range: 0..100 — REQUIRED if texture="metallic"
      "colorIntensity": 50             // integer, range: 0..100
    }
  ]                                    // minItems: (see colorNum in pattern)
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/eyeshadow.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "1 color",
    "label": "1color1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/188/0322c4f9-e54d-4a6b-8072-6bb76560121a.jpg",
    "tags": [
      {
        "id": 12,
        "name": "Artistic"
      },
      {
        "id": 14,
        "name": "Dream"
      },
      {
        "id": 15,
        "name": "Trend"
      }
    ],
    "colorNum": 1
  },
  {
    "category": "2 colors",
    "label": "2colors1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/938/3348211c-1b83-4ab2-9c6a-ce06e4aa3528.jpg",
    "tags": [
      {
        "id": 1,
        "name": "Fan shape"
      },
      {
        "id": 8,
        "name": "Only upper lid"
      }
    ],
    "colorNum": 2
  },
  {
    "category": "3 colors",
    "label": "3colors1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/542/55e1b0fd-b888-47ff-bd3a-3dc1af2a7b69.jpg",
    "tags": [
      {
        "id": 1,
        "name": "Fan shape"
      },
      {
        "id": 8,
        "name": "Only upper lid"
      }
    ],
    "colorNum": 3
  },
  {
    "category": "4 colors",
    "label": "4colors1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/429/29cd5839-464b-4a7a-a5c1-c7b40e9464d7.jpg",
    "tags": [
      {
        "id": 4,
        "name": "Closed banana"
      },
      {
        "id": 10,
        "name": "Whole eye"
      }
    ],
    "colorNum": 4
  },
  {
    "category": "5 colors",
    "label": "5colors1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/2/824dcf7c-1273-4a30-8f1f-2137926057d6.jpg",
    "tags": [
      {
        "id": 4,
        "name": "Closed banana"
      },
      {
        "id": 10,
        "name": "Whole eye"
      }
    ],
    "colorNum": 5
  }
]
```
* `eyelashes`


```json
{
  "category": "eyelashes",             // string, const "eyelashes"
  "pattern": { "name": "" },           // object — name 必須等於 eyelashes.json 中的 label
  "palettes": [
    { "color": "#ff0000", "colorIntensity": 50 }  // hex color, int range: 0..100
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/eyelashes.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "Artistic",
    "label": "Artistic1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/146/7a8ed606-1c27-4d91-9320-c40a904f621f.jpg",
    "tags": []
  },
  {
    "category": "Natural",
    "label": "Natural1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/287/cd5cae75-a1b3-48f8-8537-e6e259213901.png",
    "tags": []
  },
  {
    "category": "Upper&Lower",
    "label": "Upper&Lower1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/18/2689ea2d-725e-4fa0-8563-df874ae1a83f.jpg",
    "tags": []
  },
  {
    "category": "Upper",
    "label": "Upper1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/982/c99bf74e-545f-4da7-a314-f3bd84b82156.jpg",
    "tags": []
  },
  {
    "category": "UpperDense",
    "label": "UpperDense1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/888/452ec863-f0a8-40e7-aa33-31c0c39f57e2.jpg",
    "tags": []
  },
  {
    "category": "Winged",
    "label": "Winged1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/825/36ab3859-eae5-49e4-9d97-161698bbb8bb.jpg",
    "tags": []
  },
  {
    "category": "Wispies",
    "label": "Wispies1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/722/a2a727f6-748c-41e7-8ac0-c9c57c18c05a.png",
    "tags": []
  }
]
```
* `foundation`


```json
{
  "category": "foundation",            // string, const "foundation"
  "palettes": [
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "colorIntensity": 50,            // integer, range: 0..100
      "glowIntensity": 50,             // integer, range: 0..100
      "coverageIntensity": 50          // integer, range: 0..100
    }
  ]
}
```
* `highlighter`


```json
{
  "category": "highlighter",           // string, const "highlighter"
  "pattern": { "name": "" },           // object — name 必須等於 highlighter.json 中的 label
  "palettes": [
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "glowIntensity": 50,             // integer, range: 0..100
      "shimmerIntensity": 50,          // integer, range: 0..100
      "shimmerDensity": 50,            // integer, range: 0..100
      "shimmerSize": 50,               // integer, range: 0..100
      "colorIntensity": 50             // integer, range: 0..100
    }
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/highlighter.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "Heart face",
    "label": "HeartFace4",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/246/6ca40279-79cc-4918-b48a-64306009b365.jpg",
    "tags": []
  },
  {
    "category": "Invtriangle",
    "label": "Invtriangle2",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/7/6b0b9760-612c-4319-bd81-855d262d8e89.jpg",
    "tags": []
  },
  {
    "category": "Oblong",
    "label": "Oblong11",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/862/b7279f4e-edf2-43f3-8156-561fe5a52ec3.jpg",
    "tags": []
  },
  {
    "category": "Oval face",
    "label": "OvalFace2",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/369/91097a05-9fd2-43cb-82e9-dd45e72b613b.jpg",
    "tags": []
  },
  {
    "category": "Round face",
    "label": "RoundFace3",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/520/2d3ccbe2-36c3-43df-9e78-4c2c931fa431.jpg",
    "tags": []
  },
  {
    "category": "Square face",
    "label": "SquareFace3",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/989/2959777b-19ca-4f4a-a023-3c8927191497.jpg",
    "tags": []
  },
  {
    "category": "Triangle face",
    "label": "TriangleFace3",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/customer/guest/SkuCustomImage/765/221c1f12-c621-4567-a8ee-1433038ee8a2.jpg",
    "tags": []
  }
]
```
* `lip_color`


```json
{
  "category": "lip_color",             // string, const "lip_color"
  "shape": {                           // object — driven by lipshape.json
    "name": "original"                 // string — 必須等於 lipshape.json 中的 `label`
  },
  "morphology": {                      // optional object
    "fullness": 50,                    // integer, range: 0..100 (default: 0)
    "wrinkless": 50                    // integer, range: 0..100 (default: 0)
  },
  "palettes": [                        // minItems depends on style; often ≥1
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "texture": "matte",              // string, enum ["matte","gloss","holographic","metallic","satin","sheer","shimmer"]
      "colorIntensity": 50,            // integer, range: 0..100
      "gloss": 50,                     // int, range: 0..100 — REQUIRED if texture in ["gloss","holographic","metallic","sheer","shimmer"]
      "shimmerColor": "#ff0000",       // string, hex color "#RRGGBB" — REQUIRED if texture in ["holographic","metallic","shimmer"]
      "shimmerIntensity": 50,          // integer, range: 0..100 — REQUIRED if texture in ["holographic","metallic","shimmer"]
      "shimmerDensity": 50,            // integer, range: 0..100 — REQUIRED if texture in ["holographic","metallic","shimmer"]
      "shimmerSize": 50,               // integer, range: 0..100 — REQUIRED if texture in ["holographic","metallic","shimmer"]
      "transparencyIntensity": 50      // integer, range: 0..100 — REQUIRED if texture in ["gloss","sheer","shimmer"]
    }
  ],
  "style": {
    "type": "full",                    // string, enum ["full","ombre","twoTone"]
    "innerRatio": 50,                  // int, range: 0..100 — REQUIRED if type="ombre"
    "featherStrength": 50              // int, range: 0..100 — REQUIRED if type="ombre"
  }
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/shapes/lipshape.json
**各彩妝圖樣類別：**

```json
[{
        "category": "general",
        "label": "original",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/original.png",
        "tags": [
        ]
    }, {
        "category": "general",
        "label": "heart-shaped",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/heart-shaped.jpg",
        "tags": [
        ]
    }, {
        "category": "general",
        "label": "m-shaped",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/m-shaped.jpg",
        "tags": [
        ]
    }, {
        "category": "general",
        "label": "petal",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/petal.jpg",
        "tags": [
        ]
    }, {
        "category": "general",
        "label": "plump",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/plump.jpg",
        "tags": [
        ]
    }, {
        "category": "general",
        "label": "pouty",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/pouty.jpg",
        "tags": [
        ]
    }, {
        "category": "general",
        "label": "smile",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/smile.jpg",
        "tags": [
        ]
    }, {
        "category": "general",
        "label": "vintage",
        "thumbnail": "https://plugins-media.makeupar.com/wcm-saas/images/lipshapes/vintage.jpg",
        "tags": [
        ]
    }
]
```
* `lip_liner`


```json
{
  "category": "lip_liner",             // string, const "lip_liner"
  "pattern": { "name": "" },           // object — name 必須等於 lipliner.json 中的 label
  "palettes": [
    {
      "color": "#ff0000",              // string, hex color "#RRGGBB"
      "texture": "matte",              // string, enum ["matte","satin"]
      "colorIntensity": 50,            // integer, range: 0..100
      "thickness": 50,                 // integer, range: 0..100
      "smoothness": 50                 // integer, range: 0..100
    }
  ]
}
```
**完整圖樣目錄：**
https://plugins-media.makeupar.com/wcm-saas/patterns/lipliner.json
**各彩妝圖樣類別：**

```json
[
  {
    "category": "Large & Full",
    "label": "Large&Full1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/417/7ac66cb2-2c7b-451c-8284-cc77791b7001.jpg",
    "tags": []
  },
  {
    "category": "Larger Lower",
    "label": "LargerLower1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/878/84b2ef48-3af4-4851-86d2-b01d10db82b2.jpg",
    "tags": []
  },
  {
    "category": "Larger Upper",
    "label": "LargerUpper1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/867/674f9f4c-7961-462e-8cc9-9a8acaad4168.jpg",
    "tags": []
  },
  {
    "category": "Natural",
    "label": "Natural1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/258/7533c08a-cc9c-45ab-9294-5d5a8114037d.jpg",
    "tags": []
  },
  {
    "category": "Rosebud",
    "label": "Rosebud1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/47/eb95e91f-6ef1-41f7-bc4f-aecd7d780c42.jpg",
    "tags": []
  },
  {
    "category": "Small",
    "label": "Small1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/396/6b78e461-24a6-4c6d-afb4-88beb71f1732.jpg",
    "tags": []
  },
  {
    "category": "Wider",
    "label": "Wider1",
    "thumbnail": "https://app-cdn-01.makeupar.com/console/SkuCustomImage/guest/867/21f92b70-72b5-4a57-b4d7-81c5cce757a6.jpg",
    "tags": []
  }
]
```


---

## 內容範例
以下是一個套用多個特效的有效 `effectJson` 內容完整範例。

```json
{
  "version": "1.0",
  "effects": [
    {
      "category": "skin_smooth",
      "skinSmoothStrength": 55,
      "skinSmoothColorIntensity": 45
    },
    {
      "category": "blush",
      "pattern": { "name": "2colors1" },
      "palettes": [
        {
          "color": "#e19f9f",
          "texture": "matte",
          "colorIntensity": 60,
          "shimmerColor": "#d63252",
          "shimmerDensity": 50
        },
        {
          "color": "#c98a8a",
          "texture": "satin",
          "glowStrength": 40,
          "colorIntensity": 70
        }
      ]
    },
    {
        "category": "lip_color",
        "shape": { "name": "plump" },
        "morphology": { "fullness": 30, "wrinkless": 25 },
        "style": { "type": "full" },
        "palettes": [
            {
                "color": "#e11c43",
                "texture": "gloss",
                "colorIntensity": 80,
                "gloss": 75
            }
        ]
    }
  ]
}
```
在此範例中，`blush` 使用來自 `blush.json` 的 `2colors1` 圖樣，需要恰好兩個調色盤。`lip_color` 特效使用來自 `lipshape.json` 的 `plump` 形狀。
## 檔案規格與錯誤
* 支援的格式與尺寸

| AI 功能 | 支援的尺寸 | 支援的檔案大小 | 支援的格式 |
|  --- | --- | --- | --- |
| AI 虛擬試妝 | 長邊 < 1920，臉寬 >= 100 | < 10MB | jpg/jpeg/png |

* 錯誤代碼

| 錯誤代碼 | 說明 |
|  --- | --- |
| error_below_min_image_size | 來源圖片尺寸小於最小值（期望：寬 >= 100px，高 >= 100px） |
| error_exceed_max_image_size | 來源圖片尺寸大於最大值（期望：寬 < 1920px，高 < 1080px） |
| error_face_position_invalid | 請確保您的整張臉在圖片中完全可見 |
| error_face_position_too_small | 偵測到的臉部過小。請靠近鏡頭 |
| error_face_position_out_of_boundary | 臉部過大或部分在畫面之外。請調整您的位置 |
| error_face_angle_invalid | 臉部角度不正確。正面照片請將頭部保持在 10° 內。側面照片請確保超過 15°。 |

* 環境與相依性

| 範例程式語言 / 工具 | 建議的執行環境版本 |
|  --- | --- |
| cURL | - bash >= 3.2   - curl >= 7.58（現代 TLS/HTTP 支援）   - jq >= 1.6（穩健的 JSON 解析） |
| Node.js（JavaScript） | Node >= 18（支援全域 fetch） |
| JavaScript | - Chrome / Edge >= 80   - Firefox >= 74   - Safari >= 13.1 |
| PHP | PHP >= 7.4（現代 TLS/相容性），ext-curl（建議）或 allow_url_fopen=On + ext-openssl、ext-json |
| Python | Python >= 3.10（支援 f-strings），requests >= 2.20.0 |
| Java | Java 11+（支援 HttpClient），Jackson Databind >= 2.12.0 |



---

## JS Camera Kit


---

## 點數消耗
| AI 功能 | 消耗的點數 |
|  --- | --- |
| AI 虛擬試妝 V1.0 | 1 |



---

License: Privacy policy

## Servers

```
https://yce-api-01.makeupar.com
```

## Security

### BearerAuthenticationV2

使用標準的 'Bearer authentication'。請在標頭中放入您的 'API Key'：`Authorization:Bearer YOUR_API_KEY`。請注意 'Bearer' 與 'YOUR_API_KEY' 之間有一個空格。

Type: http
Scheme: bearer

## Download OpenAPI description

 - [AI 虛擬試妝](https://docs.perfectcorp.com/_bundle/@l10n/zh-TW/reference/makeup_vto.yaml)

## V1.0

 - [POST /s2s/v2.0/task/makeup-vto](https://docs.perfectcorp.com/zh-tw/reference/makeup_vto/v1.0/paths/~1s2s~1v2.0~1task~1makeup-vto/post.md): 這個端點啟動彩妝虛擬試妝流程。您必須提供來源檔案（透過網址或檔案 ID），並使用定義的特效 schema 指定要套用的特效。任務會以非同步方式處理，您可以使用這個回應回傳的 task_id 查詢其狀態。
 - [GET /s2s/v2.0/task/makeup-vto/{task_id}](https://docs.perfectcorp.com/zh-tw/reference/makeup_vto/v1.0/paths/~1s2s~1v2.0~1task~1makeup-vto~1%7Btask_id%7D/get.md)
