Skip to main content

IDCard OCR

Extract ID CARD information from an image or photo. Currently only Thai ID Card is supported. Confidence score is scored from the OCR result.

info

Confidence score is -1.0 when the value of each validation field is False.

IDCard OCR

Extract ID CARD information from an image or photo Currently only Thai ID Card is supported. Confidence score is scored from the OCR result.

Response Definition

http statuserror codeerror messagedescription
200--OCR successful
206partial_contentpartial_contentSome page of request is invalid
400no_id_cardno idcard on imageCan't detect ID CARD on image
Confidence score is -1.0 when the value of each validation field is False.

Request Options

option keydescriptionwhat change
censor_fieldcensor source image depend on given input fields the list of censor fields like ["id_number","title_name_surname_th"]response data each page has key "option" in "option" has "processed_image" that contain censored_image in base64 format
return_faceSet true to enable return of facial image in UTF-8 Base64 formatresponse data each page has key "option" in "option" has "face" that contain face_image in base64 format
return_genderSet true to return of the gender informationesponse data each page has key "option" in "option" has "gender" that contain "M"/"F"/"N/A"
return_signedSet true to enable detection of overlaying signed on top of the document's photos or imagesresponse data each page has key "option" in "option" has "signed" that contain true/false
do_field_validationSet true to enable field validationresponse data "id_number" has 2 new key valid(bool), error_message(List[str])
return_datetime_isoSet true to enable add date time iso format to field date timeresponse data "dob_th","dob_en","doi_th","doi_en","doe_th","doe_en", has 3 new key valid(bool), datetime_iso(str)

Extract ID card information

POST https://apis.aigen.online/aiscript/idcard/v2

Request Body

NameTypeDescription
imageStringBase64 image encoded string
optionObjectSpecify optional features like
{
  censor_field:[field_array]
  return_face: true,
  ...
}

Responses

View Response
{
"status": "success",
"error": [
{
"object": "error",
"code": "string",
"message": "string"
}
],
"data": [
{
"option": {}
},
"string"
],
"request_id": "string"
}

Example Code

import requests

api = "https://apis.aigen.online/aiscript/idcard/v2"
headers = {"x-aigen-key": "<key>"}
data = {
"image": "base64_image",
"option": {} #optional
}
res = requests.post(api, json=data, headers=headers)
print(res.json())