# API Lite Methods

{% hint style="info" %}
From 1.1.0, Oz API Lite works with base64 as an input format and is also able to return the biometric templates in this format. To enable this option, add `Content-Transfer-Encoding = base64` to the request headers.
{% endhint %}

### **version – component version check**

Use this method to check what versions of components are used (available from 1.1.1).

Call `GET /version`&#x20;

#### Input parameters

\-

#### **Request example**

`GET localhost/version`&#x20;

#### **Successful response**

In case of success, the method returns a message with the following parameters.&#x20;

HTTP response content type: “application/json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type**  | **Description**                                                                       |
| ------------------ | --------- | ------------------------------------------------------------------------------------- |
| core               | String    | API Lite core version number.                                                         |
| tfss               | String    | TFSS version number.                                                                  |
| models             | \[String] | An array of model versions, each record contains model name and model version number. |

#### **Response example**

```json
200 OK
Content-Type: application/json
{
2	"core": "core_version",
3	"tfss": "tfss_version",
4	"models": [
5		{
6			"name": "model_name",
7			"version": "model_version"
8		}
9	]
10}
```

## *Biometry*

### health – biometric processor status check

Use this method to check whether the biometric processor is ready to work.

Call `GET /v1/face/pattern/health`&#x20;

#### Input parameters

\-

#### **Request example**

`GET localhost/v1/face/pattern/health`&#x20;

#### **Successful response**

In case of success, the method returns a message with the following parameters.&#x20;

HTTP response content type: “application/json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type** | **Description**                                                                                             |
| ------------------ | -------- | ----------------------------------------------------------------------------------------------------------- |
| status             | Int      | <p>0 – the biometric processor is working correctly. </p><p>3 – the biometric processor is inoperative.</p> |
| message            | String   | Message.                                                                                                    |

#### **Response example**

```json
200 OK
Content-Type: application/json
{“status”: 0, message: “”}
```

### extract – the biometric template extraction

The method is designed to extract a biometric template from an image.&#x20;

HTTP request content type: “image / jpeg” or “image / png”&#x20;

Call `POST /v1/face/pattern/extract`&#x20;

#### **Input parameters**

| **Parameter name** | **Type** | **Description**                                                                                                                           |
| ------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Not specified\*    | Stream   | <p>Required parameter. Image to extract the biometric template.</p><p>The “Content-Type” header field must indicate the content type.</p> |

<details>

<summary>*</summary>

The name itself is not mandatory for a parameter of the Stream type.

</details>

{% hint style="info" %}
To transfer data in base64, add `Content-Transfer-Encoding = base64` to the request headers.
{% endhint %}

#### **Request example**

```json
POST localhost/v1/face/pattern/extract
Content-Type: image/jpeg
{Image byte stream}
```

#### **Successful response**

In case of success, the method returns a biometric template.&#x20;

The content type of the HTTP response is “application/octet-stream”.&#x20;

{% hint style="info" %}
If you've passed `Content-Transfer-Encoding = base64` in headers, the template will be in base64 as well.
{% endhint %}

#### **Output parameters**

| **Parameter name** | **Type** | **Description**                            |
| ------------------ | -------- | ------------------------------------------ |
| Not specified\*    | Stream   | A biometric template derived from an image |

<details>

<summary>*</summary>

The name itself is not mandatory for a parameter of the Stream type.

</details>

#### **Response example**

```json
200 OK
Content-Type: application/octet-stream
{Biometric template byte stream}
```

### compare – the comparison of biometric templates

The method is designed to compare two biometric templates.&#x20;

The content type of the HTTP request is “multipart / form-data”.&#x20;

Call`POST /v1/face/pattern/compare`&#x20;

#### **Input parameters**

| **Parameter name** | **Type** | **Description**                                             |
| ------------------ | -------- | ----------------------------------------------------------- |
| bio\_feature       | Stream   | <p>Required parameter.</p><p>First biometric template.</p>  |
| bio\_template      | Stream   | <p>Required parameter.</p><p>Second biometric template.</p> |

{% hint style="info" %}
To transfer data in base64, add `Content-Transfer-Encoding = base64` to the request headers.
{% endhint %}

#### **Request example**

```json
POST localhost/v1/face/pattern/compare
Content-Type: multipart/form-data;
boundary=--BOUNDARY--
Content-Length: Message body length
--BOUNDARY--
Content-Disposition: form-data; name=”bio_feature”
Content_type: application/octet-stream
{Biometric template byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”bio_template”
Content_type: application/octet-stream
{Biometric template byte stream}
--BOUNDARY--
```

#### **Successful response**&#x20;

In case of success, the method returns the result of comparing the two templates.&#x20;

HTTP response content type: “application/json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type** | **Description**                                                                                                                                                                                                                                                               |
| ------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| score              | Float    | The result of comparing two templates                                                                                                                                                                                                                                         |
| decision           | String   | <p>Recommended solution based on the score.</p><p></p><p><em>approved</em> – positive. The faces match.</p><p></p><p><em>operator\_required</em> – additional operator verification is required.</p><p></p><p><em>declined</em> – negative result. The faces don't match.</p> |

#### **Response example**

```json
200 OK
Content-Type: application/json
{“score”: 1.0, “decision”: “approved”}
```

### verify – the biometric verification

The method combines the two methods from above, **extract** and **compare**. It extracts a template from an image and compares the resulting biometric template with another biometric template that is also passed in the request.&#x20;

The content type of the HTTP request is “multipart / form-data”.&#x20;

Call `POST /v1/face/pattern/verify`&#x20;

#### **Input parameters**

| **Parameter name** | **Type** | **Description**                                                           |
| ------------------ | -------- | ------------------------------------------------------------------------- |
| sample             | Stream   | <p>Required parameter.</p><p>Image to extract the biometric template.</p> |
| bio\_template      | Stream   | <p>Required parameter.</p><p>The biometric template to compare with.</p>  |

{% hint style="info" %}
To transfer data in base64, add `Content-Transfer-Encoding = base64` to the request headers.
{% endhint %}

#### **Request example**

```json
POST localhost/v1/face/pattern/verify
Content-Type: multipart/form-data;
boundary=--BOUNDARY--
Content-Length: Message body length
--BOUNDARY--
Content-Disposition: form-data; name=”bio_template”
Content_type: application/octet-stream
{Biometric template byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”sample”
Content_type: image/jpeg
{Image byte stream}
--BOUNDARY--
```

#### **Successful response**&#x20;

In case of success, the method returns the result of comparing two biometric templates and the biometric template.&#x20;

The content type of the HTTP response is “multipart/form-data”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type** | **Description**                       |
| ------------------ | -------- | ------------------------------------- |
| score              | Float    | The result of comparing two templates |
| bio\_feature       | Stream   | Biometric template derived from image |

#### **Response example**

```json
200 OK
Content-Type: multipart/form-data;
boundary=--BOUNDARY--
Content-Length: Message body length
--BOUNDARY--
Content-Disposition: form-data; name=”score”
Content_type: application/json
{“score”: 1.0}
--BOUNDARY--
Content-Disposition: form-data; name=”bio_feature”
Content_type: application/octet-stream
{Biometric template byte stream}
--BOUNDARY--
```

### extract\_and\_compare – extracting and comparison of templates derived from two images

The method also combines the two methods from above, **extract** and **compare**. It extracts templates from two images, compares the received biometric templates, and transmits the comparison result as a response.&#x20;

The content type of the HTTP request is “multipart / form-data”.&#x20;

Call `POST /v1/face/pattern/extract_and_compare`

#### **Input parameters**

| **Parameter name** | **Type** | **Description**                               |
| ------------------ | -------- | --------------------------------------------- |
| sample\_1          | Stream   | <p>Required parameter.</p><p>First image.</p> |
| sample\_2          | Stream   | <p>Required parameter.</p><p>Second image</p> |

{% hint style="info" %}
To transfer data in base64, add `Content-Transfer-Encoding = base64` to the request headers.
{% endhint %}

#### **Request example**

```json
POST localhost/v1/face/pattern/extract_and_compare
Content-Type: multipart/form-data;
boundary=--BOUNDARY--
Content-Length: Message body length
--BOUNDARY--
Content-Disposition: form-data; name=”sample_1”
Content_type: image/jpeg
{Image byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”sample_2”
Content_type: image/jpeg
{Image byte stream}
--BOUNDARY--
```

#### **Successful response**&#x20;

In case of success, the method returns the result of comparing the two extracted biometric templates.&#x20;

HTTP response content type: “application / json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type** | **Description**                                                                                                                                                                                                                                                                   |
| ------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| score              | Float    | The result of comparing the two extracted templates.                                                                                                                                                                                                                              |
| decision           | String   | <p>Recommended solution based on the score.</p><p></p><p><em>approved</em> – positive. The faces are match.</p><p></p><p><em>operator\_required</em> – additional operator verification is required.</p><p></p><p><em>declined</em> – negative result. The faces don't match.</p> |

#### **Response example**

```json
200 OK
Content-Type: application/json
{“score”: 1.0, “decision”: “approved”}
```

### compare\_n – 1:N biometric template comparison&#x20;

Use this method to compare one biometric template to N others.&#x20;

The content type of the HTTP request is “multipart/form-data”.&#x20;

Call `POST /v1/face/pattern/compare_n`

#### **Input parameters**

| **Parameter name** | **Type** | **Description**                                                                                                                                                            |
| ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| template\_1        | Stream   | This parameter is mandatory. The first (main) biometric template                                                                                                           |
| templates\_n       | Stream   | A list of N biometric templates. Each of them should be passed separately but the parameter name should be templates\_n. You also need to pass the filename in the header. |

#### **Request example**

```json
POST localhost/v1/face/pattern/compare_n
Content-Type: multipart/form-data;
boundary=--BOUNDARY--
Content-Length: message body length
--BOUNDARY--
Content-Disposition: form-data; name=”template_1”
Content_type: application/octet-stream
{biometric template byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”templates_n”; filename=”1.template”
Content_type: application/octet-stream
{biometric template byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”templates_n”; filename=”2.template”
Content_type: application/octet-stream
{biometric template byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”templates_n”; filename=”3.template”
Content_type: application/octet-stream
{biometric template byte stream}
--BOUNDARY--
```

#### **Successful response**&#x20;

In case of success, the method returns the result of the 1:N comparison.

HTTP response content type: “application / json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type**    | **Description**                                                                                                                                                                                                                                                                   |
| ------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| results            | List\[JSON] | A list of N comparison results. The Nth result contains the comparison result for the main and Nth templates. The result has the fields as follows:                                                                                                                               |
| \*filename         | String      | A filename for the Nth template.                                                                                                                                                                                                                                                  |
| \*score            | Float       | The result of comparing the main and Nth templates.                                                                                                                                                                                                                               |
| \*decision         | String      | <p>Recommended solution based on the score.</p><p></p><p><em>approved</em> – positive. The faces are match.</p><p></p><p><em>operator\_required</em> – additional operator verification is required.</p><p></p><p><em>declined</em> – negative result. The faces don't match.</p> |

#### **Response example**

```json
200 OK
Content-Type: application/json
{'results': [
    {'filename': '1.template', 'score': 0.0, 'decision': 'declined'}, 
    {'filename': '2.template', 'score': 1.0, 'decision': 'approved'}, 
    {'filename': '3.template', 'score': 0.21, 'decision': 'declined'}
]}
```

### **verify\_n – 1:N biometric verification**&#x20;

The method combines the **extract** and **compare\_n** methods. It extracts a biometric template from an image and compares it to N other biometric templates that are passed in the request as a list.

The content type of the HTTP request is “multipart/form-data”.&#x20;

Call `POST /v1/face/pattern/verify_n`

#### **Input parameters**

| **Parameter name** | **Type** | **Description**                                                                                                                                                            |
| ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sample\_1          | Stream   | This parameter is mandatory. The main image.                                                                                                                               |
| templates\_n       | Stream   | A list of N biometric templates. Each of them should be passed separately but the parameter name should be templates\_n. You also need to pass the filename in the header. |

{% hint style="info" %}
To transfer data in base64, add `Content-Transfer-Encoding = base64` to the request headers.
{% endhint %}

#### **Request example**

```json
POST localhost/v1/face/pattern/verify_n
Content-Type: multipart/form-data;
boundary=--BOUNDARY--
Content-Length: message body length
--BOUNDARY--
Content-Disposition: form-data; name=”sample_1”
Content_type: image/jpeg
{image byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”templates_n”; filename=”1.template”
Content_type: application/octet-stream
{biometric template byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”templates_n”; filename=”2.template”
Content_type: application/octet-stream
{biometric template byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”templates_n”; filename=”3.template”
Content_type: application/octet-stream
{biometric template byte stream}
--BOUNDARY--
```

#### **Successful response**&#x20;

In case of success, the method returns the result of the 1:N comparison.

HTTP response content type: “application / json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type**    | **Description**                                                                                                                                                                                                                                                                   |
| ------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| results            | List\[JSON] | A list of N comparison results. The Nth result contains the comparison result for the template derived from the main image and the Nth template. The result has the fields as follows:                                                                                            |
| \*filename         | String      | A filename for the Nth template.                                                                                                                                                                                                                                                  |
| \*score            | Float       | The result of comparing the template derived from the main image and the Nth template.                                                                                                                                                                                            |
| \*decision         | String      | <p>Recommended solution based on the score.</p><p></p><p><em>approved</em> – positive. The faces are match.</p><p></p><p><em>operator\_required</em> – additional operator verification is required.</p><p></p><p><em>declined</em> – negative result. The faces don't match.</p> |

#### **Response example**

```json
200 OK
Content-Type: application/json
{'results': [
    {'filename': '1.template', 'score': 0.0, 'decision': 'declined'}, 
    {'filename': '2.template', 'score': 1.0, 'decision': 'approved'}, 
    {'filename': '3.template', 'score': 0.21, 'decision': 'declined'}
]}
```

### **extract\_and\_compare\_n – 1:N template extraction and comparison**&#x20;

This method also combines the **extract** and **compare\_n** methods but in another way. It extracts biometric templates from the main image and a list of other images and then compares them in the 1:N mode.

The content type of the HTTP request is “multipart/form-data”.&#x20;

Call `POST /v1/face/pattern/`extract\_and\_compare`_n`

#### **Input parameters**

| **Parameter name** | **Type** | **Description**                                                                                                                                             |
| ------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sample\_1          | Stream   | This parameter is mandatory. The first (main) image.                                                                                                        |
| samples\_n         | Stream   | A list of N images. Each of them should be passed separately but the parameter name should be samples\_n. You also need to pass the filename in the header. |

{% hint style="info" %}
To transfer data in base64, add `Content-Transfer-Encoding = base64` to the request headers.
{% endhint %}

#### **Request example**

```json
POST localhost/v1/face/pattern/extract_and_compare_n
Content-Type: multipart/form-data;
boundary=--BOUNDARY--
Content-Length: message body length
--BOUNDARY--
Content-Disposition: form-data; name=”sample_1”
Content_type: image/jpeg
{image byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”samples_n”; filename=”1.jpeg”
Content_type: image/jpeg
{image byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”samples_n”; filename=”2.jpeg”
Content_type: image/jpeg
{image byte stream}
--BOUNDARY--
Content-Disposition: form-data; name=”samples_n”; filename=”3.jpeg”
Content_type: image/jpeg
{image byte stream}
--BOUNDARY--
```

#### **Successful response**&#x20;

In case of success, the method returns the result of the 1:N comparison.

HTTP response content type: “application / json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type**    | **Description**                                                                                                                                                                                                                                                                   |
| ------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| results            | List\[JSON] | A list of N comparison results. The Nth result contains the comparison result for the main and Nth images. The result has the fields as follows:                                                                                                                                  |
| \*filename         | String      | A filename for the Nth image.                                                                                                                                                                                                                                                     |
| \*score            | Float       | The result of comparing the main and Nth images.                                                                                                                                                                                                                                  |
| \*decision         | String      | <p>Recommended solution based on the score.</p><p></p><p><em>approved</em> – positive. The faces are match.</p><p></p><p><em>operator\_required</em> – additional operator verification is required.</p><p></p><p><em>declined</em> – negative result. The faces don't match.</p> |

#### **Response example**

```json
200 OK
Content-Type: application/json
{'results': [
    {'filename': '1.jpeg', 'score': 0.0, 'decision': 'declined'}, 
    {'filename': '2.jpeg', 'score': 1.0, 'decision': 'approved'}, 
    {'filename': '3.jpeg', 'score': 0.21, 'decision': 'declined'}
]}
```

### Method errors&#x20;

HTTP response content type: “application / json”.

<table data-header-hidden><thead><tr><th width="207.87420091917764">HTTP response codes</th><th width="247.97192325690224">The value of the “code” parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>HTTP response codes</strong></td><td><strong>The value of the “code” parameter</strong></td><td><strong>Description</strong></td></tr><tr><td>400</td><td>BPE-002001</td><td>Invalid Content-Type of HTTP request</td></tr><tr><td>400</td><td>BPE-002002</td><td>Invalid HTTP request method</td></tr><tr><td>400</td><td>BPE-002003</td><td>Failed to read the biometric sample*</td></tr><tr><td>400</td><td>BPE-002004</td><td>Failed to read the biometric template</td></tr><tr><td>400</td><td>BPE-002005</td><td>Invalid Content-Type of the multiparted HTTP request part</td></tr><tr><td>400</td><td>BPE-003001</td><td>Failed to retrieve the biometric template</td></tr><tr><td>400</td><td>BPE-003002</td><td>The biometric sample* is missing face</td></tr><tr><td>400</td><td>BPE-003003</td><td>More than one person is present on the biometric sample*</td></tr><tr><td>500</td><td>BPE-001001</td><td>Internal bioprocessor error</td></tr><tr><td>400</td><td>BPE-001002</td><td>TFSS error. Call the biometry health method.</td></tr></tbody></table>

<details>

<summary>*</summary>

A biometric sample is an input image.

</details>

## Liveness

### health – checking the status of liveness processor

Use this method to check whether the liveness processor is ready to work.

Call `GET /v1/face/liveness/health`&#x20;

#### Input parameters

* None.&#x20;

#### **Request example**

`GET localhost/v1/face/liveness/health`&#x20;

#### **Successful response**

In case of success, the method returns a message with the following parameters.&#x20;

HTTP response content type: “application/json”.&#x20;

#### **Output parameters**

| **Parameter name** | **Type** | **Description**                                                                                           |
| ------------------ | -------- | --------------------------------------------------------------------------------------------------------- |
| status             | Int      | <p>0 – the liveness processor is working correctly. </p><p>3 – the liveness processor is inoperative.</p> |
| message            | String   | Message.                                                                                                  |

#### **Response example**

```json
200 OK
Content-Type: application/json
{“status”: 0, message: “”}
```

### detect – presentation attack detection

The `detect` method is made to reveal presentation attacks. It detects a face in each image or video (since 1.2.0), sends them for analysis, and returns a result.

The method supports the following content types:

* `image/jpeg` or `image/png` for an image;
* `multipart/form-data` for  images, videos, and archives. You can use `payload` to add any parameters that affect the analysis.

To run the method, call `POST /{version}/face/liveness/detect`.

<figure><img src="/files/Kq1DXZMHM7s8zhzdQKlG" alt=""><figcaption></figcaption></figure>

#### Image <a href="#image" id="image"></a>

Accepts an image in JPEG or PNG format. No `payload` attached.

<details>

<summary>Request example</summary>

```json
POST /v1/face/liveness/detect HTTP/1.1
Host: localhost
Content-Type: image/jpeg
Content-Length: [the size of the message body]
[Image byte stream]
```

</details>

<details>

<summary>Successful response example</summary>

```json
HTTP/1.1 200 OK
Content-Type: application/json
{
  "passed": false,
  "score": 0.999484062
}
```

</details>

#### Multipart/form-data <a href="#multipart-form-data" id="multipart-form-data"></a>

Accepts the multipart/form-data request.

* Each media file should have a unique name, e.g., `media_key1`, `media_key2`.
* The `payload` parameters should be a JSON placed in the `payload` field.

{% hint style="info" %}
Temporary IDs will be deleted once you get the result.
{% endhint %}

<details>

<summary>Request example</summary>

```json
POST /v1/face/liveness/detect HTTP/1.1
Host: localhost
Content-Length: [the size of the message body]
Content-Type: multipart/form-data; boundary=--BOUNDARY--

--BOUNDARY--
Content-Disposition: form-data; name="media_key1"; filename="video.mp4"
Content-Type: multipart/form-data; 

[media file byte stream]
--BOUNDARY--
Content-Disposition: form-data; name="payload"

    {
        "folder:meta_data": {
            "partner_side_folder_id": "partner_side_folder_id_if_needed",
            "person_info": {
                "first_name": "John",
                "middle_name": "Jameson",
                "last_name": "Doe"
            }
        },
        "resolution_endpoint": "https://www.your-custom-endpoint.com",
        "media:meta_data": {
            "media_key1": {
                "foo": "bar2"
            }
        },
        "media:tags": {
            "media_key1": [
                "video_selfie",
                "video_selfie_blank"
            ]
        },
        "analyses": [
          {
            "type": "quality",
            "meta_data": {
              "example1": "some_example1"
            },
            "params": {
                "threshold_spoofing": 0.6,
                "extract_best_shot": false
            }
          }
]
    }
--BOUNDARY--
```

</details>

<details>

<summary>Successful response example</summary>

```json
{
    "company_id": null,
    "time_created": 1720180784.769608,
    "folder_id": "folder_id", // temporary ID
    "user_id": null,
    "resolution_endpoint": "https://www.your-custom-endpoint.com",
    "resolution_status": "FINISHED",
    "resolution_comment": "[]",
    "system_resolution": "SUCCESS",
    "resolution_time": null,
    "resolution_author_id": null,
    "resolution_state_hash": null,
    "operator_comment": null,
    "operator_status": null,
    "is_cleared": null,
    "meta_data": {
        "partner_side_folder_id": "partner_side_folder_id_if_needed",
        "person_info": {
            "first_name": "John",
            "middle_name": "Jameson",
            "last_name": "Doe"
        }
    },
    "technical_meta_data": {},
    "time_updated": 1720180787.531983,
    "media": [
        {
            "folder_id": "folder_id", // temporary ID
            "media_id": "video_id", // temporary ID
            "media_type": "VIDEO_FOLDER",
            "info": {
                "thumb": null,
                "video": {
                    "duration": 3.76,
                    "FPS": 22.83,
                    "width": 960,
                    "height": 720,
                    "md5": "8879b4fa9ee7add77aceb8d7d5d7b92d",
                    "size": 6017119,
                    "mime-type": "video/mp4"
                }
            },
            "tags": [
                "video_selfie",
                "video_selfie_blank",
                "orientation_portrait"
            ],
            "original_name": "video-5mb.mp4",
            "original_url": null,
            "company_id": null,
            "technical_meta_data": {},
            "time_created": 1719573752.78253,
            "time_updated": 1720180787.531801,
            "meta_data": {
                "foo4": "bar5"
            },
            "thumb_url": null,
            "folder_time_created": null,
            "video_id": "video_id", // temporary ID
            "video_url": null
        }
    ],
    "analyses": [
        {
            "analyse_id": null,
            "analysis_id": null,
            "folder_id": "folder_id", // temporary ID
            "folder_time_created": null,
            "type": "QUALITY",
            "state": "FINISHED",
            "company_id": null,
            "group_id": null,
            "results_data": null,
            "confs": {
                "threshold_replay": 0.5,
                "extract_best_shot": false,
                "threshold_liveness": 0.5,
                "threshold_spoofing": 0.42
            },
            "error_message": null,
            "error_code": null,
            "resolution_operator": null,
            "technical_meta_data": {},
            "time_created": 1720180784.769944,
            "time_updated": 1720180787.531877,
            "meta_data": {
                "some_key": "some_value"
            },
            "source_media": [
                {
                    "folder_id": "folder_id", // temporary ID
                    "media_id": "video_id", // temporary ID
                    "media_type": "VIDEO_FOLDER",
                    "info": {
                        "thumb": null,
                        "video": {
                            "duration": 3.76,
                            "FPS": 22.83,
                            "width": 960,
                            "height": 720,
                            "md5": "8879b4fa9ee7add77aceb8d7d5d7b92d",
                            "size": 6017119,
                            "mime-type": "video/mp4"
                        }
                    },
                    "tags": [
                        "video_selfie",
                        "video_selfie_blank",
                        "orientation_portrait"
                    ],
                    "original_name": "video-5mb.mp4",
                    "original_url": null,
                    "company_id": null,
                    "technical_meta_data": {},
                    "time_created": 1719573752.78253,
                    "time_updated": 1720180787.531801,
                    "meta_data": {
                        "foo4": "bar5"
                    },
                    "thumb_url": null,
                    "folder_time_created": null,
                    "video_id": "video_id", // temporary ID
                    "video_url": null
                }
            ],
            "results_media": [
                {
                    "company_id": null,
                    "media_association_id": "video_id", // temporary ID
                    "analysis_id": null,
                    "results_data": {
                        "confidence_spoofing": 0.000541269779
                    },
                    "source_media_id": "video_id", // temporary ID
                    "output_images": [],
                    "collection_persons": [],
                    "folder_time_created": null
                }
            ],
            "resolution_status": "SUCCESS",
            "resolution": "SUCCESS"
        }
    ]
}
```

</details>

#### Multipart/form-data with Best Shot <a href="#multipart-form-data-with-best-shot" id="multipart-form-data-with-best-shot"></a>

To extract the best shot from your video or archive, in `analyses`, set `extract_best_shot` = `true` (as shown in the request example below). In this case,  API Lite will analyze your archives and videos, and, in response, will return the best shot. It will be a base64 image in `analysis->output_images->image_b64`.

Additionally, you can change the Liveness threshold. In `analyses`, set the new threshold in the `threshold_spoofing` parameter. If the resulting score will be higher than this parameter's value, the analysis will end up with the DECLINED status. Otherwise, the status will be SUCCESS.

<details>

<summary>Request example</summary>

```json
POST /v1/face/liveness/detect HTTP/1.1
Host: localhost
Content-Length: [the size of the message body]
Content-Type: multipart/form-data; boundary=--BOUNDARY--

--BOUNDARY--
Content-Disposition: form-data; name="media_key1"; filename="video.mp4"
Content-Type: multipart/form-data; 

[media file byte stream]
--BOUNDARY--
Content-Disposition: form-data; name="payload"

    {
        "folder:meta_data": {
            "partner_side_folder_id": "partner_side_folder_id_if_needed",
            "person_info": {
                "first_name": "John",
                "middle_name": "Jameson",
                "last_name": "Doe"
            }
        },
        "resolution_endpoint": "https://www.your-custom-endpoint.com",
        "media:meta_data": {
            "media_key1": {
                "foo": "bar2"
            }
        },
        "media:tags": {
            "media_key1": [
                "video_selfie",
                "video_selfie_blank"
            ]
        },
        "analyses": [
          {
            "type": "quality",
            "meta_data": {
              "example1": "some_example1"
            },
            "params": {
                "threshold_spoofing": 0.6,
                "extract_best_shot": true
            }
          }
]
    }
--BOUNDARY--
```

</details>

<details>

<summary>Successful response example</summary>

```json
{
    "company_id": null,
    "time_created": 1720177371.120899,
    "folder_id": "folder_id", // temporary ID
    "user_id": null,
    "resolution_endpoint": "https://www.your-custom-endpoint.com",
    "resolution_status": "FINISHED",
    "resolution_comment": "[]",
    "system_resolution": "SUCCESS",
    "resolution_time": null,
    "resolution_author_id": null,
    "resolution_state_hash": null,
    "operator_comment": null,
    "operator_status": null,
    "is_cleared": null,
    "meta_data": {
        "partner_side_folder_id": "partner_side_folder_id_if_needed",
        "person_info": {
            "first_name": "John",
            "middle_name": "Jameson",
            "last_name": "Doe"
        }
    },
    "technical_meta_data": {},
    "time_updated": 1720177375.531137,
    "media": [
        {
            "folder_id": "folder_id", // temporary ID
            "media_id": "media_id", // temporary ID
            "media_type": "VIDEO_FOLDER",
            "info": {
                "thumb": null,
                "video": {
                    "duration": 3.76,
                    "FPS": 22.83,
                    "width": 960,
                    "height": 720,
                    "md5": "8879b4fa9ee7add77aceb8d7d5d7b92d",
                    "size": 6017119,
                    "mime-type": "video/mp4"
                }
            },
            "tags": [
                "video_selfie",
                "video_selfie_blank",
                "orientation_portrait"
            ],
            "original_name": "video-5mb.mp4",
            "original_url": null,
            "company_id": null,
            "technical_meta_data": {},
            "time_created": 1719573752.781861,
            "time_updated": 1720177373.772401,
            "meta_data": {
                "foo4": "bar5"
            },
            "thumb_url": null,
            "folder_time_created": null,
            "video_id": "media_id", // temporary ID
            "video_url": null
        }
    ],
    "analyses": [
        {
            "analyse_id": null,
            "analysis_id": null,
            "folder_id": "folder_id", // temporary ID
            "folder_time_created": null,
            "type": "QUALITY",
            "state": "FINISHED",
            "company_id": null,
            "group_id": null,
            "results_data": null,
            "confs": {
                "threshold_replay": 0.5,
                "extract_best_shot": true,
                "threshold_liveness": 0.5,
                "threshold_spoofing": 0.42
            },
            "error_message": null,
            "error_code": null,
            "resolution_operator": null,
            "technical_meta_data": {},
            "time_created": 1720177371.121241,
            "time_updated": 1720177375.531043,
            "meta_data": {
                "some_key": "some_value"
            },
            "source_media": [
                {
                    "folder_id": "folder_id", // temporary ID
                    "media_id": "media_id", // temporary ID
                    "media_type": "VIDEO_FOLDER",
                    "info": {
                        "thumb": null,
                        "video": {
                            "duration": 3.76,
                            "FPS": 22.83,
                            "width": 960,
                            "height": 720,
                            "md5": "8879b4fa9ee7add77aceb8d7d5d7b92d",
                            "size": 6017119,
                            "mime-type": "video/mp4"
                        }
                    },
                    "tags": [
                        "video_selfie",
                        "video_selfie_blank",
                        "orientation_portrait"
                    ],
                    "original_name": "video-5mb.mp4",
                    "original_url": null,
                    "company_id": null,
                    "technical_meta_data": {},
                    "time_created": 1719573752.781861,
                    "time_updated": 1720177373.772401,
                    "meta_data": {
                        "foo4": "bar5"
                    },
                    "thumb_url": null,
                    "folder_time_created": null,
                    "video_id": "media_id", // temporary ID
                    "video_url": null
                }
            ],
            "results_media": [
                {
                    "company_id": null,
                    "media_association_id": "media_id", // temporary ID
                    "analysis_id": null,
                    "results_data": {
                        "confidence_spoofing": 0.000541269779
                    },
                    "source_media_id": "media_id", // temporary ID
                    "output_images": [
                        {
                            "folder_id": "folder_id", // temporary ID
                            "media_id": "media_id", // temporary ID
                            "media_type": "IMAGE_RESULT_ANALYSIS_SINGLE",
                            "info": {
                                "thumb": null,
                                "original": {
                                    "md5": "e6effeceb94e79b8cb204c6652283b57",
                                    "width": 720,
                                    "height": 960,
                                    "size": 145178,
                                    "mime-type": "image/jpeg"
                                }
                            },
                            "tags": [],
                            "original_name": "<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=720x960 at 0x766811DF8E90>",
                            "original_url": null,
                            "company_id": null,
                            "technical_meta_data": {},
                            "time_created": 1719573752.781861,
                            "time_updated": 1719573752.781871,
                            "meta_data": null,
                            "folder_time_created": null,
                            "image_b64": "",
                            "media_association_id": "media_id" // temporary ID
                        }
                    ],
                    "collection_persons": [],
                    "folder_time_created": null
                }
            ],
            "resolution_status": "SUCCESS",
            "resolution": "SUCCESS"
        }
    ]
}
```

</details>

<details>

<summary>The <code>payload</code> field</summary>

```json
{
    "folder:meta_data": {
        "partner_side_folder_id": "partner_side_folder_id_if_needed",
        "person_info": {
            "first_name": "John",
            "middle_name": "Jameson",
            "last_name": "Doe"
        }   },
    "resolution_endpoint": "https://www.your-custom-endpoint.com",
    "media:meta_data": {
        "media_key1": {
            "foo": "bar2",
            "additional_info": "additional_info" // might affect the score
        },
        "media_key2": {
            "foo2": "bar3"
        },
        "media_key3": {
            "foo4": "bar5"
        }
    },
    "media:tags": {
        "media_key1": [
            "video_selfie",
            "video_selfie_blank",
            "orientation_portrait"
        ],
        "media_key2": [
            "photo_selfie"
        ],
        "media_key3": [
            "video_selfie",
            "video_selfie_blank",
            "orientation_portrait"
        ]
    },
"analyses": [
    {
      "type": "quality",
      "meta_data": {
        "some_key": "some_value"
      },
      "params": {
      	"threshold_spoofing": 0.42, // affects resolution
      	"extract_best_shot":true // analysis will return the best shot
      }
    }
  ]
}
```

</details>

### Method errors&#x20;

HTTP response content type: “application / json”.

<table data-header-hidden><thead><tr><th width="207.87420091917764">HTTP response codes</th><th width="247.97192325690224">The value of the “code” parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>HTTP response codes</strong></td><td><strong>The value of the “code” parameter</strong></td><td><strong>Description</strong></td></tr><tr><td>400</td><td>LDE-002001</td><td>Invalid Content-Type of HTTP request</td></tr><tr><td>400</td><td>LDE-002002</td><td>Invalid HTTP request method</td></tr><tr><td>400</td><td>LDE-002004</td><td>Failed to extract the biometric sample*</td></tr><tr><td>400</td><td>LDE-002005</td><td>Invalid Content-Type of the multiparted HTTP request part</td></tr><tr><td>500</td><td>LDE-001001</td><td>Liveness detection processor internal error</td></tr><tr><td>400</td><td>LDE-001002</td><td>TFSS error. Call the Liveness health method.</td></tr></tbody></table>

<details>

<summary>*</summary>

A biometric sample is an input image.

</details>


---

# 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.ozforensics.com/oz-knowledge/guides/developer-guide/api/oz-api-lite/api-methods.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.
