Skip to main content

Thai National ID Card OCR

Mobile & Web SDK available

Skip the camera work — our free open-source eKYC SDK (Web, Flutter, iOS, Android & React Native) auto-captures documents and faces and calls this API for you. View on GitHub.

The Thai National ID Card OCR API extracts structured data from both faces of the Thai national ID card: the 13-digit ID number, names in Thai and English, address, dates, religion, and gender from the front, and the laser code from the back — with per-field confidence scores and optional bounding boxes, cropped images, and raw values. The production service processes a card in 1.4 seconds (median) and sustains 5,000 cards per hour. Measured field-level accuracy is 98.0 percent against human-verified ground truth, with the ID number at 100 percent; see Accuracy.

Live Demo

Upload a Thai national ID card, or use the synthetic specimens below.

Try Our AI Demo

Login or create a free account to use this AI service demo and explore our powerful APIs.

Get 100 Free Credits (IC) when you sign up!

Offer ends December 31, 2025

Example Images (Click to try)

Example 1
Try Demo

Try the SDK (Live Camera)

Prefer not to upload a file? The free open-source iApp eKYC Web SDK captures the card automatically from your camera — it detects the card boundary, waits for a sharp stable frame, perspective-corrects the image, and submits it to this API. See more flows on the full SDK live demo page.

Loading live demo…

Loading live demo…

Quick Start

You need an API key from the API Key Management page. Send the image as multipart/form-data:

curl -X POST https://api.iapp.co.th/v3/store/ekyc/thai-national-id-card/front \
-H "apikey: YOUR_API_KEY" \
-F "file=@idcard.jpg"
{
"id_number": "3411700830334",
"th_name": "นาง บุญยัง โลเปช",
"en_name": "Mrs. Bunyang Lopez",
"en_dob": "22 Mar. 1957",
"address": "33/349 หมู่ที่ 7 ต.หนองปรือ อ.บางละมุง จ.ชลบุรี",
"province": "ชลบุรี",
"detection_score": 0.979
}

The full response schemas, processing options, and error codes are in the Technical Reference.

Endpoints and Pricing

EndpointOutputPrice
POST /v3/store/ekyc/thai-national-id-card/frontJSON with all front-side fields, per-field confidence, and optional bounding boxes and images1.25 IC per page
POST /v3/store/ekyc/thai-national-id-card/backJSON with the back-side laser code0.75 IC per page

The legacy paths /thai-national-id-card/v3.5/front and /thai-national-id-card/v3.5.1/back remain supported at the same prices. For photographed photocopies, use Photographed Thai National ID Card With Signature Detection. For on-premise deployment, see Data Security.

Performance

Measured on the production service, August 2026.

MetricValue
Median processing time1.4 s per card (front); 1.3 s (back)
Sustained throughput1.4 cards per second (5,000 cards per hour)
Maximum file size10 MB
Supported input formatsJPEG, JPG, PNG, HEIC, HEIF, PDF

Accuracy

Accuracy is measured against human-verified ground truth: 60 labeled Thai national ID cards, 1,380 individual field observations. The ground-truth dataset contains real ID cards and is kept private for privacy reasons; the methodology is fully specified in the whitepaper below.

FieldExact match
ID number (13 digits)100%
Surname (English), name titles, gender, religion100%
Sub-district, district, postal code100%
Province, dates of birth and expiry100%
Address (full)98.3%
Full name (Thai)93.3%
All fields (overall)98.0%

The recognition engine was upgraded in August 2026, raising overall field accuracy from 97.8% to 98.0%, with the largest gains on addresses, province, and expiry dates. One honest caveat: Thai given/family-name fields moved slightly the other way (full Thai name 93.3%, versus 96.7% before) — if your integration keys specifically on Thai names rather than the ID number or address, validate them against the per-field confidence scores. Full methodology, per-field results, and comparison against a leading global cloud OCR service are published in the benchmark whitepaper:

Download the benchmark whitepaper (PDF)

Data Security and Compliance

  • The service is GDPR and PDPA compliant.
  • Uploaded images are processed in memory and are not retained after the response is returned.
  • A fully self-contained on-premise deployment is available, in which no card data leaves your infrastructure. Contact us for details.

Technical Reference

Thai National ID Card Endpoints

1. Thai National ID Card - Front Side

POST /v3/store/ekyc/thai-national-id-card/front

Extracts detailed information from the front side of a Thai national ID card.

Request Headers
NameTypeRequiredDescription
apikeystringYesYour API key
Request Body (multipart/form-data)
ParameterTypeRequiredDescription
fileFileYesThe binary data of the image (front side)
fieldsStringNoOption to choose fields in output
optionsStringNoOption to choose processing tools and settings

2. Thai National ID Card - Back Side

POST /v3/store/ekyc/thai-national-id-card/back

Extracts information from the back side of a Thai national ID card.

Request Headers
NameTypeRequiredDescription
apikeystringYesYour API key
Request Body (multipart/form-data)
ParameterTypeRequiredDescription
fileFileYesThe binary data of the image (back side)
optionsStringNoOption to choose processing tools and settings

Available Options

  • not_crop_card - Skip card cropping
  • not_rotate_card - Skip auto-rotation
  • get_bbox - Return bounding box coordinates
  • get_image - Return processed image
  • get_original - Return original image
Response Format for Available Options

When using the available options, the response JSON will include additional fields based on the options selected:

Response with get_bbox Option

Returns bounding box coordinates for each detected field in the format [x1, y1, x2, y2] with confidence score:

{
"bbox": {
"address": [
[[119, 292, 376, 334], 0.991],
[[75, 330, 255, 362], 0.999]
],
"card": [[[0, 0, 713, 462], 0.99]],
"en_dob": [[[370, 235, 526, 266], 0.999]],
"face": [[[544, 218, 708, 407], 0.999]]
// Other field coordinates...
}
}
Response with get_image Option

Returns base64 encoded cropped images for each detected field:

{
"image": {
"address": ["/9j/4AAQSk...", "/9j/4AAQSk..."],
"card": ["/9j/4AAQSk..."],
"face": ["/9j/4AAQSk..."],
"id_number": ["/9j/4AAQSk..."]
// Other field images...
}
}
Response with get_original Option

Returns the original values before the autocorrect step (which occured in the post processing step) detected from the card:

{
"original": {
"address": "XXXXX XXXXX X ต.หนองปรือ อ.บางละมุง จ.ชลบุรี",
"en_dob": "XX Mar. 1957",
"en_expire": "XX Mar. 2025",
"th_name": "นาง XXXXXX โลเปซ"
// Other original field values...
}
}

The response will always include the standard fields like detection_score, error_message, and process_time regardless of options used.

Responses

Front side

Thai National ID Card Example (Front side)
Request:
curl -X POST https://api.iapp.co.th/v3/store/ekyc/thai-national-id-card/front
-H "apikey: YOUR_API_KEY"
-F "file=@/path/to/idcard.jpg"
Response:
{
"address": "XXXXXX XXXX X ต.หนองปรือ อ.บางละมุง จ.ชลบุรี",
"alley": "",
"detection_score": 0.981011797984441,
"district": "บางละมุง",
"en_dob": "XX Mar. 1957",
"en_expire": "XX Mar. 2025",
"en_fname": "XXXXXX",
"en_init": "Mrs.",
"en_issue": "26 Jul. 2016",
"en_lname": "Lopez",
"en_name": "Mrs. XXXXXX Lopez",
"error_message": "",
"face": "/9j/4AAQ...UAFFFFAH/9k=", # Base64 of photo's image
"gender": "Female",
"home_address": "XXXXX XXX",
"house_no": "XXXXXX",
"id_number": "34117XXXXXX334",
"id_number_status": 1,
"lane": "",
"postal_code": "20150", # Automatic Retrieve from Database
"process_time": 1.3018648624420166, # Seconds
"province": "ชลบุรี",
"religion": "",
"request_id": null,
"road": "",
"sub_district": "หนองปรือ",
"th_dob": "XX มี.ค. 2500",
"th_expire": "XX มี.ค. 2568",
"th_fname": "XXXXX",
"th_init": "นาง",
"th_issue": "XX ก.ค. 2559",
"th_lname": "โลเปซ",
"th_name": "นาง XXXXX โลเปซ",
"village": "",
"village_no": "7",
"confidence": {
"id_number": 0.95,
"th_name": 0.95,
"th_fname": 0.95,
"th_lname": 0.95,
"en_name": 0.95,
"en_fname": 0.95,
"en_lname": 0.95,
"th_dob": 0.9,
"en_dob": 0.9,
"th_issue": 0.9,
"en_issue": 0.9,
"th_expire": 0.9,
"en_expire": 0.9,
"address": 0.95,
"gender": 0.95,
"religion": 0.9
}
}

Backside

Thai National ID Card Example (Back side)
Request:
curl --location --request POST 'https://api.iapp.co.th/v3/store/ekyc/thai-national-id-card/back' \
--header 'apikey: {Your API Key}' \
--form 'file=@"path/to/id-card-back.jpg"'
Response:
{
"back_number": "JT0-XXXXXXX-05",
"detection_score": 0.99846746524175,
"process_time": 1.370201416015625
}

Supported Fields

Front Side

FieldTypeDescription
addressStringAddress on the ID card
detection_scorefloatDetection score of a related field
districtStringDistrict name on the ID card
en_dobStringDate of birth, in English
en_expireStringDate of expiry, in English
en_fnameStringEnglish given name
en_initStringName title, in English
en_issueStringDate of issue, in Thai
en_lnameStringEnglish surname
en_nameStringEnglish given name and surname
error_messageStringError message
faceStringBase64 character string converted from the image
genderStringGender
home_addressStringHome address on the ID card
id_numberStringNational ID number
postal_codeStringPostal Code
process_timeStringProcessing time (Sec.)
provinceStringProvince name on the ID card
religionStringReligion on the ID card
sub_districtStringSub district name on the ID card
th_dobStringDate of birth, in Thai
th_expireStringDate of expiry, in Thai
th_fnameStringThai given name
th_initStringName title, in English
th_issueStringDate of issue
th_lnameStringThai surname
th_nameStringThai given name and surname
confidenceObjectConfidence scores (0-1) for each extracted field

Back side

FieldTypeDescription
back_numberStringLaser number on back of ID card

Common Response Fields

FieldTypeDescription
detection_scoreFloatConfidence score (0-1)
error_messageStringError message if request fails
process_timeFloatProcessing time in seconds

Error Code

Specific Error Messages

Thai National ID Card Front Side
Status CodeStatus MessageDescription
420NO_ID_CARD_FOUNDThe image file is not the ID card
421IMAGE_ERROR_UNSUPPORTED_FORMATThe image cannot be resolved. The file format may not be supported or the file is damaged
422INVALID_IMAGE_SIZEThe size of the uploaded image does not meet the requirement
424PLEASE_VERIFY_ID_CARD_NUMBERThe National ID Number has 13 digits but is incorrect. Response code 424 will show when using id_check option
425CANNOT_READ_ID_CARD_NUMBER_CLEARLYThe National ID Number has less than 13 digits. Response code 425 will show when using id_check option
426IMAGE_ERROR_UNSUPPORTED_BLACK_WHITE_IMAGEUsed gray_check option to check black-white and gray images
Thai National ID Card Back Side
Status CodeStatus MessageDescription
430NO_ID_CARD_FOUNDThe image file is not the ID Card
431IMAGE_ERROR_UNSUPPORTED_FORMATThe image cannot be resolved. The file format may not be supported or the file is damaged
432INVALID_IMAGE_SIZEThe size of the uploaded image does not meet the requirement
434LASER_NUMBER_NOT_FOUNDCannot detect the laser number on back ID Card
435CANNOT_READ_LASER_NUMBER_CLEARLYThe laser number has less than 12 digits. Response code 435 will show when using id_check option
436IMAGE_ERROR_UNSUPPORTED_BLACK_WHITE_IMAGEUsed gray_check option to check black-white and gray images

Common Error Messages

Status CodeStatus MessageDescription
404REQUESTED_URL_NOT_FOUNDAPI Route not found in request
405METHOD_NOT_ALLOWEDMethod name (GET, POST) in the URL is incorrect
413FILE_IS_TOO_LARGE: (more than 2 MB)The file size is too large
427LONG_TIME_TO_PROCESSThe server is processed for a long time
428LONG_TIME_TO_REQUESTThe client is waiting in the queue for a long time
461NO_FILE_ATTACHEDNo file attached
560SERVER_IS_BUSY: (Please try again in a few seconds.)Server is working on many requests
563ID_CARD_API_NOT_SUPPORT_THIS_IMAGEThe API has an error in the process

Code Examples

curl -X POST https://api.iapp.co.th/v3/store/ekyc/thai-national-id-card/front \
-H "apikey: YOUR_API_KEY" \
-F "file=@idcard.jpg"

Limitations and Best Practices

Limitations

  • Maximum file size: 10MB
  • Supported formats: JPEG, JPG, PNG, HEIC, HEIF, PDF

Best Practices

  1. Ensure good image quality
  2. Check detection_score in response
  3. Handle error messages appropriately
  4. Validate ID card number format
  5. Consider using options parameter for specific needs

Thai National ID Card Specifications

Understanding the physical specifications of Thai National ID cards helps ensure optimal image capture for OCR processing.

Card Dimensions (ขนาดบัตรประชาชน)

SpecificationMetricImperial (inches)
Width85.60 mm3.370 inches (3⅜")
Height53.98 mm2.125 inches (2⅛")
Thickness0.76 mm0.030 inches
Corner Radius3.18 mm0.125 inches
ขนาดบัตรประชาชน นิ้ว

บัตรประชาชนไทยมีขนาด 3.370 × 2.125 นิ้ว (85.60 × 53.98 มม.) ตามมาตรฐาน ISO/IEC 7810 ID-1 ซึ่งเป็นขนาดเดียวกับบัตรเครดิตทั่วโลก

Card Format Standards

StandardDescription
FormatISO/IEC 7810 ID-1 (Credit card size)
MaterialPolycarbonate (PC) plastic
Chip TypeContact smart card chip (since 2005)
Data StorageBiometric data, digital certificate, fingerprint templates

Card Features

  • Front Side: Photo, name (Thai/English), ID number, date of birth, address, issue/expiry dates, barcode
  • Back Side: Laser code (12-character alphanumeric)
  • Security Features: Hologram, UV printing, microtext, laser engraving
  • Smart Card Chip: Contains encrypted biometric data and digital signature

Image Requirements for OCR

For optimal OCR accuracy, ensure your captured images meet these requirements:

RequirementRecommendedMinimum
Resolution600 DPI300 DPI
Image Width1000+ pixels600 pixels
Image Height630+ pixels400 pixels
File Size< 5 MB< 10 MB
FormatJPEG, PNGJPEG, PNG, HEIC, PDF

Changelog

VersionDateAccuracyChanges
v3.6.0-2026082424 Aug 202698.0% field-levelEnglish-format dates (en_dob, en_issue, en_expire) now match the card's printed format: abbreviated month names carry a dot (23 Apr. 1997); May, printed unabbreviated, has none. Verified on 60 cards — only these three fields changed and every Thai field is identical. Update client-side date parsing to accept the dotted form.
v3.5.3-2026082424 Aug 202698.0% field-levelUpgraded recognition engine: overall field accuracy 97.8% to 98.0% against human-verified ground truth, ID number at 100%; largest gains on addresses, province, and expiry dates. Median processing 1.4 s per card. Fully self-contained on-premise deployment available.
3.5Nov 202298.13% character-levelNew OCR engine, faster processing.
3.4Jul 202293.25%Added Thai military ranks.
3.0Feb 202191.75%Major accuracy improvements.
2.0Feb 202085%Added back-side support.
1.0Nov 201976%Initial release.