Skip to main content
This document will introduce a Face Beautification API integration guide, which can accurately locate facial features and achieve beautification functions such as skin smoothing, skin brightening, and acne removal through a user-uploaded face image (up to five faces can be processed from a single image).

Application Process

To use the API, you need to first apply for the corresponding service on the Face Beautification API page. After entering the page, click the “Acquire” button, as shown in the image below: If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page. Upon your first application, there will be a free quota available for you to use the API for free.

Basic Usage

First, understand the basic usage method, which is to input the image link and beautification information to obtain the processed result image. You need to simply pass an image_url field, as shown in the face image below:

Next, we also need to upload the parameters related to face beautification information, as detailed in the request body information below. We can then fill in the corresponding content on the interface, as shown in the image below:

Here we can see that we have set the Request Headers, including:
  • accept: the format of the response result you want to receive, here filled in as application/json, which means JSON format.
  • authorization: the key to call the API, which can be directly selected after application.
Additionally, we set the Request Body, including:
  • image_url: the link to the face image that needs to be processed.
  • smoothing: the degree of skin smoothing, with a range of [0,100]. 0 means no smoothing, and 100 represents the highest degree. The default value is 10.
  • whitening: the degree of skin whitening, with a range of [0,100]. 0 means no whitening, and 100 represents the highest degree. The default value is 30.
  • face_lifting: the degree of face slimming, with a range of [0,100]. 0 means no slimming, and 100 represents the highest degree. The default value is 70.
  • eye_enlarging: the degree of eye enlargement, with a range of [0,100]. 0 means no enlargement, and 100 represents the highest degree. The default value is 70.
After selection, you can see that the corresponding code is also generated on the right side, as shown in the image below:

Click the “Try” button to conduct a test, as shown in the image above, and we obtained the following result:
{
  "image_url": "https://faceeffect-1254418846.cos.ap-guangzhou.myqcloud.com/fmu/BeautifyPic/1256437459/1a68c13b-b03c-4c7b-92a1-e4a9b5f1d7ec"
}
As you can see, the returned result contains an image_url field, which is the face image after beautification based on the input changes. The changed face information is shown below:

You can see that the face in the image has changed according to the input beautification information. Additionally, if you want to generate the corresponding integration code, you can directly copy the generated code, for example, the CURL code is as follows:
curl -X POST 'https://api.acedata.cloud/face/beautify' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "image_url": "https://cdn.acedata.cloud/lrbtcn.jpg",
  "smoothing": 50,
  "whitening": 50,
  "face_lifting": 50,
  "eye_enlarging": 50
}'
The Python integration code is as follows:
import requests

url = "https://api.acedata.cloud/face/beautify"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "image_url": "https://cdn.acedata.cloud/lrbtcn.jpg",
    "smoothing": 50,
    "whitening": 50,
    "face_lifting": 50,
    "eye_enlarging": 50
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)

Error Handling

When calling the API, if an error occurs, the API will return the corresponding error code and message. For example:
  • 400 token_mismatched: Bad request, possibly due to missing or invalid parameters.
  • 400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.
  • 401 invalid_token: Unauthorized, invalid or missing authorization token.
  • 429 too_many_requests: Too many requests, you have exceeded the rate limit.
  • 500 api_error: Internal server error, something went wrong on the server.

Error Response Example

{
  "success": false,
  "error": {
    "code": "api_error",
    "message": "fetch failed"
  },
  "trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}

Conclusion

Through this document, you have learned how to use the Face Beautification API for a user-uploaded face image (up to five faces can be processed from a single image), accurately locate facial features, and achieve beautification functions such as skin smoothing, skin brightening, and acne removal. We hope this document can help you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.