跳转到内容

护照OCR

护照识别

代码示例:

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'

ID 护照识别成功的响应

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

CN 护照识别成功的响应

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

PH 护照识别成功的响应

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

识别失败的响应

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

未识别类型的响应

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

无效请求参数的响应

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

图像格式无效的响应

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

图像大小超过 2M 的响应

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

服务器错误的响应

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

HTTP 请求

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

请求参数

参数描述
imgstring,base64 编码的图像。建议图像大小小于 200KB,这样返回时间将在 2 秒内,否则返回时间会更长。

护照的响应格式

字段描述
status状态码
messagepassportNumber: 护照号码
chName: 中文名
name: 姓名
gender: 性别
birthDay: 出生日期
birthPlace: 出生地
issueDay: 签发日期
issuePlace: 签发地
expiryDay: 过期日期
nationality: 国籍

状态码

状态描述
OK成功
FAIL图像识别错误,请检查输入图像
INVALID_REQUEST无效的请求参数
IMAGE_INVALID_FORMAT无效的图像格式,图像格式应为jpeg/jpg/png/bmp之一
IMAGE_INVALID_SIZE图像大小无效,应小于2M
INNER_ERROR服务器错误