Configure Response

Now you that have successfully created a session, the next step is to set the response config. The sandbox requires you to set an expected outcome for your tasks and checks. This will be an object with defined task_results and check_reports. For identity profile sessions, the outcomes that you define for the individual checks will determine the overall outcome for the identity profile check.

const { RequestBuilder, Payload } = require("yoti");

const request = new RequestBuilder()
.withBaseUrl("https://api.yoti.com/sandbox/idverify/v1")
.withPemFilePath("<YOTI_KEY_FILE_PATH>")
.withEndpoint("/sessions/<SESSION_ID>/response-config")
.withPayload(new Payload(RESPONSE_CONFIG))
.withMethod("PUT")
.withQueryParam("sdkId", "<YOTI_CLIENT_SDK_ID>")
.build();

//get Yoti response
const response = request.execute();
<?php
use Yoti\Http\RequestBuilder;
use Yoti\Http\Payload;

$request = (new RequestBuilder())
->withBaseUrl('https://api.yoti.com/sandbox/idverify/v1')
->withPemFilePath('<YOTI_KEY_FILE_PATH>')
->withEndpoint('/sessions/<SESSION_ID>/response-config')
->withPayload(Payload::fromString(RESPONSE_CONFIG_STRING)) // * Version ^2: new Payload(SESSION_OBJ)
->withMethod('PUT')
->withQueryParam('sdkId', '<YOTI_CLIENT_SDK_ID>')
->build()
//get Yoti Response
->execute();

// * For JSON data in Version >3 please use Payload::fromJsonData(SESSION_OBJ)
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 generate_session():
payload_string = json.dumps(data).encode()
signed_request = (
SignedRequest
.builder()
.with_pem_file("https://api.yoti.com/sandbox/idverify/v1")
.with_base_url("<BASE_URL>")
.with_endpoint("/sessions/<SESSION_ID>/response-config")
.with_http_method("PUT")
.with_query_param("sdkId", "<YOTI_CLIENT_SDK_ID>")
.with_payload(payload_string)
.build()
)

# get Yoti response
byte[] RESPONSE_CONFIG = ...

try {
SignedRequest signedRequest = SignedRequestBuilder.newInstance()
.withKeyPair(<YOTI_KEY_FILE_PATH>)
.withBaseUrl("https://api.yoti.com/sandbox/idverify/v1")
.withEndpoint("/sessions/<SESSION_ID>/response-config")
.withPayload(RESPONSE_CONFIG)
.withHttpMethod("PUT")
.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"
)
key, _ := ioutil.ReadFile("<YOTI_KEY_FILE_PATH>")
// Create session
request, _ := requests.SignedRequest{
HTTPMethod: http.MethodPut,
BaseURL: "https://api.yoti.com/sandbox/idverify/v1",
Endpoint: "/sessions/<SESSION_ID>/response-config",
Params: map[string]string{
"sdkId": "<YOTI_CLIENT_SDK_ID>"
},
Headers: map[string][]string{
"Content-Type": {"application/json"},
"Accept": {"application/json"}
},
Body: func(data []byte, _ error) []byte {
return data
}(json.Marshal(jsonobj{ data },
})),
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using Yoti.Auth.Web;

HttpClient httpClient = new HttpClient();
StreamReader privateKeyStream = System.IO.File.OpenText("PEM_FILE_PATH");

string serializedRequest = Newtonsoft.Json.JsonConvert.SerializeObject(new
PAYLOAD);

byte[] byteContent = Encoding.UTF8.GetBytes(serializedRequest);

Uri _baseUrl = new UriBuilder("https", "api.yoti.com", 443, "sandbox/idverify/v1").Uri;

Yoti.Auth.Web.Request ageScanRequest = new RequestBuilder()
.WithStreamReader(privateKeyStream)
.WithBaseUri(_baseUrl)
.WithEndpoint("/sessions/<SESSION_ID>/response-config")
.WithHttpMethod(HttpMethod.Post)
.WithContent(byteContent)

Example Response Config

{
"task_results": {
"ID_DOCUMENT_TEXT_DATA_EXTRACTION": [
{
"result_template": "SUCCESS"
}
]
},
"check_reports": {
"ID_DOCUMENT_AUTHENTICITY": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"ID_DOCUMENT_FACE_MATCH": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"LIVENESS": [
{
"liveness_type": "STATIC",
"response_delay": 5,
"result": {
{
"task_results": {
"ID_DOCUMENT_TEXT_DATA_EXTRACTION": [
{
"result_template": "SUCCESS"
}
]
},
"check_reports": {
"ID_DOCUMENT_AUTHENTICITY": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"ID_DOCUMENT_FACE_MATCH": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"LIVENESS": [
{
"liveness_type": "STATIC",
"response_delay": 5,
"result": {
{
"task_results": {
"ID_DOCUMENT_TEXT_DATA_EXTRACTION": [
{
"result_template": "SUCCESS"
}
]
},
"check_reports": {
"ID_DOCUMENT_AUTHENTICITY": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"ID_DOCUMENT_FACE_MATCH": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"LIVENESS": [
{
"liveness_type": "STATIC",
"response_delay": 5,
{
"task_results": {
"ID_DOCUMENT_TEXT_DATA_EXTRACTION": [
{
"result_template": "SUCCESS"
}
]
},
"check_reports": {
"ID_DOCUMENT_AUTHENTICITY": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"ID_DOCUMENT_FACE_MATCH": [
{
"result": {
"report_template": "SUCCESS"
}
}
],
"WATCHLIST_SCREENING":{
"result": {
"report_template": "SUCCESS"
}
},

On completion of this API request, you will simply receive a 200 response.