Create a session

AI Tools

To use Age estimation with Headless Age verification service (AVS), you will first need to create a session with age_estimation method enabled.

HTTP
Copy
HeaderDescription
AuthorizationAPI Key for the Yoti Age Verification API. Should be sent as Bearer {{API_TOKEN}} .
Content-Typeapplication/json
Yoti-SDK-IdYour unique Yoti-Sdk-Id (uuid)

The age verification API uses an HTTP authentication scheme called ‘bearer authentication’. This involves security tokens called ‘bearer tokens’. They are the predominant type of access token used with OAuth 2.0. A resource should interpret a bearer token as "Give the bearer of this token access". The client must send this token in the Authorization header when making requests to protected resources.

It is important that your API Key remains strictly confidential. It must be stored securely. We advise that you never commit any code containing your API Key, and never share it beyond the authorised party.

If you believe your API key has been compromised, please generate new API keys in the hub asap.

Request Body

JSON
Copy
ParameterTypeValueDescription
allowedboolean

TRUE/

FALSE

Enable the age estimation method for the user to use.
thresholdintegere.g. 21Age threshold for under/over age limits. We recommend that this threshold be more than the age you want to set as your barrier to entry.
levelstringPASSIVE

The level of anti-spoofing for each age verification method.

PASSIVE enables a passive liveness test for age estimation.

typetype

OVER/

UNDER/AGE

OVER - If the user is OVER the age threshold (e.g., over 21).

UNDER - If the user is UNDER an age threshold (e.g., under 21).

AGE - This will return the estimated AGE of the user (e.g, if the user is estimated to be 25, we will return 25).

ttlstring (in seconds)e.g. 900

Configure how long the session is valid for. The user will need to complete this before the ttl expires. Minimum value: 60 (1 minute)

Maximum value: 2592000 (1 month)

Response

If the request is successful and a session is generated, the API will send a response in the form:

JSON
Copy

Below are the different statuses Yoti returns:

StatusExplanation
PENDINGUser has not started any checks.
IN_PROGRESSChecks have begun on the session, awaiting the result to be returned.
FAILThe session has been completed, and the user has failed to meet the age threshold. FAIL will be returned only for OVER and UNDER attempts.
COMPLETEThe session has been completed, the user has passed the required threshold, or an age has been returned. Always COMPLETE if AGE type is configured.
ERRORWe could not provide an age result or calculate the threshold. This may be because the face was not recognised during age estimation, or if the ID document was processed via Doc Scan, but we do not believe that it is a genuine document.
CANCELLEDThe user no longer wishes to prove their age and aborts the session.
EXPIREDThe session has expired and is no longer usable.

Error Codes

Error codeDescription
201Success
400Missing field(s) in the request body
401Missing or unknown SDK ID
403Incorrect API key
409Verification check already in progress
410Session has already expired for the current check
VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches