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.

Image Reage

POST https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization

Body Attributes

ParameterTypeValueDescription
targetImageArray[{path:"",opts:""}]Replacement target image information(Each array element is an object, and the object contains 2 properties, path:Links to faces detected in target images. opts: Key information of the face detected in the target image【You can get it through the face https://sg3.akool.com/detect API, You can get the landmarks_str value returned by the api interface as the value of opts)
face_reageInt[-30, 30]Reage ranges
modifyImageStringModify the link address of the image
webhookUrlStringCallback url address based on HTTP request

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringInterface returns status information
dataObject{_id:"",url: "",job_id: ""}_id: Interface returns data url: faceswwap result url job_id: Task processing unique id

Example

Body

{
    "targetImage": [    // Replacement target image information
        {
            "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1695201103793-0234-0-1695201106985-2306.png",  // Links to faces detected in target images
            "opts": "2804,2182:3607,1897:3341,2566:3519,2920"   // Key information of the face detected in the target image【You can get it through the face https://sg3.akool.com/detect API,You can get the landmarks_str value returned by the api interface as the value of opts
        }
    ],
    "face_reage":10,// [-30,30]
    "modifyImage": "https://d3t6pcz7y7ey7x.cloudfront.net/material1__a92671d0-7960-4028-b2fc-aadd3541f32d.jpg", // Modify the link address of the image
     "webhookUrl":"http://localhost:3007/api/webhook" // Callback url address based on HTTP request
}

Request

curl --location 'https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data '{
    "targetImage": [
        {
            "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1695201103793-0234-0-1695201106985-2306.png",
            "opts": "2804,2182:3607,1897:3341,2566:3519,2920"
        }
    ],
    "face_reage":10,
    "modifyImage": "https://d3t6pcz7y7ey7x.cloudfront.net/material1__a92671d0-7960-4028-b2fc-aadd3541f32d.jpg",
    "webhookUrl":"http://localhost:3007/api/webhook"
}'

Response

{
  "code": 1000, // Interface returns business status code
  "msg": "Please be patient! If your results are not generated in three hours, please check your input image.", // Interface returns status information
  "data": {
    "_id": "6593c94c0ef703e8c055e3c8",  // Interface returns data
    "url": "https://***.cloudfront.net/final_71688047459_.pic-1704184129269-4947-f8abc658-fa82-420f-b1b3-c747d7f18e14-8535.jpg",    // faceswwap result url
    "job_id": "20240102082900592-5653"  // Task processing unique id
  }
}

Video Reage

POST https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization

Body Attributes

ParameterTypeValueDescription
targetImageArray[]Replacement target image information(Each array element is an object, and the object contains 2 properties, path:Links to faces detected in target images. opts: Key information of the face detected in the target image【You can get it through the face https://sg3.akool.com/detect API, You can get the landmarks_str value returned by the api interface as the value of opts)
face_reageInt[-30,30]Reage ranges
modifyVideoStringModify the link address of the video
webhookUrlStringCallback url address based on HTTP request

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code (1000: success)
msgStringInterface returns status information
dataObject{ _id: "", url: "", job_id: "" }_id: Interface returns data, url: faceswap result url, job_id: Task processing unique id

Example

Body

{
    "targetImage": [    // Replacement target image information
        {
            "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1695200391486-4662-0-1695200392027-6110.png",   // Links to faces detected in target images
            "opts": "1622,759:2149,776:1869,1085:1875,1345" // Key information of the face detected in the target image【You can get it through the face https://sg3.akool.com/detect API,You can get the landmarks_str value returned by the api interface as the value of opts
        }
    ],
    "face_reage":10,// [-30,30]
    "modifyVideo": "https://d3t6pcz7y7ey7x.cloudfront.net/Video10__d2a8cf85-10ae-4c2d-8f4b-d818c0a2e4a4.mp4",    // Modify the link address of the video
     "webhookUrl":"http://localhost:3007/api/webhook" // Callback url address based on HTTP request
}

Request

curl --location 'https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data '{
    "targetImage": [
        {
            "path": "https://d21ksh0k4smeql.cloudfront.net/crop_1695200391486-4662-0-1695200392027-6110.png",
            "opts": "1622,759:2149,776:1869,1085:1875,1345"
        }
    ],
    "face_reage":10,
    "modifyVideo": "https://d3t6pcz7y7ey7x.cloudfront.net/Video10__d2a8cf85-10ae-4c2d-8f4b-d818c0a2e4a4.mp4",
     "webhookUrl":"http://localhost:3007/api/webhook"
}'

Response

{
  "code": 1000, // Interface returns business status code
  "msg": "Please be patient! If your results are not generated in three hours, please check your input image.", // Interface returns status information
  "data": {
    "_id": "6593c94c0ef703e8c055e3c8",  // Interface returns data
    "url": "https://***.cloudfront.net/final_71688047459_.pic-1704184129269-4947-f8abc658-fa82-420f-b1b3-c747d7f18e14-8535.jpg",    // faceswwap result url
    "job_id": "20240102082900592-5653"  // Task processing unique id
  }
}

Get Reage Result List Byids

GET https://openapi.akool.com/api/open/v3/faceswap/result/listbyids?_ids=64ef2f27b33f466877701c6a

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization

Query Attributes

ParameterTypeValueDescription
_idsStringResult ids are strings separated by commas. You can get it by returning the _id field from https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage or https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage api.

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code (1000: success)
msgStringInterface returns status information
dataObjectresult: [{ faceswap_status: "", url: "", createdAt: "" }]faceswap_status: faceswap result status (1 In Queue, 2 Processing, 3 Success, 4 Failed), url: faceswap result url, createdAt: current faceswap action created time

Example

Request

curl --location 'https://openapi.akool.com/api/open/v3/faceswap/result/listbyids?_ids=64ef2f27b33f466877701c6a' \
--header 'Authorization: Bearer token'

Response

{
  "code": 1000,   // error code
  "msg": "OK",    // api message
  "data": {
    "result": [
      {
        "faceswap_type": 1,
        "faceswap_quality": 2,
        "faceswap_status": 1,   // faceswap result status: 1 In Queue 2 Processing 3 Success 4 failed
        "deduction_status": 1,
        "image": 1,
        "video_duration": 0,
        "deduction_duration": 0,
        "update_time": 0,
        "_id": "64dae65af6e250d4fb2bca63",
        "userId": "64d985c5571729d3e2999477",
        "uid": 378337,
        "url": "https://d21ksh0k4smeql.cloudfront.net/final_material__d71fad6e-a464-43a5-9820-6e4347dce228-80554b9d-2387-4b20-9288-e939952c0ab4-0356.jpg", // faceswwap result url
        "createdAt": "2023-08-15T02:43:38.536Z"    // current faceswap action created time
      }
    ]
  }
}

Reage Task cancel

POST https://openapi.akool.com/api/open/v3/faceswap/job/del

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization

Body Attributes

ParameterTypeValueDescription
job_idsStringTask id, You can get it by returning the job_id field based on https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage or https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage api.

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code (1000: success)
msgStringInterface returns status information

Example

Body

{
    "job_ids":""    // task id, You can get it by returning the job_id field based on https://openapi.akool.com/api/open/v3/faceswap/highquality/specifyimage or https://openapi.akool.com/api/open/v3/faceswap/highquality/specifyvideo api.
}

Request


curl --location 'https://openapi.akool.com/api/open/v3/faceswap/job/del' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data '{
    "job_ids":""
}'

Response

{
  "code": 1000, // Business status code
  "msg": "OK"   // The interface returns status information
}

Response Code Description

Please note that if the value of the response code is not equal to 1000, the request is failed or wrong
ParameterValueDescription
code1000Success
code1003Parameter error or Parameter can not be empty
code1005Operation is too frequent
code1006Your quota is not enough
code1007The number of people who can have their faces changed cannot exceed 8
code1101Invalid authorization or The request token has expired
code1102Authorization cannot be empty
code1200The account has been banned