---
title: Face Match
slug: v3-gateway/PRS6-face-match
description: Learn about the Face Match API and its capabilities for face recognition and face mask detection. This comprehensive document covers API usage, input guidelines, sample responses, and code samples in various programming languages. Discover endpoints, envi
createdAt: 2023-06-12T12:57:33.000Z
---

## Introduction

The Face Match API allows users to perform various operations related to face recognition and face mask detection. This documentation provides an overview of the available APIs, how to call them, input guidelines, sample responses, and other relevant information.

## How to call the API

Before making API requests, you need to perform a login authentication and obtain an access token. The access token should be included in the authorization header of subsequent API requests. The API endpoints and environments for different operations are provided below.

## API Input Guidelines

The Face Match API is used to determine if two images belong to the same person. You can provide two images either by uploading them or by providing their URLs as input to the API.

You can also provide a optional threshold value between 0.05-0.95 to decide which match is False or True. If match percentage is greater than or equal to threshold then True otherwise False.

### Endpoint Details

| Endpoints                                                                      | Environment   |
| ------------------------------------------------------------------------------ | ------------- |
| https\://preproduction.signzy.tech/api/v2/patrons/&#x7B;patron-id}/facematches | Preproduction |
| https\://signzy.tech/api/v2/patrons/&#x7B;patron-id}/facematches               | Production    |

### Request Body Parameters

| **PARAMETER NAME** | **Required/Optional** | **DESCRIPTION**     |
| ------------------ | --------------------- | ------------------- |
| firstImage         | Required              | first-image-URL     |
| secondImage        | Required              | second-image-URL    |
| threshold          | Required              | threshold-value     |
| alignHorizontally  | Required              | yes\|no             |
| detectMask         | Required              | URLs-to-detect-mask |

```json
{
    "essentials": {
        "firstImage": ".....first image URL....",
        "secondImage": ".....Second image URL....",
        "threshold": "...value between 0.05 to 0.95...(optional)",
        "alignHorizontally": "yes|no....(optional)",
        "detectMask": [
            "...URLs to detect if face is wearing mask..."
        ]
    }
}
```

### Request Body Headers

| **Header Name** | **Required/Optional** | **DESCRIPTION**                                    |
| --------------- | --------------------- | -------------------------------------------------- |
| Authorization   | Required              | access token returned as id field of login request |
| Content-Type    | Required              | application/json                                   |

### Code Samples

:::CodeblockTabs
```curl
curl --request POST \
  --url https://signzy.tech/api/v2/patrons/...patronID.../facematches \
  --header 'Accept: */*' \
  --header 'Accept-Language: en-US,en;q=0.8' \
  --header 'Authorization: <Access-Token>' \
  --header 'content-type: application/json' \
  --data '{"essentials":{"firstImage":"...firstImage..","secondImage":"...secondImage..."}}'
```

```nodejs
const axios = require('axios');
let data = JSON.stringify({
  "essentials": {
    "firstImage": "...firstImage..",
    "secondImage": "...secondImage..."
  }
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://signzy.tech/api/v2/patrons/...patronID.../facematches',
  headers: { 
    'Accept': '*/*', 
    'Accept-Language': 'en-US,en;q=0.8', 
    'Authorization': '<Access-Token>', 
    'content-type': 'application/json'
  },
  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("signzy.tech")
payload = json.dumps({
  "essentials": {
    "firstImage": "...firstImage..",
    "secondImage": "...secondImage..."
  }
})
headers = {
  'Accept': '*/*',
  'Accept-Language': 'en-US,en;q=0.8',
  'Authorization': '<Access-Token>',
  'content-type': 'application/json'
}
conn.request("POST", "/api/v2/patrons/...patronID.../facematches", 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://signzy.tech/api/v2/patrons/...patronID.../facematches"
  method := "POST"

  payload := strings.NewReader(`{"essentials":{"firstImage":"...firstImage..","secondImage":"...secondImage..."}}`)

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Accept", "*/*")
  req.Header.Add("Accept-Language", "en-US,en;q=0.8")
  req.Header.Add("Authorization", "<Access-Token>")
  req.Header.Add("content-type", "application/json")

  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))
}
```
:::

### Sample Response

```json
{
    "essentials": {
        "firstImage": ".....first image URL....",
        "secondImage": ".....Second image URL...."
    },
    "id": "......id.....",
    "patronId": "..patronID....",
    "result": {
        "verified": "...verified 'true' or 'false'.....",
        "message": ".....message.....",
        "matchPercentage": ".....match %....",
        "maskDetections": [
            {
                "maskDetected": "...true/false...",
                "confidence": "...confidence..."
                "url": "...input URL..."
            }
        ]
    }
}
```

### Response Parameter

| **Parameter** **Name** | **Description**                                                      |
| ---------------------- | -------------------------------------------------------------------- |
| **verified**           | (boolean): Indicates whether the verification was successful or not. |
| **message**            | (string): Message indicating the result of the verification.         |
| **matchPercentage**    |  (string): Percentage of match between the two images.               |
| **maskDetections**     |  (array): Information about mask detection results.                  |
| **maskDetected**       | (boolean): Indicates whether a mask was detected or not.             |
| **confidence**         | (string): Confidence score for mask detection.                       |
| **url**                | (string): Input URL for mask detection.                              |

***

### Sample Error

:::CodeblockTabs
```json
{
    "error": {
        "name": "error"
        "status": "...status code...",
        "msg": "...reason...",
        "responseCode": "fail"
    }
}
```

400

```json
{
    "error": {
        "name": "Invalid Request JSON Syntax",
        "status": "400",
        "msg": "Expecting property name enclosed in double quotes: line 3 column 3 (char 155)",
        "responseCode": "fail"
    }
}
```

401

```json
{
    "message": "No API key found in request"
}
```

422

```json
{
    "error": {
        "status": "422",
        "msg": "Invalid request parameters: The image has expired",
        "responseCode": "fail"
    }
}
```
:::

### Status Codes

| Status Code | Description                    |
| ----------- | ------------------------------ |
| 200         | OK                             |
| 400         | Bad Request                    |
| 401         | Authorization token is invalid |
| 422         | Unprocessable Entity           |

***

:::hint{type="success"}
### Getting help

Please feel free to contact us if you have any questions, require clarification, or have ideas for how to make the documents or any of our services better.


You can reach out to us at [help@signzy.com](#).
:::

