Skip to main content
Version: 3.1.0

Identification Card

POST

  https://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

Ruta: api/ocr/

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 or DESKTOP
'validate_sides': True
} // (where images are .jpg files)

Request examples

Python

# 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 the 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 the 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):

Response format: JSON
{
"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):

Response format: JSON
{
"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:

Response format: JSON
{
"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:

CodeMessage
800The submitted file could not be processed correctly.
801The MRZ could not be extracted from the document.
802The date of birth could not be processed.
803The gender could not be processed.
804The expiration date could not be processed.
805Error processing QR.
806The document metadata could not be extracted.
807Could not extract names from the document.
808The ID number could not be extracted from the document.
809The "frontside" was not sent in the request.
810The "backside" was not sent in the request.
811Could not extract surnames from the document, "surnames".
812Could not extract the place of birth from the document, "birth_country".
813Data does not match between frontside and backside, "data".
814The image does not meet the minimum score for MRZ reading, "mrz".
815ID card QR format is not readable, "backside".
816The document does not match the one specified in the parameters.
817The submitted passport code is not yet supported by the service.
818No se pudo obtener el OCR del frontside.