# Adapt Face

To perform an adaption to the user’s biometric face sample registered on the engine, the method to be used is Adapt Face.  Similar to the face verification process, this method is expecting a user’s face sample. In case of success, the system will replace the face registry by the new sample provided and respond that this process is complete with success. In case of failure, it’s necessary to repeat this process until the adaption process is completed with success.

## Adapt Face

<mark style="color:green;">`POST`</mark> `Https://api.biometrid.com/api/1.1/users/:userId/dialogue/adapt/face`

Adapt User's face enroll on provider.

#### Path Parameters

| Name   | Type   | Description       |
| ------ | ------ | ----------------- |
| userID | string | BiometrID user ID |

#### 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                                                                                                                      |
| ---------- | ------ | -------------------------------------------------------------------------------------------------------------------------------- |
| livenessId | string | Liveness session identifier obtained from successful validation. **Required** if liveness is active for in Client configuration. |
| photo      | object | Image file containing user's face for biometric analysis. File format: jpeg, png or jpg. Maximum file size 1 Mb.                 |

{% tabs %}
{% tab title="200 Success 200 types" %}
{% code title="HTTP/1.1 200 OK" %}

```javascript
//Adapt Face
{
    "status": true,
    "data": {
      "message": "FACE_ADAPTED_WITH_SUCCESS",
      "adapted": true,
      "faceImg" 'http://static.findface.pro/uploads/5836b930a43d246605076eb8(...).jpg'
    }
}

//Adapt Face Failed
{
    "status": false,
    "data": {
        "message": "FACE_ADAPT_FAILED",
        "reason": "No faces found on 'photo'"
      }
}

//Adapt Face Failed
{
    "status": false,
    "data": {
        "message": "FACE_NOT_REALIABLE_TO_ADAPT",
        "alreadyExists": false
      }
}
```

{% endcode %}
{% endtab %}

{% tab title="400 Bad Request types" %}
{% code title="HTTP/1.1 400 Bad Request" %}

```javascript
//No photo file detected on request. Not sent or invalid format
    {
        "status": false,
        "data": {
            "message": "NO_FILE_OR_INVALID_FORMAT"
        }
    }
// User face not enroled on this provider.
{
    "status": false,
    "data": {
        "message": "ENROLL_USER_FACE_FIRST"
    }
}
// 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 Payment Required - 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 Not Found request types" %}
{% code title="HTTP/1.1 404 Not Found" %}

```javascript
// No active engine configuration for this provider.
    {
        "status": false,
        "data": {
            "message": "NO_FACE_ENGINE_CONFIGURATION_AVAILABLE"
        }
    }
 // User's id not exists in biometrid environment.
    {
        "status": false,
        "data": {
            "message": "USERID_NOT_EXISTS"
        }
    }
//Client not found by given key.
    {
        "status": false,
        "data": {
            "message": "CLIENT_NOT_FOUND/CHECK_AUTHENTICATION_HEADERS"
        }
    }
 
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% code title="Example (JSON)" %}

```javascript
{
    "photo": face.jpeg
    "liveness": "d3213-23dds2-75rgu6-ds3434"
}
```

{% endcode %}
