Retrieve Results
After the user has completed their session you will then be able to retrieve the result of the session.
For any active session, you can use the Yoti API to retrieve a report on the session (containing all the end-user's uploaded documents, and recommendations). If you wish to be notified of the session completion, please use notifications.
This sections explains how to:
- Retrieve the results of the session
If you would like information on retrieving the ID document images, user information and the report head here.
GET https://api.yoti.com/idverify/v1/sessions/{sessionId}
SDK Example:
const { RequestBuilder} = require("yoti");
const request = new RequestBuilder()
.withBaseUrl("https://api.yoti.com/idverify/v1")
.withPemFilePath("<YOTI_KEY_FILE_PATH>") // file path to PEM file
.withEndpoint("/sessions/<sessionId>")
.withMethod("GET")
.withQueryParam("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build();
//get Yoti response
const response = await request.execute();
Example of the get session response of a completed session, outlining the state of the checks. A recommendation value of "APPROVE" will be issued for each one. The person in branch will not complete the session if:
- All / Any of the documents are not present
- The profile data doesn't match
- If the wrong documents are brought in
- If the documents are not valid
Example Responses:
The below responses are examples of the various stages of fetching a session. Typically it's recommended to use the Session Completion webhook notification to be noticed of a completed Session.
These examples are based on a three document flow, two Identity documents and one Supplementary document.
You can use the following keyboard shortcuts to expand and collapse the JSON code blocks
- Ctrl + I to Expand
- Ctrl + Y to Collapse
Immediately after session creation
{
"client_session_token_ttl": 2637668,
"session_id": "1c3cae90-1769-43a9-8554-d85f2e7cdb0f",
"state": "ONGOING",
"client_session_token": "039abe07-166b-4f1d-9442-c86127d0143e",
"resources": {
"id_documents": [],
"supplementary_documents": [],
"liveness_capture": [],
"face_capture": [],
"applicant_profiles": [
{
"id": "9ab4729c-9777-44cd-acc1-c8d96a658125",
"tasks": [],
"source": {
"type": "RELYING_BUSINESS"
},
"created_at": "2023-10-16T09:18:46Z",
"last_updated": "2023-10-16T09:18:46Z",
"media": {
"id": "d609734c-e444-4c97-8211-6a3fe81e64e2",
"type": "JSON",
"created": "2023-10-16T09:18:46Z",
"last_updated": "2023-10-16T09:18:46Z"
}
}
]
},
"checks": [],
"user_tracking_id": "optional_string"
}
After the first uploaded document
{
"client_session_token_ttl": 2637490,
"session_id": "1c3cae90-1769-43a9-8554-d85f2e7cdb0f",
"state": "ONGOING",
"client_session_token": "039abe07-166b-4f1d-9442-c86127d0143e",
"resources": {
"id_documents": [
{
"id": "3332241d-2ae7-437a-ae48-4b50ddb41638",
"tasks": [],
"source": {
"type": "IBV"
},
"created_at": "2023-10-16T09:21:19Z",
"last_updated": "2023-10-16T09:21:40Z",
"document_type": "PASSPORT",
"issuing_country": "GBR",
"pages": [
{
"capture_method": "CAMERA",
"media": {
"id": "9935a420-364e-4d45-a25d-81b971c7307a",
"type": "IMAGE",
"created": "2023-10-16T09:21:40Z",
"last_updated": "2023-10-16T09:21:40Z"
},
"frames": [
{
"media": {
"id": "188259c5-430f-47cc-8ea2-a7c873c18dda",
"type": "IMAGE",
"created": "2023-10-16T09:21:42Z",
"last_updated": "2023-10-16T09:21:42Z"
}
},
{
"media": {
"id": "37cbd9b9-b62b-478f-aaf1-233dc0d6eda4",
"type": "IMAGE",
"created": "2023-10-16T09:21:44Z",
"last_updated": "2023-10-16T09:21:44Z"
}
},
{
"media": {
"id": "c8aa83c5-0292-4b4b-9f37-46b6bdca1856",
"type": "IMAGE",
"created": "2023-10-16T09:21:45Z",
"last_updated": "2023-10-16T09:21:45Z"
}
}
]
}
]
}
],
"supplementary_documents": [],
"liveness_capture": [],
"face_capture": [],
"applicant_profiles": [
{
"id": "9ab4729c-9777-44cd-acc1-c8d96a658125",
"tasks": [],
"source": {
"type": "RELYING_BUSINESS"
},
"created_at": "2023-10-16T09:18:46Z",
"last_updated": "2023-10-16T09:18:46Z",
"media": {
"id": "d609734c-e444-4c97-8211-6a3fe81e64e2",
"type": "JSON",
"created": "2023-10-16T09:18:46Z",
"last_updated": "2023-10-16T09:18:46Z"
}
}
]
},
"checks": [],
"user_tracking_id": "optional_string"
}
After the second uploaded document
{
"client_session_token_ttl": 2637311,
"session_id": "1c3cae90-1769-43a9-8554-d85f2e7cdb0f",
"state": "ONGOING",
"client_session_token": "039abe07-166b-4f1d-9442-c86127d0143e",
"resources": { },
"checks": [],
"user_tracking_id": "optional_string"
}
After the third uploaded document
{
"client_session_token_ttl": 2637186,
"session_id": "1c3cae90-1769-43a9-8554-d85f2e7cdb0f",
"state": "ONGOING",
"client_session_token": "039abe07-166b-4f1d-9442-c86127d0143e",
"resources": { },
"checks": [],
"user_tracking_id": "optional_string"
}
Session Completion
{
"client_session_token_ttl": 2637097,
"session_id": "1c3cae90-1769-43a9-8554-d85f2e7cdb0f",
"state": "COMPLETED",
"resources": { },
"checks": [ ],
"user_tracking_id": "optional_string"
}
The following is present in every session result.
Value | Description |
---|---|
Resources | A container of all ID documents and liveness captures for this session. |
Checks | A container of all checks performed for this session |
Retrieving Media
A second API call will need to be made to retrieve the media related to a session e.g document images.
SDK Example:
const { RequestBuilder} = require("yoti");
const request = new RequestBuilder()
.withBaseUrl("https://api.yoti.com/idverify/v1")
.withPemFilePath("<YOTI_KEY_FILE_PATH>") // file path to PEM file
.withEndpoint("/sessions/<sessionId>/media/<mediaId>/content")
.withMethod("GET")
.withQueryParam("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build();
//get Yoti response
const response = await request.execute();