tencent cloud

文档反馈

RecognizeSingaporeIDCardOCR

最后更新时间:2024-11-13 11:54:05

1. API Description

Domain name for API request: ocr.tencentcloudapi.com.

This interface supports the identification of all fields on the front side of ID card for Singapore residents.The identification accuracy reaches more than 99%.In addition, this interface also supports a variety of value-added capabilities to meet the needs of different scenarios. Such as the cropping function of ID card photos and portrait photos, and also has 5 alarm functions.
As shown in the table below.

Value-added ability Ability items
Alarm function
ID card copy warning
ID card copy warning
Alarm for occlusion in the ID card frame
ID card reflective warning
Blurry picture warning
Default interface request frequency limit: 20 times/second

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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: RecognizeSingaporeIDCardOCR.
Version Yes String Common Params. The value used for this API: 2018-11-19.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-singapore.
ImageBase64 No String The Base64 value of the image. The image is required to be no larger than 7M after Base64 encoding, and the resolution is recommended to be 500*800 or above. PNG, JPG, JPEG, and BMP formats are supported. It is recommended that the card part occupies at least 2/3 of the picture. 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 address of the image. The image is required to be no larger than 7M after Base64 encoding, and the resolution is recommended to be 500*800 or above. PNG, JPG, JPEG, and BMP formats are supported. It is recommended that the card part occupies at least 2/3 of the picture. It is recommended that images be stored in Tencent Cloud to ensure higher download speed and stability.
ReturnHeadImage No Boolean Whether to return portrait photos.

3. Output Parameters

Parameter Name Type Description
ChName String Chinese name
EnName String English name
Sex String gender
CountryOfBirth String Birth Country
Birthday String Brithday
Address String Address(back side)
ID String License number
Race String Nationality(back side)
NRICCode String NRIC code(back side)
PostCode String Post code(back side)
DateOfExpiration String Date of Expiration(back side)
DateOfIssue String Date of issue(back side)
Photo String Head image
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.

4. Example

Example1 RecognizeSingaporeIDCardOCR调用

Input Example

POST / HTTP/1.1
Host: ocr.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: RecognizeSingaporeIDCardOCR
<common request parameters>

{
    "ReturnHeadImage": "false",
    "ImageUrl": "https://ocr-demo-1254418846.cos.ap-guangzhou.myqcloud.com/***/fakeurl.jpg"
}

Output Example

{
    "Response": {
        "Address": "",
        "Birthday": "12/04/1988",
        "ChName": "夏*阳",
        "CountryOfBirth": "CHINA",
        "DateOfExpiration": "",
        "DateOfIssue": "",
        "EnName": "XIA ***YANG",
        "ID": "S7***22E",
        "NRICCode": "",
        "Photo": "",
        "PostCode": "",
        "Race": "CHINESE",
        "RequestId": "65b41f06-2759-4a7f-b5dd-639f1e676e28",
        "Sex": "M",
        "WarnCardInfos": [
            -9104
        ]
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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.
FailedOperation.UnKnowError Unknown error.
FailedOperation.UnOpenError The service is not activated.
FailedOperation.WarningServiceFailed
InvalidParameter.EngineImageDecodeFailed Image decoding failed.
InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
ResourcesSoldOut.ChargeStatusException Exceptional billing status.