Domain name for API request: ocr.tencentcloudapi.com.
This API is used to recognize key fields on the photo side of a Hong Kong (China) identity card, including name in Chinese, name in English, telecode for name, date of birth, gender, document symbol, date of the first issue, date of the last receipt, identity card number, and permanent residency attribute.
This API is not fully available for the time being. For more information, please contact your Tencent Cloud sales rep.
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: RecognizeMacaoIDCardOCR. |
Version | Yes | String | Common Params. The value used for this API: 2018-11-19. |
Region | No | String | Common Params. This parameter is not required for this API. |
ImageUrl | No | String | The URL address of the image. Supported image formats: PNG, JPG, JPEG. Not support GIF yet. Supported image size: The downloaded image should not exceed 7M. The image download takes no more than 3 seconds.Storing images in Tencent Cloud URLs can ensure higher download speed and stability. It is recommended that images be stored in Tencent Cloud. The URL speed and stability of non-Tencent cloud storage may be affected to a certain extent. |
ImageBase64 | No | String | Base64 value of the image.Supported image formats: PNG, JPG, JPEG. Not support GIF yet. Supported image size: The downloaded image should not exceed 7M after Base64 encoding. The image download takes no more than 3 seconds. One of ImageUrl and ImageBase64 of the image must be provided. If both are provided, only ImageUrl will be used. |
Config | No | String | The following optional fields are of string type and are empty by default: RetImage: whether to return the processed image (base64 encrypted string); the value and meaning of RetImage are as follows: 1.preprocess returns the preprocessed image data 2.portrait Return portrait image data 3."" Do not return image data SDK setting method reference: Config = Json.stringify({"RetImage":"preprocess"}) API 3.0 Explorer setting method reference: Config = {"RetImage":"portrait" } |
Parameter Name | Type | Description |
---|---|---|
CnLastName | String | Chinese last name |
EnLastName | String | English last name |
LastNameCode | String | Last name code |
CnFirstName | String | Chinese first name |
EnFirstName | String | English first name |
FirstNameCode | String | First name code |
ID | String | ID Number |
Birthday | String | Birthday(DD-MM-YYYY) |
Sex | String | gender |
FirstIssueDate | String | First issue Date (DD-MM-YYYY) |
CurrentIssueDate | String | Issue date (DD-MM-YYYY) |
ValidityPeriod | String | Validity period (DD-MM-YYYY) |
Symbol | String | ID symbol |
Height | String | Height (unit: meters) |
RetImage | String | Processed image (Base64) |
Angle | String | Image rotation angle, the horizontal direction of the text is 0, clockwise is positive, counterclockwise is negative |
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. |
Recognizes Macao (China) identity card
https://ocr.tencentcloudapi.com/?Action=RecognizeMacaoIDCardOCR
&ImageUrl=https://xx/a.jpg
&Config={\"RetImage\":\"preprocess\"}
&<public parameters>
{
"Response": {
"Angle": "0",
"CnLastName": "",
"EnLastName": "HO",
"LastNameCode": "0149",
"CnFirstName": "*",
"EnFirstName": "CHAN YOU",
"FirstNameCode": "37****27",
"ID": "15****0(4)",
"Birthday": "22-04-1997",
"Sex": "F",
"FirstIssueDate": "06-05-2011",
"CurrentIssueDate": "01-08-2014",
"ValidityPeriod": "01-08-2024",
"Symbol": "C",
"Height": "1.64",
"RetImage": "",
"RequestId": "68f8fcbf-9314-6112a-ac18-6f1a9308fs100mab"
}
}
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 | File download failed. |
FailedOperation.EmptyImageError | The image is empty. |
FailedOperation.ImageDecodeFailed | Image decoding failed. |
FailedOperation.OcrFailed | OCR failed. |
FailedOperation.UnKnowError | Unknown error. |
FailedOperation.UnOpenError | The service is not activated. |
InvalidParameter.ConfigFormatError | Config is not in valid JSON format. |
InvalidParameterValue.InvalidParameterValueLimit | Incorrect parameter value. |
LimitExceeded.TooLargeFileError | The file is too large. |
Was this page helpful?