
# Face Validator Config

The config feature allows you to customize various parameters to enhance or adjust the behavior of the **Face Validator** according to your company's needs. When a validation is executed, these parameters override the default configuration we have stored for any validation performed in **Truora**, ensuring that customers have all models up to date. For example:

{{<table >}}
| Parameter     | Client Config | Default Config  | Used Config<br>(Client+Default) |
|---------------|:-------------:|:---------------:|:-------------------------------:|
|Allowed Retries| 1             | 0               | **1**                           |
|Timeout        | 900           | 300             | **900**                         |	
|Retries TTL    | -             | 300             | **300**                         |	

{{</table >}}

In this guide, you will learn how to update, retrieve, and delete a configuration for the **Face Validator**. We will use a single example throughout this guide to demonstrate the use of the **Update**, **Get**, and **Delete** Config requests, helping you understand their essential functions and responses.

## Face Validator Parameters

You can set the following parameters:

- ``timeout``: The amount of time, in seconds, that users will have to perform the validation before it times out. The default value is 300 seconds (5 minutes), with a maximum of 21600 seconds (6 hours) and a minimum of 1 second.
- ``allowed_retries``: The number of times the validation may be retried before failing. The default value is 0 retries, with a maximum of 2 retries. *
- ``retry_ttl``: The time to live (TTL), in seconds, for creating a retry of any validation. The default and maximum value is 300 seconds (5 minutes), with a minimum of 1 second. *
- ``use_manual_review``: Determines whether manual review will be performed upon validation failure. You must contact Truora to activate this service. For more information please visit the {{< newtab href="/guides/manual_review/" >}}manual review{{< /newtab >}} guide. 
- ``threshold``: Determines the required similarity, ranging from **0 to 1**, between the provided picture and the video or selfie to pass the validation. Note that a higher value may increase friction with the end-user, resulting in decreased customer conversion, while a lower value might increase conversion but reduce the rigor of the validation.      
- ``include_face_search``: When set to true, adds ``face_search`` subvalidation to the ``face-recognition`` validation. This enables the system to check if the uploaded face is reported in {{< newtab href="/guides/truface/" >}}Truface (face-search){{< /newtab >}}.

***NOTE:** Retry feature is only available when **passive liveness** is enabled in the {{< newtab href="/guides/face_validation_api/" >}}Face Validation{{< /newtab >}} process. For more information visit the {{< newtab href="/guides/facial_recognition_methods" >}}Facial Recognition Methods{{< /newtab >}} guide.

### Default Config

The **Face Validator** has a default configuration, which you can leave as is or adjust to better suit your industry or use case.
Below are the default values for this configuration:

{{<table_sm>}}

| Parameter             | Default Value |
|-----------------------|:-------------:|
| timeout               | 300           |
| allowed_retries       | 0             |
| retry_ttl             | 300           | 
| use_manual_review     | false         |
| threshold             | 0.65          |
| include_face_search   | false         |

{{</table_sm>}}

## Update Config - Face Validator

To Update the configuration for the Face Validator, follow these steps:

1. Create a ``PUT`` request to the endpoint ``https://api.validations.truora.com/v1/config``.
2. Set the **Headers**
    - ``Truora-API-Key``: enter the value of your {{< newtab href="/guides/authentication/" >}}Truora API-key{{< /newtab >}}.
    - ``Content-Type``: the value should be ``application/x-www-form-urlencoded``.
3. Set required values for the request body
    - ``validator`` [***Required***]: Allowed: ``face-recognition``. Validator to be configured.
    - ``timeout`` [***Optional***]: The amount of time, in seconds, that users will have to perform the validation before it times out. 
    - ``allowed_retries`` [***Optional***]: The number of times the validation may be retried before failing. *
    - ``retry_ttl`` [***Optional***]: The time to live (TTL), in seconds, for creating a retry of any validation. *
    - ``use_manual_review`` [***Optional***]: Determines whether manual review will be performed upon validation failure. You must contact Truora to activate this service. For more information please visit the {{< newtab href="/guides/manual_review/" >}}manual review{{< /newtab >}} guide.
    - ``threshold`` [***Optional***]: Determines the required similarity, ranging from **0 to 1**, between the provided picture and the video or selfie to pass the validation.
    - ``include_face_search`` [***Optional***]: When set to true, adds ``face_search`` subvalidation to the ``face-recognition`` validation. This enables the system to check if the uploaded face is reported in {{< newtab href="/guides/truface/" >}}Truface (face-search){{< /newtab >}}.

    ***NOTE:** Retry feature is only available when **passive liveness** is enabled in the {{< newtab href="/guides/face_validation_api/" >}}Face Validation{{< /newtab >}} process. For more information visit the {{< newtab href="/guides/facial_recognition_methods" >}}Facial Recognition Methods{{< /newtab >}} guide.


For this guide's example we will start by setting the following parameters:

  - ``timeout``: **400**
  - ``allowed_retries``: **2**
  - ``use_manual_review``: **true**

Sending the **Update Config** request with these parameters, the response should look similar to the following:

{{<code lang="json" method="PUT" endpoint="/v1/config">}}
    {
        "authenticate": {
            "timeout": 300,
            "allowed_retries": 2
        },
        "face-recognition": {
            "timeout": 400,
            "enrollment_timeout": 300,
            "allowed_retries": 2,
            "use_manual_review": true,
            "threshold": 0.65,
            "face_validation_config": {
                "similarity": {
                    "threshold": 0.65
                }
            },
            "retry_ttl": 300,
            "include_face_search": false
        },
        "face-search": {
            "timeout": 300,
            "enrollment_timeout": 300,
            "threshold": 0.98
        },
        "identity-questions": {
            "timeout": 300,
            "allowed_retries": 1,
            "threshold": 0.75
        },
        "phone-verification": {
            "timeout": 300,
            "allowed_retries": 2,
            "custom_name": "el proceso"
        },
        "voice-recognition": {
            "timeout": 300,
            "enrollment_timeout": 300
        }
    }
{{</code>}}

Among other details, you will identify the updated config:

- For ``face-recognition`` the ``timeout`` is set to **400**, ``allowed_retries`` is set to **2** and ``use_manual_review`` is set to **true**.

## Get Config

The **Get Config** request allows you to fetch the current configuration state for all validators associated with your account. This request retrieves the configuration for the **Face Validator** as well as the configuration states for all other validators linked to your account.
 
- To obtain the current validators' configuration, send a **GET** request to the endpoint ``https://api.validations.truora.com/v1/config``.

In the case of our current example, at this point you should receive the same response as the previous step:

{{<code lang="json" method="GET" endpoint="/v1/config">}}
    {
        "authenticate": {
            "timeout": 300,
            "allowed_retries": 2
        },
        "face-recognition": {
            "timeout": 400,
            "enrollment_timeout": 300,
            "allowed_retries": 2,
            "use_manual_review": true,
            "threshold": 0.65,
            "face_validation_config": {
                "similarity": {
                    "threshold": 0.65
                }
            },
            "retry_ttl": 300,
            "include_face_search": false
        },
        "face-search": {
            "timeout": 300,
            "enrollment_timeout": 300,
            "threshold": 0.98
        },
        "identity-questions": {
            "timeout": 300,
            "allowed_retries": 1,
            "threshold": 0.75
        },
        "phone-verification": {
            "timeout": 300,
            "allowed_retries": 2,
            "custom_name": "el proceso"
        },
        "voice-recognition": {
            "timeout": 300,
            "enrollment_timeout": 300
        }
    }
{{</code>}}

## Delete Config - Face Validator

The **Delete Config** request allows you to delete a validator's configuration or a specific parameter within the validator's configuration. Deleting the configuration resets its values back to their defaults.

-  To delete a config, send a **DELETE** request to the endpoint ``https://api.validations.truora.com/v1/config`` with the following **Query Parameters**:
    - ``validator`` [***Required***]: Name of the validation config to delete. Set this value to ``face-recognition``.
    - ``type`` [***Optional***]: Allowed: ``timeout`` | ``allowed_retries`` | ``retry_ttl`` | ``use_manual_review`` | ``threshold`` | ``include_face_search``. This specifies the configuration type to be reset. If provided, only the selected configuration will be reset. Otherwise, all configurations will be reset. *
    
    ***Note**: If you omit the ``type`` parameter when sending the request, all configurations associated with the validator will be deleted, reverting all values to their default settings.

### Deleting a specific config type

Following our example, we had updated the following configuration:

- For ``face-recognition`` the ``timeout`` was set to **400**, ``allowed_retries`` was set to **2** and ``use_manual_review`` was set to **true**. All other values where left as default.

To reset the **timeout** to its default value (300 seconds), set the following **Query Parameters** :

  - ``validator``: **face-recognition**
  - ``type``: **timeout** 

Now send the **DELETE** request to the endpoint ``https://api.validations.truora.com/v1/config``. In the response, you should see that for ``face-recognition`` the ``timeout`` has been reset to **300**, ``allowed_retries`` will remain unchanged at **2**, and ``use_manual_review`` will also remain unchanged at **true**:

{{<code lang="json" method="DELETE" endpoint="/v1/config?validator=face-recognition&type=timeout">}}
    {
        "authenticate": {
            "timeout": 300,
            "allowed_retries": 2
        },
        "face-recognition": {
            "timeout": 300,
            "enrollment_timeout": 300,
            "allowed_retries": 2,
            "use_manual_review": true,
            "threshold": 0.65,
            "face_validation_config": {
                "similarity": {
                    "threshold": 0.65
                }
            },
            "retry_ttl": 300,
            "include_face_search": false
        },
        "face-search": {
            "timeout": 300,
            "enrollment_timeout": 300,
            "threshold": 0.98
        },
        "identity-questions": {
            "timeout": 300,
            "allowed_retries": 1,
            "threshold": 0.75
        },
        "phone-verification": {
            "timeout": 300,
            "allowed_retries": 2,
            "custom_name": "el proceso"
        },
        "voice-recognition": {
            "timeout": 300,
            "enrollment_timeout": 300
        }
    }
{{</code>}}

### Deleting all configurations

Following our example, after deleting the ``timeout`` config,  we have the following configuration states:

- For ``face-recognition``, the ``timeout`` was reset to its default (**300**), ``allowed_retries`` is set to **2** and ``use_manual_review`` is set to **true**.

To reset all the configuration for the **Face Validator**, set the following **Query Parameters** :

  - ``validator``: **face-recognition**
  - ``type``: Omit this parameter. Remember that if this parameter is omitted, all configurations will be reset to their default values.

Now send the **DELETE** request to the endpoint ``https://api.validations.truora.com/v1/config``:

{{<code lang="json" method="DELETE" endpoint="/v1/config?validator=face-recognition">}}
    {
        "authenticate": {
            "timeout": 300,
            "allowed_retries": 2
        },
        "face-recognition": {
            "timeout": 300,
            "enrollment_timeout": 300,
            "allowed_retries": 0,
            "use_manual_review": false,
            "threshold": 0.65,
            "face_validation_config": {
                "similarity": {
                    "threshold": 0.65
                }
            },
            "retry_ttl": 300,
            "include_face_search": false
        },
        "face-search": {
            "timeout": 300,
            "enrollment_timeout": 300,
            "threshold": 0.98
        },
        "identity-questions": {
            "timeout": 300,
            "allowed_retries": 1,
            "threshold": 0.75
        },
        "phone-verification": {
            "timeout": 300,
            "allowed_retries": 2,
            "custom_name": "el proceso"
        },
        "voice-recognition": {
            "timeout": 300,
            "enrollment_timeout": 300
        }
    }
{{</code>}}

Finally, in this response you should recognize the following changes:

- For ``face-recognition`` the ``timeout`` remains **300** (default), ``allowed_retries`` is reset to **0** (default), and ``use_manual_review`` is reset to **false** (default).