Skip to main content

Selfie Validation API

API Description

Objective

The Selfie Validation API, also known as the Liveness API, verifies if a user's selfie has been captured by a live individual at the time of the verification indicating no fraudulent impersonation attempt. It also supports additional configurations to suit your business requirements.

Did you know?

In a fraudulent "photo-on-photo" scenario, a fraudster attempts to use an existing photograph of a different individual to deceive the verification system.

API URL

https://<regionCode>.idv.hyperverge.co/v1/checkLiveness

API Endpoint

checkLiveness

Supported Regions (regionCode)

The API URL accepts any of the region codes listed in the table below as values for the regionCode placeholder.

RegionregionCode Value
Africazaf
Europeirl
Indiaind
Indonesiaidn
Singaporesgp
USAusa

For example, to use this API for India, the URL would be: "https://ind.idv.hyperverge.co/v1/checkLiveness"

Overview

The API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.

Authentication

You need a unique pair of application ID ( appId ) and application key (appKey) from HyperVerge to verify your identity for accessing the API.

API Request Details

Method - POST

Headers

ParameterMandatory or OptionalDescriptionValid Values
Content-typeMandatoryThe media type for the request payload.multipart/form-data
appIdMandatoryThe application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tab.This should be a unique value.
appKeyMandatoryThe application key shared by HyperVerge. You can find the details in the dashboard's credentials tab.This should be a unique value.
transactionIdMandatoryA unique identifier for tracking a user journey.This should be both unique and easily associated with the specific user's interaction in your application(s).

Inputs

The following table provides information on the parameters used in the request body for the API:

ParameterMandatory or OptionalDescriptionAllowed ValuesDefault Values
imageMandatoryThe selfie image file to be processedImage formats: JPG, JPEG, and PNGNot Applicable
returnCroppedImageURLOptionalWhen enabled, returns a signed URL of the cropped face image from the uploaded selfieyes, nono

Quality Checks

ParameterMandatory or OptionalDescriptionAllowed ValuesDefault Values
qualityChecks.blurOptionalFlag to perform blur detection on the imageyes, nono
qualityChecks.eyesClosedOptionalFlag to check if eyes are closed in the imageyes, nono
qualityChecks.occlusionOptionalFlag to check if the face is partially occluded by any object, hand, mask, or accessoryyes, nono
qualityChecks.multipleFacesOptionalFlag to detect multiple faces in the imageyes, nono
qualityChecks.headTurnedOptionalFlag to detect if the head is turned in the imageyes, nono
qualityChecks.hatOptionalFlag to check if the individual is wearing a hatyes, nono
qualityChecks.eyewearOptionalFlag to check if the individual is wearing any eyewearyes, nono
qualityChecks.readingGlassesOptionalFlag to check if the individual is wearing reading glassesyes, nono
qualityChecks.sunglassesOptionalFlag to check if the individual is wearing sunglassesyes, nono
qualityChecks.dullOptionalFlag to check if the selfie is under-exposedyes, nono
qualityChecks.brightOptionalFlag to check if the selfie is over-exposedyes, nono
qualityChecks.nonWhiteBackgroundOptionalFlag to check if the background is not whiteyes, nono
qualityChecks.nudityOptionalFlag to check the selfie for any explicit contentyes, nono
qualityChecks.lowQualityOptionalFlag to check if the overall image quality is too low for reliable processingyes, nono

Face Attribute Checks

ParameterMandatory or OptionalDescriptionAllowed ValuesDefault Values
ageRangeOptionalReturns the estimated age range of the individual in the selfieyes, nono
checkGenderOptionalReturns the estimated gender of the individual in the selfieyes, nono
Additional Checks

For a complete list of all quality checks, face attribute checks, and fraud checks, see our Additional Checks for Liveness page.
Depending on the checks enabled for your credentials, all or a subset of these checks would be available in your API response.

Request

The following is a sample cURL request for the API with all checks enabled:

curl --location 'https://<regionCode>.idv.hyperverge.co/v1/checkLiveness' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_transactionId>' \
--form 'image=@"<path_to_image>"' \
--form 'returnCroppedImageURL="yes"' \
--form 'qualityChecks.blur="yes"' \
--form 'qualityChecks.eyesClosed="yes"' \
--form 'qualityChecks.occlusion="yes"' \
--form 'qualityChecks.multipleFaces="yes"' \
--form 'qualityChecks.headTurned="yes"' \
--form 'qualityChecks.hat="yes"' \
--form 'qualityChecks.eyewear="yes"' \
--form 'qualityChecks.readingGlasses="yes"' \
--form 'qualityChecks.sunglasses="yes"' \
--form 'qualityChecks.dull="yes"' \
--form 'qualityChecks.bright="yes"' \
--form 'qualityChecks.nonWhiteBackground="yes"' \
--form 'qualityChecks.nudity="yes"' \
--form 'qualityChecks.lowQuality="yes"' \
--form 'ageRange="yes"' \
--form 'checkGender="yes"'

Success Response

The following is a comprehensive success response with all quality checks and face attribute checks enabled:

{
"status": "success",
"statusCode": 200,
"metadata": {
"requestId": "<Request_ID>",
"transactionId": "<Transaction_ID>"
},
"result": {
"details": {
"liveFace": {
"value": "yes",
"confidence": "high"
},
"ageRange": {
"low": 19,
"high": 25,
"value": "19-25",
"confidence": "high"
},
"gender": {
"value": "Female",
"confidence": "high"
},
"qualityChecks": {
"multipleFaces": {
"value": "no",
"confidence": "high"
},
"eyewear": {
"value": "no",
"confidence": "high"
},
"readingGlasses": {
"value": "no",
"confidence": "high"
},
"sunglasses": {
"value": "no",
"confidence": "high"
},
"nudity": {
"value": "no",
"confidence": "high"
},
"faceOccluded": {
"value": "no",
"confidence": "high"
},
"headTurned": {
"value": "no",
"confidence": "high"
},
"bright": {
"value": "no",
"confidence": "high"
},
"blur": {
"value": "no",
"confidence": "high"
},
"eyesClosed": {
"value": "no",
"confidence": "high"
},
"nonWhiteBackground": {
"value": "no",
"confidence": "high"
},
"hat": {
"value": "no",
"confidence": "high"
},
"dull": {
"value": "no",
"confidence": "high"
},
"lowQuality": {
"value": "no",
"confidence": "high"
}
}
},
"summary": {
"action": "pass",
"details": []
},
"croppedImageUrl": "<signed_URL_of_the_cropped_face_image>"
}
}

Success Response Details

ParameterTypeDescription
statusstringThe status of the request. Returns success for a successful API call.
statusCodeintegerThe HTTP status code returned for the request. Returns 200 on success.
metadata.requestIdstringA unique identifier for the request, generated by HyperVerge.
metadata.transactionIdstringThe transaction ID passed in the request header, used to track the user journey.
result.details.liveFace.valuestringIndicates whether the face in the image is live. Returns yes or no.
result.details.liveFace.confidencestringThe confidence level for the live face determination. Returns high or low.
result.details.ageRange.valuestringThe estimated age range of the individual (e.g., "19-25"). Returned when ageRange is enabled.
result.details.ageRange.lowintegerThe lower bound of the estimated age range.
result.details.ageRange.highintegerThe upper bound of the estimated age range.
result.details.ageRange.confidencestringThe confidence level for the age range estimate. Returns high or low.
result.details.gender.valuestringThe estimated gender of the individual (e.g., "Female", "Male"). Returned when checkGender is enabled.
result.details.gender.confidencestringThe confidence level for the gender estimate. Returns high or low.
result.details.qualityChecks.blur.valuestringIndicates whether the image is blurred. Returns yes or no. Returned when qualityChecks.blur is enabled.
result.details.qualityChecks.blur.confidencestringThe confidence level for blur detection.
result.details.qualityChecks.eyesClosed.valuestringIndicates whether the eyes are closed. Returns yes or no. Returned when qualityChecks.eyesClosed is enabled.
result.details.qualityChecks.eyesClosed.confidencestringThe confidence level for the eyes closed check.
result.details.qualityChecks.faceOccluded.valuestringIndicates if the face is partially or fully occluded by objects, hands, masks, or accessories. Returns yes or no. Returned when qualityChecks.occlusion is enabled.
result.details.qualityChecks.faceOccluded.confidencestringThe confidence level for the occlusion check.
result.details.qualityChecks.multipleFaces.valuestringIndicates whether multiple faces are detected. Returns yes or no. Returned when qualityChecks.multipleFaces is enabled.
result.details.qualityChecks.multipleFaces.confidencestringThe confidence level for the multiple faces check.
result.details.qualityChecks.headTurned.valuestringIndicates whether the head is not facing forward. Returns yes or no. Returned when qualityChecks.headTurned is enabled.
result.details.qualityChecks.headTurned.confidencestringThe confidence level for the head turned check.
result.details.qualityChecks.hat.valuestringIndicates whether the individual is wearing a hat. Returns yes or no. Returned when qualityChecks.hat is enabled.
result.details.qualityChecks.hat.confidencestringThe confidence level for the hat check.
result.details.qualityChecks.eyewear.valuestringIndicates whether the individual is wearing any eyewear. Returns yes or no. Returned when qualityChecks.eyewear is enabled.
result.details.qualityChecks.eyewear.confidencestringThe confidence level for the eyewear check.
result.details.qualityChecks.readingGlasses.valuestringIndicates whether the individual is wearing reading glasses. Returns yes or no. Returned when qualityChecks.readingGlasses is enabled.
result.details.qualityChecks.readingGlasses.confidencestringThe confidence level for the reading glasses check.
result.details.qualityChecks.sunglasses.valuestringIndicates whether the individual is wearing sunglasses. Returns yes or no. Returned when qualityChecks.sunglasses is enabled.
result.details.qualityChecks.sunglasses.confidencestringThe confidence level for the sunglasses check.
result.details.qualityChecks.dull.valuestringIndicates whether the selfie is under-exposed. Returns yes or no. Returned when qualityChecks.dull is enabled.
result.details.qualityChecks.dull.confidencestringThe confidence level for the dull (under-exposure) check.
result.details.qualityChecks.bright.valuestringIndicates whether the selfie is over-exposed. Returns yes or no. Returned when qualityChecks.bright is enabled.
result.details.qualityChecks.bright.confidencestringThe confidence level for the bright (over-exposure) check.
result.details.qualityChecks.nonWhiteBackground.valuestringIndicates whether the background is non-white. Returns yes or no. Returned when qualityChecks.nonWhiteBackground is enabled.
result.details.qualityChecks.nonWhiteBackground.confidencestringThe confidence level for the non-white background check.
result.details.qualityChecks.nudity.valuestringIndicates whether explicit content is detected. Returns yes or no. Returned when qualityChecks.nudity is enabled.
result.details.qualityChecks.nudity.confidencestringThe confidence level for the nudity check.
result.details.qualityChecks.lowQuality.valuestringIndicates whether the overall image quality is too low for reliable processing. Returns yes or no. Returned when qualityChecks.lowQuality is enabled.
result.details.qualityChecks.lowQuality.confidencestringThe confidence level for the low quality check.
result.croppedImageUrlstringThe signed URL to access the cropped face image from the uploaded selfie. Returned when returnCroppedImageURL is enabled.
result.summary.actionstringThe final decision for the verification. Returns pass, fail, or manualReview.
result.summary.detailsarrayAn array of objects providing additional context for the summary action (e.g., failure reason codes and messages).

The Summary Object

The Summary object helps in deciding the final action for a user's application.

  • It contains any of the following decisions:

    • "Fail(reject)",
    • "Manual Review",
    • "Pass(approve)".
  • The configuration for these decisions are customisable. It can be changed to suit your business requirements through the integration and also after going live.

  • The configuration is hosted in the backend and not in the SDK or frontend.

  • New features can be supported immediately not requiring application releases at your end.

The following code samples are the 3 types of actions responses that you will find in the response.

This is the response where the application is approved for further processing.

"summary": {
"action": "pass",
"details": []
}

Error Responses

A failure or error response contains a failure status with a relevant status code and error message. The following tabs show the error responses for each status code.

Returned when the request body cannot be parsed. Check that all form-data fields are correctly formatted.

{
"statusCode": 400,
"status": "failure",
"result": {
"error": "Error while parsing request body"
},
"metadata": {
"transactionId": "<Transaction_ID>",
"requestId": "<Request_ID>"
}
}

Returned when the requested API endpoint does not exist. Verify the API URL.

{
"statusCode": 404,
"status": "failure",
"result": {
"error": "Not Found"
},
"metadata": {
"requestId": "<Request_ID>"
}
}

Error Response Details

The following table lists all error responses with their status codes and descriptions.

Status CodeError MessageDescription
400Error while parsing request bodyThe request body could not be parsed. Check that all form-data fields are correctly formatted.
400Unsupported file typeThe uploaded file format is not supported. Please upload a valid JPG, JPEG, or PNG image.
401Missing/Invalid credentialsThe appId or appKey provided in the request headers is missing or incorrect.
403Unauthorized Access to APIThe credentials are valid but do not have permission to access this API endpoint.
404Not FoundThe requested API endpoint does not exist. Verify the API URL.
422No face detectedThe model failed to detect a face in the submitted selfie. Ensure the image contains a clearly visible face.
429Rate limit errorYou have exceeded the configured rate limit for transactions per minute. Retry after a short interval.
500Internal Server ErrorAn unexpected server-side error occurred. Contact the HyperVerge Support team for resolution.
503SERVER BUSY - retry after sometimeThe server is temporarily overloaded. Retry the request after a short wait.

Reading Results for Selfie Validation

We recommend using the liveFace parameter in the response to decide the result.

  • liveFace.value = "yes" , when the face in the image taken is live
  • liveFace.value = "no" , when face in the image taken is not live
  • action parameter in the response can be used to decide whether the image sent requires manual review or not (optional)

How to assess the Liveness, based on the response returned by the API:

When the following conditions are met:

  • statusCode = 200
  • liveFace.value = "yes"
  • action = "pass"
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: