Skip to content

Mexico ID Card OCR

id number + name recognition

Code example:

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'

Response for card front recognition success

{
"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."
}
}

Response for card back recognition success

{
"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": ""
}
}

Response for recognition fail

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

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/mx_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

fieldsdescription
statusstatus code
messageidNumber: id number
fullName: name
fatherLastName: father lastName
motherLastName: mother lastName
name: name
birthday: birthday
gender: gender
expiryYear: expiry year
issueYear: issue year
voterId: voter id
placeNumber: place number
stateNumber: state number
municipalNumber: municipal number
state: state
district: district
subDistrict: sub district
addressAll: address
postalCode: postal code
registrationYearAndMonth: registration year and month

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