Skip to main content
POST
/
api
/
open
/
v3
/
faceswap
/
highquality
/
specifyimage
Image Faceswap
curl --request POST \
  --url https://openapi.akool.com/api/open/v3/faceswap/highquality/specifyimage \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "targetImage": [
    {
      "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1694593694387-4562-0-1694593694575-0526.png",
      "opts": "262,175:363,175:313,215:272,279"
    }
  ],
  "sourceImage": [
    {
      "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1705462509874-9254-0-1705462510015-9261.png",
      "opts": "239,364:386,366:317,472:266,539"
    }
  ],
  "face_enhance": 0,
  "modifyImage": "https://d21ksh0k4smeql.cloudfront.net/bdd1c994c4cd7a58926088ae8a479168-1705462506461-1966.jpeg",
  "webhookUrl": ""
}'
{
  "code": 1000,
  "msg": "Please be patient! If your results are not generated in three hours, please check your input image.",
  "data": {
    "_id": "6593c94c0ef703e8c055e3c8",
    "url": "https://***.cloudfront.net/final_71688047459_.pic-1704184129269-4947-f8abc658-fa82-420f-b1b3-c747d7f18e14-8535.jpg",
    "job_id": "20240102082900592-5653"
  }
}
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.
Experience our face swap technology in action by exploring our interactive demo on GitHub: AKool Face Swap Demo.

Important Notes

  • You can get the opts parameter (landmarks_str) through the Face Detect API
  • The Face Detect API returns a landmarks_str value that should be used as the value of opts
  • 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 the targetImage and sourceImage arrays are properly aligned and correspond to each other

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
targetImage
object[]
required

A collection of faces in the original image

sourceImage
object[]
required

Replacement target image information

modifyImage
string
required

Modify the link address of the image

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

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