tencent cloud

文档反馈

HmtResidentPermitOCR

最后更新时间:2023-06-25 16:07:26

    1. API Description

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

    This API is used to recognize key fields on the front and back sides of a residence permit for Hong Kong, Macao, or Taiwan residents, including name, gender, date of birth, address, ID number, issuing authority, validity period, number of issues, and permit number. It can be used for residence permit OCR in scenarios such as bank account opening and user registration.

    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: HmtResidentPermitOCR.
    Version Yes String Common Params. The value used for this API: 2018-11-19.
    Region No String Common Params. This parameter is not required for this API.
    ImageBase64 No String The Base64-encoded value of the 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.
    Either ImageUrl or ImageBase64 of the image must be provided. If both are provided, only ImageUrl is used.
    ImageUrl No String The URL of the 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.
    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.
    CardSide No String FRONT: The side with the profile photo.
    BACK: The side with the national emblem.
    If this parameter is not specified, the system will automatically determine the ID card side.

    3. Output Parameters

    Parameter Name Type Description
    Name String Name
    Sex String Gender
    Birth String Date of birth
    Address String Address
    IdCardNo String ID card number
    CardType Integer 0: Front side.
    1: Back side.
    ValidDate String Validity period
    Authority String Issuing authority
    VisaNum String Number of issues
    PassNo String Permit number
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Recognizing a residence permit for Hong Kong, Macao, or Taiwan residents

    This example shows you how to recognize a residence permit for Hong Kong, Macao, or Taiwan residents.

    Input Example

    POST / HTTP/1.1
    Host: ocr.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: HmtResidentPermitOCR
    <Common request parameters>
    
    {
        "ImageUrl": "https://xx/a.jpg",
        "CardSide": "FRONT"
    }
    

    Output Example

    {
        "Response": {
            "Name": "",
            "Sex": "",
            "Birth": "1997/6/2",
            "Address": "",
            "IdCardNo": "830000199706020042",
            "CardType": 0,
            "ValidDate": "",
            "Authority": "",
            "VisaNum": "0",
            "PassNo": "000",
            "RequestId": "f72e7048-f1e0-42f3-b0bf-f8730d48bb5c"
        }
    }
    

    Example2 Recognizing a residence permit for Hong Kong, Macao, or Taiwan residents

    This example shows you how to recognize a residence permit for Hong Kong, Macao, or Taiwan residents.

    Input Example

    POST / HTTP/1.1
    Host: ocr.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: HmtResidentPermitOCR
    <Common request parameters>
    
    {
        "ImageUrl": "https://xx/a.jpg"
    }
    

    Output Example

    {
        "Response": {
            "Name": "",
            "Sex": "",
            "Birth": "",
            "Address": "",
            "IdCardNo": "",
            "CardType": 1,
            "ValidDate": "2018.09.06-2023.09.06",
            "Authority": "",
            "VisaNum": "0",
            "PassNo": "000",
            "RequestId": "182abb0c-b0bd-403a-ab11-3dba21ae89d0"
        }
    }
    

    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.EmptyImageError The image is empty.
    FailedOperation.ImageDecodeFailed Image decoding failed.
    FailedOperation.ImageNoText No text is detected in the image.
    FailedOperation.OcrFailed OCR failed.
    FailedOperation.UnKnowError Unknown error.
    FailedOperation.UnOpenError The service is not activated.
    InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
    LimitExceeded.TooLargeFileError The file is too large.
    ResourcesSoldOut.ChargeStatusException Exceptional billing status.
    联系我们

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

    技术支持

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

    7x24 电话支持