tencent cloud

Feedback

MLIDCardOCR

Last updated: 2024-06-13 18:13:59

    1. API Description

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

    This API is used to recognize a Malaysian identity card, including identity card number, name, gender, and address. It is also used to crop identity photos and give alarms for photographed or photocopied certificates.

    This API is not fully available for the time being. For more information, 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: MLIDCardOCR.
    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 an 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.
    ImageUrl No String The URL of an image. (This field is not available outside the Chinese mainland.)
    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.
    For a non-Tencent Cloud URL, the download speed and stability may be low.
    RetImage No Boolean Whether to return an image. Default value: false.

    3. Output Parameters

    Parameter Name Type Description
    ID String ID number
    Name String Full name
    Address String Address
    Sex String Gender
    Image String Identity photo
    AdvancedInfo String This is an extended field,
    with the confidence of a field recognition result returned in the following format.
    {
    Field name:{
    Confidence:0.9999
    }
    }
    Type String Certificate type
    MyKad ID card
    MyPR Permanent resident card
    MyTentera Military identity card
    MyKAS Temporary ID card
    POLIS Police card
    IKAD Work permit
    MyKid Kid card
    Birthday String Date of birth. This field is available only for work permits (i-Kad) and ID cards (MyKad).
    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 a Malaysian identity card

    Input Example

    https://ocr.tencentcloudapi.com/?Action=MLIDCardOCR
    &ImageUrl=https://xx/a.jpg
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "Name": "KAVIN ONG KHI MN",
            "ID": "710716-08-6085",
            "Address": "NO 11 PERSIARN PERAJRIT 4 TAMA PERAK 31400 IPOH ERAK",
            "Sex": "LEAKI",
            "Birthday": "",
            "Warn": [],
            "Image": "",
            "AdvancedInfo": "{\"ID\":{\"Confidence\":\"1.0000\"},\"Name\":{\"Confidence\":\"0.9996\"},\"Address\":{\"Confidence\":\"0.9997\"},\"Sex\":{\"Confidence\":\"0.9999\"}}",
            "Type": "MyKad",
            "RequestId": "c969da05-54e3-4d0a-a55d-b3ef90d4ebf5"
        }
    }
    

    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.NoMASIDCard Non-Malaysian ID cards.
    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.
    LimitExceeded.TooLargeFileError The file is too large.
    ResourceUnavailable.ResourcePackageRunOut The account resource package is exhausted.
    ResourcesSoldOut.ChargeStatusException Exceptional billing status.