tencent cloud

All product documents
APIs
RecognizeThaiIDCardOCR
Last updated: 2025-03-11 22:55:01
RecognizeThaiIDCardOCR
Last updated: 2025-03-11 22:55:01

1. API Description

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

This API is used to recognize the fields on a Thai identity card, including name in Thai, name in English, address, date of birth, identification number, date of issue, and date of expiry.
Currently, this API is not generally available. For more information, please contact your sales rep.

A maximum of 10 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: RecognizeThaiIDCardOCR.
Version Yes String Common Params. The value used for this API: 2018-11-19.
Region No String Common Params. This parameter is not required.
ImageBase64 No String The Base64-encoded value of an image. The image cannot exceed 7 MB after being Base64-encoded. A resolution above 500 x 800 is recommended. PNG, JPG, JPEG, and BMP formats are supported. It is recommended that the card part occupy more than 2/3 area of the image.
Either ImageUrl or ImageBase64 of the image must be provided. If both are provided, ImageUrl is used.
BackImageBase64 No String Base64 value of the image on the back of the card. Supported image formats: PNG, JPG, JPEG. GIF format is not supported yet. Supported image size: The downloaded image does not exceed 7M after Base64 encoding. The image download takes no more than 3 seconds. 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 of the image. The image cannot exceed 7 MB after being Base64-encoded. A resolution above 500 x 800 is recommended. PNG, JPG, JPEG, and BMP formats are supported. It is recommended that the card part occupy more than 2/3 area of the image.
We recommend that you store the image in Tencent Cloud for higher download speed and stability.
BackImageUrl No String The URL address of the image on the back of the card. Supported image formats: PNG, JPG, JPEG. GIF format is not supported yet. Supported image size: The downloaded image does not exceed 7M after Base64 encoding. The image download takes no more than 3 seconds. Storing images in Tencent Cloud URLs can ensure higher download speed and stability. It is recommended that images be stored in Tencent Cloud. The URL speed and stability of non-Tencent cloud storage may be affected to a certain extent.
CropPortrait No Boolean Whether to crop the profile photo. The default value is false, meaning not to return the Base64-encoded value of the profile photo on the Thai identity card.
When this parameter is set to true, the Base64-encoded value of the profile photo on the Thai identity card after rotation correction is returned.

3. Output Parameters

Parameter Name Type Description
ID String ID card number
ThaiName String Name in Thai
EnFirstName String Name in English
EnLastName String Name in English
IssueDate String Date of issue in Thai
ExpirationDate String Expiration date in Thai
EnIssueDate String Date of issue in English
EnExpirationDate String Expiration date in English
Birthday String Date of birth in Thai
EnBirthday String Date of birth in English
Religion String Religion
SerialNumber String Serial number
Address String Address
LaserID String LaserID in the back of the card.
PortraitImage String Identity photo
WarnCardInfos Array of Integer Card Warning Information

-9101 Alarm for covered certificate,
-9102 Alarm for photocopied certificate,
-9103 Alarm for photographed certificate,
-9107 Alarm for reflective certificate,
-9108 Alarm for blurry image,
-9109 This capability is not enabled.
AdvancedInfo String Field confidence:
{ "ID": { "Confidence": 0.9999 }, "ThaiName": { "Confidence": 0.9996 } }
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 RecognizeThaiIDCardOCR API Call

Input Example

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

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

Output Example

{
    "Response": {
        "Address": "ที่อยู่ 21/19 หมู่ที่ 3 ต.บางคูรัด อ.บางบัวทอง จ.นนทบุรี",
        "AdvancedInfo": "{\"ID\":0.9995814561843872,\"ThaiName\":0.9961479902267456,\"EnFirstName\":0.9232422113418579,\"EnLastName\":0.943652331829071,\"Birthday\":0.9828404188156128,\"EnBirthday\":0.92333984375,\"Religion\":1,\"ExpirationDate\":0.9919084906578064,\"IssueDate\":0.9893275499343872,\"EnExpirationDate\":0.9890950322151184,\"EnIssueDate\":0.9800618290901184,\"SerialNumber\":0.9995659589767456}",
        "Birthday": "14 ธ.ค. 2509",
        "EnBirthday": "14 Dec. 1966",
        "EnExpirationDate": "13 Dec. 2024",
        "EnFirstName": "Mr. Thanakit",
        "EnIssueDate": "9 Dec. 2016",
        "EnLastName": "Boonyopakron",
        "ExpirationDate": "13 ธ.ค. 2567",
        "ID": "3 1020 01968 75 6",
        "IssueDate": "9 ธ.ค. 2559",
        "PortraitImage": "",
        "Religion": "พุทธ",
        "RequestId": "d4af8019-08e0-4d8d-a986-e1f45efb4a6c",
        "SerialNumber": "1204-03-12091012",
        "ThaiName": "นาย ธนกฤต บุญโญปกรณ์",
        "WarnCardInfos": [
            -9109
        ]
    }
}

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.ImageBlur The image is blurry.
FailedOperation.ImageDecodeFailed Image decoding failed.
FailedOperation.ImageNoSpecifiedCard The card in the image is not of the specified type.
FailedOperation.OcrFailed OCR failed. This error may be caused by unstable network connections,service anomalies or other issues.
FailedOperation.UnKnowError Unknown error.
FailedOperation.UnOpenError The service is not activated.
FailedOperation.WarningServiceFailed Warning service error.
InvalidParameterValue.InvalidParameterValueLimit Incorrect parameter value.
LimitExceeded.TooLargeFileError The file is too large.
ResourcesSoldOut.ChargeStatusException Exceptional billing status.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon