Photo Studio - Portrait Face Swap

Photo Studio - Portrait Face Swap

Description

This API is used for Photo Studio - AI Face Swap requests. For specific effects, please refer to the details in the following documentation.

Version

1.0

Image Requirements

Image formats: JPG, PNG

Changelog

Request URL

Production environment: https://openapi.meitu.com/idphoto/business/v2/faceswap/make

Request Method

POST

The request header type should include: Content-Type:application/json

Permission

Open Platform API Signature

Credits cannot be used to pay for API calls. Please visit the MV console to activate this API and purchase or manage resource packages.

Request Parameters

Parameter NameTypeMaximum LengthRequiredRemarks
out_request_idstring200YesExternal request ID (unique)
img_urlstring200NoImage URL (complete URL address, requires urlencode processing)
template_idinteger20YesTemplate ID (provided to the merchant in advance)
mt_check_idstring64NoIf the partner integrates the detection API /idphoto/business/check, the detection identifier returned by this API will be obtained; this identifier can be used in other image creation APIs to skip image upload and detection

Note:

  1. One and only one of img_url and mt_check_id must be provided. The API will select the image to be created based on the parameter provided;
  2. This API has built-in basic image detection capabilities. If the partner has more detailed detection requirements, the detection API /idphoto/business/check can be integrated;

Request Example

{
     "out_request_id":"36936",
     "img_url":"https://1712729785284668164-674060.jpeg",
     "template_id": 100003,
	 "mt_check_id":"728888888888888"
}

Return Value Description

Successful Return Value Description

Field NameTypeExample ValueDescription
codeinteger100000Response status code
msgstringOperation successfulDescription of the response status code
dataobjectResponse data
data.face_urlstringFace-swapped image URL (Note: Since the image is stored on a private cloud, the image is valid for 5 minutes)
data.mt_generate_idstringMeitu generation ID

Failed Return Value Description

FieldTypeDescription
dataStringReturned content
messageStringError message
codeIntError code

Return Value Example

Successful Request Return Example

Response Status: 200

content-type is application/json; charset=utf-8

{
    "code": 100000,
    "msg": "Operation successful",
    "data": {
        "face_url": "http:/.jpg",
		"mt_generate_id":"123321"
    },
    "log_id": "Z7VX7Aw6pFtQ4md21VCdRlCXp3TByG99"
}

Return Status Codes

Status CodeDescription
100000Success
100001Parameter error

Error Codes and Information

  1. For descriptions of billing rules, error codes, msg, and other content related to this API, please refer to Billing & Status Code Description