AI Tools Suite
Background Change
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.
Background Change
Request Headers
Parameter | Value | Description |
---|---|---|
Authorization | Bearer token | Your API Key used for request authorization |
Body Attributes
Parameter | isRequired | Type | Value | Description |
---|---|---|---|---|
color_code | false | String | eg: #aafbe3 | background color。 Use hexadecimal to represent colors |
template_url | false | String | resource address of the background image | |
origin_img | true | String | Foreground image address | |
modify_template_size | false | String | eg:“3031x3372” | The size of the template image after expansion |
modify_origin_img_size | true | String | eg: “3031x2894” | The size of the foreground image after scaling |
overlay_origin_x | true | int | eg: 205 | The position of the upper left corner of the foreground image in the canvas |
overlay_origin_y | true | int | eg: 497 | The position of the upper left corner of the foreground image in the canvas |
overlay_template_x | false | int | eg: 10 | The position of the upper left corner of the template image in the canvas |
overlay_template_y | false | int | eg: 497 | The position of the upper left corner of the template image in the canvas |
canvas_size | true | String | eg:“3840x3840” | Canvas size |
webhookUrl | true | String | Callback url address based on HTTP request | |
removeBg | false | Boolean | true or false default false | Whether to remove the background image |
In addition to using the required parameters,you can also use one or both of the color_code or template_url parameters(but this is not required). Once you use template_url, you can carry three additional parameters: modify_template_size, overlay_template_x, and overlay_template_y.
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: "", image_status: 1 } | _id: Interface returns data, image_status: the status of image: 【1:queueing, 2:processing, 3:completed,4:failed】 |
Example
Body
You have 4 combination parameters to choose from
The first combination of parameters: use template_url
The second combination of parameters:use color_code
The third combination of parameters: use template_url and color_code
The fourth combination of parameters:
Request
Response
Get Image Result image info
Request Headers
Parameter | Value | Description |
---|---|---|
Authorization | Bearer token | Your API Key used for request authorization |
Query Attributes
Parameter | Type | Value | Description |
---|---|---|---|
image_model_id | String | image db id:You can get it based on the _id field returned by https://openapi.akool.com/api/open/v3/content/image/bg/replace 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 | {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
Response Code Description
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 |