tencent cloud

文档反馈

MLIDPassportOCR

最后更新时间:2024-10-30 11:12:38

    1. API Description

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

    This API is used to recognize a passport issued in Hong Kong/Macao/Taiwan (China) or other countries/regions. Recognizable fields include passport ID, name, date of birth, gender, expiration date, issuing country/region, and nationality. It has the features of cropping identity photos and alarming for photographed or photocopied documents.
    This interface supports regional scope: countries with machine-readable passports

    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: MLIDPassportOCR.
    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-guangzhou, ap-singapore.
    ImageBase64 No String Base64-encoded value of image. The image cannot exceed 7 MB in size after being Base64-encoded. A resolution above 500x800 is recommended. PNG, JPG, JPEG, and BMP formats are supported. It is recommended that the card part occupies more than 2/3 area of the image.
    RetImage No Boolean Whether to return an image.
    Default value: false.
    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 7 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
    ID String Passport ID
    Name String Name
    DateOfBirth String Date of birth
    Sex String Gender (F: female, M: male)
    DateOfExpiration String Expiration date
    IssuingCountry String Issuing country
    Nationality String Country/region code
    Warn Array of Integer Alarm codes
    -9102 Alarm for photocopy on a paper document (including black & white and color ones)
    -9103 Alarm for photocopy on an electronic device
    -9106 Alarm for covered card
    Image String Identity photo
    AdvancedInfo String Extended field:
    {
    ID:{
    Confidence:0.9999
    },
    Name:{
    Confidence:0.9996
    }
    }
    CodeSet String The first row of the machine-readable zone (MRZ) at the bottom
    CodeCrc String The second row of the MRZ at the bottom
    Surname String The surname.
    Note: This field may return null, indicating that no valid values can be obtained.
    GivenName String The given name.
    Note: This field may return null, indicating that no valid values can be obtained.
    Type String Type (in Machine Readable Zone)
    PassportRecognizeInfos PassportRecognizeInfos Document content in Information Zone
    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

    debugging-tool)">

    Example1 Recognizing a non-Chinese mainland passport (debugging tool)

    This example shows you how to recognize a non-Chinese mainland passport.

    Input Example

    POST / HTTP/1.1
    Host: ocr.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: MLIDPassportOCR
    <Common request parameters>
    
    {
        "ImageBase64": "base64 encoding"
    }
    

    Output Example

    {
        "Response": {
            "AdvancedInfo": "{\"IssuingCountry\":{\"Confidence\":\"0.9500\"},\"Name\":{\"Confidence\":\"0.9500\"},\"ID\":{\"Confidence\":\"0.9500\"},\"Nationality\":{\"Confidence\":\"0.9500\"},\"DateOfBirth\":{\"Confidence\":\"0.9500\"},\"Sex\":{\"Confidence\":\"0.9500\"},\"DateOfExpiration\":{\"Confidence\":\"0.9500\"},\"Surname\":{\"Confidence\":\"0.9500\"},\"GivenName\":{\"Confidence\":\"0.9500\"},\"CodeSet\":{\"Confidence\":\"0.9995\"},\"CodeCrc\":{\"Confidence\":\"0.9997\"}}",
            "CodeCrc": "4567123452USA9004117F2107268713843748<708026",
            "CodeSet": "P<USACARTER<<ESTHER<<<<<<<<<<<<<<<<<<<<<<<<<",
            "DateOfBirth": "19900411",
            "DateOfExpiration": "20210726",
            "GivenName": "ESTHER",
            "ID": "456712345",
            "Image": "",
            "IssuingCountry": "USA",
            "Name": "CARTER ESTHER",
            "Nationality": "USA",
            "RequestId": "9c42cdcf-53df-445d-b45b-ea3eaaf2bb70",
            "Sex": "F",
            "Surname": "CARTER",
            "Warn": [
                -9102
            ]
        }
    }
    

    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.NoPassport Not a passport.
    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.
    ResourceUnavailable.ResourcePackageRunOut The account resource package is exhausted.
    ResourcesSoldOut.ChargeStatusException Exceptional billing status.
    联系我们

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

    技术支持

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

    7x24 电话支持