ID Card 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 status
error code
error message
description

200

-

-

OCR successful

206

partial_content

partial_content

Some page of request is invalid

400

no_id_card

no idcard on image

Can't detect ID CARD on image

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

Request Options

option key
description
what change

censor_field

censor 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_face

Set true to enable return of facial image in UTF-8 Base64 format

response data each page has key "option" in "option" has "face" that contain face_image in base64 format

return_gender

Set true to return of the gender information

esponse data each page has key "option" in "option" has "gender" that contain "M"/"F"/"N/A"

return_signed

Set true to enable detection of overlaying signed on top of the document's photos or images

response data each page has key "option" in "option" has "signed" that contain true/false

do_field_validation

Set true to enable field validation

response data "id_number" has 2 new key valid(bool), error_message(List[str])

return_datetime_iso

Set true to enable add date time iso format to field date time

response 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

Name
Type
Description

image*

String

Base64 image encoded string

option

Object

Specify optional features like

{

censor_field:[field_array]

return_face: true,

...

}

{
  "status": "success",
  "error": [
    {
      "object": "error",
      "code": "string",
      "message": "string"
    }
  ],
  "data": [
    {
      "option": {}
    },
    "string"
  ],
  "request_id": "string"
}
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())

Last updated