Face Beauty Pro
curl --request POST \
--url https://www.ailabapi.com/api/portrait/effects/face-beauty-pro \
--header 'Content-Type: multipart/form-data' \
--header 'ailabapi-api-key: <api-key>' \
--form task_type=sync \
--form image='@example-file' \
--form whitening=50 \
--form smoothing=50 \
--form thinface=50 \
--form shrink_face=50 \
--form enlarge_eye=50 \
--form remove_eyebrow=50 \
--form 'filter_type=<string>'import requests
url = "https://www.ailabapi.com/api/portrait/effects/face-beauty-pro"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"task_type": "sync",
"whitening": "50",
"smoothing": "50",
"thinface": "50",
"shrink_face": "50",
"enlarge_eye": "50",
"remove_eyebrow": "50",
"filter_type": "<string>"
}
headers = {"ailabapi-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('task_type', 'sync');
form.append('image', '<string>');
form.append('whitening', '50');
form.append('smoothing', '50');
form.append('thinface', '50');
form.append('shrink_face', '50');
form.append('enlarge_eye', '50');
form.append('remove_eyebrow', '50');
form.append('filter_type', '<string>');
const options = {method: 'POST', headers: {'ailabapi-api-key': '<api-key>'}};
options.body = form;
fetch('https://www.ailabapi.com/api/portrait/effects/face-beauty-pro', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.ailabapi.com/api/portrait/effects/face-beauty-pro",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"ailabapi-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.ailabapi.com/api/portrait/effects/face-beauty-pro"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ailabapi-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.ailabapi.com/api/portrait/effects/face-beauty-pro")
.header("ailabapi-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.ailabapi.com/api/portrait/effects/face-beauty-pro")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ailabapi-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"request_id": "",
"log_id": "",
"error_detail": {
"code": "",
"code_message": "",
"message": ""
},
"task_type": "sync",
"result": ""
}Face Beauty Pro
Face Beauty Pro Async API
Face Beauty Pro API provides advanced portrait retouching, face shaping, eyebrow removal, filters, and skin beautification.
POST
/
api
/
portrait
/
effects
/
face-beauty-pro
Face Beauty Pro
curl --request POST \
--url https://www.ailabapi.com/api/portrait/effects/face-beauty-pro \
--header 'Content-Type: multipart/form-data' \
--header 'ailabapi-api-key: <api-key>' \
--form task_type=sync \
--form image='@example-file' \
--form whitening=50 \
--form smoothing=50 \
--form thinface=50 \
--form shrink_face=50 \
--form enlarge_eye=50 \
--form remove_eyebrow=50 \
--form 'filter_type=<string>'import requests
url = "https://www.ailabapi.com/api/portrait/effects/face-beauty-pro"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"task_type": "sync",
"whitening": "50",
"smoothing": "50",
"thinface": "50",
"shrink_face": "50",
"enlarge_eye": "50",
"remove_eyebrow": "50",
"filter_type": "<string>"
}
headers = {"ailabapi-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('task_type', 'sync');
form.append('image', '<string>');
form.append('whitening', '50');
form.append('smoothing', '50');
form.append('thinface', '50');
form.append('shrink_face', '50');
form.append('enlarge_eye', '50');
form.append('remove_eyebrow', '50');
form.append('filter_type', '<string>');
const options = {method: 'POST', headers: {'ailabapi-api-key': '<api-key>'}};
options.body = form;
fetch('https://www.ailabapi.com/api/portrait/effects/face-beauty-pro', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.ailabapi.com/api/portrait/effects/face-beauty-pro",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"ailabapi-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.ailabapi.com/api/portrait/effects/face-beauty-pro"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ailabapi-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.ailabapi.com/api/portrait/effects/face-beauty-pro")
.header("ailabapi-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.ailabapi.com/api/portrait/effects/face-beauty-pro")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ailabapi-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_type\"\r\n\r\nsync\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"whitening\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"smoothing\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"thinface\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shrink_face\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enlarge_eye\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"remove_eyebrow\"\r\n\r\n50\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filter_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"request_id": "",
"log_id": "",
"error_detail": {
"code": "",
"code_message": "",
"message": ""
},
"task_type": "sync",
"result": ""
}Request
- URL:
https://www.ailabapi.com/api/portrait/effects/face-beauty-pro - Method:
POST - Content-Type:
multipart/form-data
Image requirements
- Image format:
JPEGJPGPNG - Image size: No more than 2 MB.
- Image resolution: Larger than 48x48px, smaller than 4096x4096px.
Headers
| Field | Required | Type | Description |
|---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. Get API KEY |
Body
| Field | Required | Type | Scope | Default | Description |
|---|---|---|---|---|---|
task_type | YES | string | async | “async: Asynchronous tasks. | |
image | YES | file | |||
whitening | NO | integer | [0, 100] | 50 | Whitening Degree. 0 means no whitening effect, 100 represents the highest degree. |
smoothing | NO | integer | [0, 100] | 50 | Smoothing Degree. 0 means no smoothing effect, 100 represents the highest degree. |
thinface | NO | integer | [0, 100] | 50 | Face Slimming Degree. 0 means no face slimming effect, 100 represents the highest degree. |
shrink_face | NO | integer | [0, 100] | 50 | Small Face Degree. 0 means no small face effect, 100 represents the highest degree. |
enlarge_eye | NO | integer | [0, 100] | 50 | Big Eyes Degree. 0 means no big eyes effect, 100 represents the highest degree. |
remove_eyebrow | NO | integer | [0, 100] | 50 | Eyebrow Removal Degree. 0 means no eyebrow removal effect, 100 represents the highest degree. |
filter_type | NO | integer | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 | 1`: Black and White.`, 2: Calm., 3`: Sunny Day.`, 4: Journey., 5`: Beautify Skin.`, 6: Hong Kong Style., 7`: Aesthetic.`, 8: Lovely., 9`: New York.`, 10: Sakura., 11`: Seventeen.`, 12: Soft Light., 13`: Afternoon Tea.`, 14: Brighten Skin., 15`: Chaplin.`, 16: Floral., 17`: Memories.`, 18: Ice Beauty., 19`: Paris.`, 20: Time., 21`: LOMO.`, 22: Old Times., 23`: Early Spring.`, 24: Story., 25`: Abao Color.`, 26: Fill Light., 27`: Warm.`, 28: Gorgeous., 29`: Lavender.`, 30: Chanel., 31`: Prague.`, 32: Old Dreams., 33`: Peach Blossom.`, 34: Pink., “35: Misty Rain. |
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. |
Response Example
{
"request_id": "",
"log_id": "",
"error_code": 0,
"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 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. |
result_url | string | Result URL address. |
All result URLs are temporarily available and will expire after 24 hours.
Response Example
{
"error_code": 0,
"error_msg": "",
"error_detail": {
"status_code": 200,
"code": "",
"code_message": "",
"message": ""
},
"task_status": 0,
"result_url": ""
}
Authorizations
API Key for authentication
Body
multipart/form-data
Task Type.
sync: Synchronous tasks.async: Asynchronous tasks.
Example:
"sync"
Whitening Degree. 0 means no whitening effect, 100 represents the highest degree.
Example:
"50"
Smoothing Degree. 0 means no smoothing effect, 100 represents the highest degree.
Example:
"50"
Face Slimming Degree. 0 means no face slimming effect, 100 represents the highest degree.
Example:
"50"
Small Face Degree. 0 means no small face effect, 100 represents the highest degree.
Example:
"50"
Big Eyes Degree. 0 means no big eyes effect, 100 represents the highest degree.
Example:
"50"
Eyebrow Removal Degree. 0 means no eyebrow removal effect, 100 represents the highest degree.
Example:
"50"
Filter Effects.
1: Black and White.2: Calm.3: Sunny Day.4: Journey.5: Beautify Skin.6: Hong Kong Style.7: Aesthetic.8: Lovely.9: New York.10: Sakura.11: Seventeen.12: Soft Light.13: Afternoon Tea.14: Brighten Skin.15: Chaplin.16: Floral.17: Memories.18: Ice Beauty.19: Paris.20: Time.21: LOMO.22: Old Times.23: Early Spring.24: Story.25: Abao Color.26: Fill Light.27: Warm.28: Gorgeous.29: Lavender.30: Chanel.31: Prague.32: Old Dreams.33: Peach Blossom.34: Pink.35: Misty Rain.
Response
200 - application/json
Success
The response is of type object.
⌘I

