Background Color Replacement
Description
This API is used for ID Photo - Background Color Replacement 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/v1/generate
Request Method
POST
The request header type should include: Content-Type:application/json
Permission
Request Parameters
| Parameter Name | Type | Maximum Length | Required | Remarks |
|---|---|---|---|---|
| out_request_id | string | 64 | Yes | External request ID (unique) |
| back_color | string | 7 | Yes | Background color value |
| back_mode | int | - | Yes | Background mode: 0 solid color, 1 top to bottom, 2 outside to inside, 3 inside to outside |
| mt_generate_id | string | 10 | Yes | Meitu ID photo generation ID |
| custom_watermark_vertical | string | 200 | No | Custom vertical watermark identifier, applicable to ID photos (contact Meitu Business for configuration) |
| custom_watermark_transverse | string | 200 | No | Custom horizontal watermark identifier, applicable to typesetting photos (contact Meitu Business for configuration) |
Request Example
{
"back_color": "#00868B",
"back_mode": 3,
"mt_generate_id":"1712652640552366000",
"out_request_id":"36936"
}Return Value Description
Successful Return Value Description
| Field Name | Type | Example Value | Description |
|---|---|---|---|
| code | int | 100000 | Response status code |
| msg | string | Operation successful | Prompt |
| data | object | Data | |
| data.mt_generate_id | string | 100 | Meitu ID photo generation ID (used when querying the final ID photo) |
| data.sd_photo | string | http://biz-res-pre.zone1.meitudata.com/idphoto-private/1646220627569878737-460912.jpg?xxxxxxxxx | Standard-definition image |
| data.hd_photo | string | http://biz-res-pre.zone1.meitudata.com/idphoto-private/1646220627569878737-460912.jpg?xxxxxxxxx | High-definition image |
| data.typesetting_photo | string | http://biz-res-pre.zone1.meitudata.com/idphoto-private/1646220627569878737-460912.jpg?xxxxxxx | Typesetting photo |
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": {
"mt_generate_id": "6917420196238201566",
"sd_photo": "http://biz-res-pre.zone1.meitudata.com/idphoto-private/1651889152914183000-339473.jpg",
"hd_photo": "http://biz-res-pre.zone1.meitudata.com/idphoto-private/1651889152914183000-339473.jpg",
"typesetting_photo": "http://biz-res-pre.zone1.meitudata.com/idphoto-private/1651889152915709000-175421.jpg"
},
"log_id": "HRf7EMZn6CyqZ1barVvPBpa3O50Nj63k"
}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