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.
Endpoint
POST https://openapi.akool.com/api/open/v3/content/image/createbybutton
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 |
Body Attributes
| Parameter | Type | Required | Description |
|---|---|---|---|
| _id | String | true | The image _id you had generated, from the Create By Source Prompt API response |
| button | String | true | The type of operation to perform. Get available values from the buttons field in Get Image Result API response. U1-U4: Generate a single 4K image based on the corresponding image. V1-V4: Generate a single variant based on the corresponding image |
| webhookUrl | String | false | Callback URL address based on HTTP request |
Response Attributes
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Interface returns business status code (1000:success) |
| msg | String | Interface returns status information |
| data | Object | Response data object |
| - _id | String | Document ID for the new image |
| - image_content_model_id | String | The original image _id from the source generation |
| - create_time | Long | Creation timestamp |
| - op_button | String | The operation button used |
| - op_buttonMessageId | String | Operation message ID |
| - image_status | Integer | Status: 1=queueing, 2=processing, 3=completed, 4=failed |
| - deduction_credit | Integer | Credits deducted |
| - from | Integer | Source identifier |
| - buttons | Array | Available operation buttons |
| - used_buttons | Array | Already used buttons |
| - upscaled_urls | Array | Upscaled image URLs |
Example
Request Body
{
"_id": "65d3206b83ccf5ab7d46cdc6",
"button": "U2",
"webhookUrl": ""
}
Request
curl --location 'https://openapi.akool.com/api/open/v3/content/image/createbybutton' \
--header 'x-api-key: {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
"_id": "65d3206b83ccf5ab7d46cdc6",
"button": "U2",
"webhookUrl": ""
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"_id\": \"65d3206b83ccf5ab7d46cdc6\",\n \"button\": \"U2\",\n \"webhookUrl\": \"\"\n}");
Request request = new Request.Builder()
.url("https://openapi.akool.com/api/open/v3/content/image/createbybutton")
.method("POST", body)
.addHeader("x-api-key", "{{API Key}}")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
const myHeaders = new Headers();
myHeaders.append("x-api-key", "{{API Key}}");
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
"_id": "65d3206b83ccf5ab7d46cdc6",
"button": "U2",
"webhookUrl": ""
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://openapi.akool.com/api/open/v3/content/image/createbybutton", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
<?php
$client = new Client();
$headers = [
'x-api-key' =>'{{API Key}}',
'Content-Type' => 'application/json'
];
$body = '{
"_id": "65d3206b83ccf5ab7d46cdc6",
"button": "U2",
"webhookUrl": ""
}';
$request = new Request('POST', 'https://openapi.akool.com/api/open/v3/content/image/createbybutton', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>
import requests
import json
url = "https://openapi.akool.com/api/open/v3/content/image/createbybutton"
payload = json.dumps({
"_id": "65d3206b83ccf5ab7d46cdc6",
"button": "U2",
"webhookUrl": ""
})
headers = {
'x-api-key':'{{API Key}}',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response
{
"code": 1000,
"msg": "OK",
"data": {
"faceswap_quality": 2,
"deduction_credit": 2,
"buttons": [],
"used_buttons": [],
"upscaled_urls": [],
"_id": "6508292f16e5ba407d47d21b",
"image_content_model_id": "6508288416e5ba407d47d13f",
"create_time": 1695033647012,
"op_button": "U2",
"op_buttonMessageId": "kwZsk6elltno5Nt37VLj",
"image_status": 1,
"from": 1
}
}
Button Operations
| Button | Description |
|---|---|
| U1 | Generate a single 4K image based on image #1 |
| U2 | Generate a single 4K image based on image #2 |
| U3 | Generate a single 4K image based on image #3 |
| U4 | Generate a single 4K image based on image #4 |
| V1 | Generate a single variant based on image #1 |
| V2 | Generate a single variant based on image #2 |
| V3 | Generate a single variant based on image #3 |
| V4 | Generate a single variant based on image #4 |
Important Notes
- The
_idmust be from a previously generated image via the Create By Source Prompt API - Check available buttons from the
buttonsfield in the Get Image Result API response before performing an operation - Once a button is used, it will move from
buttonstoused_buttonsand cannot be used again - Resource Expiration: Generated images are valid for 7 days, save them promptly
- Webhook: Use
webhookUrlto receive notifications when image generation is complete - Save the new
_idfrom the response to check image status using the Get Image Result API