Skip to content

Passport OCR

passport recognition

Code example:

curl --location --request POST 'https://api.ekycpro.com/v1/pp_ocr/general' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'X-API-Key: AbcdEfgh' \
--data-urlencode 'img=BASE64_ENCODE_VALUE'

Response for ID passport recognition success

{
"status": "OK",
"message": {
"passportNumber": "E95095047",
"name": "KHOLISATUN NISA",
"gender": "F",
"birthDay": "19891110",
"birthPlace": "SUBANG",
"issueDay": "20170214",
"expiryDay": "20270213",
"issuePlace": "WONOSOBO",
"nationality": "INDONESIA"
}
}

Response for CN passport recognition success

{
"status": "OK",
"message": {
"passportNumber": "E95095047",
"chName": "徐涛涛",
"name": "XU, TAOTA0",
"gender": "M",
"birthDay": "19891110",
"birthPlace": "SHANDONG",
"issueDay": "20170214",
"expiryDay": "20270213",
"issuePlace": "SHANDONG",
"nationality": "CHINESE"
}
}

Response for PH passport recognition success

{
"status": "OK",
"message": {
"passportNumber": "P9603119",
"name": "KHOLISATUN NISA",
"gender": "F",
"birthDay": "19891110",
"birthPlace": "MAKATI MM",
"issueDay": "20170214",
"expiryDay": "20270213",
"nationality": "FILIPINO"
}
}

Response for recognition fail

{
"status": "FAIL",
"message": "check input image and retry"
}

Response for not recognized type

{
"status": "FAIL",
"message": "not a passport""
}

Response for invalid request parameters

{
"status": "INVALID_REQUEST",
"message": "check request params"
}

Response for invalid image format

{
"status": "IMAGE_INVALID_FORMAT",
"message": "image format not support"
}

Response for image size larger than 2M

{
"status": "IMAGE_INVALID_SIZE",
"message": "image larger than 2M"
}

Response for server error

{
"status": "INNER_ERROR",
"message": "Inner error, please retry later"
}

HTTP request

POST https://api.ekycpro.com/v1/pp_ocr/general

Request parameters

parameterdescription
imgstring, base64 encoded image. It is recommended that the image be less than 200KB, so it will be returned within 2 seconds, otherwise the return time will be longer.

Response format for passport

fieldsdescription
statusstatus code
messagepassportNumber: passport number
chName: Chinese name
name: name
gender: gender
birthDay: birth day
birthPlace: birth place
issueDay: issue day
issuePlace: issue place
expiryDay: expiry day
nationality: nationality

Status code

statusdescription
OKcharge, success
FAILcharge, image recognition error, please check input image
INVALID_REQUESTfree, invalid request parameters
IMAGE_INVALID_FORMATfree, invalid image format, image format should be one of jpeg/jpg/png/bmp
IMAGE_INVALID_SIZEfree, invalid image size, should be less than 2M
INNER_ERRORfree, server error