API Reference
Face swap API
POST
face-swap-api
ID 21
Replace a face in a video with a specified portrait. Use only with the rights you have.
POST
https://xiaoapis.com/api/video/aiface
Overview
- 视频 + 人脸图
- 异步任务
Use cases
- 创意视频
- 角色替换(已授权)
Conventions
- Gateway ·
https://xiaoapis.com - Auth · send
key(query or JSON body, as this API specifies) - Response · JSON. Check the business code and the HTTP status, not only HTTP 200
Authentication
Send the platform API key (query parameter key or JSON field key, as this page specifies). Create one in API key management.
POST https://xiaoapis.com/api/video/aiface
Content-Type: application/json
{
"key": "YOUR_API_KEY"
}
Request example
https://xiaoapis.com/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 | 服务器内部错误 |
FAQ
换脸 API 需要什么输入?
待处理视频 URL 与新人脸图片 URL,以及 API Key。
合规要求?
仅可处理你拥有合法权利的人像与视频,禁止未授权换脸。
如何获取结果?
异步任务完成后通过查询或回调获取成片。
效果不佳?
使用清晰、正面、光线均匀的人脸图,并保证视频人脸可见。
是否保存素材?
以平台隐私政策与文件留存规则为准。
Related APIs
Full console doc (with the debugger):/doc/21