Skip to main content

/extractDocumentDataWeb

Description

This service returns all the data extracted from an identification document by applying OCR to MRZ code, PDF, Barcode, and visible fields in other areas of the document according to the model defined for each country. For passports, OCR is exclusively applied to the MRZ code due to its standardized format.

Integration

This service is used for implementations of the SelphID Web widget or for sending open images from any platform. When using the SelphID Web widget, the images generated by the widget are retrieved from an array of images.

caution

For passport cases, only the tokenFrontDocument is required with countryCode set to "PSP".

Request:

curl --location '{IDENTITY_API_BASE_URL}/services/extractDocumentDataWeb' \
--header 'x-api-key: {API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"tokenFrontDocument": "{TOKEN_FRONT_DOCUMENT}",
"tokenBackDocument": "{TOKEN_BACK_DOCUMENT}",
"countryCode": "{COUNTRY_CODE}",
"decompose": false,
"tracking": {
"extraData": "{EXTRA_DATA}",
"operationId": "{OPERATION_ID}"
}
}'

Request parameters:

ParameterType (Content)RequiredDescription
tokenFrontDocumentString (Base64)YesBase64 encoded image of the front side of the document, removing the mime type header.
tokenBackDocumentString (Base64)YesBase64 encoded image of the back side of the document, removing the mime type header.
countryCodeStringYesCountry code in ISO 3166-1 alpha-3 format. If not present in the request body, the service will use the default country defined for the client in the API settings.
decomposeBooleanNoIndicates whether to obtain the face image present in the document and the signature crop. (*) Consult with Latam Support team for enabled countries.
trackingJSON ObjectNoObject that represents necessary tracking information.
extraDataString (Base64)NoToken generated by Mobile/Web SDK. Contains tokenized tracking information with Platform.
operationIdString (Base64)NoOperation identifier generated by Mobile/Web SDK.

Example response:

{
"serviceResultCode": 0,
"serviceResultLog": "Service request successfully processed",
"serviceTime": "2237",
"serviceDocument": "{\"ASK4BACK\":\"NO\",\"BACKSIDE\":{\"FIELD_DATA\":{\"BARCODES\":[{\"DATA\":\"\",\"TYPE\":\"\"}]},\"MRZ_DATA\":{\"BIRTH_DATE\":\"01/01/1980\",\"EXPEDITION_DATE\":\"01/01/2020\",\"EXPIRATION_DATE\":\"01/01/2030\",\"IDENTITY_NUMBER\":\"123\",\"ISSUING_COUNTRY\":\"XYZ\",\"NAME\":\"JOHN\",\"NATIONALITY\":\"XYZ\",\"PERSONAL_NUMBER\":\"12345678\",\"SERIAL_NUMBER\":\"000000001\",\"SURNAME\":\"DOE\"}},\"CHECKS\":{\"BIRTH_DATE_SIDE_MATCH\":true,\"EXPEDITION_DATE_SIDE_MATCH\":true,\"EXPIRATION_DATE_SIDE_MATCH\":true,\"NAME_SIDE_MATCH\":true,\"NATIONALITY_SIDE_MATCH\":true,\"SURNAME_SIDE_MATCH\":true},\"COUNTRY_CODE\":\"XYZ\",\"DECOMPOSED\":{\"FACE\":\"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/p3Vg7fMCvXH/66ujh6VJXhFfkzHE4rEYqV6kmz/9k=...\"},\"DOC_MODEL\":\"NEW\",\"FRONTSIDE\":{\"FIELD_DATA\":{\"BIRTH_DATE\":\"01/01/1980\",\"BIRTH_PLACE\":\"SOMEPLACE/XYZ\",\"DOCUMENT_NUMBER\":\"1.234.567-8\",\"EXPEDITION_DATE\":\"01/01/2020\",\"EXPIRATION_DATE\":\"01/01/2030\",\"NAME\":\"JOHN\",\"NATIONALITY\":\"XYZ\",\"SURNAME\":\"DOE\"}},\"SCORING\":{\"BACK_CONFIDENCE\":0.927620202303,\"BACK_SHA256\":\"0f8b53d5724a186cf19c882baa20eb92fa6e1708065987a32ecbf0141a86e6a5\",\"FIELDS_RETURNED\":27,\"FIELDS_TOTAL\":27,\"FRONT_CONFIDENCE\":0.97401304245,\"FRONT_SHA256\":\"a3dccd459f4674ec8440a11c7c65ab0e1ebaa5fd8357b55484574e71116bef2c\",\"OVERALL_RATING\":100.0}}\n",
"serviceTransactionId": "123e4567-e89b-12d3-a456-426614174000"
}

Response fields:

IdentifierTypeDescription
serviceResultCodeIntegerCode indicating the overall result of the service execution. See Table 1 - Service Result Code
serviceResultLogStringDescriptive field of the service execution result. Details of the module are included in case of an error or exception.
serviceDocumentJSONObject that represents the captured document. Its properties are all the fields extracted by the OCR process including the face image present in the document.
serviceTimeStringTotal execution time of the service (milliseconds).
serviceTransactionIdStringTransaction identifier associated with the request processed by the API.