Retrieve user data
To view all submitted user information related to a session use the resources container.
idvClient.getSession(sessionId).then(session => {
// Returns all resources in the session
const resources = session.getResources();
// Returns a collection of ID Documents
const idDocuments = resources.getIdDocuments();
idDocuments.map((idDocument) => {
// Gets the UUID of the document resource
const id = idDocument.getId();
// Returns the ID Document Type
const documentType = idDocument.getDocumentType();
// Returns the ID Document country
const issuingCountry = idDocument.getIssuingCountry();
// Returns pages of an ID Document
const pages = idDocument.getPages();
// Get pages media ids
const pageMediaIds = pages.map(page => {
if (page.getMedia() && page.getMedia().getId()) {
return page.getMedia().getId();
}
return null;
});
//return document id photo media id
const documentPhoto = idDocument.getDocumentIdPhoto().getMedia().getId();
// Returns document fields object
const documentFields = idDocument.getDocumentFields();
// Get document fields media id
let documentFieldsMediaId = null;
if (documentFields) {
documentFieldsMediaId = documentFields.getMedia().getId();
}
});
// Returns a collection of liveness capture resources
const livenessCapture = resources.getLivenessCapture();
const zoomLiveness = resources.getZoomLivenessResources();
}).catch(error => {
console.log(error)
// handle error
})
Retrieve user information
This is the full JSON version of the user's profile using document fields. An explanation of the address format can be found in this section: Attributes explained.
The document_fields media id should be used when an OCR or manual data entry result is successful. The media ID will be updated to the latest result, if you get OCR data back it will relate to the server side extraction. If the data entry goes for a manual check and data is extracted successfully the media ID will also be updated accordingly and point to generated media from a text data check.
The absence of the document fields object would indicate that data did not get extracted from the ID document.
idvClient.getMediaContent(sessionId, documentFieldsMediaId).then(media => {
const buffer = media.getContent();
const jsonData = JSON.parse(buffer);
// handle jsonData here
}).catch(error => {
// handle error
})
Example Extractions
{
"full_name": "ANGELA ZOE UK SPECIMEN",
"date_of_birth": "1988-12-04",
"nationality": "GBR",
"given_names": "ANGELA ZOE",
"family_name": "UK SPECIMEN",
"place_of_birth": "CROYDON",
"gender": "FEMALE",
"document_type": "PASSPORT",
"issuing_country": "GBR",
"document_number": "533028754",
"expiration_date": "2025-09-28",
"date_of_issue": "2015-09-28",
"issuing_authority": "HMPO",
"mrz": {
"type": 2,
"line1": "P<GBRUK<SPECIMEN<<ANGELA<ZOE<<<<<<<<<<<<<<<<",
"line2": "5330287549GBR8812049F2509286<<<<<<<<<<<<<<02"
},
"document_template": {
"front_page_name": "United Kingdom - ePassport (2015)"
}
}
Retrieve supplementary documents
Supplementary documents will be similarly available as part of the JSON if they have been successfully parsed by either OCR or manual data entry. When retrieving supplementary documents, any document images will appear as 'pages' objects in the JSON whilst uploaded pdfs will be 'file' objects.
idvClient.getMediaContent(sessionId, documentFieldsMediaId).then(media => {
const buffer = media.getContent();
const jsonData = JSON.parse(buffer);
// handle jsonData here
}).catch(error => {
// handle error
})
If you have enabled non latin characters Yoti will do its best to provide the latin characters where possible.