Yunxiu Beauty Retouching
Submit an image to Yunxiu Beauty Retouching and retrieve the processed image asynchronously.
Permissions
Obtain an AccessKey and SecretKey and sign each request as described in the Open Platform request signing guide.
Requests
Use POST with Content-Type: application/json.
| Operation | URL | JSON body |
|---|---|---|
| Submit a preset | https://openapi.meitu.com/yunxiu_api/openapi/beauty_async | media_code (preset ID) and media_data (public image URL) |
| Submit raw parameters | https://openapi.meitu.com/yunxiu_api/openapi/beauty_async | parameter and media_info_list |
| Query a task | https://openapi.meitu.com/yunxiu_api/openapi/query | msg_id from the submission response |
Raw request body
Use a public image URL in the following sample.
{
"parameter": {
"repost_url": "https://example.com/callback",
"all_params": {
"fleck_clean_flag": [
1,
1,
1,
1,
1
],
"lip_remove_alpha": [
30,
30,
30,
30,
30
],
"wrinkle_nasolabial_removal_alpha": [
30,
30,
30,
30,
30
],
"black_head_clean_flag": [
1,
1,
1,
1,
1
],
"remove_pouch": [
30,
30,
30,
30,
30
],
"wrinkle_neck_removal_alpha": [
30,
30,
30,
30,
30
],
"wrinkle_cheek_removal_alpha": [
30,
30,
30,
30,
30
],
"double_chin": [
1,
1,
1,
1,
1
],
"double_chin_alpha": [
100,
30,
100,
100,
100
],
"wrinkle_forehead_removal_alpha": [
30,
30,
30,
30,
30
],
"wrinkle_periorbital_removal_alpha": [
30,
30,
30,
30,
30
],
"shiny_clean_alpha": [
30,
30,
30,
30,
30
],
"nevus_removal_flag": [
1,
1,
1,
1,
1
],
"ai_shrink_head": [
30,
30,
30,
30,
30
],
"face_forehead": [
30,
30,
30,
30,
30
],
"middle_half_of_face": [
20,
20,
20,
20,
20
],
"bottom_half_of_face": [
20,
20,
20,
20,
20
],
"philtrum_warp": [
20,
20,
20,
20,
20
],
"narrow_face": [
30,
30,
30,
30,
30
],
"facial_contour": [
20,
20,
20,
20,
20
],
"cheekbone_left": [
20,
20,
20,
20,
20
],
"cheekbone_right": [
20,
20,
20,
20,
20
],
"temple_left": [
20,
20,
20,
20,
20
],
"temple_right": [
20,
20,
20,
20,
20
],
"mandible_left": [
20,
20,
20,
20,
20
],
"mandible_right": [
20,
20,
20,
20,
20
],
"jaw_trans": [
30,
30,
30,
30,
30
],
"face_trans": [
30,
30,
30,
30,
30
],
"run_symmetry_list": [
0,
1,
0,
0,
0
],
"face_symmetry": [
0,
100,
0,
0,
0
],
"body_symmetry": [
0,
50,
0,
0,
0
],
"threed_up_down": [
20,
20,
20,
20,
20
],
"threed_left_right": [
20,
20,
20,
20,
20
],
"filter": {
"filter_id": "Fa0000ItjzwJwznN",
"filters_lut_alpha": 80,
"filter_is_black": 0
},
"skin_tone_flag": [
0,
0,
0,
0,
0
],
"body_dullness_remove_alpha": [
30,
30,
30,
30,
30
],
"skin_tone_body_luma_alpha": [
100,
100,
100,
100,
100
],
"skin_tone_body_hue_alpha": [
100,
100,
100,
100,
100
],
"skin_color_path": [
2,
2,
2,
2,
2
],
"skin_color_hue_skin_alpha": [
50,
50,
50,
50,
50
],
"skin_color_hue_alpha": [
20,
20,
20,
20,
20
],
"skin_red_alpha": [
30,
30,
30,
30,
30
],
"skin_white_alpha": [
30,
30,
30,
30,
30
],
"skin_hdr_alpha": [
30,
30,
30,
30,
30
],
"smooth_face_skin_alpha": [
30,
30,
30,
30,
30
],
"smooth_not_face_skin_alpha": [
20,
20,
20,
20,
20
],
"face_balance_alpha": [
30,
30,
30,
30,
30
],
"sharpen_alpha": [
30,
30,
30,
30,
30
],
"fluffy_hair": [
30,
30,
30,
30,
30
],
"black_hair": [
30,
30,
30,
30,
30
],
"nasal_tip": [
30,
30,
30,
30,
30
],
"bridge_nose": [
30,
30,
30,
30,
30
],
"shrink_nose": [
30,
30,
30,
30,
30
],
"scale_nose": [
30,
30,
30,
30,
30
],
"nose_longer": [
30,
30,
30,
30,
30
],
"nasal_root": [
30,
30,
30,
30,
30
],
"upperlip_enhance": [
30,
30,
30,
30,
30
],
"lowerlip_enhance": [
20,
20,
20,
20,
20
],
"mouth_trans": [
30,
30,
30,
30,
30
],
"mouth_high": [
30,
30,
30,
30,
30
],
"mouth_breadth": [
30,
30,
30,
30,
30
],
"high_mouth": [
30,
30,
30,
30,
30
],
"mouth_smile": [
20,
20,
20,
20,
20
],
"eye_up_down_left": [
20,
20,
20,
20,
20
],
"eye_up_down_right": [
20,
20,
20,
20,
20
],
"eye_trans_left": [
20,
20,
20,
20,
20
],
"eye_trans_right": [
20,
20,
20,
20,
20
],
"eye_tilt_left": [
30,
50,
30,
30,
30
],
"eye_tilt_right": [
30,
30,
30,
30,
30
],
"eye_height_left": [
30,
20,
30,
30,
30
],
"eye_height_right": [
30,
30,
30,
30,
30
],
"eye_lid_left": [
20,
20,
20,
20,
20
],
"eye_lid_right": [
20,
20,
20,
20,
20
],
"eye_distance_left": [
30,
40,
30,
30,
30
],
"eye_distance_right": [
30,
30,
30,
30,
30
],
"eye_width_left": [
30,
30,
30,
30,
30
],
"eye_width_right": [
30,
30,
30,
30,
30
],
"inner_eye_corner_left": [
20,
20,
20,
20,
20
],
"inner_eye_corner_right": [
20,
20,
20,
20,
20
],
"eyebrow_tilt_left": [
20,
20,
20,
20,
20
],
"eyebrow_tilt_right": [
20,
20,
20,
20,
20
],
"eyebrow_height_left": [
20,
20,
20,
20,
20
],
"eyebrow_height_right": [
20,
20,
20,
20,
20
],
"eyebrow_distance_left": [
20,
20,
20,
20,
20
],
"eyebrow_distance_right": [
20,
20,
20,
20,
20
],
"eyebrow_ridge_left": [
20,
20,
20,
20,
20
],
"eyebrow_ridge_right": [
20,
20,
20,
20,
20
],
"eyebrow_size_left": [
20,
20,
20,
20,
20
],
"eyebrow_size_right": [
20,
20,
20,
20,
20
]
},
"preview_size": 3000,
"req_mask_version": 0,
"people_type": [
{
"key": "man",
"gender": 1,
"name": "Man",
"age": [
15,
49
]
},
{
"key": "woman",
"gender": 0,
"name": "Woman",
"age": [
15,
49
]
},
{
"key": "child",
"gender": 0,
"name": "Child",
"age": [
0,
14
]
},
{
"key": "oldwoman",
"gender": 0,
"name": "Senior",
"age": [
50,
100
]
},
{
"key": "oldman",
"gender": 1,
"name": "Senior",
"age": [
50,
100
]
}
],
"output": {
"file_prefix": "",
"file_start_no": 0,
"format": "jpg",
"preview_size": 3000,
"quality": 0,
"qualityKey": 12,
"resize_height": 0,
"resize_width": 0,
"water_mark": 0,
"file_size_limit": [
0,
0
]
}
},
"media_info_list": [
{
"media_data": "https://beauty-public.zone1.meitudata.com/Marvel/1680141903114.jpg",
"media_extra": {},
"media_profiles": {
"media_data_type": "url",
"media_data_describe": "src"
}
}
]
}Results
Read data.msg_id from the submission response. Send it in the query request to check the task status. If you supply a repost_url, your callback can also receive the result.
SDK examples
Install the signing SDK for your language. Python also requires requests. For PHP, place signer.php alongside the script. Save the Java example as Main.java.
Enter your signing keys, preset ID and image URL to submit a task. Use the returned data.msg_id to query the result.
Python
import json
import requests
from sign_sdk import sign
def api_call_example():
key = "your_access_key"
secret = "your_secret_key"
url = "https://openapi.meitu.com/yunxiu_api/openapi/beauty_async"
method = "POST"
headers = {
"Content-Type": "application/json",
sign.HeaderHost: "openapi.meitu.com",
}
payload = {"media_code": "YOUR_PRESET_ID", "media_data": "https://example.com/portrait.jpg"}
body = json.dumps(payload, ensure_ascii=False)
signer = sign.Signer(key, secret)
signed_request = signer.sign(url, method, headers, body)
with requests.Session() as session:
response = session.send(signed_request, timeout=60)
print("Status:", response.status_code)
print("Response:", response.text)
if __name__ == "__main__":
api_call_example()Go
package main
import (
"fmt"
"github.com/mtlab/api/signer"
"io"
"net/http"
"time"
)
func main() {
key := "your_access_key"
secret := "your_secret_key"
signObj := signer.NewSigner(key, secret)
url := "https://openapi.meitu.com/yunxiu_api/openapi/beauty_async"
headers := make(http.Header)
headers.Set(signer.HeaderHost, "openapi.meitu.com")
headers.Set("Content-Type", "application/json")
body := `{"media_code":"YOUR_PRESET_ID","media_data":"https://example.com/portrait.jpg"}`
req, err := signObj.Sign(url, http.MethodPost, headers, body)
if err != nil {
fmt.Println("Failed to sign request:", err)
return
}
client := &http.Client{Timeout: 60 * time.Second}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Failed to send request:", err)
return
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Failed to read response:", err)
return
}
fmt.Println("Status:", resp.StatusCode)
fmt.Println("Response:", string(responseBody))
}PHP
<?php
require_once __DIR__ . '/signer.php';
$key = 'your_access_key';
$secret = 'your_secret_key';
$url = 'https://openapi.meitu.com/yunxiu_api/openapi/beauty_async';
$headers = [
'Content-Type' => 'application/json',
'Host' => 'openapi.meitu.com',
];
$payload = ['media_code' => 'YOUR_PRESET_ID', 'media_data' => 'https://example.com/portrait.jpg'];
$body = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR);
$signer = new Signer($key, $secret);
$curl = $signer->sign($url, 'POST', $headers, $body);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
$response = curl_exec($curl);
if ($response === false) {
echo 'Error: ' . curl_error($curl);
} else {
echo 'Status: ' . curl_getinfo($curl, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response: ' . $response . PHP_EOL;
}
curl_close($curl);Java
import com.meitu.openai.common.Signer;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
Signer signer = new Signer("your_access_key", "your_secret_key");
String url = "https://openapi.meitu.com/yunxiu_api/openapi/beauty_async";
String method = "POST";
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put(Signer.HeaderHost, "openapi.meitu.com");
String body = "{\"media_code\": \"YOUR_PRESET_ID\", \"media_data\": \"https://example.com/portrait.jpg\"}";
Map<String, String> signedHeaders = signer.sign(url, method, headers, body);
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
try {
connection.setRequestMethod(method);
connection.setConnectTimeout(10000);
connection.setReadTimeout(60000);
connection.setInstanceFollowRedirects(false);
for (Map.Entry<String, String> header : signedHeaders.entrySet()) {
connection.setRequestProperty(header.getKey(), header.getValue());
}
connection.setDoOutput(true);
try (OutputStream output = connection.getOutputStream()) {
output.write(body.getBytes(StandardCharsets.UTF_8));
}
int status = connection.getResponseCode();
InputStream stream = status >= 400
? connection.getErrorStream()
: connection.getInputStream();
System.out.println("Status: " + status);
if (stream != null) {
try (InputStream input = stream;
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
byte[] buffer = new byte[4096];
int length;
while ((length = input.read(buffer)) != -1) {
output.write(buffer, 0, length);
}
System.out.println("Response: " + output.toString("UTF-8"));
}
}
} finally {
connection.disconnect();
}
}
}Submit raw parameters
Save the complete raw request body above as params.json and set the image URL and processing parameters.
Python
import json
import requests
from sign_sdk import sign
def api_call_example():
key = "your_access_key"
secret = "your_secret_key"
url = "https://openapi.meitu.com/yunxiu_api/openapi/beauty_async"
method = "POST"
headers = {
"Content-Type": "application/json",
sign.HeaderHost: "openapi.meitu.com",
}
with open("params.json", encoding="utf-8") as source:
body = source.read()
signer = sign.Signer(key, secret)
signed_request = signer.sign(url, method, headers, body)
with requests.Session() as session:
response = session.send(signed_request, timeout=60)
print("Status:", response.status_code)
print("Response:", response.text)
if __name__ == "__main__":
api_call_example()Go
package main
import (
"fmt"
"github.com/mtlab/api/signer"
"io"
"net/http"
"os"
"time"
)
func main() {
key := "your_access_key"
secret := "your_secret_key"
signObj := signer.NewSigner(key, secret)
url := "https://openapi.meitu.com/yunxiu_api/openapi/beauty_async"
headers := make(http.Header)
headers.Set(signer.HeaderHost, "openapi.meitu.com")
headers.Set("Content-Type", "application/json")
data, err := os.ReadFile("params.json")
if err != nil { panic(err) }
body := string(data)
req, err := signObj.Sign(url, http.MethodPost, headers, body)
if err != nil {
fmt.Println("Failed to sign request:", err)
return
}
client := &http.Client{Timeout: 60 * time.Second}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Failed to send request:", err)
return
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Failed to read response:", err)
return
}
fmt.Println("Status:", resp.StatusCode)
fmt.Println("Response:", string(responseBody))
}PHP
<?php
require_once __DIR__ . '/signer.php';
$key = 'your_access_key';
$secret = 'your_secret_key';
$url = 'https://openapi.meitu.com/yunxiu_api/openapi/beauty_async';
$headers = [
'Content-Type' => 'application/json',
'Host' => 'openapi.meitu.com',
];
$body = file_get_contents(__DIR__ . '/params.json');
if ($body === false) { throw new RuntimeException('Cannot read params.json'); }
$signer = new Signer($key, $secret);
$curl = $signer->sign($url, 'POST', $headers, $body);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
$response = curl_exec($curl);
if ($response === false) {
echo 'Error: ' . curl_error($curl);
} else {
echo 'Status: ' . curl_getinfo($curl, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response: ' . $response . PHP_EOL;
}
curl_close($curl);Java
import com.meitu.openai.common.Signer;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
Signer signer = new Signer("your_access_key", "your_secret_key");
String url = "https://openapi.meitu.com/yunxiu_api/openapi/beauty_async";
String method = "POST";
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put(Signer.HeaderHost, "openapi.meitu.com");
String body = new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get("params.json")), StandardCharsets.UTF_8);
Map<String, String> signedHeaders = signer.sign(url, method, headers, body);
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
try {
connection.setRequestMethod(method);
connection.setConnectTimeout(10000);
connection.setReadTimeout(60000);
connection.setInstanceFollowRedirects(false);
for (Map.Entry<String, String> header : signedHeaders.entrySet()) {
connection.setRequestProperty(header.getKey(), header.getValue());
}
connection.setDoOutput(true);
try (OutputStream output = connection.getOutputStream()) {
output.write(body.getBytes(StandardCharsets.UTF_8));
}
int status = connection.getResponseCode();
InputStream stream = status >= 400
? connection.getErrorStream()
: connection.getInputStream();
System.out.println("Status: " + status);
if (stream != null) {
try (InputStream input = stream;
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
byte[] buffer = new byte[4096];
int length;
while ((length = input.read(buffer)) != -1) {
output.write(buffer, 0, length);
}
System.out.println("Response: " + output.toString("UTF-8"));
}
}
} finally {
connection.disconnect();
}
}
}Query the result
Set YOUR_MSG_ID to the data.msg_id returned by the submission request. Sign and send the POST request to retrieve the result.
Python
import json
import requests
from sign_sdk import sign
def api_call_example():
key = "your_access_key"
secret = "your_secret_key"
url = "https://openapi.meitu.com/yunxiu_api/openapi/query"
method = "POST"
headers = {
"Content-Type": "application/json",
sign.HeaderHost: "openapi.meitu.com",
}
payload = {"msg_id": "YOUR_MSG_ID"}
body = json.dumps(payload, ensure_ascii=False)
signer = sign.Signer(key, secret)
signed_request = signer.sign(url, method, headers, body)
with requests.Session() as session:
response = session.send(signed_request, timeout=60)
print("Status:", response.status_code)
print("Response:", response.text)
if __name__ == "__main__":
api_call_example()Go
package main
import (
"fmt"
"github.com/mtlab/api/signer"
"io"
"net/http"
"time"
)
func main() {
key := "your_access_key"
secret := "your_secret_key"
signObj := signer.NewSigner(key, secret)
url := "https://openapi.meitu.com/yunxiu_api/openapi/query"
headers := make(http.Header)
headers.Set(signer.HeaderHost, "openapi.meitu.com")
headers.Set("Content-Type", "application/json")
body := `{"msg_id":"YOUR_MSG_ID"}`
req, err := signObj.Sign(url, http.MethodPost, headers, body)
if err != nil {
fmt.Println("Failed to sign request:", err)
return
}
client := &http.Client{Timeout: 60 * time.Second}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Failed to send request:", err)
return
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Failed to read response:", err)
return
}
fmt.Println("Status:", resp.StatusCode)
fmt.Println("Response:", string(responseBody))
}PHP
<?php
require_once __DIR__ . '/signer.php';
$key = 'your_access_key';
$secret = 'your_secret_key';
$url = 'https://openapi.meitu.com/yunxiu_api/openapi/query';
$headers = [
'Content-Type' => 'application/json',
'Host' => 'openapi.meitu.com',
];
$payload = ['msg_id' => 'YOUR_MSG_ID'];
$body = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR);
$signer = new Signer($key, $secret);
$curl = $signer->sign($url, 'POST', $headers, $body);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
$response = curl_exec($curl);
if ($response === false) {
echo 'Error: ' . curl_error($curl);
} else {
echo 'Status: ' . curl_getinfo($curl, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response: ' . $response . PHP_EOL;
}
curl_close($curl);Java
import com.meitu.openai.common.Signer;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
Signer signer = new Signer("your_access_key", "your_secret_key");
String url = "https://openapi.meitu.com/yunxiu_api/openapi/query";
String method = "POST";
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put(Signer.HeaderHost, "openapi.meitu.com");
String body = "{\"msg_id\":\"YOUR_MSG_ID\"}";
Map<String, String> signedHeaders = signer.sign(url, method, headers, body);
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
try {
connection.setRequestMethod(method);
connection.setConnectTimeout(10000);
connection.setReadTimeout(60000);
connection.setInstanceFollowRedirects(false);
for (Map.Entry<String, String> header : signedHeaders.entrySet()) {
connection.setRequestProperty(header.getKey(), header.getValue());
}
connection.setDoOutput(true);
try (OutputStream output = connection.getOutputStream()) {
output.write(body.getBytes(StandardCharsets.UTF_8));
}
int status = connection.getResponseCode();
InputStream stream = status >= 400
? connection.getErrorStream()
: connection.getInputStream();
System.out.println("Status: " + status);
if (stream != null) {
try (InputStream input = stream;
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
byte[] buffer = new byte[4096];
int length;
while ((length = input.read(buffer)) != -1) {
output.write(buffer, 0, length);
}
System.out.println("Response: " + output.toString("UTF-8"));
}
}
} finally {
connection.disconnect();
}
}
}