Domain name for API request: ocr.intl.tencentcloudapi.com.
This API is used to recognize a Malaysian identity card, including identity card number, name, gender, and address. It is also used to crop identity photos and give alarms for photographed or photocopied certificates.
This API is not fully available for the time being. For more information, contact your Tencent Cloud sales rep.
A maximum of 5 requests can be initiated per second for this API.
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: MLIDCardOCR. |
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 | The Base64-encoded value of an image. Supported image formats: PNG, JPG, and JPEG. GIF is currently not supported. Supported image size: The downloaded image after Base64 encoding can be up to 7 MB. The download time of the image cannot exceed 3s. |
BackImageBase64 | No | String | Base64 value of the image on the back of the card. Supported image formats: PNG, JPG, JPEG, GIF format is not supported yet. Supported image size: The downloaded image cannot 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. |
ImageUrl | No | String | The URL of an image. (This field is not available outside the Chinese mainland.) Supported image formats: PNG, JPG, and JPEG. GIF is currently not supported. Supported image size: The downloaded image after Base64 encoding can be up to 7 MB. The download time of the image cannot exceed 3s. We recommend that you store the image in Tencent Cloud for higher download speed and stability. For a non-Tencent Cloud URL, the download speed and stability may be low. |
BackImageUrl | No | String | The URL address of the image on the back of the card. Supported image formats: PNG, JPG, JPEG, GIF format is not supported yet. Supported image size: The downloaded image does not exceed 7M after Base64 encoding. 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. |
RetImage | No | Boolean | Whether to return an image. Default value: false . |
Parameter Name | Type | Description |
---|---|---|
ID | String | ID number |
Name | String | Full name |
Address | String | Address |
Sex | String | Gender |
Image | String | Identity photo |
AdvancedInfo | String | This is an extended field, with the confidence of a field recognition result returned in the following format. { Field name:{ Confidence:0.9999 } } |
Type | String | Certificate type MyKad ID card MyPR Permanent resident card MyTentera Military identity card MyKAS Temporary ID card POLIS Police card IKAD Work permit MyKid Kid card |
Birthday | String | Date of birth. This field is available only for work permits (i-Kad) and ID cards (MyKad). |
MyKadNumber | String | Number on the back of Malaysia ID card |
WarnCardInfos | Array of Integer | Card Warning Information -9101 Alarm for covered certificate, -9102 Alarm for photocopied certificate, -9103 Alarm for photographed certificate, -9104 Alarm for PS certificate, -9107 Alarm for reflective certificate, -9108 Alarm for blurry image, -9109 This capability is not enabled. |
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. |
POST / HTTP/1.1
Host: ocr.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: MLIDCardOCR
<common request parameters>
{
"ImageUrl": "https://ocr-demo-1254418846.cos.ap-guangzhou.myqcloud.com/***/fakeurl.jpg"
}
{
"Response": {
"Name": "KAVIN ONG KHI MN",
"ID": "710716-08-6085",
"Address": "NO 11 PERSIARN PERAJRIT 4 TAMA PERAK 31400 IPOH ERAK",
"Sex": "LEAKI",
"Birthday": "",
"Warn": [],
"Image": "/9j/4AAQSkZJRg.....s97n//2Q==",
"AdvancedInfo": "{\"ID\":{\"Confidence\":\"1.0000\"},\"Name\":{\"Confidence\":\"0.9996\"},\"Address\":{\"Confidence\":\"0.9997\"},\"Sex\":{\"Confidence\":\"0.9999\"}}",
"Type": "MyKad",
"RequestId": "c969da05-54e3-4d0a-a55d-b3ef90d4ebf5"
}
}
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.ImageDecodeFailed | Image decoding failed. |
FailedOperation.NoMASIDCard | Non-Malaysian ID cards. |
FailedOperation.OcrFailed | OCR failed. |
FailedOperation.UnKnowError | Unknown error. |
FailedOperation.UnOpenError | The service is not activated. |
FailedOperation.WarningServiceFailed | |
InvalidParameter.EngineImageDecodeFailed | Image decoding failed. |
InvalidParameterValue.InvalidParameterValueLimit | Incorrect parameter value. |
LimitExceeded.TooLargeFileError | The file is too large. |
ResourceUnavailable.ResourcePackageRunOut | The account resource package is exhausted. |
ResourcesSoldOut.ChargeStatusException | Exceptional billing status. |
Was this page helpful?