API Usage

spoofsense-triton endpoints are optimised for speed and performance.

Walk through

Authentication

You will require x-api-key in order to use the API.

Contact kartikeya@spoofsense.com in case you do not already have it.

1. POST /antispoofing

Performs a Passive Liveness Check

https://z3jwq0rjyj.execute-api.ap-south-1.amazonaws.com/prod/antispoofing

Request body

{
    "data": "image_base64_string",          # base64 string of the image
}

Response

Understanding the Response

Following table shows the API responses and behaviours in different cases

HTTP Code
Type of Image
Raw Output

200

Live Face

{
    "success": true,
    "message": "Process finished successfully",
    "model_output": {
        "pred_idx": "real",
        "prob_real": 0.9997915625572205
}

200

Spoof Face

{
    "success": true,
    "message": "Process finished successfully",
    "model_output": {
        "pred_idx": "spoof",
        "prob_real": 0.00045343424235454
}

200

No Face

{
    "success": false,
    "message": "face not detected"
}

200

Bad Input

{
    "success": false,
    "message": "Invalid base64 string"
}

413

Image Size > 10MB

HTTP content length exceeded 10485760 bytes.

model_output

model_output contains everything needed to check for facial liveness

"pred_idx" refers to the predicted class of the face and has two possible values:

  • "real": A Live Face

  • "spoof": A Spoof Face / Presentation Attack

"prob_real" refers to the probability of the face being "real" (live). A score above 0.50 means the face is "real". A score less than 0.50 means the face is "spoof". "prob_real" metric should be used for writing the liveness check logic in your app. (Default Threshold 0.55)

Perform Liveness Check

if model_output[“prob_real”] > 0.55:

return “Liveness Confirmed”

else:

return “Liveness Failed”

Last updated