> ## Documentation Index
> Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Watermark Remover API：去除單張圖片中的水印

> 單一影像浮水印移除 API 用於圖生圖的清理，恢復乾淨的視覺效果，無需手動遮罩或修飾。

## 概覽

Image Watermark Remover 可去除單張圖片上可見的文字或標誌水印，並傳回處理後圖片的 URL。在 APIXO Playground 試用後，可依本頁範例呼叫 API。

| 功能 | 值 |
| - | - |
| 模型 ID | `image-watermark-remover` |
| 模式 | `image-to-image` |
| 輸入影像 | 正是1公共影像URL |
| 輸出格式 | `jpg`, `jpeg`, `png`, `webp` |
| 預設輸出格式 | `jpg` |
| 結果交付 | 非同步輪詢或 webhook 回呼 |

> [!TIP]
>
> 此模型固定為單一影像圖生圖的工作流程。它不接受提示、遮罩、種子、解析度控製或多個參考影像。

## 端點與身分驗證

API 基底網址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/image-watermark-remover` | 提交去浮水印任務 |
| `GET` | `/statusTask/image-watermark-remover?taskId={taskId}` | 查詢任務狀態並取得結果 |

每個請求都必須附上 APIXO API 金鑰：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

送出任務時，還需設定以下請求標頭：

```http theme={null}
Content-Type: application/json
```

## 非同步請求範例

這項最小請求提交一個影像清理任務並傳回 `taskId`。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/image-watermark-remover" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "image_urls": [
        "https://example.com/photo-with-watermark.jpg"
      ],
      "output_format": "jpg"
    }
  }'
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

請保留 `taskId`，後續輪詢結果時會用到。

## 輪詢結果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/image-watermark-remover?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

任務處理中的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/watermark-free-image.jpg\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

任務失敗時的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "UPSTREAM_ERROR",
    "failMsg": "The service could not complete the task",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
```

等 `state` 變為 `success` 後，再解析 `resultJson`：

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const imageUrls = payload.resultUrls;
```

## 請求體

### 預設JPG輸出

```json theme={null}
{
  "request_type": "async",
  "input": {
    "image_urls": [
      "https://example.com/photo-with-watermark.jpg"
    ],
    "output_format": "jpg"
  }
}
```

### PNG輸出

```json theme={null}
{
  "request_type": "async",
  "input": {
    "image_urls": [
      "https://example.com/marketing-banner.png"
    ],
    "output_format": "png"
  }
}
```

### 顯式模式

`mode` 是選填的，因為該端點只有一個工作流程。如果包含它，它一定是`image-to-image`。

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "image_urls": [
      "https://example.com/photo-with-watermark.webp"
    ],
    "output_format": "webp"
  }
}
```

## 參數

**request\_type** `string` *required* (default: async)

取得結果的方式。選擇 `async` 時，透過 `statusTask` 輪詢結果；選擇 `callback` 時，透過 Webhook 接收結果。

**callback\_url** `string`

當 `request_type` 為 `callback` 時必填。請提供可從網際網路存取的 HTTPS 網址，以接收任務的最終結果。詳見 [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

**input** `object` *required*

Image Watermark Remover 的輸入參數。

**屬性**

**mode** `string` (default: image-to-image)

固定工作流程模式。如果提供，則唯一支援的值為 `image-to-image`。

**image\_urls** `string[]` *required*

來源影像 URL。必須完全包含 1 非空字串，格式為 JPG、JPEG、PNG 或 WEBP。使用可公開存取且可直接取得的影像 URL。

**output\_format** `string` (default: jpg)

輸出影像格式。支援的值：`jpg`、`jpeg`、`png`、`webp`。`jpeg` 被接受為 `jpg` 的別名。

## 回應格式

### 送出任務時的回應

任務受理後，`POST /generateTask/image-watermark-remover` 會傳回任務 ID：

**code** `integer`

API 狀態碼。`200` 表示任務已受理。

**message** `string`

狀態說明。

**data.taskId** `string`

任務的唯一 ID，用於查詢任務狀態。

### 狀態回應欄位

**taskId** `string`

任務的唯一識別碼。

**state** `string`

目前的任務狀態，可能的值為 `pending`、`processing`、`success`、`failed`。

**resultJson** `string`

JSON 包含已清理影像 URL 的字串。當 `state` 為 `success` 時存在。

**failCode** `string`

供程式判讀的錯誤碼，僅在 `state` 為 `failed` 時傳回。

**failMsg** `string`

失敗原因說明，僅在 `state` 為 `failed` 時傳回。

**createTime** `integer`

任務建立時的 Unix 時間戳記，單位為毫秒。

**completeTime** `integer`

任務完成時間戳記（以 Unix 毫秒為單位）。完成後可用時呈現。

**costTime** `integer`

處理時間，以毫秒為單位。有計時資料時才會傳回。

### `resultJson` 內的資料

`resultJson` 是 JSON 編碼的字串。解析後，有效載荷具有以下形狀：

```json theme={null}
{
  "resultUrls": [
    "https://file.apixo.ai/watermark-free-image.jpg"
  ]
}
```

## Webhook 回呼模式

若希望後端自動收到最終結果，可使用回呼模式，無須輪詢。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/image-watermark-remover" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "image_urls": [
        "https://example.com/photo-with-watermark.jpg"
      ],
      "output_format": "png"
    }
  }'
```

最終回呼有效負載使用與狀態輪詢相同的任務回應形狀：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/watermark-free-image.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

Webhook 的接收條件與重試規則請見 [Webhook 文件](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

## 計費

新提交的非 LLM 請求按 **1 點 = `$0.001`** 計費。先依用量和加購項目計算總額，再套用帳戶折扣，最後將請求總額無條件進位至整數點數。若已約定固定單價，則保留該單價的精度，不再使用標準價或另行打折；最終點數仍須進位。詳見[積分換算與進位](https://apixo.ai/docs/zh-hant/pricing.md#credit-conversion-and-rounding)。

Image Watermark Remover 按提交的影像任務計費。由於 `image_urls` 必須恰好包含一張影像，因此每個接受的任務都算作一張影像進行計費。

| 單位 | APIXO 價格 | 價格發生什麼變化 |
| - | - | - |
| `PER_IMAGE` | `$0.015 / image` | 固定單價；`output_format` 不建立單獨的定價層 |

有關當前公開價格，請參閱 [API 定價](https://apixo.ai/pricing/api)。

市場參考價為`$0.020 / image`:`$0.015 * 1.30 = $0.0195`，四捨五入至小數點後三位。標準費用仍為 `$0.015 / image`。

## 耗時與輪詢

該端點是異步的。實際延遲可能因影像複雜性、佇列負載和結果儲存時間而異。

| 階段 | 建議 |
| - | - |
| 第一次輪詢 | 任務建立 10 至 20 秒後 |
| 輪詢間隔 | 5s-10s |
| 高並行 | 優選回呼模式以減少輪詢流量 |

## 錯誤與排查

### HTTP 錯誤

| 代碼 | 含義 | 處理方式 |
| - | - | - |
| `400` | 請求主體無效、模式不受支援、輸出格式無效或 `image_urls` 形狀錯誤 | 修正請求後再試 |
| `401` | 缺少 API 金鑰，或金鑰無效 | 檢查 `Authorization` 請求標頭 |
| `402` | 餘額或配額不足 | 充值或更換帳號或金鑰 |
| `403` | 金鑰或路由無權訪問該模型 | 檢查權限和路由策略 |
| `429` | 已達到速率或並行限制 | 以指數退避方式重試 |
| `500` | 伺服器錯誤 | 逐步拉長間隔後重試 |
| `502` | 服務錯誤 | 逐步拉長間隔後重試 |
| `504` | 服務超時 | 重新嘗試；耗時較長的任務可改用回呼模式 |

### 驗證錯誤

| 錯誤 | 原因 | 處理方式 |
| - | - | - |
| `The required parameter {{input}} is missing.` | 缺少頂級 `input` 對象 | 發送 `input` 對象 |
| `The required parameter {{image_urls}} is missing.` | 缺少 `input.image_urls` | 發送 `image_urls` 且僅含一個 URL |
| `The parameter {{image_urls}} must be Array type.` | `image_urls` 不是陣列 | 使用 JSON 陣列 |
| `The parameter {{image_urls}} must contain exactly 1 image.` | `image_urls` 為空或包含多個項目 | 僅發送一張影像 URL |
| `The parameter {{image_urls}} Array elements must be String type.` | 影像 URL 項目不是字串 | 使用字串 URL |
| `The parameter {{image_urls}} cannot contain empty string.` | 影像 URL 修剪後為空白 | 使用非空公共影像 URL |
| `Invalid mode type. Supported: image-to-image` | `mode` 不是 `image-to-image` | 省略`mode`或設定為`image-to-image` |
| `The parameter {{output_format}} must be String type.` | `output_format` 不是字串 | 使用字串值 |
| `The parameter {{output_format}} must be either 'jpg', 'png' or 'webp'.` | 不支援的輸出格式 | 使用`jpg`、`jpeg`、`png`或`webp` |

### 任務失敗代碼

| 錯誤碼 | 含義 | 處理方式 |
| - | - | - |
| `INVALID_PARAMETER` | 參數不受支援或格式錯誤 | 檢查`mode`、`image_urls`和`output_format` |
| `INSUFFICIENT_BALANCE` | 該帳戶沒有足夠的餘額來執行任務 | 重試前加結餘額 |
| `UPSTREAM_ERROR` | 服務無法完成任務 | 逐步拉長間隔後重試 |
| `TIMEOUT` | 生成任務逾時 | 重試或使用回呼模式 |

完整列表見[錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)。

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/image/image-watermark-remover.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。附件欄位為 `image_urls`。請保留使用者指定的檔案順序。模型參數由 API 驗證。

## 相關連結

* [生成 API 總覽](https://apixo.ai/docs/zh-hant/models.md)
* [影像模型](https://apixo.ai/docs/zh-hant/models/image)
* [送出生成任務](https://apixo.ai/docs/zh-hant/api-reference/generate-task.md)
* [查詢任務狀態](https://apixo.ai/docs/zh-hant/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)
* [錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)
* [參數規範](https://apixo.ai/docs/zh-hant/api-reference/parameters.md)
* [路由策略](https://apixo.ai/docs/zh-hant/concepts/routing-strategies.md)
* [嘗試 Image Watermark Remover 在 APIXO Playground](https://apixo.ai/models/image-watermark-remover)
* [API定價](https://apixo.ai/pricing/api)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.