Domain name for API request: ocr.intl.tencentcloudapi.com.
This API retrieves a token before each call to the OCR SDK verification service. Save the token to initiate the verification process and retrieve the verification result after the process completes.
A maximum of 20 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: ApplyOcrToken. |
| Version | Yes | String | Common Params. The value used for this API: 2018-11-19. |
| Region | No | String | Common Params. This parameter is not required. |
| Nationality | Yes | String | Country code. ISO 3166-1 Alpha-3 country/region code standard. |
| CardType | Yes | String | Supported countries/regions and document types: Mainland China: ID_CARD, PERMIT Hong Kong: ID_CARD Macao: ID_CARD Hong Kong/Macao/Taiwan: MAINLAND_PERMIT, HMT_RESIDENT_PERMIT Thailand: ID_CARD, THA_PINK_CARD Indonesia: ID_CARD Malaysia: ID_CARD Singapore: ID_CARD Philippines: PHL_UMID, PHL_VOTE_ID, PHL_TIN_ID, PHL_SSS_ID, DRIVING_LICENSE Any country/region: PASSPORT |
| EncryptedConfig | Yes | String | SDK-generated device-related encryption configuration information. |
| ReturnHeadImage | No | Boolean | Whether to extract the portrait image from the document. false by default Default value: false |
| RetryLimit | No | Integer | Maximum number of token retries Value range: [1, 5] Default value: 3 |
| OcrModeType | No | String | SDK capture mode Enumeration values:
Default value: OCR_DETECT_AUTO_MANUAL |
| AllowUploadPhoto | No | Boolean | Whether to allow uploading gallery images for recognition. Default value: true |
| CropIdCard | No | Boolean | Whether to enable ID card photo cropping (remove extra edges outside the document and automatically correct the shooting angle). It is false by default and only applicable to Mainland ID cards. Default value: false |
| SdkVersion | No | String | SDK-supported recognition version mode Enumeration values:
Default value: BASIC |
| OcrAutoDetectTimeout | No | Integer | OCR automatic capture mode timeout (ms). Value range: [5000, 180000]. Default value: 20000. If the value is below 5000, it is set to 5000; if above 180000, it is set to 180000. |
| Parameter Name | Type | Description |
|---|---|---|
| SdkToken | String | Token that identifies an SDK verification process. It is valid for 10 minutes. After the process completes, use this token to obtain the verification result information. |
| EncryptedConfig | String | Encryption configuration generated on the server side. |
| 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: ApplyOcrToken
<Common request parameters>
{
"Nationality": "HKG",
"CardType": "ID_CARD",
"EncryptedConfig": "AQB5Cwcz7yCcFSBNSBT181w0zZHl4YS2HHhmBAT48FgCVGDAcPE1KaT3MS2Ecb1ZJG+ZuQcD8ksUZQe3wuDppsMaczIOSDV6QgD3Oes6a6OuSADELN83f8Y+i6m1L2lHVdtt3FYZUP/h8hdImWFetToyOq0zxUkxuhEDKKz8iwTVkVGbUOkMe94mhKqdAxWp7L2vfBLRW5MH7RGK66dWeSiM0ESVFpipQXgMAqZwKF1j/lLgXG79luhyHyZH/TYFz2vdIBWAFtGgxdXBirdvUp2wba501SMyp6jPn38V5f1k6bKUazOgy7Y3GJni9L9Am0I=",
"ReturnHeadImage": true,
"RetryLimit": 8,
"OcrModeType": "OCR_DETECT_AUTO",
"AllowUploadPhoto": true,
"CropIdCard": true,
"SdkVersion": "ENHANCED"
}
{
"Response": {
"EncryptedConfig": "AQZFBOs3IFEwi+Whxt6PjAtL3xLTtX2uvdS7cOhIMImrlnQBH2hAwh4rryLMWSOBWdVxRXscS0hx9zMGlUuRWnooRBkhRLViQZUG7l51OUvFxsl+gJ3uLXJLBd3yc7GLBGtRfp4doLZVGBUgm5gEepMrhsnx/EswAnkYgJe6Ppw8p1HA7fFpWbkoWrfFRRYtJF5WQNXzBcuPZ1VHhkulNgu0RlwLs9WiEJ2jZkxsKuHCTq2h9Ch4zFGEiEXuXbq6X7DjeHntYdgtQxi6d+i3RR7v8Nr0tE9Xkfh0zmoF+l3V+u09KCXjYyl8Pn4DGFvxUXnfb9rfgagS0waUG4IbgQGP+Puc4BqnhF59R6QR53mWsG1hNKtzqL7lrGloxBl6ycQWpBpps5ryLIRyDjXt8QKowiPYbEumgnPmyOTStND7nRLX5BFt4wbUDshTKTHE+R/RDHBy0KN+Xj/NQzMOmN0n",
"SdkToken": "8197EF936E23344018A8005538C7E739DB4",
"RequestId": "7fe92f9f-3ea1-428a-9d4b-0be4dbf3eca0"
}
}
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.UnKnowError | Unknown error. |
| FailedOperation.UnOpenError | The service has not been activated. |
| InvalidParameterValue.UnsupportedCard | Unsupported identity document type |
| ResourceUnavailable.InArrears | The account has insufficient balance. |
| ResourceUnavailable.ResourcePackageRunOut | The resource package has been exhausted. |
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários