Help Center > > API Reference> API> Thai ID Card OCR

Thai ID Card OCR

Updated at: Aug 05, 2019 GMT+08:00

Function

Thai ID Card OCR recognizes information on Thailand-issued identity cards and returns the structured result.

URI

URI format:

POST /v1.0/thailand-id-card

Request Message

Table 1 describes the request parameters of Thai ID Card OCR.

Table 1 Request parameters

Parameter

Mandatory

Type

Description

image

Configure either this parameter or url.

String

Base64 character string converted from the image. The size cannot exceed 10 MB.

The narrow edge contains at least 15 pixels and the wide edge contains at most 4096 pixels. The JPG, PNG, BMP, and TIFF formats are supported.

url

Configure either this parameter or image.

String

URL of the image file. Currently, URLs for anonymously and publicly authorized or external access to image files stored on OBS are supported.

Response Message

Table 2 describes the response parameters of Thai ID Card OCR.

Table 2 Response parameters

Parameter

Type

Description

result

JSON

Calling result when the API is successfully called.

id_number

String

ID number

name_th

String

Thai name

first_name_en

String

English given name

last_name_en

String

English surname

date_of_birth_th

String

Date of birth, in Thai

date_of_birth_en

String

Date of birth, in English

religion_th

String

Religion

address_th

String

Address on the ID card

date_of_issue_th

String

Date of issue, in Thai

date_of_issue_en

String

Date of issue, in English

date_of_expiry_th

String

Date of expiry, in Thai

date_of_expiry_en

String

Date of expiry, in English

serial_number

String

Serial number

portrait

String

Base64-encoded photo (the photo cannot be extracted.)

confidence

JSON

Confidence scores of related fields. A higher confidence score indicates a more accurate result. Note that the confidence scores are provided by the algorithm and are not equal to the accuracy of the fields.

error_code

String

Error code when the API fails to be called. For details, see Error Code.

This parameter is not included when the API is successfully called.

error_msg

String

Error message when the API fails to be called.

This parameter is not included when the API is successfully called.

Example

  • Request example: Use a Base64-encoded image.
    POST  https://{endpoint}/v1.0/thailand-id-card
    
    Request Header:
    Content-Type: application/json
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...
    Request Body: 
    {
        "image":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAA..."
    }
  • Successful response example
    {
        "result": {
            "id_number": "3 4508 00337 39 6", 
            "name_th": "นาย มานิตย์ ทองเหี่ยง", 
            "first_name_en": "Mr. Thai", 
            "last_name_en": "Yurates", 
            "date_of_birth_th": "5 ก.พ. 2493", 
            "date_of_birth_en": "5 Feb. 1950", 
            "religion_th": "พุทธ", 
            "address_th": "94 หมู่ที่ 12 ต.น้ำชุน อ.หล่มสัก จ.เพชรบูรณ์", 
            "date_of_issue_th": "4 มี.ค. 2554", 
            "date_of_issue_en": "4 Mar. 2011", 
            "date_of_expiry_th": "22 ก.พ. 2561", 
            "date_of_expiry_en": "22 Feb. 2018", 
            "serial_number": "4808-02-12090931", 
            "portrait": ""
            "confidence": {
                "id_number": 0.9999, 
                "name_th": 0.9994, 
                "first_name_en": 0.998, 
                "last_name_en": 1.0, 
                "date_of_birth_th": 1.0, 
                "date_of_birth_en": 0.9995, 
                "religion_th": 0.686, 
                "address_th": 0.61, 
                "date_of_issue_th": 1, 
                "date_of_issue_en": 1, 
                "date_of_expiry_th": 0.9969, 
                "date_of_expiry_en": 0.61, 
                "serial_number": 0.9887,
                "portrait": 0
            }
        }
    }
  • Failed response example
    {
        "error_code": "AIS.0103", 
        "error_msg": "The image size does not meet the requirements" 
    }

Status Code

For details about the status code, see Status Code.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel