# Match

## Parameters

As an API parameter, a POST route must be sent to the endpoint `/api/v1/match` with the client ID, the face that will go through the 1:N Match process in base64, token and the function "ativarLiveness" true/false. JSON example:

```json
{
"face":"/9j/4DAWLFK...",
"clientid":"658cc36e-XXXX-XXXX-XXXX-29711f9566aa",
"ativarLiveness":true/false,
"token":"0002221"
}
```

The information is sent to the Facesign API and then to the 2D Liveness.

#### Liveness parameter disabled

With the Liveness Parameter disabled, the 1:N Match can be successfully performed even with a negative Liveness return. After the Liveness return (positive or negative), the API will query the face in the client's profile container, returning the Match status, Match level (if any), Liveness and transaction ID:

* Negative Liveness and face not found

*Code 400 - Error*

```json
{
"clientId":"30af224e-XXXX-XXXX-XXXX-b2a7d2081a59",
"face":"/9j/4AAQSkZJRgABAQAA...",
"status":"Face not located",
"Liveness":false,
"transactionId":"123456"
}
```

* Negative Liveness and Match ok

*Code 200 - Success*

```json
{
"clientId":"30af224e-XXXX-XXXX-XXXX-b2a7d2081a59",
"id":"cli0001",
"status":"Match ok",
"Liveness":false,
"nivelMatch":99.51,
"transactionId":"123456"
}
```

* Positive Liveness and face not found

*Code 400 - Error*

```json
{
"clientId":"30af224e-XXXX-XXXX-XXXX-b2a7d2081a59",
"face":"/9j/4AAQSkZJRgABAQAA...",
"status":"Face not located",
"Liveness":true,
"transactionId":"123456"
}
```

* Positive Liveness and Match ok

*Code 200 - Success*

```json
{
"clientId":"30af224e-XXXX-XXXX-XXXX-b2a7d2081a59",
"id":"cli0001",
"status":"Match ok",
"Liveness":true,
"nivelMatch":99.51,
"transactionId":"123456"
}
```

#### Liveness parameter enabled

With the Liveness Parameter enabled, the Match will only be performed with a positive Liveness return:

* Positive Liveness and face not found

*Code 400 - Error*

```json
{
"clientId":"30af224e-XXXX-XXXX-XXXX-b2a7d2081a59",
"face":"/9j/4AAQSkZJRgABAQAA...",
"status":"Face not located",
"Liveness":true,
"transactionId":"123456"
}
```

* Positive Liveness and Match ok

*Code 200 - Success*

```json
{
"clientId":"30af224e-XXXX-XXXX-XXXX-b2a7d2081a59",
"id":"cli0001",
"status":"Match ok",
"Liveness":true,
"nivelMatch":99.51,
"transactionId":"123456"
}
```

* Negative Liveness

*Code 400 - Error*

```json
{
"clientId":"30af224e-XXXX-XXXX-XXXX-b2a7d2081a59",
"face":"/9j/4AAQSkZJRgABAQAA...",
"status":"failure",
"Liveness":false
}
```
