---
description: >-
  This endpoint allows the matching between the user selfie and the photo on the
  ID document simultaneously.
---

# Verify document photo

The IDCard photo sent in this request is provided at the response of the method Validate Document, so is necessary to store the photo temporarily to send it along with the uploaded photo sample taken at the moment.

## Document - Verify document photo

<mark style="color:green;">`POST`</mark> `https://api.biometrid.com/api/1.0/document/selfie-compare`

#### Headers

| Name               | Type   | Description                                                                                                                                             |
| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Content-type       | string | Request content type (This is not required to be set. Referenced only to show how we expect data to be sent). { "Content-Type": "multipart/form-data" } |
| x-biometrid-key    | string | <p>Application Client Key<br></p>                                                                                                                       |
| x-biometrid-secret | string | Application Client Secret                                                                                                                               |

#### Request Body

| Name     | Type    | Description                                                                                                |
| -------- | ------- | ---------------------------------------------------------------------------------------------------------- |
| photo1   | object  | Image file containing photo for biometric analysis. File format: jpeg, png or jpg. Maximum file size 1 Mb. |
| photo2   | object  | Image file containing photo for biometric analysis. File format: jpeg, png or jpg. Maximum file size 1 Mb. |
| liveness | boolean | Optional liveness state flag. For now, just implemented on the biometrid SDK.                              |

{% tabs %}
{% tab title="200 Success 200 types" %}
{% code title=" HTTP/1.1 200 OK" %}
```javascript
//Selfie Commpare Process
{
    "status": true,
    "data": {
        "message": "FACE_COMPARED_WITH_SUCCESS",
        "verified": true,
        "confidence": "0.99"
        }
    }
}
//Selfie Compare Process Failed
{
    "status": false,
    "data": {
        "message": "FACE_COMPARISON_FAILED"
        }
    }
}
```
{% endcode %}
{% endtab %}

{% tab title="400 Bad Request types" %}
{% code title="HTTP/1.1 400 Bad Request" %}
```javascript
//No photo files detected on request. Not sent or invalid format.
{
    "status": false,
    "data": {
        "message": "NO_FILES_OR_INVALID_FORMATS"
    }
}
//Missing photo files on request.
{
    "status": false,
    "data": {
        "message": "EXPECTING_2_IMAGE_FILES_TO_COMPARE"
    }
}
//Missing Headers.
{
    "status": false,
    "data": {
        "message": "AUTHENTICATION_HEADERS_MISSING"
    }
}
```
{% endcode %}
{% endtab %}

{% tab title="401 Invalid Headers." %}
{% code title="HTTP/1.1 401 Unauthorized" %}
```javascript
{
    "status": false,
    "data": {
        "message": "INVALID_AUTHENTICATION_HEADERS"
    }
}
```
{% endcode %}
{% endtab %}

{% tab title="402 Request Limit Reached for Client Plan." %}
{% code title="HTTP/1.1 402 Payment Required" %}
```javascript
{
    "status": false,
    "data": {
        "message": "REQUEST_LIMIT_REACHED"
    }
}
```
{% endcode %}
{% endtab %}

{% tab title="404 Client not found by given key." %}
{% code title="HTTP/1.1 404 Not Found" %}
```javascript
{
    "status": false,
    "data": {
        "message": "CLIENT_NOT_FOUND/CHECK_AUTHENTICATION_HEADERS"
    }
}
```
{% endcode %}
{% endtab %}

{% tab title="405 No active engine configuration for this provider." %}
{% code title="HTTP/1.1 405 Method Not Allowed" %}
```javascript
{
    "status": false,
    "data": {
        "message": "NO_FACE_ENGINE_CONFIGURATION_AVAILABLE"
    }
}
```
{% endcode %}
{% endtab %}

{% tab title="428 Precondition Required" %}
{% code title="HTTP/1.1 428 Precondition Required" %}
```javascript
{
    "status": false,
    "data": {
        "message": "NO_LIVENESS_DETECTION"
    }
}
```
{% endcode %}
{% endtab %}
{% endtabs %}

{% code title="Example (JSON)" %}
```javascript
{
    "photo1": photo1.jpeg,
    "photo2": photo2.jpeg,
    "livess": true
}
```
{% endcode %}

### Success 200

| Field        | Type    | Description                                   |
| ------------ | ------- | --------------------------------------------- |
| status       | Boolean | Response status.                              |
| data         | Object  | Response main data.                           |
|   message    | String  | Message regarding the selfie compare process. |
|   verified   | Boolean | Photos comparison result.                     |
|   confidence | String  | Photos comparison result confidence.          |

