Quick start

AI Tools

We suggest you read through the step by step integration guide to understand the integration in detail. Please see below for example code snippets and example projects.

Before you start
You will need to access your Yoti Hub account with an e-mail & password or using the Yoti mobile app and to have registered your business with Yoti. Click below for more info.

Example code

Below is an example complete request snippet in different languages.

Hint We suggest you read through the full documentation first.

Install the Yoti SDK

npm install -S -E yoti
// If you are using Maven, add the following dependency: <dependency> <groupId>com.yoti</groupId> <artifactId>yoti-sdk-api</artifactId> <version>3.0.0</version> </dependency> // If you are using Gradle, add the following dependency: compile group: 'com.yoti', name: 'yoti-sdk-api', version: ‘3.0.0'
// Get the Yoti PHP SDK library via a Composer package composer require yoti/yoti-php-sdk
pip install yoti
// To install the Yoti NuGet package you will need to install NuGet. // To import the latest Yoti SDK into your project, enter the following // command from NuGet Package Manager Console in Visual Studio: Install-Package Yoti // For other installation methods, see https://www.nuget.org/packages/Yoti
// As of version 2.4.0, modules are used. This means it's not necessary to get a copy or fetch all dependencies // as instructed below, as the Go toolchain will fetch them as necessary. // You can simply add a `require github.com/getyoti/yoti-go-sdk/v3` to go.mod. // To download and install the Yoti SDK and its dependencies, run the following command from your terminal: go get "github.com/getyoti/yoti-go-sdk/v3”
gem install yoti # The gem provides a configuration generator for Ruby on Rails: rails generate yoti:install
// If you are using Maven, add the following dependency: <dependency> <groupId>com.yoti</groupId> <artifactId>yoti-sdk-impl</artifactId> <version>2.12.0</version> </dependency> // If you are using Gradle, add the following dependency: compile group: 'com.yoti', name: 'yoti-sdk-impl', version: ‘2.12.0'
const yoti = require('yoti') const CLIENT_SDK_ID = 'YOTI_CLIENT_SDK_ID' const PEM_PATH = 'YOTI_KEY_FILE_PATH' const PEM_KEY = fs.readFileSync(PEM_PATH) // For SDK version < 3 const yotiClient = new yoti(CLIENT_SDK_ID, PEM) // For SDK version >= 3 const yotiClient = new yoti.Client(CLIENT_SDK_ID, PEM_KEY)
import java.io.File; import com.yoti.api.client.ActivityDetails; import com.yoti.api.client.Date; import com.yoti.api.client.FileKeyPairSource; import com.yoti.api.client.HumanProfile; import com.yoti.api.client.HumanProfile.Gender; import com.yoti.api.client.Image; import com.yoti.api.client.YotiClient; import com.yoti.api.client.YotiClientBuilder; YotiClient client = YotiClient.builder() .withClientSdkId(<YOTI_CLIENT_SDK_ID>) .withKeyPair(FileKeyPairSource.fromFile(new File("<YOTI_KEY_FILE_PATH>"))) .build();
<?php require_once './vendor/autoload.php'; $client = new \Yoti\YotiClient('YOTI_CLIENT_SDK_ID', 'YOTI_KEY_FILE_PATH');
from yoti_python_sdk import Client client = Client(YOTI_CLIENT_SDK_ID, YOTI_KEY_FILE_PATH)
const string SDK_ID = "YOTI_CLIENT_SDK_ID"; const string PEM_PATH = "YOTI_KEY_FILE_PATH"; var privateKeyStream = System.IO.File.OpenText(PEM_PATH); var yotiClient = new YotiClient(SDK_ID, privateKeyStream);
sdkID := "YOTI_CLIENT_SDK_ID"; key, _ := ioutil.ReadFile("YOTI_KEY_FILE_PATH") client, err := yoti.NewClient(sdkId, key)
Yoti.configuration do |c| c.yoti_client_sdk_id = ENV['YOTI_CLIENT_SDK_ID'] c.yoti_key_file_path = ENV['YOTI_KEY_FILE_PATH'] end # or Yoti.configuration do |c| c.yoti_client_sdk_id = ENV['YOTI_CLIENT_SDK_ID'] c.yoti_key = ENV['YOTI_KEY'] end # Where *YOTI_KEY* is an environment variable that stores the content of the secret key: # YOTI_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIIEp…"
import java.io.File; import com.yoti.api.client.ActivityDetails; import com.yoti.api.client.Date; import com.yoti.api.client.FileKeyPairSource; import com.yoti.api.client.HumanProfile; import com.yoti.api.client.HumanProfile.Gender; import com.yoti.api.client.Image; import com.yoti.api.client.YotiClient; import com.yoti.api.client.YotiClientBuilder; YotiClient client = YotiClientBuilder.newInstance() .forApplication(<YOTI_CLIENT_SDK_ID>) .withKeyPair(FileKeyPairSource.fromFile(new File("<YOTI_KEY_FILE_PATH>"))) .build();

Yoti QR button

You can add the Yoti QR button to your site using either the JavaScript (JS) approach or the NPM module method. The JS method uses a script tag and global object, while the NPM approach lets you install the package and use imports. See below for both examples, and feel free to look at our other examples.

<!-- Simple Modal Button Generation --> <head> <script src="https://www.yoti.com/share/client/"></script> </head> <body> <!-- Yoti element will be rendered inside this DOM node --> <div id="xxx"></div> <!-- This script snippet will also be required in your HTML body --> <script> window.Yoti.Share.init({ elements: [ { domId: "xxx", scenarioId: "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", clientSdkId: "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", displayLearnMoreLink: true, } ] }); </script> </body>
// Install the Yoti Share Client Core module npm install @getyoti/share-client-core // Import and use in your JavaScript/TypeScript project import { startYotiModalShare } from '@getyoti/share-client-core'; await startYotiModalShare({ clientSdkId: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', domId: 'xxx', controls: { scenarioId: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', } }); // Note: Make sure to have a <div id="xxx"></div> in your HTML

Retrieve profile

yotiClient.getActivityDetails(oneTimeUseToken) .then((activityDetails) => { const rememberMeId = activityDetails.getRememberMeId(); const parentRememberMeId = activityDetails.getParentRememberMeId(); const receiptId = activityDetails.getReceiptId(); const timestamp = activityDetails.getTimestamp(); const profile = activityDetails.getProfile(); const applicationProfile = activityDetails.getApplicationProfile(); const selfieImageData = profile.getSelfie().getValue(); const base64SelfieUri = profile.getSelfie().getValue().getBase64Content(); const fullName = profile.getFullName().getValue(); const familyName = profile.getFamilyName().getValue(); const givenNames = profile.getGivenNames().getValue(); const phoneNumber = profile.getPhoneNumber().getValue(); const emailAddress = profile.getEmailAddress().getValue(); const dateOfBirth = profile.getDateOfBirth().getValue(); const postalAddress = profile.getPostalAddress().getValue(); const structuredPostalAddress = profile.getStructuredPostalAddress().getValue(); const gender = profile.getGender().getValue(); const nationality = profile.getNationality().getValue(); const ageVerifications = profile.getAgeVerifications(); const ageVerified = profile.findAgeVerification('age_over:', 18).getValue(); // or 'age_under:' const documentDetails = profile.getDocumentDetails().getValue(); const applicationName = applicationProfile.getName().getValue(); const applicationUrl = applicationProfile.getUrl().getValue(); const applicationLogo = applicationProfile.getLogo().getValue(); const applicationReceiptBgColor = applicationProfile.getReceiptBgColor().getValue(); // You can retrieve the sources and verifiers for each attribute as follows const givenNamesObj = profile.getGivenNames() const givenNamesSources = givenNamesObj.getSources(); // list/array of anchors const givenNamesVerifiers = givenNamesObj.getVerifiers(); // list/array of anchor // You can also retrieve further properties from these respective anchors in the following way: // Retrieving properties of the first anchor const value = givenNamesSources[0].getValue(); // string const subtype = givenNamesSources[0].getSubType(); // string const timestamp = givenNamesSources[0].getSignedTimeStamp().getTimestamp(); // Date object const originServerCerts = givenNamesSources[0].getOriginServerCerts(); // list of X509 certificates })
ActivityDetails activityDetails = client.getActivityDetails(oneTimeUseToken); HumanProfile profile = activityDetails.getUserProfile(); ApplicationProfile applicationProfile = activityDetails.getApplicationProfile(); String rememberMeId = activityDetails.getRememberMeId(); String parentRememberMeId = activityDetails.getParentRememberMeId(); Date timestamp = activityDetails.getTimestamp(); String receiptId = activityDetails.getReceiptId(); Image selfie = profile.getSelfie().getValue(); String selfieBase64Content = selfie.getBase64Content(); String fullName = profile.getFullName().getValue(); String givenNames = profile.getGivenNames().getValue(); String familyName = profile.getFamilyName().getValue(); String phoneNumber = profile.getPhoneNumber().getValue(); String emailAddress = profile.getEmailAddress().getValue(); Date dateOfBirth = profile.getDateOfBirth().getValue(); String gender = profile.getGender().getValue(); String address = profile.getPostalAddress().getValue(); String nationality = profile.getNationality().getValue(); AgeVerification over18Verification = profile.findAgeOverVerification(18); if (over18Verification != null) { boolean isAgedOver18 = over18Verification.getResult(); } AgeVerification under55Verification = profile.findAgeUnderVerification(55); if (under55Verification != null) { boolean isAgedUnder55 = under55Verification.getResult(); } Map<?, ?> structuredPostalAddress = profile.getStructuredPostalAddress().getValue(); DocumentDetails documentDetails = profile.getDocumentDetails().getValue(); String applicationName = applicationProfile.getApplicationName().getValue(); String applicationUrl = applicationProfile.getApplicationUrl().getValue(); Image applicationLogo = applicationProfile.getApplicationLogo().getValue(); String applicationReceiptBgColor = applicationProfile.getApplicationReceiptBgColor().getValue(); // You can retrieve the sources and verifiers for each attribute as follows: Attribute<String> givenNamesAttr = profile.getGivenNames(); List<Anchor> givenNamesSources = givenNamesAttr.getSources(); List<Anchor> givenNamesVerifiers = givenNamesAttr.getVerifiers(); List<Anchor> givenNamesAnchors = givenNamesAttr.getAnchors(); // You can also retrieve further properties from these respective anchors in the following way: // Retrieving properties of the first anchor Anchor firstSourceAnchor = givenNamesSources.get(0); String type = firstSourceAnchor.getType(); String value = firstSourceAnchor.getValue(); String subType = firstSourceAnchor.getSubType(); SignedTimestamp signedTimestamp = firstSourceAnchor.getSignedTimestamp(); List<X509Certificate> originCertificates = firstSourceAnchor.getOriginCertificates(); // list of X509 certificates
<?php $activityDetails = $client->getActivityDetails($oneTimeUseToken); rememberMeId = $activityDetails->getRememberMeId(); parentRememberMeId = $activityDetails->getParentRememberMeId(); $profile = $activityDetails->getProfile(); $applicationProfile = $activityDetails->getApplicationProfile(); $selfieImageObj = $profile->getSelfie()->getValue(); $selfieImageBase64Content = $selfieImageObj->getBase64Content(); $fullName = $profile->getFullName()->getValue(); $givenNames = $profile->getGivenNames()->getValue(); $familyName = $profile->getFamilyName()->getValue(); $phoneNumber = $profile->getPhoneNumber()->getValue(); $emailAddress = $profile->getEmailAddress()->getValue(); $dateOfBirth = $profile->getDateOfBirth()->getValue(); $postalAddress = $profile->getPostalAddress()->getValue(); $structuredPostalAddress = $profile->getStructuredPostalAddress()->getValue(); $gender = $profile->getGender()->getValue(); $nationality = $profile->getNationality()->getValue(); $ageVerifications = $profile->getAgeVerifications(); $ageUnderVerification = $profile->findAgeUnderVerification($age); $ageOverVerification = $profile->findAgeOverVerification($age); $documentDetails = $profile->getDocumentDetails()->getValue(); $applicationName = $applicationProfile->getApplicationName()->getValue(); $applicationUrl = $applicationProfile->getApplicationUrl()->getValue(); $applicationLogo = $applicationProfile->getApplicationLogo()->getValue(); $applicationReceiptBgColor = $applicationProfile->getApplicationReceiptBgColor()->getValue(); // You can retrieve the sources and verifiers for each attribute as follows: $givenNamesObj = $profile->getGivenNames(); $givenNamesSources = $givenNamesObj->getSources(); // list of anchors $givenNamesVerifiers = $givenNamesObj->getVerifiers(); // list of anchors // You can also retrieve further properties from these respective anchors in the following way: // Retrieving properties of the first anchor $value = $givenNamesSources[0]->getValue(); // string $subType = $givenNamesSources[0]->getSubType(); // string $timeStamp = $givenNamesSources[0]->getSignedTimeStamp()->getTimestamp(); // DateTime object $originServerCerts = $givenNamesSources[0]->getOriginServerCerts(); // list of X509 certificates
activity_details = client.get_activity_details(oneTimeUseToken) profile = activity_details.profile selfie = profile.selfie.value given_names = profile.given_names.value family_name = profile.family_name.value full_name = profile.full_name.value phone_number = profile.phone_number.value date_of_birth = profile.date_of_birth.value postal_address = profile.postal_address.value structured_postal_address = profile.structured_postal_address.value gender = profile.gender.value nationality = profile.nationality.value remember_me_id = activity_details.user_id base64_selfie_uri = activity_details.base64_selfie_uri # You can retrieve the anchors, sources and verifiers for each attribute as follows: given_names_attribute = profile.given_names given_names_anchors = given_names_attribute.anchors given_names_sources = given_names_attribute.sources given_names_verifiers = given_names_attribute.verifiers # You can also retrieve further properties from these respective anchors in the following way: source_anchor = given_names_sources[0] value = source_anchor.value sub_type = source_anchor.sub_type timestamp = source_anchor.signed_timestamp origin_server_certs = source_anchor.origin_server_certs
ActivityDetails activityDetails = yotiClient.GetActivityDetails(oneTimeUseToken); YotiProfile profile = activityDetails.Profile; Image selfie = profile.Selfie?.GetValue(); string selfieURI = profile.Selfie?.GetValue().GetBase64URI(); string fullName = profile.FullName?.GetValue(); string givenNames = profile.GivenNames?.GetValue(); string familyName = profile.FamilyName?.GetValue(); string mobileNumber = profile.MobileNumber?.GetValue(); string emailAddress = profile.EmailAddress?.GetValue(); DateTime? dateOfBirth = profile.DateOfBirth?.GetValue(); string address = profile.Address?.GetValue(); Dictionary<string, Newtonsoft.Json.Linq.JToken> structuredPostalAddress = profile.StructuredPostalAddress?.GetValue(); string gender = profile.Gender?.GetValue(); string nationality = profile.Nationality?.GetValue(); Yoti.Auth.Document.DocumentDetails documentDetails = profile.DocumentDetails?.GetValue(); bool? isAgedOver18 = profile.FindAgeOverVerification(18)?.Result(); bool? isAgedUnder55 = profile.FindAgeUnderVerification(55)?.Result(); // You can retrieve the anchors, sources and verifiers for each attribute as follows: using System.Linq; using System.Security.Cryptography.X509Certificates; using Yoti.Auth.Anchors; List<Anchor> givenNamesAnchors = profile.GivenNames.GetAnchors(); List<Anchor> givenNamesSources = profile.GivenNames.GetSources(); List<Anchor> givenNamesVerifiers = profile.GivenNames.GetVerifiers(); // You can also retrieve further properties from these respective anchors in the following way: Anchor givenNamesFirstSource = profile.GivenNames.GetSources().First(); AnchorType anchorType = givenNamesFirstSource.GetAnchorType(); List<X509Certificate2> originServerCerts = givenNamesFirstSource.GetOriginServerCerts(); byte[] signature = givenNamesFirstSource.GetSignature(); DateTime signedTimeStamp = givenNamesFirstSource.GetSignedTimeStamp().GetTimestamp(); string subType = givenNamesFirstSource.GetSubType(); string value = givenNamesFirstSource.GetValue();
activityDetails, err := client.GetActivityDetails(yotiOneTimeUseToken) rememberMeID := activityDetails.RememberMeID() parentRememberMeID := activityDetails.ParentRememberMeID() userProfile := activityDetails.UserProfile selfie := userProfile.Selfie().Value().Data() givenNames := userProfile.GivenNames().Value() familyName := userProfile.FamilyName().Value() fullName := userProfile.FullName().Value() mobileNumber := userProfile.MobileNumber().Value() emailAddress := userProfile.EmailAddress().Value() address := userProfile.Address().Value() gender := userProfile.Gender().Value() nationality := userProfile.Nationality().Value() var dateOfBirth *time.Time dobAttr, err := userProfile.DateOfBirth() if err != nil { // handle error } else { dateOfBirth = dobAttr.Value() } var structuredPostalAddress map[string]interface{} structuredPostalAddressAttribute, err := userProfile.StructuredPostalAddress() if err != nil { // handle error } else { structuredPostalAddress = structuredPostalAddressAttribute.Value() } // If you have chosen Verify Condition on the Yoti Dashboard with the age condition of "Over 18", // you can retrieve the user information with the generic .GetAttribute method, which requires the // result to be cast to the original type: age_over := userProfile.GetAttribute("age_over:18").Value().(string) // GetAttribute returns an interface, the value can be acquired through a type assertion. // From each attribute you can retrieve the Anchors, and subsets Sources and Verifiers // (all as []*anchor.Anchor) as follows: givenNamesAnchors := userProfile.GivenNames().Anchors() givenNamesSources := userProfile.GivenNames().Sources() givenNamesVerifiers := userProfile.GivenNames().Verifiers() // You can also retrieve further properties from these respective anchors in the following way: var givenNamesFirstAnchor *anchor.Anchor = givenNamesAnchors[0] var anchorType anchor.Type = givenNamesFirstAnchor.Type() var signedTimestamp *time.Time = givenNamesFirstAnchor.SignedTimestamp().Timestamp() var subType string = givenNamesFirstAnchor.SubType() var value string = givenNamesFirstAnchor.Value()
yoti_activity_details = Yoti::Client.get_activity_details(oneTimeUseToken) remember_me_id = yoti_activity_details.remember_me_id parent_remember_me_id = yoti_activity_details.parent_remember_me_id receipt_id = yoti_activity_details.receipt_id timestamp = yoti_activity_details.timestamp base64_selfie_uri = yoti_activity_details.base64_selfie_uri age_verified = yoti_activity_details.age_verified profile = yoti_activity_details.profile application_profile = yoti_activity_details.application_profile selfie_image_data = profile.selfie.value full_name = profile.full_name.value given_names = profile.given_names.value family_name = profile.family_name.value phone_number = profile.phone_number.value email_address = profile.email_address.value date_of_birth = profile.date_of_birth.value postal_address = profile.postal_address.value structured_postal_address = profile.structured_postal_address.value gender = profile.gender.value nationality = profile.nationality.value application_name = application_profile.name.value application_url = application_profile.url.value application_logo = application_profile.logo.value application_receipt_bgcolor = application_profile.receipt_bgcolor.value # You can retrieve the sources and verifiers for each attribute as follows: given_names_obj = profile.given_names given_names_sources = given_names_obj.sources # list of anchors given_names_verifiers = given_names_obj.verifiers # list of anchors given_names_anchors = given_names_attribute.anchors # You can also retrieve further properties from these respective anchors in the following way: # Retrieving properties of the first anchor type = given_names_sources[0].type # string value = given_names_sources[0].value # string sub_type = given_names_sources[0].sub_type # string time_stamp = given_names_sources[0].signed_time_stamp.time_stamp # DateTime object origin_server_certs = given_names_sources[0].origin_server_certs # list of X509 certificates

Web examples

Our GitHub pages are listed below for the Digital ID Integration. Please select your preferred language to continue.


Identity access management platform

We have built a node (or marketplace app) for ForgeRock BackStage. This means that companies that have integrated with ForgeRock can simply integrate the Yoti node, which is already compatible with ForgeRock Access Manager. Now the many organisations that use ForgeRock can quickly integrate with Yoti, using it to sign in to their platforms or verify their users.