AILabTools API - Hairstyle Changer Advanced - API
Request
- URL:
https://www.ailabapi.com/api/portrait/effects/hairstyle-editor-advanced
- Method:
POST
- Content-Type:
multipart/form-data
Image requirements
- Image format:
PNG
JPG
JPEG
BMP
TIFF
WEBP
- Image size: No more than 5 MB.
- Image resolution: Less than 1024x1024px.
Header
Field | Required | Type | Description |
---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. |
Body
Fixed Fields
Field | Required | Type | Scope | Description |
---|---|---|---|---|
task_type | YES | string | async | Task Type. async : Asynchronous tasks. |
image | YES | file | ||
editing_type | YES | string | both hairstyle color | Edit Type. both : Change the hairstyle & Change the color.hairstyle : Change the hairstyle.color : Change the color. |
gender | YES: editing_type =both editing_type =hairstyle NO: editing_type =color | string | male female | Gender. male : Male.female : Female. |
hair_style | YES: editing_type =both editing_type =hairstyle NO: editing_type =color | string | editing_type =male OR editing_type =female : style_1 style_2 style_3 style_4 style_5 style_6 style_7 style_8 style_9 style_10 style_11 style_12 style_13 style_14 style_15 style_16 style_17 editing_type =female : style_18 | Hairstyle. |
color | YES: editing_type =both editing_type =color NO: editing_type =hairstyle | string | color_1 color_2 color_3 color_4 color_5 color_6 color_7 color_8 color_9 color_10 color_11 color_12 color_13 color_14 color_15 color_16 color_17 color_18 color_19 color_20 | Color. View Effect |
Response
Parameters
Field | Type | Scope | Description |
---|---|---|---|
error_code | integer | Status Code. | |
error_code_str | string | Error Code. | |
error_msg | string | Error Message. | |
request_id | string | Request ID. | |
log_id | string | Log ID. | |
task_type | string | async | Task Type. async : Asynchronous tasks. |
task_id | string | Asynchronous task ID. Please use this field when calling the Querying asynchronous task results API. |
Example
{
"error_code": 0,
"error_code_str": "",
"error_msg": "",
"request_id": "",
"log_id": "",
"task_type": "",
"task_id": ""
}
tip
This API is asynchronous, please keep task_id
and call Querying asynchronous task results
to get the final results.
Asynchronous task results are valid for 24 hours. It is recommended that asynchronous task results be queried every 5 seconds.
Querying asynchronous task results
Response
Parameters
Field | Type | Scope | Description |
---|---|---|---|
error_code | integer | Status Code. | |
error_code_str | string | Error Code. | |
error_msg | string | Error Message. | |
task_status | integer | 0 1 2 | Asynchronous task status. 0 : The task is queued.1 : Asynchronous processing.2 : Processing was successful. |
data | object | The content of the result data returned. | |
+cropped_image | string | Cropped face image URL. | |
+hairstyle_image | string | Resulting graph URL. |
tip
The URL address is a temporary address, valid for 24 hours, and will not be accessible after it expires. If you need to save the file for a long time or permanently, please visit the URL address within 24 hours and download the file to your own storage space.
Examples
{
"error_code": 0,
"error_code_str": "",
"error_msg": "",
"task_status": 0,
"data": {
"cropped_image": "",
"hairstyle_image": ""
}
}