Get age estimation
Below are the end points and integration configuration you need to integrate.
The image requirements to use Age Scan are:
- Yoti only accepts JPEG’s encoded as a base64 image
- Base64 body must be below 100KB (~70KB JPEG)
- The minimum face dimensions we accept is 96 x 96 pixels
Get Age Estimation
After completing the Yoti onboarding, you will need to complete authentication for the API by using the Yoti SDK to simplify the process for requesting to Yoti. The Yoti SDKs are available via popular dependency management systems. Further details can be found on the pages of the specific projects.
npm install -S -E yoti
Once you have added the Yoti SDK dependency to your project, you can use it to build and send your request. See the code snippets below for examples.
const { RequestBuilder, Payload } = require('yoti');
const request = new RequestBuilder()
.withBaseUrl('https://api.yoti.com/api/v1/age-verification')
.withPemFilePath('<YOTI_KEY_FILE_PATH>')
.withEndpoint('/checks')
.withPayload(new Payload(data))
.withMethod('POST')
.withHeader('X-Yoti-Auth-Id', '<YOTI_CLIENT_SDK_ID>')
.build();
//get Yoti response
const response = request.execute();
The request payload should be in the following format: This JSON string will be the data
parameter in the withPayload
above code snippet.
{
"data": "/9j/4AAQSkZJRgABAgAAAQABAAD/2wAcHNXCKigjEaYH51Me1Zy1Za0P/Z....",
}
Example responses
The response received from the API will be below:
The uncertainty value is a confidence score. Yoti recommends rejecting any response with an uncertainty greater than 6.0. Typically this indicates a problem with image capture.
{
"pred_age": 29.7475,
"uncertainty": 2.04677
}