Configure response

AI Tools

Instead of relying on the Yoti default sandbox response, integrators can configure which checks pass or fail and specify the failure reasons within a session. This is done using an object that includes defined task_results and check_reports.

Endpoint

https://api.yoti.com/sandbox/idverify/v1/sessions/{sessionId}/response-config

Code examples

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(RESPONSE_CONFIG_OBJ) ->withMethod('PUT') ->withQueryParam('sdkId', '<YOTI_CLIENT_SDK_ID>') ->build() //get Yoti Response ->execute();
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 response = signed_request.execute() response_payload = json.loads(response.text)
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(); }// Click to edit code
import ( "io/ioutil" "net/http" "github.com/getyoti/yoti-go-sdk/v3/requests" ) key, _ := ioutil.ReadFile("<YOTI_KEY_FILE_PATH>") // Create session request, _ := requests.SignedRequest{ HTTPMethod: http.MethodPut, BaseURL: "<BASE_URL>", 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 }, })), }.WithPemFile(key).Request() //get Yoti response response, _ := http.DefaultClient.Do(request)

Example Response Configuration

{ "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": { "report_template": "SUCCESS" } } ] } }

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

In the sandbox you can configure both successful outcomes and unsuccessful outcomes of checks & tasks to mock multiple different scenarios. The below tables outlines the different scenarios that can be mocked.

Tasks

Task

Report template

Description

ID_DOCUMENT_TEXT_DATA_EXTRACTION

SUCCESS

This simulates a successful automated data extraction task.

ID_DOCUMENT_TEXT_DATA_EXTRACTION

UNSUPPORTED_DOCUMENT

This simulates an unsuccessful automated data extraction task.

ID_DOCUMENT_TEXT_DATA_EXTRACTION

DOCUMENT_IS_EXPIRED

This simulates a unsuccessful automated data extraction task.

ID_DOCUMENT_TEXT_DATA___EXTRACTION

UNABLE_TO_OCR

This simulates a unsuccessful automated data extraction task.

Check

Report template

Description

ID_DOCUMENT_AUTHENTICITY

SUCCESS

This simulates a "APPROVE" outcome for the document authenticity check

ID_DOCUMENT_AUTHENTICITY

TAMPERED

This simulates a "REJECT" outcome for the document authenticity check, due to a fraudulent document.

ID_DOCUMENT_AUTHENTICITY

DOCUMENT_COPY

This simulates a "REJECT" outcome for the document authenticity check, due to an image of a document being used instead of a live capture.

ID_DOCUMENT_AUTHENTICITY

PHOTO_TOO_BLURRY

This simulates a "NOT_AVAILABLE" outcome for the document authenticity check, due a blurry image.

ID_DOCUMENT_AUTHENTICITY

FRAUD_LIST_MATCH

This simulates a "REJECT" outcome for the document authenticity check, due to a fraudulent document.

ID_DOCUMENT_AUTHENTICITY

GLARE_OBSTRUCTION

This simulates a "NOT_AVAILABLE" outcome for the document authenticity check, due to glare obstruction.

ID_DOCUMENT___FACE_MATCH

SUCCESS

This simulates a "APPROVE" outcome for the face match check.

ID_DOCUMENT_FACE_MATCH

AUTO_FAIL

This simulates a "REJECT" outcome for the face match check. With the automated sub check failing.

ID_DOCUMENT_FACE_MATCH

MANUAL_FAIL

This simulates a "REJECT" outcome for the face match check. With the manual sub check failing.

ID_DOCUMENT_FACE_MATCH

FAIL

This simulates a "REJECT" outcome for the face match check. With both the automated and the manual sub check failing.

ID_DOCUMENT_TEXT_DATA___CHECK

SUCCESS

This simulates a "APPROVE" outcome for the data extraction manual check.

ID_DOCUMENT_TEXT_DATA_CHECK

EXTRACTION_FAILED

This simulates a "NOT_AVAILABLE" outcome for the data extraction manual check.

LIVENESS

SUCCESS

This simulates a "APPROVE" outcome for the liveness check.

LIVENESS

FAIL

This simulates a "REJECT" outcome for the liveness check.

Related resources