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 its 'time to live' is reached. For any active session, you can use the Yoti SDK to retrieve a report on the session (containing the end-user's uploaded documents and associated metadata).
This page explains how to:
- Retrieve the results of the session.
- Retrieve the associated media.
- Display the Identity Profile Report for the session.
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
const sessionResult = await idvClient.getSession(sessionId);
// Returns the session state
const state = sessionResult.getState();
// Returns session resources
const resources = session.getResources();
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. |
Checks | A container of all checks performed for this session. |
Retrieve the Media
Document images from the user, text extraction fields and liveness captures for the session are available inside the resources container. These can be retrieved by looking at the relevant media ID inside the documents collection.
// Returns a collection of ID Documents
const idDocuments = resources.getIdDocuments();
// Returns document fields object
const documentFields = idDocuments[0].getDocumentFields();
const mediaId = documentFields.getMedia().getId();
const media = await idvClient.getMediaContent(sessionId, mediaId);
const buffer = media.getContent();
const base64Content = media.getBase64Content();
const mimeType = media.getMimeType();
Retrieve the Identity Profile
Once the session has reached the state of 'Completed', identity profile can be successfully retrieved.
In case of a successful transaction, once the identity profile is received, the identity profile report JSON will be accessible. This contains the media ID which can then be used to get the full JSON response of the report.
const identityProfile = sessionResult.getIdentityProfile();
const identityProfileReport = identityProfile.getIdentityProfileReport();
const mediaId = identityProfileReport.getMedia().getId();
const identityProfileReportMedia = await idvClient.getMediaContent(sessionId, mediaId);
const identityProfileReportMediaBuffer = identityProfileReportMedia.getContent();
Session Result Parameters
The session result contains the session metadata, ID checks, uploaded documents and the identity profile report.
Parameter | Type | Description | Included |
---|---|---|---|
SessionResult | Object | Complete Session Result | Always |
sessionId | String | Unique Session ID | Always |
userTrackingId | String | Unique User Tracking ID | Optional |
state | String | The current state of the session. Enum: ONGOING, COMPLETED, EXPIRED | Always |
clientSessionToken | String | Token for the user session. | Optional |
clientSessionTokenTtl | Integer | Remaining time the user has to complete the session. | Optional |
checks | []Object | List of all the checks performed. | Always |
resources | Object | Collection of all the resources created. | Always |
biometricConsent | String | Collected biometric consent. | Conditional |
identityProfile | Object | Complete Identity profile (Available when the session is completed). | Always |
subjectId | String | Subject identifier provided by the RP at session creation time. | Optional |
result | String | Final result of the identity verification. 'Done' means the identity could be verified and the identity profile report provided. 'Aborted' means the user could not be verified and no identity profile report produced, all the resources and checks are still available. Enum: DONE, ABORTED | Always |
failureReason | Object | In case of result: ABORTED, reason for the failure. | Optional |
reasonCode | String | Reason code for the failure. Please see error codes for full list | Conditional |
identityProfileReport | Object | The identity profile report media contains the identity attributes and the verification report that certifies the scheme compliance and achieved verification level. | Conditional |
trustFramework | String | Defines under which trust framework this identity was verified. As defined at session creation time. Enum: UK_TFIDA, YOTI_GLOBAL | Conditional |
schemesCompliance | []Object | Defines which schemes (of the requested ones) this identity profile satisfies. | Conditional |
scheme | Boolean | Scheme defines the identity scheme. | Conditional |
requirementsMet | String | Asserts whether the identity scheme requirements were met or not. | Conditional |
requirementsNotMetInfo | Object | Provides info on why the scheme requirements were not met. | Conditional |
media | String | Full identity profile report provided as a JSON media. | Conditional |
created | String | Uses the ISO8601 standard representation of date times. | Conditional |
last_updated | String | Uses the ISO8601 standard representation of date times. | Conditional |
id | String | Identifier to be used to fetch this media. | Conditional |
type | String | JSON Enum: IMAGE, JSON,BINARY | Conditional |
Example JSON Response
{
"client_session_token_ttl": 8490,
"session_id": "52098976-42d0-4051-a80f-7fc3438e4d9e",
"state": "COMPLETED",
"resources": { },
"checks": [ ],
"biometric_consent": "2024-06-24T14:44:33Z",
"advanced_identity_profile": { }
}