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
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 Name | Type | Maximum Length | Required | Remarks |
|---|---|---|---|---|
| out_request_id | string | 200 | Yes | External request ID (unique) |
| img_url | string | 200 | No | Image URL (complete URL address, requires urlencode processing) |
| template_id | integer | 20 | Yes | Template ID (provided to the merchant in advance) |
| mt_check_id | string | 64 | No | If 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:
- 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;
- 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 Name | Type | Example Value | Description |
|---|---|---|---|
| code | integer | 100000 | Response status code |
| msg | string | Operation successful | Description of the response status code |
| data | object | Response data | |
| data.face_url | string | Face-swapped image URL (Note: Since the image is stored on a private cloud, the image is valid for 5 minutes) | |
| data.mt_generate_id | string | Meitu generation ID |
Failed Return Value Description
| Field | Type | Description |
|---|---|---|
| data | String | Returned content |
| message | String | Error message |
| code | Int | Error 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 Code | Description |
|---|---|
| 100000 | Success |
| 100001 | Parameter error |
Error Codes and Information
- For descriptions of billing rules, error codes, msg, and other content related to this API, please refer to Billing & Status Code Description