Image Creation

Description

This API is used for ID Photo - Image Creation 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/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_idstring64YesExternal request ID (unique)
img_urlstring200NoImage URL (complete URL address, requires urlencode processing)
namestring20YesID photo name (e.g.: One-inch Photo)
back_colorstring7YesBackground color value, e.g.: #357ec2
back_modeint-YesBackground mode: 0 solid color, 1 top to bottom, 2 outside to inside, 3 inside to outside
size_unitint-YesSize unit: 1=px, 2=mm, required for custom ID photos
sd_widthint-YesStandard-definition width, unit: px
sd_heightint-YesStandard-definition height, unit: px
sd_dpiint-YesStandard-definition resolution (dpi)
sd_size_minint-YesStandard-definition file size, minimum value, unit: kb
sd_size_maxint-YesStandard-definition file size, maximum value, unit: kb
hd_dpiint-YesHigh-definition resolution (dpi), generally recommended value: 1000
custom_watermark_verticalstring200NoCustom vertical watermark identifier (contact Meitu Business for configuration)
custom_watermark_transversestring200NoCustom horizontal watermark identifier (contact Meitu Business for configuration)
face_switchint-NoFace frame switch, 1=enabled, 2=disabled (disabled by default). Face parameters take effect only when enabled
face_topint-NoDistance from the top of the head to the top of the image, top, 0≤ face_top < height of the generated ID photo
face_widthint-NoFace frame width, width, 0<face_width < width of the generated ID photo
face_heightint-NoFace frame height, height, 0< face_height< height of the generated ID photo
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

{
    "back_color": "#00868B",
    "back_mode": 3,
    "hd_dpi":1000,
    "img_url": "https://481598.jpeg",
    "name": "295*413",
    "out_request_id":"36936",
    "sd_dpi": 300,
    "sd_height": 35,
    "sd_size_max": 6,
    "sd_size_min": 2,
    "size_unit": 2,
    "sd_width": 25,
	"mt_generate_id": "72039499999199999"
}

Return Value Description

Successful Return Value Description

Field NameTypeExample ValueDescription
codeint100000Response status code
msgstringOperation successfulPrompt
dataobjectData
data.check_fail_itemstringUnable to recognize, face is obstructedImage detection failure error information (multiple errors are separated by commas) [Used to prompt the user when image detection fails]
data.mt_generate_idstring6917420196238201565Meitu ID photo generation ID
data.sd_photostringhttp://biz-res-pre.zone1.meitudata.com/idphoto-private/1646220627569878737-460912.jpg?xxxxxxxxxStandard-definition image
data.hd_photostringhttp://biz-res-pre.zone1.meitudata.com/idphoto-private/1646220627569878737-460912.jpg?xxxxxxxxxHigh-definition image
data.typesetting_photostringhttp://biz-res-pre.zone1.meitudata.com/idphoto-private/1646220627569878737-460912.jpg?xxxxxxxTypesetting image

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": {
        "check_fail_msg": "",
        "mt_generate_id": "2329351846",
        "sd_photo": "http://biz-res-pre.zone1.meitudata.com/i0T242B5B786IvdMEigEjyE8=",
        "hd_photo": "http://biz-res-pre.zone1.meitudata.com/oken=MO2HHQCVI6TWO3RGWjyE8=",
        "typesetting_photo": "http://biz-res-pre.zone1.meitudata.com/i56fKhjxeTmUYEeG5jEdOM3Y="
    },
    "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
  2. For platform-wide error codes, please refer to API Error Codes