Domain name for API request: ocr.intl.tencentcloudapi.com.
This API is used to recognize the fields on an exit/entry permit (card) for traveling to and from Hong Kong, Macao, or Taiwan, including place of issuance, issuing authority, validity period, gender, date of birth, name in English, name in Chinese, and document number.
A maximum of 10 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: PermitOCR. |
| 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 value of the image. Supported image formats: PNG, JPG, JPEG. GIF format is not currently supported. Supported image size: the downloaded image after Base64 encoding is no more than 7M. Image download time is not more than 3 seconds. Either ImageUrl or ImageBase64 must be provided. If both are provided, only use ImageUrl. |
| ImageUrl | No | String | The URL of the image. Supported image formats: PNG, JPG, JPEG. GIF format is not currently supported. Supported image size: no more than 7M after Base64 encoding. Image download time: no more than 3 seconds. We recommend that you store the image in Tencent Cloud for higher download speed and stability. The download speed and stability of non-Tencent Cloud URLs may be low. |
| CropPortrait | No | Boolean | Whether to return the avatar image. Default is false. |
| Parameter Name | Type | Description |
|---|---|---|
| Name | String | Name |
| EnglishName | String | English name |
| Number | String | ID number |
| Sex | String | Gender |
| ValidDate | String | Validity period |
| IssueAuthority | String | Issuing authority |
| IssueAddress | String | Issuing place |
| Birthday | String | Date of birth |
| PortraitImage | String | base64 of the avatar image |
| Type | String | Return type |
| 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: PermitOCR
<Common request parameters>
{
"ImageUrl": "https://ocr-demo-1254418846.cos.ap-guangzhou.myqcloud.com/card/PermitOCR/PermitOCR1.jpg"
}
{
"Response": {
"Birthday": "1900.10.27",
"EnglishName": "XXX,XXXX",
"IssueAddress": "XX",
"IssueAuthority": "Exit and Entry Administration of the Ministry of Public Security"
"Name": "Name",
"Number": "C900001111",
"PortraitImage": "",
"RequestId": "fedf285d-60bc-4e46-8d27-3f1d80bb19f6",
"Sex": "Female",
"Type": "Mainland Travel Permit for Hong Kong and Macao Residents"
"ValidDate": "2018.10.09-2028.10.08"
}
}
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.OcrFailed | OCR failed. This error may be caused by unstable network connections,service anomalies or other issues. |
| FailedOperation.UnKnowError | Unknown error. |
| FailedOperation.UnOpenError | The service is not activated. |
| InvalidParameterValue.InvalidParameterValueLimit | Incorrect parameter value. |
| LimitExceeded.TooLargeFileError | The file is too large. |
| ResourceUnavailable.InArrears | The account is in arrears. |
| ResourcesSoldOut.ChargeStatusException | Exceptional billing status. |
フィードバック