Retrieve results
Each session has a configured 'time to live' (TTL) which must be above 300 seconds (5 minutes). When a session is created, it remains active until it's time to live is reached. For any active session, you can use the Yoti SDK to retrieve a report on the session (containing all the end-user's uploaded documents and associated metadata).
This sections explains how to:
- Retrieve the results of the session
- Display checks and results associated to an ID Document in a session
The structure of the full response is shown below:

Results hierarchy
The report includes a recommendation for each check. Please read this section and then head over to Understanding the report for more information.
Result of the session
Session retrieval requires a session ID, this is generated from the create a session endpoint. Below is a basic example of what retrieving a session looks like:
// Returns a session result
idvClient.getSession(sessionId).then(session => {
// Returns the session state
const state = session.getState();
// Returns session resources
const resources = session.getResources();
// Returns all checks on the session
const checks = session.getChecks();
// Return specific check types
const authenticityChecks = session.getAuthenticityChecks();
const faceMatchChecks = session.getFaceMatchChecks();
const textDataChecks = session.getTextDataChecks();
const livenessChecks = session.getLivenessChecks();
const watchlistScreeningChecks = session.getWatchlistScreeningChecks();
const watchlistAdvancedCaChecks = session.getWatchlistAdvancedCaChecks();
// Returns biometric consent timestamp
const biometricConsent = session.getBiometricConsentTimestamp();
}).catch(error => {
// handle error
})
The following are present in every session result:
Value | Description |
---|---|
State | The current state of the session. It provides the overall state of the session. You can search through session results prior to this being completed, but some checks may not have been processed yet. |
Resources | A container of all ID documents and liveness captures for this session. A new resource is created on each attempt at a document or liveness submission. |
Checks | A container of all checks performed for this session |
Results of checks
A basic example of how to get the check type, check recommendation value and reason is shown below.
A recommendation reason will only be provided if the value isn't 'APPROVE'. The recommended approach for processing a session is to ensure that each check value is APPROVE.
We will use the check container to iterate through all of the checks that have been completed as part of the session. The checks object will only contain information once the user has completed all events (apart from Liveness) inside of the iFrame.
Liveness
The liveness response is available immediately. The user may have multiple attempts of liveness and It's possible for some of these attempts to be rejected.
idvClient.getSession(sessionId).then(session => {
// Returns a collection of liveness checks
const livenessChecks = session.getLivenessChecks();
livenessChecks.map(check => {
// Returns the id of the check
const id = check.getId();
// Returns the state of the check
const state = check.getState();
// Returns an array of resources used in the check
const resourcesUsed = check.getResourcesUsed();
// Returns the report for the check
const report = check.getReport();
// Returns the recommendation value
const recommendation = report.getRecommendation().getValue();
// Returns the report breakdown including sub-checks
const breakdown = report.getBreakdown();
breakdown.forEach(function(breakdown) {
// Returns the sub-check
const subCheck = breakdown.getSubCheck();
// Returns the sub-check result
const subCheckResult = breakdown.getResult();
});
})
}).catch(error => {
// handle error
})
Multiple document resources
Each check returns a list of 'resources used', identifying the ID document, face capture, or supplementary document resources used for that check. These are mapped to the resources container.
A single ID Document or Face capture can have multiple resources. This is because a new resource may be created for each attempt to submit an ID document (for example, if Yoti's in-browser feedback requests another capture or multiple liveness attempts).
idvClient.getSession(sessionId).then(session => {
// Returns a collection of checks
const checks = session.getChecks();
checks.map(check => {
// Returns the type of check
const type = check.getType();
// Returns the state of the check
const state = check.getState();
// Returns an array of resources used in this check
const resourcesUsed = check.getResourcesUsed();
// Returns a list of generated media for this check
// For THIRD_PARTY_CHECK this will be the fields used to perform the check
const generatedMedia = check.getGeneratedMedia();
// Returns the report for the check
const report = check.getReport();
// Pull recommendation object
const recommendation = report.getRecommendation();
// Obtain the recommendation value, either APPROVE, NOT_AVAILABLE or REJECT
const recommendationValue = recommendation.getValue();
// If the check is not APPROVE, obtain the reason
const reason = recommendation.getReason();
// Obtains a report breakdown
const breakdown = report.getBreakdown();
})
}).catch(error => {
// handle error
})
AML
In addition to the normal report, watchlist checks will also return a WatchlistSummary object:
const watchlistScreeningChecks = session.getWatchlistScreeningChecks();
const report = watchlistScreeningChecks[0].getReport();
// Watchlist Screening summary
const watchlistSummary = report.getWatchlistSummary();
const associatedCountryCodes = watchlistSummary.getAssociatedCountryCodes();
const rawResults = watchlistSummary.getRawResults();
const totalHits = watchlistSummary.getTotalHits();
// Search config used
const searchConfig = watchlistSummary.getSearchConfig();
const categories = searchConfig.getCategories();
//Adcvanced checks
const watchlistAdvancedCaChecks = session.getWatchlistAdvancedCaChecks();
const report = watchlistScreeningChecks[0].getReport();
// Watchlist summary
const watchlistSummary = report.getWatchlistSummary();
const associatedCountryCodes = watchlistSummary.getAssociatedCountryCodes();
const rawResults = watchlistSummary.getRawResults();
const totalHits = watchlistSummary.getTotalHits();
// Search config
const searchConfig = watchlistSummary.getSearchConfig();
const removeDeceased = searchConfig.isRemoveDeceased();
const shareUrl = searchConfig.isShareUrl();
const sources = searchConfig.getSources();
const matchingStrategy = searchConfig.getMatchingStrategy();
AML raw
You have the ability to extract the raw results from the comply advantage API, as well as a link to a comply advantage page displaying the hits (if any) by using the raw_results ID.
idvClient.getMediaContent(sessionId, rawResultsId).then(media => {
const content = media.getContent();
const buffer = content.toBuffer();
const jsonData = JSON.parse(buffer);
}).catch(error => {
console.log(error)
// handle error
})