> ## Documentation Index
> Fetch the complete documentation index at: https://docs.authentica.sa/llms.txt
> Use this file to discover all available pages before exploring further.

# Voice verification

> Compare a reference voice sample with a real-time recording.

`authentica.voice.verify()` checks whether a real-time voice recording matches the reference audio you registered for a user.

```ts theme={null}
const result = await authentica.voice.verify({
  userId: 'user_123',
  registeredAudio, // Base64-encoded reference audio
  queryAudio,      // Base64-encoded real-time audio
});

if (!result.success) {
  console.log('Voice verification could not be completed.');
} else if (result.result) {
  console.log('Voice match confirmed.');
} else {
  console.log('Voices do not match.');
}
```

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | Yes | Your unique identifier for the user. |
| `registeredAudio` | `string` | Yes | Base64-encoded reference audio. |
| `queryAudio` | `string` | Yes | Base64-encoded real-time audio recorded by your application. |

The SDK checks only that each field is a non-empty string. The API decides whether the audio is valid.

## Response

```json theme={null}
{
  "success": true,
  "userId": "user_123",
  "result": true
}
```

**success** `boolean`

Whether the API processed the verification request.

**userId** `string`

The user ID returned by the API.

**result** `boolean`

`true` if the voices match, `false` if they do not.

Check `success` first. `success: false` means the verification could not be completed, not that the voices do not match. Only when `success` is `true` does `result` tell you whether the voices match. A `result` of `false` is a normal outcome, not an error.

> [!WARNING]
>
> Voice recordings are biometric data. Never log Base64 audio payloads, and avoid storing them unnecessarily. Limit upload and request sizes in your backend; the SDK does not impose a size limit.

See also: [Voice Verification Workflow](https://docs.authentica.sa/guides/voice-verification-workflow.md) and the [Verify By Voice](https://docs.authentica.sa/api-reference/voice-verification/verify-by-voice.md) API Reference.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.