AILabTools API - Hairstyle Changer Advanced - API
draft: true
Dear Developers,
We sincerely appreciate your continued support and use of our API over the years. Throughout this time, we have strived to provide high-quality services and reliable API interfaces to meet your needs.
However, due to technological advancements and adjustments in our business strategies, we regret to announce the discontinuation of maintenance and support for the current API. This means that we will no longer be releasing new features, fixing known issues, or providing technical support.
If you have any questions or need assistance regarding this change, please feel free to reach out to our support team ([email protected]). We are committed to assisting you and making this transition process as smooth as possible.
Once again, we thank you for your continued support and cooperation.
Warm regards,
AILabTools Support Team
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. Get 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
-
Handle
Public Parameters
:First, parse and validate the
Public Parameters
, checking the status code or response message to ensure the request is successful and no errors are present. -
Handle
Business Parameters
:If the public parameters are valid and no exceptions are found, proceed to process the business logic in the
Business Parameters
.
Public Parameters
Viewing Public Parameters and Error CodesBusiness Parameters
Field | Type | Scope | Description |
---|---|---|---|
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
{
"request_id": "",
"log_id": "",
"error_code": 0,
"error_code_str": "",
"error_msg": "",
"error_detail": {
"status_code": 200,
"code": "",
"code_message": "",
"message": ""
},
"task_type": "",
"task_id": ""
}
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
-
Handle
Public Parameters
:First, parse and validate the
Public Parameters
, checking the status code or response message to ensure the request is successful and no errors are present. -
Handle
Business Parameters
:If the public parameters are valid and no exceptions are found, proceed to process the business logic in the
Business Parameters
.
Public Parameters
Viewing Public Parameters and Error CodesBusiness Parameters
Field | Type | Scope | Description |
---|---|---|---|
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. |
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.
Example
{
"request_id": "",
"log_id": "",
"error_code": 0,
"error_code_str": "",
"error_msg": "",
"error_detail": {
"status_code": 200,
"code": "",
"code_message": "",
"message": ""
},
"task_status": 0,
"data": {
"cropped_image": "",
"hairstyle_image": ""
}
}