# 换脸 API Documentation

> 视频换脸

## Overview

This document describes how to call the **换脸** API.

- **Model / path slug**: `video/aiface`
- **Task type**: `sync` (`sync` = synchronous, `async` = create task then poll / callback)
- **HTML docs**: `/doc/21`

## Authentication

All API requests require your platform API key as the query parameter `key`:

```
?key=YOUR_API_KEY
```

Get API Key:
1. Sign in to the console
2. Open [API Key Management](/user/key) and create or copy your key
3. Append `key=YOUR_API_KEY` to the request URL (or pass it in form/JSON when the endpoint accepts it)

---

## API Information

- **URL**: `POST https://apis.xiaobao.ink/api/video/aiface`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `POST`

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `video` | Yes | 视频地址 |
| `image` | Yes | 新的人脸（半身+正视图效果更佳） |
| `notify` | Yes | 回调地址 |

> **Note**: `key` (API key) is required for authenticated calls even if omitted from the parameter list above.

### Request Example

```
https://apis.xiaobao.ink/api/video/aiface?key=你的密钥
```

## Details

## 请求HEADER：

| 名称 | 值 |
| --- | --- |
| Content-Type | application/json |

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| key | 是 | string | 35kj5jnlj53453kl5j43nj5 | 接口密钥,在控制台->密钥管理查看 |
| image | 是 | string | https://api.xx.et/images/store4.jpg | 上传换脸的图片 |
| video | 是 | string | https://api.xx.et/im.mp4 | 视频地址 |
| notify | 是 | string | https://xx.com/xxx | 回调地址 （ 任务推送地址） |

## 返回参数说明：

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| code | int | 状态码 |
| msg | string | 状态信息 |
| data | string | 请求结果数据集 |
| - task_id  | string | 任务ID |
| debug | string/array | 调试数据 |
| exec_time | float | 执行耗时 |
| user_ip | string | 客户端IP |

## Error Codes

| 错误码 | 类型 | 说明 |
| --- | --- | --- |
| 403 | int | 没有权限 |
| 400 | int | 参数传递不正确 |
| 500 | int | 服务器内部错误 |

## Usage Flow

1. Obtain your API Key from the console
2. Call the endpoint with `key` and required parameters
3. Parse the JSON (or binary) response according to the examples above

---

_Generated for AI / LLM consumption. Source of truth: `api_list` (same as HTML `/doc/{id}`)._
