API Authentication

AI Tools

This document will cover the steps required to send API requests using Yoti’s new Central Auth.

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:

  1. Generate a JWT token using a Yoti private key (.pem file)
  2. Acquire an OAuth Access Token using this JWT Token
  3. Send an API request to Yoti

A token can be reused for multiple requests - you must NOT use a new token for every request. 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 will need a Verified Yoti Organisation account and service set up with a Private PEM key and SDK ID.

Set this up by following this guide

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.

HeaderValueDescription
algPS384Algorithm. We require the algorithm to be PS384. No other algorithms are accepted.
typJWTType. Must be the string value JWT.

The following claims must be present in the payload:

ClaimValueDescription
isssdk: <YOUR_SDK_ID>Issuer. Must be set to the string “sdk:" || SDK ID, e.g. sdk:67d60fe2-5576-49ae-9ac9-ad76b232c5e1.
subsdk: <YOUR_SDK_ID>Subject. Must be set to the same value as iss
audhttps://api.example.comAudience. This must be the full URL for the OAuth client credentials grant endpoint.
jtiUUID stringJWT 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 authorisation server will remember iss || jti
exp1751700000Expiry time. The authorisation 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.
iat1751700000OPTIONAL. Issued at. The authorisation server will refuse to grant client credentials if this value is unreasonably far in the past. We have a threshold of 30 minutes
nbf1751700000OPTIONAL. Not before. The authorisation server will refuse to grant client credentials if the request arrives before the “not before” time.

Examples

Node.JS
.NET
Go
PHP
Copy

Response

JWT generated
Copy

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 authorisation server. The request method is POST, and the body from the client must be encoded with the application/x-www-form-urlencoded content type

HTTP
Copy

The request must include the following form values:

HeaderValueDescription
grant_typeclient_credentialsOAuth grant type
scopepoa:verifyA space-separated list of one or more scopes that the token will grant access for.
client_assertion_typeurn:ietf:params:oauth:client-assertion-type:jwt-bearerThe OAuth client assertion type
client_assertionJWT valueThe value of the JWT token
comment“production_key”Must be valid UTF-8, limited to 128 characters, and comprise only Unicode printable characters.

Examples

Node.Js
.NET
Go
PHP
Copy

Response

OAuth Token response
Copy

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 CodeDetails
400Bad Request
403Forbidden
JSON
Copy

SDKs

Methods have been added to the Yoti SDKs to generate the Access Tokens instead of the steps above.

PHP
Node.JS
Java
Go
.NET
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard