[Important: API Service Retirement Announcement]Dear Developers,Thank you for your continued trust and support in AILabTools API. In order to provide more efficient and reliable services, we will officially deprecate the current version of this API.As this interface is based on an outdated architecture and its performance can no longer meet evolving needs, it will no longer be available starting from the date of this announcement.We kindly recommend that you evaluate and adopt an alternative solution as soon as possible to ensure a smooth transition for your applications.If you have any questions or need assistance during the migration, please feel free to contact our support team:
📧 [email protected]We sincerely appreciate your understanding and cooperation, and we remain committed to delivering better and more advanced services for you.Warm regards,AILabTools Support Team
Request
- URL:
https://www.ailabapi.com/api/portrait/effects/hairstyle-editor-pro - Method:
POST - Content-Type:
multipart/form-data
Image requirements
- Image format:
PNGJPGJPEG - 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 |
Headers
| Field | Required | Type | Description |
|---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. Get API KEY |
Body
Fixed Fields
| Field | Required | Type | Scope | Default | Description |
|---|---|---|---|---|---|
task_type | YES | string | async | “async: Asynchronous tasks. | |
auto | YES | integer | 1 | 1 | “1: Automatic mode. |
image | YES | file | Main image. | ||
hair_style | YES | string | Scope | Hairstyle. More Details | |
color | NO | string | Scope | Color. More 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 | dark blue hair |
burgundy | burgundy hair |
darkGreen | dark green hair |
Response
Response Field Handling Flow-
Handle
Public Response FieldsParse and validate thePublic Response Fields, checking the status code or response message to ensure the request is successful and error-free. -
Handle
Business Response FieldsIf thePublic Response Fieldsare valid and error-free, proceed with processing the business logic in theBusiness Response Fields.
Public Response Fields
Viewing Public Response Fields and Error CodesBusiness Response Fields
| 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 Async Task Results API. |
Response Example
task_id and call Querying Async 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 Async Task Results Response
Response Field Handling Flow
-
Handle
Public Response FieldsParse and validate thePublic Response Fields, checking the status code or response message to ensure the request is successful and error-free. -
Handle
Business Response FieldsIf thePublic Response Fieldsare valid and error-free, proceed with processing the business logic in theBusiness Response Fields.
Public Response Fields
Viewing Public Response Fields and Error CodesBusiness Response Fields
| 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. | |
+images | array | Array of resultant image addresses. |

