Skip to main content
POST
/
api
/
open
/
v3
/
faceswap
/
highquality
/
specifyvideo
Video Faceswap
curl --request POST \
  --url https://openapi.akool.com/api/open/v3/faceswap/highquality/specifyvideo \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "sourceImage": [
    {
      "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1705475757658-3362-0-1705475757797-3713.png",
      "opts": "239,364:386,366:317,472:266,539"
    }
  ],
  "targetImage": [
    {
      "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1705479323786-0321-0-1705479323896-7695.png",
      "opts": "176,259:243,259:209,303:183,328"
    }
  ],
  "face_enhance": 0,
  "modifyVideo": "https://d21ksh0k4smeql.cloudfront.net/avatar_01-1705479314627-0092.mp4",
  "webhookUrl": ""
}'
{
  "code": 1000,
  "msg": "OK",
  "data": {
    "_id": "<string>",
    "url": "<string>",
    "job_id": "<string>"
  }
}
The resources (image, video, voice) generated by our API are valid for 7 days. Please save the relevant resources as soon as possible to prevent expiration.

Important Notes

  • sourceImage: You need to change it to the link collection of the face you need. Pass your image through the Face Detect API to obtain the link and key point data
  • targetImage: Represents the collection of faces after face detection using modifyVideo. When the original video has multiple faces, here is the image link and key point data of each face
  • When using Face Detect API, set single_face: true to return only the largest face data, or false to return all detected faces
  • Ensure that each picture in the sourceImage is a single face, otherwise the face change may fail
  • You need to ensure that sourceImage and targetImage correspond to each other in order

Authorizations

x-api-key
string
header
required

Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded.

Body

application/json
sourceImage
object[]
required

Replacement target image information. You need to change it to the link collection of the face you need.

targetImage
object[]
required

A collection of faces in the original video. Represents the collection of faces after face detection using modifyVideo.

modifyVideo
string
required

The original video you need to change the face

face_enhance
enum<integer>
default:0

Whether facial enhancement (1 means open, 0 means close)

Available options:
0,
1
webhookUrl
string

Callback url address based on HTTP request

Response

200 - application/json

Video faceswap request submitted successfully

code
integer
required

Interface returns business status code (1000: success)

Example:

1000

msg
string
required

Interface returns status information

Example:

"OK"

data
object