---
title: Face match
slug: api-marketplace/face-match
description: Stay ahead of the game with our upcoming document featuring valuable information coming soon. Be prepared to access essential insights and stay tuned for its release in the near future. Subscribe now to be the first to receive this highly anticipated reso
createdAt: 2023-04-20T21:12:16.000Z
---

## Introduction

The "Face Match" API  offers a robust and secure way to compare and verify identities using facial recognition technology. This API is designed to accurately match a person's face from two different images, such as a selfie or passport-size photo (first image) and an ID card containing the individual's image (second image). Utilizing advanced algorithms, it not only compares faces with high precision but also checks for the presence of masks, enhancing its utility in various verification scenarios. The API response includes a verification status, match percentage, and detailed mask detection results, ensuring a comprehensive and reliable identity verification process.

***

### Endpoint

:::CodeblockTabs
UAT/Testing Endpoint

```text
POST https://api-preproduction.signzy.app/api/v3/face/match
```
:::

:::CodeblockTabs
Production

```text
POST https://api.signzy.app/api/v3/face/match
```
:::

***

### Request Headers

| Name          | Value            | Required  | Description                                                                                                |
| ------------- | ---------------- | --------- | ---------------------------------------------------------------------------------------------------------- |
| Content-Type  | application/json | Mandatory | The type of content that the request body contains.                                                        |
| Authorization | XXXXXXXXXXXXXXX  | Mandatory | An authentication token to authorize the request. Reach out to the Signzy support team to get one created. |

***

### Request body parameters

| **Parameter**     | **Data Type**    | **Description**                                                                                                                                                                                           | **Required** |
| ----------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| firstImage        | String           | Individual image. Can be a passport-size photo or a selfie. (The field accepts only image URL)<br />(Supported file types include JPG, JPEG, PNG, TIFF, and PDF)                                          | Mandatory    |
| secondImage       | String           | ID card image containing the individual's image.<br />(The field accepts only image URL)<br />(Supported file types include JPG, JPEG, PNG, TIFF, and PDF)                                                | Mandatory    |
| threshold         | Float            | The threshold value can be passed between 0.05 to 0.95. The default value is 0.5.<br />If the image match percentage is greater than or equal to threshold then the result would be true otherwise false. | optional     |
| alignHorizontally | String           | Align the image horizontally, possible values: "**yes"** or "**no".&#x20;**&#x54;he default value is "no".                                                                                                | optional     |
| detectMask        | Array of strings | Array of image URLs to check if the person is wearing a mask.                                                                                                                                             | optional     |

***

### Code samples

:::CodeblockTabs
```curl
curl --location 'https://api.signzy.app/api/v3/face/match' \
--header 'Content-Type: application/json' \
--header 'Authorization: <Token>' \
--data '{
    "firstImage": "<First image URL>",
    "secondImage": "<Second image URL>",
    "threshold": "<Value between 0.05 to 0.95>",
    "detectMask": [
        "<URLs to detect if the individual in image is wearing a mask>"
    ]
}'
```

```nodejs
const axios = require('axios');
let data = JSON.stringify({
  "firstImage": "<First image URL>",
  "secondImage": "<Second image URL>",
  "threshold": "<Value between 0.05 to 0.95>",
  "detectMask": [
    "<URLs to detect if the individual in image is wearing a mask>"
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.signzy.app/api/v3/face/match',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': '<Token>'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

```python
import http.client
import json

conn = http.client.HTTPSConnection("api.signzy.app")
payload = json.dumps({
  "firstImage": "<First image URL>",
  "secondImage": "<Second image URL>",
  "threshold": "<Value between 0.05 to 0.95>",
  "detectMask": [
    "<URLs to detect if the individual in image is wearing a mask>"
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': '<Token>'
}
conn.request("POST", "/api/v3/face/match", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.signzy.app/api/v3/face/match"
  method := "POST"

  payload := strings.NewReader(`{
    "firstImage": "<First image URL>",
    "secondImage": "<Second image URL>",
    "threshold": "<Value between 0.05 to 0.95>",
    "detectMask": [
        "<URLs to detect if the individual in image is wearing a mask>"
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "<Token>")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```
:::

***

### Response body parameters

| **Parameter**                      | **Data Type**   | **Description**                                                              |
| ---------------------------------- | --------------- | ---------------------------------------------------------------------------- |
| result                             | object          | The main result object containing the response.                              |
| result.verified                    | boolean         | Indicates whether the verification was successful (true or false).           |
| result.message                     | string          | A message describing the result of the verification process.                 |
| result.matchPercentage             | string          | The percentage indicating the level of match or similarity.                  |
| result.maskDetections              | array of object | An array containing mask detection information.                              |
| result.maskDetections.maskDetected | boolean         | Indicates whether a mask was detected in the provided image (true or false). |
| result.maskDetections.confidence   | number          | A numerical value indicating the confidence level of the mask detection.     |
| result.maskDetections.url          | string          | The URL of the image that was analyzed for mask detection.                   |
| status                             | Integer         | It represents the HTTP status code                                           |

:::CodeblockTabs
200

```json
{
    "result": {
        "verified": true,
        "message": "Verification completed with positive result",
        "matchPercentage": "99.00%",
        "maskDetections": []
    },
    "status": 200
}
```

400

```json
// Incorrect image url
{
    "error": {
        "message": "Error in downloading file",
        "name": "error",
        "status": 400,
        "reason": "Error",
        "type": "Bad Request",
        "statusCode": 400
    }
}

// Incorrect threshold values
{
    "error": {
        "message": "\"threshold\" must be less than or equal to 0.95",
        "name": "error",
        "status": 400,
        "reason": "VALIDATION_ERROR",
        "type": "Bad Request",
        "statusCode": 400
    }
}

// file size greater than 5 mb
{
    "error": {
        "message": "File size is greater than 5.000 MB",
        "name": "error",
        "status": 400,
        "reason": "Error",
        "type": "Bad Request",
        "statusCode": 400
    }
}
```

401

```json
{
    "message": "Invalid authentication credentials"
}
```

409

```json
{
    "error": {
        "reason": "Error From Upstream",
        "status": 409,
        "message": "Upstream Down",
        "type": "Conflict",
        "statusCode": 409,
        "name": "error"
    }
}
```
:::

### Document related Constraints:

- Max Image size supported is 5 MB
- For best results, please make sure the image you use fits tightly in the camera view and is horizontally aligned.
- Don't pass the same URL in both the input images. it will throw a 400 error if the same URL is passed in both the first and second image.

***

**Contact Us for Any Assistance**

If you have any questions or need assistance, please reach out to our customer support team. You can contact us via email at <font color="#2166ae">**help\@signzy.com**</font>. We strive to provide prompt and reliable assistance, ensuring your queries are addressed effectively.

We value your feedback and are committed to making your experience smooth and enjoyable. Our team is dedicated to assisting you with any needs you may have. Thank you for choosing our services. We look forward to helping you!
