跳转到内容

墨西哥身份证OCR

身份证号码 + 姓名识别

代码示例:

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

身份证正面识别成功的响应

{
"status": "OK",
"message": {
"gender": "M",
"idNumber": "MONY801107MTSLRR07",
"voterId": "MLNRYR80110728M300"
"fullName": "MOLINA NORATO YURI YERANIA",
"fatherLastName": "MOLINA",
"motherLastName": "NORATO",
"name": "YURI YERANIA",
"birthday": "15/07/1987",
"issueYear": "2011",
"expiryYear": "2021",
"registrationYearAndMonth": "200101",
"municipalNumber": "041",
"postalCode": "87040",
"placeNumber": "0001",
"stateNumber": "28",
"state": "TAMPS",
"district": "VICTORIA",
"subDistrict":"FRACC EL MIRADOR",
"addressAll": "AND 8 1121 INF ALDAMA 87040 VICTORIA ,TAMPS.",
}
}

身份证背面识别成功的响应

{
"status": "OK",
"message": {
"idNumber": "",
"fullName": "JTMENEZ HERNANDEZ ADRTANA",
"fatherLastName": "JTMENEZ",
"motherLastName": "HERNANDEZ",
"name": "ADRTANA",
"birthday": "16/03/1970",
"gender": "M",
"expiryYear": "2032",
"issueYear": "2022",
"voterId": "",
"placeNumber": "",
"stateNumber": "",
"municipalNumber": "",
"state": "",
"district": "",
"subDistrict": "",
"addressAll": "",
"postalCode": "",
"registrationYearAndMonth": ""
}
}

识别失败的响应

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

请求参数无效的响应

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

请求参数

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

响应格式

字段描述
status状态码
messageidNumber:身份证号码
fullName:姓名
fatherLastName:父姓
motherLastName:母姓
name:名字
birthday:生日
gender:性别
expiryYear:过期年份
issueYear:签发年份
voterId:选民 ID
placeNumber:地点编号
stateNumber:州编号
municipalNumber:市编号
state:州
district:区
subDistrict:子区
addressAll:地址
postalCode:邮政编码
registrationYearAndMonth:注册年份和月份

状态码

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