tencent cloud

文档反馈

HKIDCardOCR

最后更新时间:2024-11-13 11:04:09

    1. API Description

    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.

    A maximum of 5 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: HKIDCardOCR.
    Version Yes String Common Params. The value used for this API: 2018-11-19.
    Region No String Common Params. This parameter is not required.
    ReturnHeadImage Yes Boolean Whether to return identity photo.
    ImageBase64 No String Base64 string of the image
    Supported image formats: PNG, JPG, JPEG. GIF is not supported yet.
    Supported image size: The downloaded image cannot exceed 7 MB after being Base64-encoded, and it cannot take longer than 3 seconds to download the image.
    ImageUrl No String URL address of image. (This field is not supported outside Chinese mainland)
    Supported image formats: PNG, JPG, JPEG. GIF is currently not supported.
    Supported image size: the downloaded image cannot exceed 3 MB after being Base64-encoded. The download time of the image cannot exceed 3 seconds.
    We recommend you store the image in Tencent Cloud, as a Tencent Cloud URL can guarantee higher download speed and stability.
    The download speed and stability of non-Tencent Cloud URLs may be low.

    3. Output Parameters

    Parameter Name Type Description
    CnName String Name in Chinese
    EnName String Name in English
    TelexCode String Telecode for the name in Chinese
    Sex String Gender. Valid values: Male, Female
    Birthday String Date of birth
    Permanent Integer Permanent identity card.
    0: non-permanent;
    1: permanent;
    -1: unknown.
    IdNum String Identity card number
    Symbol String Document symbol, i.e., the symbol under the date of birth, such as "***AZ"
    FirstIssueDate String First issue date
    CurrentIssueDate String Last receipt date
    HeadImage String Base64-encoded identity photo
    Note: this field may return null, indicating that no valid values can be obtained.
    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 Recognizing Hong Kong (China) identity card

    Input Example

    POST / HTTP/1.1
    Host: ocr.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: HKIDCardOCR
    
    {
        "ReturnHeadImage": "false",
        "ImageUrl": "https://xx/a.jpg"
    }
    

    Output Example

    {
        "Response": {
            "CnName": "",
            "EnName": "SAN, Nan",
            "TelexCode": "300000000000",
            "Sex": "",
            "Birthday": "01-01-2001",
            "Permanent": 1,
            "IdNum": "C000000(E)",
            "Symbol": "***AZ",
            "FirstIssueDate": "(09-99)",
            "CurrentIssueDate": "23-09-10",
            "HeadImage": "",
            "WarnCardInfos": [
                -9104
            ],
            "RequestId": "fba1c9ad-aeb3-4418-9ecf-80ab1b5fc875"
        }
    }
    

    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.NoHKIDCard Not a Hong Kong identity card.
    FailedOperation.OcrFailed OCR failed.
    FailedOperation.UnKnowError Unknown error.
    FailedOperation.UnOpenError The service is not activated.
    FailedOperation.WarningServiceFailed
    InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
    LimitExceeded.TooLargeFileError The file is too large.
    ResourceUnavailable.InArrears The account is in arrears.
    ResourcesSoldOut.ChargeStatusException Exceptional billing status.
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持