> 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-enrollment.md). Agents can also search and read this documentation through its [MCP server](https://docs.facephi.com/~gitbook/mcp).

# Voice Enrollment

Service that generates a voice template from the enrollment audios and returns the validation result for each audio.

### Endpoint

```
POST /biometric/voice/enrollment
```

### Headers

| Name              | Type   | Required | Description                                                                                                                                        |
| ----------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Authorization** | string | **Yes**  | Consumer token in the format `Bearer <token>`. See [Authentication](https://docs.facephi.com/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                                       |
| --------- | ----- | -------- | ------------------------------------------------- |
| `audios`  | array | **Yes**  | Enrollment audios, in Base64, in recording order. |

#### Request example

```json
{
  "audios": ["<base64 audio 1>", "<base64 audio 2>", "<base64 audio 3>"]
}
```

### 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 service execution result.                       |
| `operationResult`      | integer | Service execution result code.                                            |
| `template`             | string  | Resulting voice template.                                                 |
| `templateType`         | string  | Type of template generated.                                               |
| `validateAudiosResult` | array   | Result for each audio. See [Result for each audio](#resultado-por-audio). |

#### Result for each audio

| Parameter                          | Type    | Description                                  |
| ---------------------------------- | ------- | -------------------------------------------- |
| `audio_position`                   | integer | Audio position in the request.               |
| `result_code`                      | integer | Audio result code.                           |
| `matching_score`                   | number  | Audio matching score.                        |
| `snr_db_detected`                  | number  | Detected signal-to-noise ratio, in decibels. |
| `speech_length_ms_detected`        | integer | Detected speech duration, in milliseconds.   |
| `speech_relative_length_detected`  | number  | Ratio of speech to total duration.           |
| `multiple_speakers_score_detected` | number  | Multiple-speaker detection score.            |

#### Other responses

| Code  | Description                                                         |
| ----- | ------------------------------------------------------------------- |
| `400` | Required field missing or unsupported audio format.                 |
| `401` | Token is missing, invalid, or expired.                              |
| `403` | The consumer is not provisioned for the service `VOICE_ENROLLMENT`. |

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).
