Skip to main content

Face Detection

Detects and extracts faces from images. This endpoint can be used to identify and locate faces in images before performing liveness detection or face comparison.

Endpoint

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

Headers

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Params

NameTypeRequiredDescription
imagestringYesBase64 image data (data URI or raw base64). If an https URL is provided, it will be downloaded and converted internally.
return_landmarksbooleanNoWhether to return facial landmarks. Default: false.
return_attributesbooleanNoWhether to return face attributes (age, gender, etc.). Default: false.

Request

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

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

run();

Response

{
"id": "DETECT123",
"data": {
"faces": [
{
"bounding_box": {
"x": 100,
"y": 150,
"width": 200,
"height": 250
},
"confidence": 0.99,
"landmarks": {
"left_eye": {"x": 150, "y": 200},
"right_eye": {"x": 250, "y": 200},
"nose": {"x": 200, "y": 250},
"mouth": {"x": 200, "y": 300}
},
"attributes": {
"age": 30,
"gender": "male"
}
}
],
"face_count": 1
},
"signature": {
"message": "Certified by Verifik.co",
"dateTime": "January 16, 2024 3:44 PM"
}
}

Notes

  • image may be base64 or an https URL. If URL, the service fetches and converts it internally.
  • return_landmarks and return_attributes are optional and default to false for faster processing.
  • The response includes bounding boxes for all detected faces in the image.