Title
Page icon
Create new category
Edit page index title
Edit category
Edit link
Integration guide
This guide outlines how to configure and retrieve results in the Yoti Age Verification Sandbox. You can simulate user activity via the Sandbox interface or bypass the UI by using API calls to mock responses.
The implementation steps are as follows:
Generate the access token for authorization (bearer)
Create an age verification sandbox session
Mock the Yoti response
Launch the Yoti client-side interface for the user (alternative)
Subscribe to Webhook notifications (optional)
Retrieve results from the Yoti API
Authorization
All API calls will be made using an OAuth Access Token as a bearer token.
The required steps to generate this Access Token and make API calls to Yoti are as follows:
Generate or Register a Private Key Pair
Generate a JWT token using a Yoti private key (.pem file)
Acquire an OAuth Access Token using this JWT Token
Send an API request to Yoti
A token can be reused for multiple requests. There is a limit of 200 active tokens per service/SDK ID. We advise that you use one key for all calls within a scope and obtain a new token every 30 minutes.
You must NOT use a new token for every request.
Getting a Private Key Pair
You will need to create a Yoti sandbox service and generate a private key pair. This will provide you with a .pem file and an SDK ID, which will be used in the subsequent steps.
Generating a JWT Token
We use the private_key_JWT client authentication method from OIDC Core. The JWT will be signed by the RSA private key of the service/SDK ID that you are authenticating as.
Header | Value | Description | |
|---|---|---|---|
alg | PS384 | Algorithm. We require the algorithm to be PS384. No other algorithms are accepted. | yes |
typ | JWT | Type. Must be the string value JWT. | yes |
The following claims must be present in the payload:
Claim | Value | Description | Mandatory? |
|---|---|---|---|
iss | sdk: <YOUR_SDK_ID> | Issuer. Must be set to the string “sdk:" || SDK ID, e.g. sdk:67d60fe2-5576-49ae-9ac9-ad76b232c5e1. | Yes |
sub | sdk: <YOUR_SDK_ID> | Subject. Must be set to the same value as iss | Yes |
aud | Audience. This must be the full URL for the OAuth client credentials grant endpoint. | Yes | |
jti | UUID string | JWT ID. We require a valid UTF-8 string of at least 16 bytes and at most 128 bytes (not characters) in length. Each JWT that is issued must use a different jti value; the authorization server will remember iss || jti | Yes |
exp | 1751700000 | Expiry time. The authorization server will refuse to grant client credentials if a request is processed after this time. The expiry time can be a maximum of 30 minutes in the future. | Yes |
iat | 1751700000 | OPTIONAL. Issued at. The authorization server will refuse to grant client credentials if this value is unreasonably far in the past. We have a threshold of 30 minutes | No |
nbf | 1751700000 | OPTIONAL. Not before. The authorization server will refuse to grant client credentials if the request arrives before the “not before” time. | No |
Example
Response
OAuth Token Grant
Once you have generated a JWT token, this can be used to grant an OAuth Access Token to be used for Yoti API calls.
You must request this from the Yoti authorization server. The request method is POST, and the body from the client must be encoded with the application/x-www-form-urlencoded content type.
The request must include the following form values:
Header | Value | Description |
|---|---|---|
grant_type | client_credentials | OAuth grant type |
scope | avs:sessions:create | A space-separated list of one or more scopes that the token will grant access for. |
client_assertion_type | urn:ietf:params:oauth:client-assertion-type:jwt-bearer | The OAuth client assertion type |
client_assertion | JWT value | The value of the JWT token |
comment | “production_key” | Must be valid UTF-8, limited to 128 characters, and comprise only Unicode printable characters. |
Examples
Response
The access token will be used as the bearer token to authenticate your API requests.
Errors
Due to the OAuth RFC, we will only return 400 or 403 error codes. Details of the error will be found in the response.
Error Code | Details |
|---|---|
400 | Bad Request |
403 | Forbidden |
Got a question? Contact us here.