Skip to main content

Liveness Detection

Endpoint

POST https://api.verifik.co/v2/face-recognition/liveness

Detects whether a submitted face image comes from a live person or a spoof (photo, screen replay, printed copy). Returns a liveness score and a pass/fail outcome based on a minimum score threshold.

Headers

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Params

NameTypeRequiredDescription
osstringYesOrigin of capture. Suggested: DESKTOP, IOS, ANDROID.
imagestringYesBase64 image data (data URI or raw base64). If an https URL is provided, it will be downloaded and converted internally.
collection_idstringNoOptional collection to associate with the liveness attempt.
liveness_min_scorenumberNoThreshold for pass/fail. Default: 0.6.

Request

const fetch = require("node-fetch");

async function run() {
const res = await fetch("https://api.verifik.co/v2/face-recognition/liveness", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_TOKEN}`,
},
body: JSON.stringify({
os: "DESKTOP",
image: "<base64 or https url>",
liveness_min_score: 0.6,
}),
});
console.log(await res.json());
}

run();

Response

{
"id": "JQ4RM",
"data": {
"passed": true,
"min_score": 0.6,
"liveness_score": 0.98
},
"signature": {
"message": "Certified by Verifik.co",
"dateTime": "January 16, 2024 3:44 PM"
}
}

Notes

  • Ensure Authorization: Bearer <token> is present; otherwise you will receive 401/403.
  • image may be base64 or an https URL. If URL, the service fetches and converts it internally.
  • Pass/fail is determined by liveness_score > min_score (default min_score is 0.6, configurable via liveness_min_score).
  • Optional collection_id is validated for the authenticated client.