# Face Query

## Query

<mark style="color:green;">`POST`</mark> `https://okaydocdemo.innov8tif.com/ekyc/api/innov-face/facequery/query`

This API enables the querying and match the facial image in database to check for existence

#### Request Body

| Name        | Type   | Description                                                       |
| ----------- | ------ | ----------------------------------------------------------------- |
| apiKey      | string | To be assigned by Innov8tif                                       |
| imageBase64 | string | Selfie image or portrait image in base64                          |
| imageFile   | string | Selfie image or portrait image                                    |
| groupName   | string | Group name that existed in database that matches the facial image |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success",
    "resultFound": true,
    "groupFound": true,
    "name": "zhiyan",
    "score": 0.0
}
```

{% endtab %}
{% endtabs %}

### Input Example in Postman

![](https://253651193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpQle72tz7-gm8Gk4Bg%2F-MjTiYsC20tZKLuNLz6u%2F-MjTistx9xCGGTsxyQqo%2FUntitled.png?alt=media\&token=2b073f4f-fb78-4239-a5dd-c726a638a29f)

{% hint style="warning" %}
Query facial image need to fulfill the [image requirement](https://api.innov8tif.com/okayface/image-requirements) for better accuracy
{% endhint %}

### Possible Responses

{% code title="When image is found in the group (database table)" %}

```
{
    "status": "success",
    "resultFound": true,
    "groupFound": true,
    "name": "zhiyan",
    "score": 0.0
}
```

{% endcode %}

{% code title="When group does exists but cannot find similar face" %}

```
{
    "status": "success",
    "resultFound": false,
    "groupFound": true
}
```

{% endcode %}

{% code title="When group does not exist" %}

```
{
    "status": "success",
    "resultFound": false,
    "groupFound": false
}
```

{% endcode %}

{% code title="When no face detected in image" %}

```
{
    "status": "error",
    "message": "There is No Face Detected in Image",
    "resultFound": false,
    "groupFound": false
}
```

{% endcode %}

### Threshold

The score of the successful image found are listed below:

| Threshold Value   | Description Status |
| ----------------- | ------------------ |
| **Score** > 0.53  | Query Pass         |
| **Score** <= 0.53 | Query Fail         |

{% hint style="info" %}
The lower the score, the higher the confidence of the Face Search API comparing the face with the database.
{% endhint %}
