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 OptionalDescription Allowed 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
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 occlused 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
Additional Quality Checks

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

Request

The following code shows the standard cURL requests for the API:

curl --location --request POST 'https://<regionCode>.idv.hyperverge.co/v1/checkLiveness' \
--header 'Content-Type: multipart/form-data' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--form 'image=@"<Enter_the_image_path>"' \
--form 'returnCroppedImageURL="<Enter_yes_or_no>"'

Success Response

The following code snippets demonstrate success responses from the API:

{
"status": "success",
"statusCode": "200",
"result": {
"details": {
"liveFace": {
"value": "yes"/"no",
"confidence": "high"/"low"
},
"qualityChecks": { // returned if corresponding quality checks are enabled in the request
"eyesClosed": {
"confidence": "high"/"low",
"value": "yes"/"no"
},
"occlusion": {
"confidence": "high"/"low",
"value": "yes"/"no"
},
"multipleFaces": {
"confidence": "high"/"low",
"value": "yes"/"no"
},
"blur": {
"confidence": "high"/"low",
"value": "yes"/"no"
}
}
},
"croppedImageUrl": "<URL_of_the_Cropped_Selfie_Image>", // returned if returnCroppedImageURL is enabled in the request
"summary": {
"action": "pass/fail/manualReview",
"details": []
}
},
"metaData": {
"requestId": "xxx",
"transactionId": "yyy"
}
}

Success Response Details

ParameterTypeDescription
statusstringThe status of the request
statusCodestringThe HTTP status code returned for the request
liveFace.valuestringIndicates whether a face is live or non-live. Returns "yes" or "no" accordingly.
liveFace.confidencestringThe confidence level for live face detection, indicated by returning either "high" or "low"
qualityChecks.eyesClosed.valuestringIndicates whether the eyes are closed in the image
qualityChecks.eyesClosed.confidencestringThe confidence level for eyes closed detection
qualityChecks.occlusion.valuestringIndicates if the face is partially or fully occluded by objects, hands, masks, accessories (like sunglasses, hats), or other obstructions that prevent clear visibility of facial features
qualityChecks.occlusion.confidencestringThe confidence level for occlusion
qualityChecks.multipleFaces.valuestringIndicates whether multiple faces are detected in the image
qualityChecks.multipleFaces.confidencestringThe confidence level for multiple faces detection
qualityChecks.blur.valuestringIndicates whether the image is blurred
qualityChecks.blur.confidencestringThe confidence level for blur detection
croppedImageUrlstringThe signed URL to access the cropped face image from the uploaded selfie (returned when returnCroppedImageURL is enabled)
summary.actionstringThe result of the evaluation, either "pass", "fail", or "manualReview"
summary.detailsarrayAn array providing additional information about the evaluation summary
metaData.requestIdstringA unique identifier for the request
metaData.transactionIdstringA unique identifier for the transaction

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

The following are the error response for the API.

{
"status": "failure",
"statusCode": "422",
"metadata": {
"requestId": "xxx",
"transactionId": "yyyyy"
},
"result": {
"error": "Face not detected"
}
}
{
"status": "failure",
"statusCode": "433",
"error": "Multiple faces detected"
}

Error Response Details

A failure or error response from the module contains a failure status, with a relavant status code and error message. The following table lists all error responses.

Status CodeError MessageError Description
400Invalid RequestThe request is invalid due to missing image or invalid format. Please upload a valid JPEG/PNG image
422Face not detectedThe model failed to detect a face in the selfie
423Eyes ClosedThe uploaded selfie was rejected because the user's eyes are closed. Ensure that the eyes are fully open and clearly visible before capturing the image
429Rate limit errorYou have exceeded the configured rate limit for transactions per minute
432Non White BackgroundThe background is not white. Set allowOnlyWhiteBackground=no to allow non-white backgrounds
433Multiple faces detectedThe uploaded selfie was rejected because multiple faces were detected in the image. Ensure that only one face is visible and clearly captured before submitting the image
438Face BlurredThe uploaded selfie was rejected because the face appears blurred. Capture a clearer image with proper focus and sufficient lighting
439Face is maskedThe uploaded selfie was rejected because the face is partially or fully covered by a mask. Ensure that the face is fully visible and unobstructed before capturing the image
439Face is occludedThe uploaded selfie was rejected because the face is hidden or obscured from view. Ensure that the face is fully visible without any obstructions
441NudityExplicit content detected in the image. Please remove any inappropriate content
450Bad Face ClarityID quality check failed. Please retake the ID image with better quality
5xxServer ErrorKindly check the request headers or contact the HyperVerge team for resolution

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: