Skip to content
On this page

Liveness Detection

foo

You've build your application, added the best and most exciting features, built out the kyc flow and maybe even included a process to collect a customer selfie and compare it to the image on their ID. You onboard your first customer named John Dorian and have a copy of John's ID and selfie on file. Only one problem, Although the ID card and the selfie you have is that of John, the person that you just onboarded is actually Frank and looks nothing like John. How can you ensure that the selfie you are collecting is that of John and not Frank holding up a photo of John to fool your KYC process ?

This is called Liveness Detection. Liveness detection is the use of Machine Learning to quickly and effectively distinguish between a real person sitting behind a camera and a person using a spoofed selfie ( photo of a photo, video replay, 3d mask, deepfake )

Endpoint

{BASE_URL}/face/liveness

Method: POST.

ParameterDescriptionRequired
faceA JPG,JPEG,PNG image of the user's face. Uploaded as FormDataTrue

Sample Request

curl --location --request POST 'https://api.stack-ft.com/face/liveness' \
--header 'Authorization: API_KEY' \
--form 'face=@"YOUR_IMAGE_LOCATION"'

Sample Successful Response

json
{
    "status": "success",
    "request_id": "e247b54d-32e7-4d58-9a0b-36580919d9bc",
    "liveness_info": {
        "angles": {
            "pitch": 3.662020683288574,
            "roll": -1.5799074172973633,
            "yaw": 2.9840621948242188
        },
        "box": {
            "h": 854,
            "w": 590,
            "x": 201,
            "y": 103
        },
        "result": "genuine_selfie",
        "score": 0.41137218475341797
    }
}

INFO

What you really should be looking for here is the score. Although we provide a result to guide your decision based on our internal thresholds, you are able to make your own decisions based on the score provided. It goes from -600 to 1 ( Anything above 0 is considered a genuine selfie). With this info, you are able to decide your own confidence level in your application.

Score Table and definition

scoreResult
0no_face_detected
> 0genuine_selfie
> -100 ... < 0spoofed_selfie
-100face_too_small_to_detect
-200face_out_of_bounds
-300face_not_aligned
-400face_is_covered
-500multiple_faces_detected
-600deepfake