Domain name for API request: ocr.intl.tencentcloudapi.com.
This API is used to recognize a passport issued in Hong Kong/Macao/Taiwan (China) or other countries/regions. Recognizable fields include passport ID, name, date of birth, gender, expiration date, issuing country/region, and nationality. It has the features of cropping identity photos and alarming for photographed or photocopied documents.
This interface supports regional scope: countries with machine-readable passports
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: MLIDPassportOCR. |
| Version | Yes | String | Common Params. The value used for this API: 2018-11-19. |
| Region | No | String | Common Params. This parameter is not required. |
| ImageBase64 | No | String | Base64-encoded image data. The image must be no larger than 7 MB after Base64 encoding. A resolution of at least 500x800 is recommended. Supported image formats: PNG, JPG, JPEG, BMP, and PDF. The document should occupy more than 2/3 of the image area. |
| RetImage | No | Boolean | Whether to return an image. Default value: false. |
| ImageUrl | No | String | URL of the image. The downloaded image must be no larger than 7 MB after Base64 encoding. A resolution of at least 500x800 is recommended. Supported image formats: PNG, JPG, JPEG, BMP, and PDF. The document should occupy more than 2/3 of the image area. Image download must complete within 3 seconds. We recommend storing images in Tencent Cloud for higher download speed and stability. The speed and stability of URLs from non-Tencent Cloud storage may be affected. Note: This field is not supported outside the Chinese mainland region. |
| Parameter Name | Type | Description |
|---|---|---|
| ID | String | Passport ID |
| Name | String | Name |
| DateOfBirth | String | Date of birth |
| Sex | String | Gender (F: female, M: male) |
| DateOfExpiration | String | Expiration date |
| IssuingCountry | String | Issuing country |
| Nationality | String | Nationality code (MRZ field) |
| Image | String | Base64-encoded identity photo |
| CodeSet | String | The first row of the machine-readable zone (MRZ) at the bottom |
| CodeCrc | String | The second row of the MRZ at the bottom |
| Surname | String | The surname. Note: This field may return null, indicating that no valid values can be obtained. |
| GivenName | String | The given name. Note: This field may return null, indicating that no valid values can be obtained. |
| Type | String | Type (in Machine Readable Zone) |
| PassportRecognizeInfos | PassportRecognizeInfos | Document content in the visual zone |
| WarnCardInfos | Array of Integer | Warning information for the document. This field applies only to international site requests and will return an empty array for domestic site requests. Valid warning codes: -9101 (incomplete card border), -9102 (photocopied document), -9103 (re-photographed document), -9104 (PS-altered document), -9107 (reflective document), -9108 (blurry image), -9109 (warning capability not enabled). |
| CardCount | Integer | The number of cards detected in the input image.(Currently supported only in ap-bangkok region) |
| IsComplete | Boolean | Whether the passport information is complete. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Passport recognition (multiple countries and regions)
POST / HTTP/1.1
Host: ocr.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: MLIDPassportOCR
<Common Request Parameters>
{
"ImageBase64": "https://ocr-demo-1254418846.cos.ap-guangzhou.myqcloud.com/card/MLIDPassportOCR/MLIDPassportOCR1.png"
}
{
"Response": {
"AdvancedInfo": "",
"CodeCrc": "4567123452USA9004117F2107268713843748<708026",
"CodeSet": "P<USACARTER<<ESTHER<<<<<<<<<<<<<<<<<<<<<<<<<",
"DateOfBirth": "19900411",
"DateOfExpiration": "20210726",
"GivenName": "ESTHER",
"ID": "456712345",
"Image": "",
"IssuingCountry": "USA",
"Name": "CARTER ESTHER",
"Nationality": "USA",
"PassportRecognizeInfos": {
"DateOfBirth": "11 Apr 1990",
"DateOfExpiration": "26 Jul 2021",
"DateOfIssuance": "27 Jul 2011",
"GivenName": "ESTHER",
"IssuePlace": "",
"IssuingAuthority": "",
"IssuingCountry": "USA",
"Name": "",
"Nationality": "UNITED STATES OF AMERICA",
"PassportID": "456712345",
"Sex": "F",
"Signature": "",
"Surname": "CARTER",
"Type": "P"
},
"RequestId": "dad946b2-1288-4df9-a0b4-6abfaba1e170",
"Sex": "F",
"Surname": "CARTER",
"Type": "P"
"WarnCardInfos": [
-9109
]
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation.DownLoadError | Failed to download the file. |
| FailedOperation.FieldException | The field value does not meet expectations. |
| FailedOperation.ImageDecodeFailed | Failed to decode the image. |
| FailedOperation.InconsistencyBetweenMRZAndVRZ | The information in the visual zone does not match that in the machine-readable zone. |
| FailedOperation.NoPassport | Not a passport. |
| FailedOperation.OcrFailed | OCR recognition failed. This error may be caused by unstable network connections, service anomalies, or other issues. |
| FailedOperation.UnKnowError | Unknown error. |
| FailedOperation.UnOpenError | The service has not been activated. |
| FailedOperation.WarningServiceFailed | The general warning service encountered an exception. |
| InvalidParameterValue.InvalidParameterValueLimit | Incorrect parameter value. |
| LimitExceeded.TooLargeFileError | The file size exceeds the limit |
| ResourceUnavailable.InArrears | The account has insufficient balance. |
| ResourceUnavailable.ResourcePackageRunOut | The resource package has been exhausted. |
| ResourcesSoldOut.ChargeStatusException | The billing status is abnormal. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan