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.

Text to image / Image to image

POST https://openapi.akool.com/api/open/v3/content/image/createbyprompt

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization

Body Attributes

ParameterTypeValueDescription
promptStringDescribe the information needed to generate the image
source_imageStringNeed to generate the original image link of the image 【If you want to perform imageToImage operation you can pass in this parameter】
webhookUrlStringCallback url address based on HTTP request

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringInterface returns status information
dataObject{ _id: "", image_status: 1 }_id: Interface returns data, image_status: the status of image: 【1:queueing, 2:processing, 3:completed, 4:failed】

Example

Body

{
    "prompt": "Sun Wukong is surrounded by heavenly soldiers and generals", // Describe the information needed to generate the image
    "source_image": "https://drz0f01yeq1cx.cloudfront.net/1708333063911-9cbe39b7-3c5f-4a35-894c-359a6cbb76c3-3283.png", // Need to generate the original image link of the image 【If you want to perform imageToImage operation you can pass in this parameter】
    "webhookUrl":"http://localhost:3007/image/webhook" //  Callback url address based on HTTP request
}

Request

Response

{
    "code": 1000,
    "msg": "OK",
    "data": {
        "faceswap_quality": 2,
        "deduction_credit": 2, 
        "buttons": [],  
        "used_buttons": [], 
        "upscaled_urls": [],    
        "_id": "64dd82eef0b6684651e90131",
        "uid": 378337,  
        "create_time": 1692238574633, 
        "origin_prompt": "***", 
        "source_image": "https://***.cloudfront.net/1702436829534-4a813e6c-303e-48c7-8a4e-b915ae408b78-5034.png", 
        "prompt": "***** was a revolutionary leader who transformed *** into a powerful communist state.",    
        "type": 4,
        "from": 1,  
        "image_status": 1  // the status of image: 【1:queueing, 2:processing,3:completed, 4:failed】
    }
}

Generate 4K or variations

POST https://openapi.akool.com/api/open/v3/content/image/createbybutton

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization

Body Attributes

ParameterTypeValueDescription
_idStringthe image_id you had generated, you can got it from https://openapi.akool.com/api/open/v3/content/image/createbyprompt
buttonStringthe type of operation you want to perform, You can get the field(display_buttons) value from https://openapi.akool.com/api/open/v3/content/image/infobymodelid 【U(1-4): Generate a single 4k image based on the corresponding serial number original image, V(1-4):Generate a single variant image based on the corresponding serial number original image】
webhookUrlStringCallback url address based on HTTP request

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringInterface returns status information
dataObject{_id:"",image_content_model_id: "",op_button: "",image_status:1}_id: Interface returns data image_content_model_id: the origin image _id you had generated op_button: the type of operation you want to perform image_status: the status of image: 【1:queueing, 2:processing, 3:completed, 4:failed】

Example

Body

{
    "_id": "65d3206b83ccf5ab7d46cdc6",  // the image【_id】 you had generated, you can got it from https://openapi.akool.com/api/open/v3/content/image/createbyprompt
    "button": "U2",  // the type of operation you want to perform, You can get the field(display_buttons) value from https://content.akool.com/api/v1/content/image/infobyid 【U(1-4): Generate a single 4k image based on the corresponding serial number original image, V(1-4):Generate a single variant image based on the corresponding serial number original image】
    "webhookUrl":"http://localhost:3007/image/webhook" //  Callback url address based on HTTP request
}

Request

Response

{
    "code": 1000,
    "msg": "OK",
    "data": {
        "faceswap_quality": 2,
        "deduction_credit": 2,
        "buttons": [],
        "used_buttons": [],
        "upscaled_urls": [],
        "_id": "6508292f16e5ba407d47d21b",
        "image_content_model_id": "6508288416e5ba407d47d13f", // the origin image【_id】 you had generated
        "create_time": 1695033647012,
        "op_button": "U2",  // the type of operation you want to perform
        "op_buttonMessageId": "kwZsk6elltno5Nt37VLj",
        "image_status": 1,  // the status of image: 【1:queueing, 2:processing, 3:completed, 4:failed】
        "from": 1
    }
}

Get Image Result image info

GET https://openapi.akool.com/api/open/v3/content/image/infobymodelid?image_model_id=64dd838cf0b6684651e90217

Request Headers

ParameterValueDescription
AuthorizationBearer tokenYour API Key used for request authorization

Query Attributes

ParameterTypeValueDescription
image_model_idStringimage db id:You can get it based on the _id field returned by https://openapi.akool.com/api/open/v3/content/image/createbyprompt or https://openapi.akool.com/api/open/v3/content/image/createbybutton api.

Response Attributes

ParameterTypeValueDescription
codeint1000Interface returns business status code(1000:success)
msgStringInterface returns status information
dataObject{image_status:1,_id:"",image:""}image_status: the status of image: 【1:queueing, 2:processing, 3:completed, 4:failed】 image: Image result after processing _id: Interface returns data

Example

Request

Response

{
    "code": 1000,
    "msg": "OK",
    "data": {
        "faceswap_quality": 2,
        "deduction_credit": 2,
        "buttons": [ "U1",
            "U2",
            "U3",
            "U4",
            "V1",
            "V2",
            "V3",
            "V4"],
        "used_buttons": [],
        "upscaled_urls": [],
        "_id": "662a10df4197b3af58532e89",
        "create_time": 1714032863272,
        "uid": 378337,
        "type": 3,
        "image_status": 3,  // the status of image:【1:queueing, 2:processing,3:completed,4:failed】
        "image": "https://***.cloudfront.net/1714032892336-e0ec9305-e217-4b79-8704-e595a822c12b-8013.png"  // Image result after processing
    }
}

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
code1008The content you get does not exist
code1009You do not have permission to operate
code1010You can not operate this content
code1101Invalid authorization or The request token has expired
code1102Authorization cannot be empty
code1108image generate error,please try again later
code1200The account has been banned