> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akool.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reage

> [!WARNING]
>
> 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.

> [!NOTE]
>
> Experience our age adjustment technology in action by exploring our interactive demo on GitHub: [AKool Reage Demo](https://github.com/AKOOL-Official/akool-reage-demo).

### Image Reage

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

**Request Headers**

| **Parameter** | **Value** | **Description** |
| - | - | - |
| x-api-key | API Key | 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. |
| Authorization | Bearer `{token}` | Your API Key used for request authorization.[Get Token](https://docs.akool.com/authentication/usage.md#get-the-token). |

**Body Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| targetImage | Array | `[{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 [Face Detect API](https://docs.akool.com/ai-tools-suite/faceswap.md#face-detect) API, You can get the landmarks\_str value returned by the api interface as the value of opts) |
| face\_reage | Int | \[-30, 30] | Reage ranges |
| modifyImage | String | | Modify the link address of the image |
| webhookUrl | String | | Callback url address based on HTTP request |

**Response Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| code | int | 1000 | Interface returns business status code(1000:success) |
| msg | String | | Interface returns status information |
| data | Object | `{_id:"",url: "",job_id: ""}` | `_id`: Interface returns data url: faceswwap result url job\_id: Task processing unique id |

**Example**

**Body**

```json theme={null}
{
    "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://openapi.akool.com/interface/detect-api/detect_faces 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":"" // Callback url address based on HTTP request
}
```

**Request**

```bash cURL theme={null}
curl --location 'https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage' \
--header "x-api-key: {{API Key}}" \
--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":""
}'
```

```java Java theme={null}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"targetImage\": [    \n        {\n            \"path\": \"https://d21ksh0k4smeql.cloudfront.net/crop_1695201103793-0234-0-1695201106985-2306.png\",  \n            \"opts\": \"2804,2182:3607,1897:3341,2566:3519,2920\"   \n        }\n    ],\n    \"face_reage\":10,\n    \"modifyImage\": \"https://d3t6pcz7y7ey7x.cloudfront.net/material1__a92671d0-7960-4028-b2fc-aadd3541f32d.jpg\", \n    \"webhookUrl\":\"\" \n}");
Request request = new Request.Builder()
  .url("https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage")
  .method("POST", body)
  .addHeader("x-api-key", "{{API Key}}")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
```

```js Javascript theme={null}
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{{API Key}}");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "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": ""
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

```php PHP theme={null}
<?php
$client = new Client();
$headers = [
  'x-api-key' =>'{{API Key}}',
  'Content-Type' => 'application/json'
];
$body = '{
  "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": ""
}';
$request = new Request('POST', 'https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
```

```python Python theme={null}
import requests
import json

url = "https://openapi.akool.com/api/open/v3/faceswap/highquality/imgreage"

payload = json.dumps({
  "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": ""
})
headers = {
  'x-api-key':'{{API Key}}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Response**

```json theme={null}
{
  "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**

| **Parameter** | **Value** | **Description** |
| - | - | - |
| x-api-key | API Key | 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. |
| Authorization | Bearer `{token}` | Your API Key used for request authorization.[Get Token](https://docs.akool.com/authentication/usage.md#get-the-token). |

**Body Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| targetImage | Array | `[]` | 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 [Face Detect API](https://docs.akool.com/ai-tools-suite/faceswap.md#face-detect) API, You can get the landmarks\_str value returned by the api interface as the value of opts) |
| face\_reage | Int | `[-30,30]` | Reage ranges |
| modifyVideo | String | | Modify the link address of the video |
| webhookUrl | String | | Callback url address based on HTTP request |

**Response Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| code | int | 1000 | Interface returns business status code (1000: success) |
| msg | String | | Interface returns status information |
| data | Object | `{ _id: "", url: "", job_id: "" }` | `_id`: Interface returns data, url: faceswap result url, job\_id: Task processing unique id |

**Example**

**Body**

```json theme={null}
{
    "targetImage": [    // Replacement target image information
        {
            "path": "https://static.website-files.org/assets/images/faceswap/crop_1719224038759-3888-0-1719224039439-1517.jpg",   // Links to faces detected in target images
            "opts": "1408,786:1954,798:1653,1091:1447,1343" // Key information of the face detected in the target image【You can get it through the face https://openapi.akool.com/interface/detect-api/detect_faces 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":"" // Callback url address based on HTTP request
}
```

**Request**

```bash cURL theme={null}
curl --location 'https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage' \
--header "x-api-key: {{API Key}}" \
--header 'Content-Type: application/json' \
--data '{
    "targetImage": [    // Replacement target image information
        {
            "path": "https://static.website-files.org/assets/images/faceswap/crop_1719224038759-3888-0-1719224039439-1517.jpg",   // Links to faces detected in target images
            "opts": "1408,786:1954,798:1653,1091:1447,1343" // Key information of the face detected in the target image【You can get it through the face https://openapi.akool.com/interface/detect-api/detect_faces 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":"" // Callback url address based on HTTP request
}'
```

```java Java theme={null}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"targetImage\": [    \n        {\n            \"path\": \"https://static.website-files.org/assets/images/faceswap/crop_1719224038759-3888-0-1719224039439-1517.jpg\",   \n            \"opts\": \"1408,786:1954,798:1653,1091:1447,1343\" \n        }\n    ],\n    \"face_reage\":10,\n    \"modifyVideo\": \"https://d3t6pcz7y7ey7x.cloudfront.net/Video10__d2a8cf85-10ae-4c2d-8f4b-d818c0a2e4a4.mp4\",    \n     \"webhookUrl\":\"\" \n}\n");
Request request = new Request.Builder()
  .url("https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage")
  .method("POST", body)
  .addHeader("x-api-key", "{{API Key}}")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
```

```js Javascript theme={null}
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{{API Key}}");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "targetImage": [    // Replacement target image information
        {
            "path": "https://static.website-files.org/assets/images/faceswap/crop_1719224038759-3888-0-1719224039439-1517.jpg",   // Links to faces detected in target images
            "opts": "1408,786:1954,798:1653,1091:1447,1343" // Key information of the face detected in the target image【You can get it through the face https://openapi.akool.com/interface/detect-api/detect_faces 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":"" // Callback url address based on HTTP request
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

```php PHP  theme={null}
<?php
$client = new Client();
$headers = [
  'x-api-key' =>'{{API Key}}',
  'Content-Type' => 'application/json'
];
$body = '{
  "targetImage": [    // Replacement target image information
        {
            "path": "https://static.website-files.org/assets/images/faceswap/crop_1719224038759-3888-0-1719224039439-1517.jpg",   // Links to faces detected in target images
            "opts": "1408,786:1954,798:1653,1091:1447,1343" // Key information of the face detected in the target image【You can get it through the face https://openapi.akool.com/interface/detect-api/detect_faces 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":"" // Callback url address based on HTTP request
}';
$request = new Request('POST', 'https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
```

```python Python  theme={null}
import requests
import json

url = "https://openapi.akool.com/api/open/v3/faceswap/highquality/vidreage"

payload = json.dumps({
  "targetImage": [    // Replacement target image information
        {
            "path": "https://static.website-files.org/assets/images/faceswap/crop_1719224038759-3888-0-1719224039439-1517.jpg",   // Links to faces detected in target images
            "opts": "1408,786:1954,798:1653,1091:1447,1343" // Key information of the face detected in the target image【You can get it through the face https://openapi.akool.com/interface/detect-api/detect_faces 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":"" // Callback url address based on HTTP request
})
headers = {
  'x-api-key':'{{API Key}}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Response**

```json theme={null}
{
  "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**

| **Parameter** | **Value** | **Description** |
| - | - | - |
| x-api-key | API Key | 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. |
| Authorization | Bearer `{token}` | Your API Key used for request authorization.[Get Token](https://docs.akool.com/authentication/usage.md#get-the-token). |

**Query Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| `_ids` | String | | Result ids are strings separated by commas. You can get it by returning the `_id` field from [Image Reage API](https://docs.akool.com/ai-tools-suite/reage.md#image-reage) or [Video Reage API](https://docs.akool.com/ai-tools-suite/reage.md#video-reage) api. |

**Response Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| code | int | 1000 | Interface returns business status code (1000: success) |
| msg | String | | Interface returns status information |
| data | Object | `result: [{ 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**

```bash cURL theme={null}
curl --location 'https://openapi.akool.com/api/open/v3/faceswap/result/listbyids?_ids=64ef2f27b33f466877701c6a' \
--header "x-api-key: {{API Key}}"
```

```java Java theme={null}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://openapi.akool.com/api/open/v3/faceswap/result/listbyids?_ids=64ef2f27b33f466877701c6a")
  .method("GET", body)
  .addHeader("x-api-key", "{{API Key}}")
  .build();
Response response = client.newCall(request).execute();
```

```js Javascript theme={null}
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{{API Key}}");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://openapi.akool.com/api/open/v3/faceswap/result/listbyids?_ids=64ef2f27b33f466877701c6a", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

```php PHP  theme={null}
<?php
$client = new Client();
$headers = [
  'x-api-key' =>'{{API Key}}'
];
$request = new Request('GET', 'https://openapi.akool.com/api/open/v3/faceswap/result/listbyids?_ids=64ef2f27b33f466877701c6a', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
```

```python Python  theme={null}
import requests

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

payload = {}
headers = {
  'x-api-key':'{{API Key}}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Response**

```json theme={null}
{
  "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**

| **Parameter** | **Value** | **Description** |
| - | - | - |
| x-api-key | API Key | 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. |
| Authorization | Bearer `{token}` | Your API Key used for request authorization.[Get Token](https://docs.akool.com/authentication/usage.md#get-the-token). |

**Body Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| job\_ids | String | | Task id, You can get it by returning the job\_id field based on [Image Reage API](https://docs.akool.com/ai-tools-suite/reage.md#image-reage) or [Video Reage API](https://docs.akool.com/ai-tools-suite/reage.md#video-reage) api. |

**Response Attributes**

| Parameter | Type | Value | Description |
| - | - | - | - |
| code | int | 1000 | Interface returns business status code (1000: success) |
| msg | String | | Interface returns status information |

**Example**

**Body**

```json theme={null}
{
    "job_ids":""    // task id, You can get it by returning the job_id field based on [Image Reage API](/ai-tools-suite/reage#image-reage) or [Video Reage API](/ai-tools-suite/reage#video-reage) api.
}
```

**Request**

```bash cURL theme={null}

curl --location 'https://openapi.akool.com/api/open/v3/faceswap/job/del' \
--header "x-api-key: {{API Key}}" \
--header 'Content-Type: application/json' \
--data '{
    "job_ids":""
}'
```

```java Java theme={null}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"job_ids\":\"\"    \n}");
Request request = new Request.Builder()
  .url("https://openapi.akool.com/api/open/v3/faceswap/job/del")
  .method("POST", body)
  .addHeader("x-api-key", "{{API Key}}")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
```

```js Javascript theme={null}
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{{API Key}}");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "job_ids": ""
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://openapi.akool.com/api/open/v3/faceswap/job/del", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

```php PHP  theme={null}
<?php
$client = new Client();
$headers = [
  'x-api-key' =>'{{API Key}}',
  'Content-Type' => 'application/json'
];
$body = '{
  "job_ids": ""
}';
$request = new Request('POST', 'https://openapi.akool.com/api/open/v3/faceswap/job/del', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
```

```python Python  theme={null}
import requests
import json

url = "https://openapi.akool.com/api/open/v3/faceswap/job/del"

payload = json.dumps({
  "job_ids": ""
})
headers = {
  'x-api-key':'{{API Key}}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Response**

```json theme={null}
{
  "code": 1000, // Business status code
  "msg": "OK"   // The interface returns status information
}
```

**Response Code Description**

> [!NOTE]
>
> Please note that if the value of the response code is not equal to 1000, the request is failed or wrong

| **Parameter** | **Value** | **Description** |
| - | - | - |
| code | 1000 | Success |
| code | 1003 | Parameter error  or Parameter can not be empty |
| code | 1005 | Operation is too frequent |
| code | 1006 | Your quota is not enough |
| code | 1007 | The number of people who can have their faces changed cannot exceed 8 |
| code | 1101 | Invalid authorization or The request token has expired |
| code | 1102 | Authorization cannot be empty |
| code | 1200 | The account has been banned |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.