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

# Text-to-Speech API Overview

> Base URL, authentication, request IDs and limits for the Plivo Text-to-Speech API.

> [!NOTE]
>
> Everything shared by the Text-to-Speech endpoints: the base URL, how to authenticate, request IDs and account limits.

## API Resources

Base URL: `https://api.plivo.com/v1/Account/{auth_id}/TTS/`

| Call | Method | Path |
| - | - | - |
| [Batch](https://plivo.com/docs/models/text-to-speech/api/batch.md) | `POST` | `/TTS/` |
| [Realtime](https://plivo.com/docs/models/text-to-speech/api/realtime.md) | WebSocket | `wss://api.plivo.com/v1/Account/{auth_id}/TTS/Realtime/` |
| [List voices](https://plivo.com/docs/models/text-to-speech/api/voices.md) | `GET` | `/TTS/Voices/` |
| [Retrieve a voice](https://plivo.com/docs/models/text-to-speech/api/voices.md#retrieve-a-voice) | `GET` | `/TTS/Voices/{voice_id}/` |
| [Create / list lexicons](https://plivo.com/docs/models/text-to-speech/api/lexicons.md) | `POST`, `GET` | `/TTS/Lexicons/` |
| [Get / delete a lexicon](https://plivo.com/docs/models/text-to-speech/api/lexicons.md) | `GET`, `DELETE` | `/TTS/Lexicons/{lexicon_id}` |
| [Usage](https://plivo.com/docs/models/text-to-speech/api/usage.md) | `GET` | `/TTS/Usage/` |

No route takes query parameters. Sending one returns `422 invalid_request` with `param` naming it.

## Authentication

Use HTTP Basic auth with your Auth ID and Auth Token. This applies to the WebSocket upgrade too: a bad credential is refused with an HTTP status, so the socket never opens.

```bash theme={null}
-u '<auth_id>:<auth_token>'
```

A subaccount uses its own Auth ID and Auth Token. The main account is billed.

A `401` reply carries `WWW-Authenticate: Basic realm="plivo"`.

## Request IDs

Every reply has a `connection-id` header. It's the same value as `api_id` in REST bodies and `connection_id` in WebSocket events: 16 hex digits, for example `148d6af0bee98c09`. Give it to [Plivo Support](https://support.plivo.com) when you report a problem.

To tag requests with your own reference, send the optional `client-ref` header: 1 to 64 characters of `A-Z`, `a-z`, `0-9`, `_` or `-`. The ID then becomes `<client-ref>.<16 hex digits>`, for example `order-4581.148d6af0bee98c09`.

## Limits

| Limit | Value |
| - | - |
| Open connections per account | 50 (then `429 concurrency_limit`) |
| Text per request or `text` message | 5,000 characters |
| Replies (contexts) per socket | 8 |
| Request body | 1 MiB |
| WebSocket frame | 64 KiB |
| Pronunciations per request | 100 |
| Lexicons per organization | 100 |
| Lexicon | Name 100 chars, 100 rules, word 100 chars, value 120 chars |
| Slow reader | Dropped after 30 s without reading |

## Billing

Per character. Each `done` event and the [Usage API](https://plivo.com/docs/models/text-to-speech/api/usage.md) report billed `characters`.
