Skip to content
Platform / Docs / Face swap API

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-Typeapplication/json

请求参数说明:

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

返回参数说明:

名称类型说明
codeint状态码
msgstring状态信息
datastring请求结果数据集
- task_id string任务ID
debugstring/array调试数据
exec_timefloat执行耗时
user_ipstring客户端IP

Error codes

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

FAQ

换脸 API 需要什么输入?

待处理视频 URL 与新人脸图片 URL,以及 API Key。

合规要求?

仅可处理你拥有合法权利的人像与视频,禁止未授权换脸。

如何获取结果?

异步任务完成后通过查询或回调获取成片。

效果不佳?

使用清晰、正面、光线均匀的人脸图,并保证视频人脸可见。

是否保存素材?

以平台隐私政策与文件留存规则为准。

Full console doc (with the debugger):/doc/21