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();
<?php

require_once './vendor/autoload.php';

use Yoti\Http\RequestBuilder;

$response = (new RequestBuilder())
->withBaseUrl('https://api.yoti.com/idverify/v1')
->withPemFilePath('<YOTI_KEY_FILE_PATH>')
->withEndpoint('/sessions/<sessionId>')
->withMethod('GET')
->withQueryParam('sdkId', '<YOTI_CLIENT_SDK_ID>')
->build()
->execute();

//get Yoti response
$result = json_decode((string) $response->getBody());
from yoti_python_sdk.http import SignedRequest, RequestHandler
import json
import requests


def execute(request):
response = requests.request(
url=request.url, data=request.data, headers=request.headers, method=request.method)
return response.content


def get_session():

signed_request = (
SignedRequest
.builder()
.with_pem_file("<YOTI_KEY_FILE_PATH>")
.with_base_url("https://api.yoti.com/idverify/v1")
.with_endpoint("/sessions/<sessionId>")
.with_http_method("GET")
.with_param("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build()
)

response = signed_request.execute()
response_payload = json.loads(response.text)
try {
SignedRequest signedRequest = SignedRequestBuilder.newInstance()
.withKeyPair(<YOTI_KEY_FILE_PATH>)
.withBaseUrl("https://api.yoti.com/idverify/v1")
.withEndpoint("/sessions/<SESSION_ID>")
.withHttpMethod("GET")
.withQueryParameter("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build();

YourPojo yourPojo = signedRequest.execute(YourPojo.class);

} catch (GeneralSecurityException | URISyntaxException | IOException | ResourceException ex) {
ex.printStackTrace();
}
import (
"io/ioutil"
"net/http"
"github.com/getyoti/yoti-go-sdk/v2/requests"
)

sdkID := "<YOTI_CLIENT_SDK_ID>";
key, _ := ioutil.ReadFile("<YOTI_KEY_FILE_PATH>")
// Create session
sessionRequest, _ := requests.SignedRequest{
HTTPMethod: http.MethodGet,
BaseURL: "https://api.yoti.com/idverify/v1",
Endpoint: "/sessions/<SESSION_ID>",
Params: map[string]string{
"sdkId": sdkID,
},
Headers: map[string][]string{
"Content-Type": {"application/json"},
"Accept": {"application/json"},
},
}.WithPemFile(key).Request()

//get Yoti response
sessionResponse, _ := http.DefaultClient.Do(sessionRequest)

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.

Info

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",

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",

After the second uploaded document

{…}

After the third uploaded document

{…}

Session Completion

{…}

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();
<?php

require_once './vendor/autoload.php';

use Yoti\Http\RequestBuilder;

$response = (new RequestBuilder())
->withBaseUrl('https://api.yoti.com/idverify/v1')
->withPemFilePath('<YOTI_KEY_FILE_PATH>')
->withEndpoint('/sessions/<sessionId>/media/<mediaId>/content')
->withMethod('GET')
->withQueryParam('sdkId', '<YOTI_CLIENT_SDK_ID>')
->build()
->execute();

//get Yoti response
$result = $response->getBody();
from yoti_python_sdk.http import SignedRequest, RequestHandler
import json
import requests


def execute(request):
response = requests.request(
url=request.url, data=request.data, headers=request.headers, method=request.method)
return response.content


def get_session():

signed_request = (
SignedRequest
.builder()
.with_pem_file("<YOTI_KEY_FILE_PATH>")
.with_base_url("https://api.yoti.com/idverify/v1")
.with_endpoint("/sessions/<sessionId>/media/<mediaId>/content")
.with_http_method("GET")
.with_param("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build()
)

response = signed_request.execute()
try {
SignedRequest signedRequest = SignedRequestBuilder.newInstance()
.withKeyPair(<YOTI_KEY_FILE_PATH>)
.withBaseUrl("https://api.yoti.com/idverify/v1")
.withEndpoint("/sessions/<SESSION_ID>/media/<mediaId>/content")
.withHttpMethod("GET")
.withQueryParameter("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build();

YourPojo yourPojo = signedRequest.execute(YourPojo.class);

} catch (GeneralSecurityException | URISyntaxException | IOException | ResourceException ex) {
ex.printStackTrace();
}
import (
"io/ioutil"
"net/http"
"github.com/getyoti/yoti-go-sdk/v2/requests"
)

sdkID := "<YOTI_CLIENT_SDK_ID>";
key, _ := ioutil.ReadFile("<YOTI_KEY_FILE_PATH>")
// Create session
sessionRequest, _ := requests.SignedRequest{
HTTPMethod: http.MethodGet,
BaseURL: "https://api.yoti.com/idverify/v1",
Endpoint: "/sessions/<SESSION_ID>/media/<mediaId>/content",
Params: map[string]string{
"sdkId": sdkID,
},
Headers: map[string][]string{
"Content-Type": {"application/json"},
"Accept": {"application/json"},
},
}.WithPemFile(key).Request()

//get Yoti response
sessionResponse, _ := http.DefaultClient.Do(sessionRequest)

Error Response

Error code

Description

400

Invalid payload or request missing query parameters

401

Unauthorised request

404

No session found matching the sessionId provided


  Last updated by Kiran Bali