跳转到内容

秘鲁身份证OCR

身份证号码 + 姓名识别

代码示例:

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

识别成功的响应

{
"status": "OK",
"message": {
"CardNumber": "41701152",
"DateOfBirth": "19820131",
"ForeNames": "ALFREDO ALBERTO",
"PlaceOfBirthNo": "140135",
"SecondSurname": "BAUTISTA",
"Surname": "FRANCIA",
"dateOfExpiry": "20220218",
"dateOfIssue": "20210127",
"dateOfRegister": "20010618",
"gender": "M",
"maritalStatus": "S",
"nationality": "PER"
}
}

识别失败的响应

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

输入图像不是身份证的响应

{
"status": "FAIL",
"message": "not identity card"
}

无法识别的卡类型的响应

{
"status": "FAIL",
"message": "card not recognized"
}

无效请求参数的响应

{
"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/pe_ocr/general

请求参数

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

响应格式

字段描述
status状态码
messageCardNumber:身份证号码,
DateOfBirth:出生日期,
PlaceOfBirthNo:出生地编号,
ForeNames:名字,
Surname:姓氏,
SecondSurname:第二姓氏,
dateOfExpiry:过期日期,
dateOfIssue:发证日期,
dateOfRegister:注册日期,
gender:性别,
maritalStatus:婚姻状况,
nationality:国籍

状态码

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