Title
Create new category
Edit page index title
Edit category
Edit link
Quick Start
We suggest you read through the step-by-step integration guide to understand the integration in detail. Please see below for a quick start example and example projects.
You will need to sign in to your Yoti Hub account using your email and password or the Yoti mobile app, and ensure your business is verified with Yoti.
Below is an example complete request snippet in different languages.
Install the SDK
npm install -S -E yotiCreate a session
This is an example showing:
- One document authenticity check
- Text extraction
- Liveness
- Face match.
const path = require('path');const fs = require('fs');const { IDVClient, SessionSpecificationBuilder, RequestedDocumentAuthenticityCheckBuilder, RequestedLivenessCheckBuilder, RequestedTextExtractionTaskBuilder, RequestedFaceMatchCheckBuilder, SdkConfigBuilder} = require('yoti');const YOTI_CLIENT_SDK_ID = 'YOTI_CLIENT_SDK_ID';const YOTI_PEM = fs.readFileSync(path.join(__dirname, '/path/to/pem'));const idvClient = new IDVClient(YOTI_CLIENT_SDK_ID, YOTI_PEM);// Document Authenticity Checkconst documentAuthenticityCheck = new RequestedDocumentAuthenticityCheckBuilder().build();// Liveness check with 3 retriesconst livenessCheck = new RequestedLivenessCheckBuilder() .forStaticLiveness() .withMaxRetries(3) .build();// Face Match Check with manual check set to fallbackconst faceMatchCheck = new RequestedFaceMatchCheckBuilder() .withManualCheckFallback() .build();// ID Document Text Extraction Task with manual check set to fallbackconst textExtractionTask = new RequestedTextExtractionTaskBuilder() .withManualCheckFallback() .build();// Configuration for the client SDK (Frontend)const sdkConfig = new SdkConfigBuilder() .withPresetIssuingCountry('GBR') .withSuccessUrl('/success') .withErrorUrl('/error') .build();// Buiding the Session with defined specification from aboveconst sessionSpec = new SessionSpecificationBuilder() .withClientSessionTokenTtl(600) .withResourcesTtl(604800) .withUserTrackingId('some-user-tracking-id') .withRequestedCheck(documentAuthenticityCheck) .withRequestedCheck(livenessCheck) .withRequestedCheck(faceMatchCheck) .withRequestedTask(textExtractionTask) .withSdkConfig(sdkConfig) .build();// Create SessionidvClient .createSession(sessionSpec) .then((session) => { const sessionId = session.getSessionId(); const clientSessionToken = session.getClientSessionToken(); const clientSessionTokenTtl = session.getClientSessionTokenTtl(); }) .catch((err) => { // handle err });Launch the user interface
The next step is to load the Yoti client SDK. After a session is created a session id and a session token is received, we then use these to construct a URL which loads the Yoti Client SDK:
https://api.yoti.com/idverify/v1/web/index.html?sessionID=<sessionID>&sessionToken=<sessionToken>Retrieve results
The final step is to retrieve the results of the verification. Session retrieval requires the session ID, that was generated from the create a session endpoint. Below is a basic example of what retrieving a session looks like:
// Returns a session resultidvClient.getSession(sessionId).then(session => { // Returns the session state const state = session.getState(); // Returns session resources const resources = session.getResources(); // Returns all checks on the session const checks = session.getChecks(); // Return specific check types const authenticityChecks = session.getAuthenticityChecks(); const faceMatchChecks = session.getFaceMatchChecks(); const textDataChecks = session.getTextDataChecks(); const livenessChecks = session.getLivenessChecks(); const watchlistScreeningChecks = session.getWatchlistScreeningChecks(); const watchlistAdvancedCaChecks = session.getWatchlistAdvancedCaChecks(); // Returns biometric consent timestamp const biometricConsent = session.getBiometricConsentTimestamp(); }).catch(error => { // handle error})Retrieve media
All data captured in an identity verification session can be fetched. Each data point is linked to a specific media id, the media id is then used in an API call to retrieve it's related media. Below is a basic example of what retrieving media looks like:
idvClient.getMediaContent(sessionId, mediaId).then(media => { const buffer = media.getContent();}).catch(error => { // handle error})Delete session and media
It is possible to delete a session or images (media). This can only be done once the session is completed.
Deleting the session will also delete all media from that session. It's also possible to delete a single piece of media. Deleting a media object will delete only that specific object, leaving the rest of the session untouched.
idvClient.deleteSession(sessionId).then(() => { // Session has been deleted}).catch(error => { // Error occured})idvClient.deleteMediaContent(sessionId, mediaId).then(() => { // Media has been deleted}).catch(error => { // Error occured})Got a question? Contact us here.