> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2/biometric-services/face-liveness.md).

# Face Liveness

Service that determines whether the selfie corresponds to a person who was present at the time of capture.

### Endpoint

```
POST /biometric/face/liveness
```

### Headers

| Name              | Type   | Required    | Description                                                                                                                                                                                     |
| ----------------- | ------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Authorization** | string | **Yes**     | Consumer token in `Bearer <token>`. See [Authentication](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2/autenticacion.md).                                                         |
| **consumer-id**   | string | **Yes**     | Consumer identifier.                                                                                                                                                                            |
| **operation-id**  | string | Conditional | Identifier of the operation to which the referenced assets belong. Required when `source` is `FILE_KEY`. See [Storage](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2/storage.md). |

### Request body

**Content-Type:** `application/json`

#### Parameters

| Parameter | Type   | Required | Description                                                                                                                                                                                  |
| --------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `source`  | string | **Yes**  | How the assets are provided: `FILE_KEY` for keys of stored assets, `FILE` for Base64-encoded content. See [Storage](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2/storage.md). |
| `image`   | string | **Yes**  | Selfie: asset key `TOKEN_BEST_IMAGE` or its Base64-encoded content.                                                                                                                          |

#### Request example

```json
{
  "source": "FILE_KEY",
  "image": "0192a3f4-7b21-7c44-9e1a-3f5b8c2d1e04/TOKEN_BEST_IMAGE"
}
```

### Responses

#### `200` Success

#### Response parameters

| Parameter        | Type   | Description                                                |
| ---------------- | ------ | ---------------------------------------------------------- |
| `consumerId`     | string | Identifier of the consumer that made the call.             |
| `transactionId`  | string | Transaction identifier.                                    |
| `timestamp`      | string | Response timestamp in **ISO 8601**.                        |
| `message`        | string | Descriptive field for the result of the service execution. |
| `livenessResult` | string | Liveness check result: `LIVE`, `NO_LIVE` or `ERROR`.       |

#### Example response

```json
{
  "consumerId": "consumer-web",
  "transactionId": "a29cbe15-2b68-495f-b7eb-be985b21c486",
  "timestamp": "2026-06-26T12:00:05.000Z",
  "message": "Service executed ok",
  "livenessResult": "LIVE"
}
```

#### Other responses

| Code  | Description                                                                                                                                                                                                                                                                                                                                                             |
| ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `400` | Required field missing or unsupported value; the header `operation-id` has references; or a key is not in the form `{operationId}/{CONTEXTO}` or declares a context that the slot does not accept.                                                                                                                                                                      |
| `401` | Token missing, invalid, or expired.                                                                                                                                                                                                                                                                                                                                     |
| `403` | The consumer is not provisioned with the `LIVENESS`.                                                                                                                                                                                                                                                                                                                    |
| `404` | The operation declared in `operation-id` does not exist or belongs to another consumer.                                                                                                                                                                                                                                                                                 |
| `410` | The operation declared in `operation-id` has expired.                                                                                                                                                                                                                                                                                                                   |
| `422` | A key names an operation different from the one declared in `operation-id`, or the context has no stored assets.                                                                                                                                                                                                                                                        |
| `429` | The consumer has exceeded its request rate limit, or a referenced asset has exhausted its invocation budget for this endpoint. In the first case, the response includes `Retry-After`, `X-RateLimit-Limit` and `X-RateLimit-Burst`, and waiting resolves the issue; in the second case, it does not. The underlying service is not invoked, and the call is not billed. |

The body of an error response has the form described in [Middleware API v2](https://docs.facephi.com/docs.facephi-en/rest-api/midapi-v2.md#respuestas-de-error).
