Skip to main content

Face Match API - India

The following document highlights the details of the Face Match API.

API Description

Objective

The Face Match API determines whether two facial images belong to the same person.

What this API checks

The Face Match API compares two images and returns whether they match. It does not validate the completeness or quality of the images, nor does it verify whether inputs are selfies or ID images.

For proper input validation and reliable results, use the Selfie Validation API before the Face Match step.

API URL

https://ind-faceid.hyperverge.co/v1/photo/verifyPair

API Endpoint

verifyPair

Overview

The Face Match API is RESTful and uses standard HTTP verbs and status codes. Responses are in JSON format. Upload all images and files as form-data through a POST request.

Method - POST

Authentication

You need a unique pair of application ID (appId) and application key (appKey) from HyperVerge to access the API.

Headers

HeaderMandatory / OptionalDescriptionInput Format
content-typeMandatoryDefines the media type for the request payload.multipart/form-data
appIdMandatoryThe application ID 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 user's journey in your application(s)
uuidOptionalAn advanced parameter to prevent response tampering. When set, the response includes an X-Response-Signature header containing a checksum of the response body signed with the UUID and a private key.This should be a unique value

Inputs

The Face Match API supports three combinations of input parameters depending on the use case:

  • Selfie + ID image: selfie and id
  • Selfie + face string: selfie and idFaceString
  • Two-image match: image1, image2, and type

The following table provides the details of the parameters required for the Face Match API request body:

ParameterMandatory / OptionalTypeDescriptionInput FormatDefault Value
selfieConditionalfileA selfie image. Required when matching a selfie with an ID image (id) or a face string (idFaceString).JPEG, PNG, or TIFFNot Applicable
idConditionalfileAn image of the ID card. Used with selfie for selfie-to-ID matching.JPEG, PNG, or TIFFNot Applicable
idFaceStringConditionalstringThe faceString returned by the OCR API in base64 format. Used with selfie as an alternative to passing the id image.Base64 stringNot Applicable
image1ConditionalfileThe first image in a two-image match. Used with image2 and type.JPEG, PNG, or TIFFNot Applicable
image2ConditionalfileThe second image in a two-image match. Used with image1 and type.JPEG, PNG, or TIFFNot Applicable
typeConditionalstringSpecifies the image type for two-image matching. Used with image1 and image2.selfie / idNot Applicable
allowMultipleFacesOptionalstringWhen set to no, returns an error if multiple faces are detected in the selfie image.yes / nono

Request

The following code snippet demonstrates a standard curl request for the Face Match API (selfie and ID image):

curl --location --request POST 'https://ind-faceid.hyperverge.co/v1/photo/verifyPair' \
--header 'Content-Type: multipart/form-data' \
--header 'appId: <Enter_the_App_ID>' \
--header 'appKey: <Enter_the_App_Key>' \
--header 'transactionId: <Enter_the_Transaction_ID>' \
--form 'selfie=@"<Enter_the_Selfie_Image_Path>"' \
--form 'id=@"<Enter_the_ID_Image_Path>"'

Advanced Request Variants

The following is a sample request for matching a selfie with the face string returned by the OCR API.

curl --location --request POST 'https://ind-faceid.hyperverge.co/v1/photo/verifyPair' \
--header 'Content-Type: multipart/form-data' \
--header 'appId: <Enter_the_App_ID>' \
--header 'appKey: <Enter_the_App_Key>' \
--header 'transactionId: <Enter_the_Transaction_ID>' \
--form 'selfie=@"<Enter_the_Selfie_Image_Path>"' \
--form 'idFaceString="<Enter_the_Face_String>"'

Success Response

The following code snippet demonstrates a success response from the Face Match API:

{
"status": "success",
"statusCode": "200",
"result": {
"match": "yes/no",
"match-score": "<Match_Score>",
"conf": "<Confidence_Score>",
"to-be-reviewed": "yes/no"
}
}

Success Response Details

The following table describes the fields returned in the Face Match API success response:

ParameterTypeDescription
statusstringThe status of the request.
statusCodestringThe HTTP status code of the response.
result.matchstringIndicates whether the two images match. Returns yes or no.
result.match-scorenumberThe similarity score between the two faces, on a scale of 0 to 100.
result.confnumberThe confidence level of the match result.
result.to-be-reviewedstringIndicates whether the result requires manual review. Returns yes or no.

Error Responses

The following are sample error responses from the Face Match API:

{
"status": "failure",
"statusCode": "400",
"error": "Face not detected in ID image"
}
{
"status": "failure",
"statusCode": "423",
"error": "Multiple faces detected. Click Selfie/ID again"
}

Error Response Details

A failure response contains a failure status with a relevant status code and error message. The following table lists the error responses for the Face Match API:

Status CodeError MessageError DescriptionError Resolution
400Face not detected in ID imageThe AI model failed to detect a face in the ID image.Ensure the ID image clearly shows a face and retry.
400Face not detected in Selfie imageThe AI model failed to detect a face in the selfie image.Ensure the selfie image clearly shows a face and retry.
400Missing / Wrong combination of parametersThe request uses an unsupported combination of input parameters. Valid combinations: (image1, image2, type), (selfie, id), or (selfie, idFaceString).Check the Inputs section and pass a valid parameter combination.
400image size cannot be greater than 12MBThe input image exceeds the 12MB size limit.Reduce the image size to under 12MB and retry.
400Invalid value passed to idFaceStringThe value provided for idFaceString is not a valid base64 face string.Ensure the idFaceString value is the base64 face string returned by the OCR API.
401Missing/Invalid credentialsThe request is missing the mandatory appId and appKey combination or has invalid values.Verify and provide valid appId and appKey credentials.
423Multiple faces detected. Click Selfie/ID againMore than one face was detected in the image and allowMultipleFaces is set to no.Ensure only one face appears in the image, or set allowMultipleFaces to yes.
429Requests rate limit exceededThe number of transactions per minute has exceeded the limit set for your credentials.Retry after some time or contact the HyperVerge team to review your rate limit.
500Internal Server ErrorKindly check the request headers or contact the HyperVerge team for resolution.Check the request headers or contact the HyperVerge team for resolution.
501internal server errorAn unexpected server error occurred.Contact the HyperVerge team for resolution.
503DEPENDENCY SERVER BUSYThe server is overloaded or a dependency service is unavailable.Retry after some time or contact the HyperVerge team if the issue persists.
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: