> 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/voice-services/voice-authentication.md).

# Voice Authentication

Service that compares an audio against a voice template issued during enrollment and returns the result with its score.

### Endpoint

```
POST /biometric/voice/authentication
```

### Headers

| Name              | Type   | Required | Description                                                                                                                   |
| ----------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Authorization** | string | **Yes**  | Consumer Token in Bearer format `Bearer <token>`. See [Authentication](/docs.facephi-en/rest-api/midapi-v2/autenticacion.md). |
| **consumer-id**   | string | **Yes**  | Consumer identifier.                                                                                                          |

### Request body

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

#### Parameters

| Parameter  | Type   | Required | Description                                                                                                        |
| ---------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------ |
| `audio`    | string | **Yes**  | Audio to authenticate, in Base64.                                                                                  |
| `template` | string | **Yes**  | Voice template issued in the [enrollment](/docs.facephi-en/rest-api/midapi-v2/voice-services/voice-enrollment.md). |

#### Request example

```json
{
  "audio": "<base64 audio>",
  "template": "<plantilla de voz>"
}
```

### 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 format **ISO 8601**.                 |
| `message`         | string  | Descriptive field for the result of the service execution. |
| `operationResult` | integer | Result code of the service execution.                      |
| `match`           | boolean | Indicates whether the audio corresponds to the template.   |
| `matchingScore`   | number  | Match score.                                               |
| `livenessScore`   | number  | Audio liveness check score.                                |

#### Other responses

| Code  | Description                                                                 |
| ----- | --------------------------------------------------------------------------- |
| `400` | Missing required field, audio with unsupported format, or invalid template. |
| `401` | Missing, invalid, or expired Token.                                         |
| `403` | The consumer is not provisioned with the service `VOICE_AUTHENTICATION`.    |

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