Identification Card
POSThttps://api.apptenticate.com/api/v3/ocr/
Authentication
Use your JWT obtained from the authentication process to make requests to this endpoint.
The response will be 401 unauthorized if the JWT is expired. In this case you will have to obtain a new JWT.
This endpoint receives all requests directed to the Apptenticate OCR microservice that allows data to be extracted from identification documents. In this case, it is possible to process passports that contain MRZ (Machine Readable Zone) and Panamanian ID cards with or without QR code. These requests must specify the type of document to be processed, an image of the front of the document and an image of the back (in the case of identity cards). In the end, the ID Reader microservice will return a JSON with the extracted data if the operation was successful, or the appropriate error if it was not.
NOTE
• The response may be 401 unauthorized if the JWT token must be refreshed.
• Images sent in jpg format must not exceed 2MB.
• If you want to obtain the transaction ID in the response, you must indicate "return_id": "True" in the JSON of the request.
• It must be specified in the request whether a photo of a passport or ID is sent using the “document_type” parameter, which can take the values “passport” or “identification_card”.
Request structure - method: POST
• Payload for base request:
Payload: {
'frontside': Image of the front of the document,
'backside': Image of the back of the document,
'document_type': 'identification_card',
} // (where images are .jpg files)
• If you want to obtain the transaction ID:
Payload: {
'frontside': Image of the front of the document,
'backside': Image of the back of the document,
'document_type': 'identification_card',
'return_id':True
} // (where images are .jpg files)
• If you want to improve the precision of the life test
Payload: {
'frontside': Image of the front of the document,
'backside': Image of the back of the document,
'document_type': 'identification_card',
'device':'IOS', // Devices: IOS, ANDROID or DESKTOP
} // (where images are .jpg files)
• If you want to validate the data on the frontside and backside
Payload: {
'frontside': Imagen del frente del documento,
'backside': Imagen del dorso del documento,
'document_type': 'identification_card',
'device':'IOS', // Devices: IOS, ANDROID o DESKTOP
'validate_sides': True
} // (where images are .jpg files)
Request examples
# JWT Token
header = { 'Authorization': 'Bearer {}'.format(token) }
# Payload for base request
data = {'document_type': 'identification_card'}
files = {
'frontside': imagen_1.jpg,
'backside': imagen_2.jpg,
} # where images are .jpg files
# If you want to obtain the transaction ID:
data = {'document_type': 'identification_card', 'return_id': True}
files = {
'frontside': imagen_1.jpg,
'backside': imagen_2.jpg,
} # where images are .jpg files
# Sending the request
response = requests.post(
apptenticate_url,
data=data,
files=files,
headers=header
)
response = json.loads(response.content)
Response structure
• Response with transaction ID for (Panamanian ID):
{
"document_number": "E-8-123456",
"names": "Sofia Maria",
"surnames": "Lopez Contreras",
"gender": "F",
"birth_country": "VENEZUELA",
"birth_date": "10-10-1994",
"nationality": "VENEZOLANA",
"issuing_date": "12-08-2022",
"expiration_date": "12-08-2032",
"valid": true,
"id": 281234
}
• Response with transaction ID for (Panamanian ID) and validate_sides (True):
{
"backside": {
"document_number": "E-8-123456",
"names": "Sofia Maria",
"surnames": "Lopez Contreras",
"gender": "F",
"birth_country": "VENEZUELA",
"birth_date": "10-10-1994",
"nationality": "VENEZOLANA",
"issuing_date": "12-08-2022",
"expiration_date": "12-08-2032",
},
"frontside": {
"names": "Sofia Maria",
"surnames": "Lopez Contreras",
"birth_date": "11-07-1986",
"document_number": "E-8-123456",
"birth_country": "VENEZUELA",
"gender": "F",
"blood_type": "",
"issuing_date": "12-08-2022",
"expiration_date": "15-12-2036",
"nationality": "VENEZOLANA"
},
"matches_percentage": 100.0,
"match": true,
"valid": true,
"id": 5323
}
•In the case of a failed OCR:
{
"error": "No se pudo hacer OCR del documento",
"error_code": 806,
"details": {
"metadata": "No se pudo procesar correctamente alguno de los datos del documento"
}
}
Error codes:
| Code | Message |
|---|---|
805 | Error processing QR. |
806 | No se pudo extraer la metadata del documento. |
807 | Could not extract names from the document. |
808 | The ID number could not be extracted from the document. |
809 | The "frontside" was not sent in the request. |
810 | The "backside" was not sent in the request. |