AILabTools API - Hairstyle Changer Pro - API
Request
- URL:
https://www.ailabapi.com/api/portrait/effects/hairstyle-editor-pro
- Method:
POST
- Content-Type:
multipart/form-data
Image requirements
- Image format:
PNG
JPG
JPEG
- Image size: No more than 3 MB.
- Image resolution: Larger than 200x200px, smaller than 1999x1999px.
- Minimum Face Proportion: To ensure effectiveness, the proportion of the face in the image cannot be less than 20%.
- Facial Integrity: To ensure effectiveness, the face in the image should ideally not be obscured.
- Facial Angle: To ensure effectiveness, the face in the image should ideally be front-facing, with no more than a 45-degree rotation to the left or right.
Image Validity | Reason for Invalidity | |
---|---|---|
✅ | ||
❌ | No face | |
Incomplete face | ||
Face obscured | ||
Face proportion too small | ||
The face is too large to edit the hairstyle |
Header
Field | Required | Type | Description |
---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. |
Body
Fixed Fields
Field | Required | Type | Scope | Default | Description |
---|---|---|---|---|---|
task_type | YES | string | async | Task Type. async : Asynchronous tasks. | |
auto | YES | integer | 1 | 1 | Mode. 1 : Automatic mode. |
image | YES | file | Main image. | ||
hair_style | YES | string | Details | Hairstyle. Details | |
color | NO | string | Details | Color. Details | |
image_size | NO | integer | 1 2 3 4 | 1 | Returns the number of images. |
hair_style
Category: Gender | hair_style | Description |
---|---|---|
Male | BuzzCut | Buzz Cut hair |
UnderCut | UnderCut hair | |
Pompadour | Pompadour hair | |
SlickBack | Slick Back hair | |
CurlyShag | Curly Shag hair | |
WavyShag | Wavy Shag hair | |
FauxHawk | Faux Hawk hair | |
Spiky | Spiky hair | |
CombOver | Comb-over hair | |
HighTightFade | High and Tight Fade hair | |
ManBun | Man Bun hair | |
Afro | Afro hair | |
LowFade | Low Fade hair | |
UndercutLongHair | Undercut With Long Hair | |
TwoBlockHaircut | Two Block Haircut | |
TexturedFringe | Textured Fringe Hair | |
BluntBowlCut | Blunt Bowl Cut | |
LongWavyCurtainBangs | Long Wavy Curtain Bangs Hair | |
MessyTousled | Messy Tousled hair | |
MediumLengthWavy | Medium Length Wavy hair | |
CornrowBraids | Cornrow Braids hair | |
LongHairTiedUp | Long Hair Tied Up Hair | |
Middle-parted | Middle-parted Hair | |
Female | ShortPixieWithShavedSides | Short Pixie With Shaved Sides |
ShortNeatBob | short neat bob hair | |
DoubleBun | double bun hair | |
Updo | Updo hair | |
Spiked | spiked hair | |
bowlCut | bowl cut hair | |
Chignon | Chignon hair | |
PixieCut | Pixie Cut hair | |
SlickedBack | slicked back hair | |
LongCurly | Long curly hair | |
CurlyBob | Curly bob hair | |
StackedCurlsInShortBob | Stacked Curls in Short Bob hair | |
SidePartCombOverHairstyleWithHighFade | Side Part Comb-Over Hairstyle With High Fade hair | |
WavyFrenchBobVibesfrom1920 | Wavy French Bob Vibes from 1920 | |
BobCut | bob Haircut hair | |
ShortTwintails | Short Twintails hair | |
ShortCurlyPixie | Short Curly Pixie | |
LongStraight | Long straight hair | |
LongWavy | Long wavy hair | |
FishtailBraid | Fishtail braid hair | |
TwinBraids | Twin Braids hair | |
Ponytail | Ponytail hair | |
Dreadlocks | dreadlocks hair | |
Cornrows | Cornrows hair | |
ShoulderLengthHair | Shoulder Length Straight Hair | |
LooseCurlyAfro | Loose Curly Afro hair | |
LongTwintails | Long Twintails hair | |
LongHimeCut | Long Hime Cut hair | |
BoxBraids | Box Braids hair |
color
color | Description |
---|---|
blonde | blonde hair |
platinumBlonde | platinum blonde hair |
brown | brown hair |
lightBrown | light brown hair |
blue | blue hair |
lightBlue | light blue hair |
purple | purple hair |
lightPurple | light purple hair |
pink | pink hair |
black | black hair |
white | white hair |
grey | grey hair |
silver | silver hair |
red | red hair |
orange | orange hair |
green | green hair |
gradient | gradient hair |
multicolored | multicolored hair |
darkBlue | blue hair |
burgundy | burgundy hair |
darkGreen | dark green |
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. | |
+images | array | Array of resultant image addresses. |
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": {
"images": [
"Image URL",
"Image URL"
]
}
}
Code example
If you'd like to see the actual effects, please visit the experience page for a trial.