Face Match API - India
API Description
Objective
The Face Match API determines whether two facial images belong to the same person.
The Face Match API verifies whether two images belong to the same person. It neither checks the completeness, quality of the face passed as input, nor does it validate whether the inputs are selfies or ID images. The model simply compares the two images and returns whether it is a match or not.
For proper input validation and reliable results, it is recommended to invoke the Selfie Validation module before the Face Match step. Please refer to our Selfie Validation API documentation for more details.
API URL
https://ind-faceid.hyperverge.co/v1/photo/verifyPair
API Endpoint
verifyPair
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
| Parameter | Mandatory or Optional | Description | Valid Values |
|---|---|---|---|
| content-type | Mandatory | This parameter defines the media type for the request payload. | multipart/form-data |
| appId | Mandatory | Application ID shared by HyperVerge | N/A. This is a unique value. |
| appKey | Mandatory | Application Key shared by HyperVerge | N/A. This is a unique value. |
| transactionId | Mandatory | Unique ID for the customer journey. | N/A. Any defined unique value mapped to a transaction in your business ecosystem. |
Inputs
The following are the three variations of the request body based on the type of input images.
- Match selfie with photo on ID card:
-
selfie- A selfie image in JPEG, PNG or TIFF format. -
id- An image of the ID card in JPEG, PNG or TIFF format. - Match selfie with the face string provided by the OCR API:
-
selfie- A selfie image in JPEG, PNG or TIFF format. -
idFaceString- The 'faceString' in base64 format returned by the OCR API. - To match one selfie with another selfie (authentication use case):
-
image1- A selfie image in JPEG, PNG or TIFF format. -
image2- A selfie image in JPEG, PNG or TIFF format. -
type- "selfie". -
image1- An image of an identity document in JPEG, PNG or TIFF format. -
image2- An image of an identity document in JPEG, PNG or TIFF format. -
type- "id".
General Image Input Guidelines
- The API supports JPEG, PNG and TIFF images and PDFs inputs.
- Ensure that the document in the image is legible. This is a rule of thumb for our OCR servers to accurately extract any text from an image.
- Reduce the size of the image as much as possible to optimise the reponse time while also ensuring its legibility criteria as mentioned earlier. Larger image sizes lead to higher uploading and processing time.
- You can keep the width of the ID card image at least 800 pixels and the JPEG compression quality factor above 80%.
- For our DL server to extract text from the document, the aspect ratio of the input image should be the same as the aspect ratio of the original document. Hence utmost care should be taken while resizing the image to maintain the aspect ratio
Sample Request
The following code shows a standard curl request for the API.
- Selfie and ID Match
- Selfie and Face String Match
- Selfie and Selfie Match
- ID and ID Match
The following is a sample request for the matching a selfie with an ID card image.
curl --location --request POST 'https://ind-faceid.hyperverge.co/v1/photo/verifyPair' \
--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 'selfie=@"<path_to_selfie_image>"' \
--form 'id=@"<path_to_id_image>"'
The following is a sample request for matching a selfie with the face string provided 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_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--form 'selfie=@"<path_to_selfie_image>"' \
--form 'idFaceString="<face_string_in_base64_format>"'
The following is a sample request for matching a selfie with another.
curl --location --request POST 'https://ind-faceid.hyperverge.co/v1/photo/verifyPair' \
--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 'image1=@"<path_to_first_image>"' \
--form 'image2=@"<path_to_second_image>"' \
--form 'type="selfie"'
The following is a sample request for matching an identity document with another.
curl --location --request POST 'https://ind.idv.hyperverge.co/v1/matchFace' \
--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 'image1=@"<path_to_first_id_image>"' \
--form 'image2=@"<path_to_second_id_image>"' \
--form 'type="id"'
Success Response
The following is a sample response for the matching a selfie with an ID card image.
{
"status" : "success",
"statusCode" : "200",
"result" : {
"match" : "yes/no",
"match-score" : 95, // This is a number between 0-100
"conf" :97,
"to-be-reviewed": "yes/no",
}
}
Optional Configurations
The following are the optional parameters configurable for the API.
| Parameter | Position | Value | Default | Description |
|---|---|---|---|---|
transactionId | Header | String | null | The unique identifier for the customer's application. |
uuid | Header | String | null | This is an advanced feature designed to prevent tampering of response by a man in the middle. If uuid is set, the response will include an X-Response-Signature header which will have a checksum of the response body signed with the uuid and a private key. |
allowMultipleFaces | Body | "yes" or "no" | no | An error is returned when multiple faces are detected in the selfie image. |
Error Responses
The following sample responses reflect the status code 400.
- Face Not Detected
- Selfie Image
- Incorrect Parameters
- Incorrect Size
- Invalid idFaceString
{
"status" : "failure",
"statusCode" : "400",
"error" : "Face not detected in ID image"
}
{
"status" : "failure",
"statusCode" : "400",
"error" : "Face not detected in Selfie image"
}
{
"status" : "failure",
"statusCode" : "400",
"error" : "Missing / Wrong combination of parameters. Valid Parameter combinations - (image1, image2, type) or (selfie, selfie2) or (selfie, id) or (selfie, idFaceString)"
}
{
"status" : "failure",
"statusCode" : "400",
"error" : "image size cannot be greater than 12MB"
}
{
"status" : "failure",
"statusCode" : "400",
"error" : "Invalid value passed to idFaceString"
}
Additionally, you might come across the following error responses.
- Multiple Face Detected
- Requests Rate Limit Exceeded
- Internal Server Error
- Server Busy
{
"status": "failure",
"statusCode": "423",
"error": "Multiple faces detected. Click Selfie/ID again"
}
{
"status": "failure",
"statusCode": 429,
"error": "Requests rate limit exceeded"
}
{
"status": "failure",
"statusCode": "501",
"error": "internal server error"
}
{
"status": "failure",
"statusCode": "503",
"error": "DEPENDENCY SERVER BUSY"
}
| Status Code | Error Message | Error Description |
|---|---|---|
| 400 | Face not detected in Selfie image | The AI model failed to detect the face in the selfie. |
| 400 | Face not detected in ID image | The AI model failed to detect the face in the image of the identification document. |
| 400 | image size cannot be greater than 6MB | The maximum size of input image is 6MB. Crossing this will result in this error. |
| 429 | Rate limit exceeded | This error is returned when the number of transactions per minute has crossed the limit set for your credentials. |
| 500/501 | Internal Server Error | This happens when there is an error with HyperVerge's server. |
| 503 | Server busy | This happens when there is an overload on HyperVerge's server. |