API reference

The following provides information about API endpoints, response and error codes.

Endpoints

You can create the age estimation and anti-spoofing request using the API:

EndpointDescription
POST https://api.yoti.com/ai/v1/self-checkout/age-antispoofingUse Yoti's Age estimation service and the Anti-spoofing check.

Headers

The API supports the following headers:

HeaderDescription
X-Yoti-Auth-IdSDK ID for the Yoti Hub application.
Terminal-IdUnique ID per machine. Mandatory for non-browser integrations.
Session-IdMay be provided to demonstrate multiple attempts are from a single user transaction. Optional.

Request

The JSON object body for the API request has the following structure:

JSON
Copy

Example request

A typical API request will have a JSON body similar to the following:

JSON
Copy

Response

The JSON object body returned from the API has the following structure:

JSON
Copy
ResponseExplained
Prediction - realYoti has detected a real user.
Prediction - fakeYoti has detected a spoof attempt.
Age - ageThe age estimation of the user.
Age - st_devThe st_dev value is an uncertainly value. Yoti recommends rejecting any response with an uncertainty greater than 6.0. Typically this indicates a problem with image capture. This should only be treated as a quality score.

Example response

The response received from the API will be similar to the following:

/self-checkout/age-antispoofing
Copy

Error codes

In case of any failure, you will receive the following error responses:

Error codeErrorDescription
404APP_NOT_FOUNDApplication app_id not found.
401INVALID_X_YOTI_AUTH_ID
  • X-Yoti-Auth-Id__header not provided.
  • auth id is not a valid uuid.
400INVALID_APP_IDApplication id cannot be empty.
400INVALID_PUBLIC_KEYApplication public key cannot be empty.
403DISABLED_APP_STATEApplication must be enabled.
400INVALID_ORG_IDOrganisation id cannot be empty.
400INVALID_BILLING_SOURCE_IDApplication billing source id cannot be empty.
404ORG_NOT_FOUNDOrganisation org_id not found.
401INVALID_YOTI_AUTH_DIGEST
  • X-Yoti-Auth-Digest header is missing.
  • X-Yoti-Auth-Digest is not base64 encoded.
401INVALID_NONCE
  • Nonce is missing. nonce parameter is mandatory
  • Provided nonce is not a valid uuid.
401INVALID_TIMESTAMP
  • Timestamp is missing. timestamp parameter is mandatory.
  • Provided timestamp is not a valid unix timestamp.
401INVALID_PUBLIC_KEY_ENCODINGFailed to load public key. key is not der encoded.
401UNSUPPORTED_ALGORITHMSerialised key is of a type that is not supported by the backend.
401INVALID_SIGNATUREFailed to verify signature.
403INVALID_ORG_STATUSOrganisation has an invalid status.
404INVALID_METADATA_DEVICEInvalid device metadata provided.
400INVALID_BODY_ENCODINGRequest body should be a valid JSON.
404INVALID_ENDPOINTThe endpoint request is invalid.
413PAYLOAD_TOO_LARGEPayload too large.
400IMAGE_NOT_PROVIDEDImage has not been provided.
400INVALID_B64_IMAGE
  • Base64 image is incorrectly padded.
  • Cannot create image from base64 decoded bytes
400UNSUPPORTED_IMAGE_FORMATImage format not supported. Please use JPEGs (95 to 100 quality) and PNGs.
400IMAGE_SIZE_TOO_BIGImage size too big, the maximum size is 1.5MB.
400IMAGE_SIZE_TOO_SMALLImage size too small, the minimum size is 50KB.
400MIN_HEIGHTThe image height is incorrect. Image minimum height required is 300 pixels.
400MAX_HEIGHTThe image height is incorrect. Image maximum height required is 2000 pixels.
400MIN_WIDTHThe image width is incorrect. Image minimum width required is 300 pixels.
400MAX_WIDTHThe image width is incorrect. Image maximum width required is 2000 pixels.
400MIN_PIXELSTo process the image the minimum number of pixels required is 90,000 pixels.
400MAX_PIXELSTo process the image the maximum number of pixels required is 2,100,000 pixels.
400IMAGE_WRONG_CHANNELSMissing colour channel, the input image must be RGB or RGBA.
400IMAGE_GRAYSCALE_NOT_SUPPORTEDGrayscale images not supported.
503SERVICE_UNAVAILABLEThe service is temporarily unavailable.
400FACE_NOT_FOUNDFace not found.
400MULTIPLE_FACESMultiple faces in the image provided.
400FACE_BOX_TOO_SMALLThe face in the image provided is too small.
400FACE_TO_IMAGE_RATIO_TOO_LOWFace ratio is lower than the minimum ratio.
400FACE_TO_IMAGE_RATIO_TOO_HIGHFace ratio is bigger than the maximum ratio.
400INSUFFICIENT_AREA_AROUND_THE_FACEInsufficient area around the face in the image provided.
400IMAGE_TOO_BRIGHTImage too bright..
400IMAGE_TOO_DARKImage too dark.
400INVALID_LEVEL_OF_ASSURANCEInvalid antispoofing level of assurance provided.
400INVALID_REQUEST_BODYRequest body is invalid, '-' field is invalid.
400INVALID_IMG_VALIDATION_LEVELThe image validation level is invalid.
401UNAUTHORIZEDThe X-Yoti-Auth-Id provided isn't authorized to access this resource.
500FAIL_PREDICTION
  • Age distribution is empty.
  • Standard deviation is empty.
  • Cannot build model result.
  • Antispoofing prediction failed.
500UNSPECIFIED_ERRORAn internal server error occurred.
400SECURE_REQUEST_IS_EMPTYSecure request field is empty.
400SECURE_SESSION_NOT_FOUNDSecure session not found.
400SECURE_SIGNATURE_NOT_FOUNDSecure signature not found.
400SECURE_VERSION_NOT_FOUNDSecure version not found.
400INVALID_SECURE_SIGNATUREFailed to verify secure session signature.
400SECURE_VERIFICATION_NOT_FOUNDSecure verification not found.
400UNTRUSTED_SECURE_SESSIONUntrusted secure session
401INVALID_SECURE_SESSIONInvalid secure session token.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard