# Facial Comparison

## Compare Images

<mark style="color:green;">`POST`</mark> `{{baseurl}}/v2/api/identity/compare-image`

This endpoint allows you to compare the similarity between two different images. This service allows you to pass both base64 and URL for the comparison.

<mark style="color:$danger;">Note</mark>: *The maximum image size allowed is 1MB per image.*

#### Headers

| Name                                    | Type   | Description      |
| --------------------------------------- | ------ | ---------------- |
| token<mark style="color:red;">\*</mark> | String | API secret token |

#### Request Body

| Name                                               | Type    | Description                                                                                              |
| -------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------- |
| image1<mark style="color:red;">\*</mark>           | String  | valid image URL or Base64 encoded string of image                                                        |
| image2<mark style="color:red;">\*</mark>           | String  | valid image URL or Base64 encoded string of image                                                        |
| isSubjectConsent<mark style="color:red;">\*</mark> | Boolean | <p><br>Indicate subject has given consent. <mark style="color:red;"><code>Must be true</code></mark></p> |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "image1": "https://cdn.youverify.co/1655426991330-nbkHP7qYykVYiXJP-pZr3.jpg",
    "image2": "https://cdn.youverify.co/1655261851961-za9BbHiHvWwROm19hRlv7.jpg",
    "isSubjectConsent": true
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Response" %}

```json
{
            "success": true,
            "statusCode": 200,
            "message": "success",
            "data": {
                "id": "62abcfcb4f9005b0ddaa4a7a",
                "parentId": null,
                "status": "completed",
                "reason": "Provided image does not match ID image",
                "selfieValidation": true,
                "imageComparison": {
                    "confidenceLevel": 47,
                    "threshold": 80,
                    "match": false,
                    "image1": "https://cdn.youverify.co/1655426991330-nbkHP7qYykVYiXJP-pZr3.jpg",
                    "image2": "https://cdn.youverify.co/1655261851961-za9BbHiHvWwROm19hRlv7.jpg"
                },
                "isConsent": true,
                "idNumber": "62ABCFCD4F9005B0DDAA4A7B",
                "businessId": "61d880f1e8e15aaf24558f1a",
                "type": "facial_compare",
                "requestedAt": "2022-06-17T00:50:21.567Z",
                "requestedById": "61d880f2e8e15aaf24558f9b",
                "createdAt": "2022-06-17T00:50:21.716Z",
                "lastModifiedAt": "2022-06-17T00:50:21.716Z",
                "requestedBy": {
                    "firstName": "Famous",
                    "lastName": "Ehichioya",
                    "middleName": "Prior",
                    "id": "61d880f2e8e15aaf24558f9b"
                }
            },
            "links": []
        }
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Error Response" %}

```json
HTTP/1.1 404 NotFound
{
  "success": false,
  "statusCode": 404,
  "message": "You have attempted to get a resource that does not exist.",
  "name": "ResourceNotFoundError",
  "data": {}
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.youverify.co/know-your-customer-services-kyc/facial-comparison.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
