Skip to main content
POST
Age & Gender swap

Request

  • URL: https://www.ailabapi.com/api/portrait/effects/face-attribute-editing
  • Method: POST
  • Content-Type: multipart/form-data

Image requirements

  • Image format: JPEG JPG PNG BMP
  • Image size: No more than 4 MB.
  • Image resolution: Larger than 256x256px, smaller than 4096x4096px. The face area must be 64x64px or more.

Headers

Body

Fixed Fields

action_type === V2_AGE

action_type === V2_GENDER

quality_control

The quality control thresholds corresponding to different control systems: If any quality information detected does not meet the requirements of the control threshold, an error will be returned.

face_location

  • Request Example

Response

Response Field Handling Flow
  1. Handle Public Response Fields Parse and validate the Public Response Fields, checking the status code or response message to ensure the request is successful and error-free.
  2. Handle Business Response Fields If the Public Response Fields are valid and error-free, proceed with processing the business logic in the Business Response Fields.

Public Response Fields

Viewing Public Response Fields and Error Codes

Business Response Fields

Response Example

Authorizations

ailabapi-api-key
string
header
required

API Key for authentication

Body

multipart/form-data
image
file
action_type
string

Face editing method.

  • TO_KID: V1 version becomes a child.
  • TO_OLD: V1 version becomes old man.
  • TO_FEMALE: V1 version becomes girls.
  • TO_MALE: V1 version becomes boys.
  • V2_AGE: V2 version age change.
  • V2_GENDER: v2 version gender shift.
quality_control
string

Image quality (image field image quality).
Please select the appropriate option based on quality information such as masking, lighting, blurriness, and integrity of the face.
If selecting a higher quality causes the image to be unprocessable, please select a lower quality to try.

  • NONE: No control is performed.
  • LOW: Lower quality requirements.
  • NORMAL: General quality requirements.
  • HIGH: Higher quality requirements.
face_location
string

When multiple faces are detected in the image, use this parameter to specify the position of the face to be edited in the image, or default to the largest face in the image if not specified.

target
string

Response

200 - application/json

Success

The response is of type object.