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

# How to use Text to Speech

> Learn how to synthesize your text using the Vox AI API.

In this tutorial, you will learn how to use the Vox platform to synthesize text to speech both synchronously and asynchronously. By the end of this tutorial, you will be able to convert text into speech using our API.

***

## Requirements

Before you begin, ensure you have:

* Nodejs
* A Vox API Key
* Basic understanding of HTTP and JSON

***

## API Endpoint

### **POST `/api/v1/get_speech`**

Generates and streams speech audio.

#### **Headers**

```bash theme={null}
Authorization: Bearer {YOUR_API_KEY_HERE}
Content-Type: application/json
```

#### **Body**

```json theme={null}
{
  "text": "Text to convert to speech",
  "voice_id": "khvTFYgvagfvagvfuavdf",
  "language": "en",
  "add_wav_header": true,
  "speed":1.0,
  "sample_rate": 24000
}
```

#### **Response**

* Streams **audio/wav bytes**
* Headers include:

  * `X-Request-ID`

***

# Sample cURL request

Below is a synchronous example using Python + `requests`.

```bash theme={null}
curl -X POST "https://api.tts.timepay.ai/api/v1/get_speech" \
  -H "Authorization: Bearer $YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello world! This is Vox speaking.",
    "voice_id": "khvTFYgvagfvagvfuavdf",
    "language": "en",
    "add_wav_header": true,
    "speed":1.0,
    "sample_rate": 24000
  }' \
  --output output.wav
```

***

# Parameters

| Parameter        | Type           | Default  | Description       |
| ---------------- | -------------- | -------- | ----------------- |
| `text`           | string         | required | Text to convert   |
| `voice_id`       | string         | required | Select voice      |
| `language`       | string         | `"en"`   | Language code     |
| `sample_rate`    | number         | `24000`  | Audio sample rate |
| `speed`          | number (float) | `1.0`    | Audio sample rate |
| `add_wav_header` | boolean        | `true`   | Adds WAV header   |

***

# Need Help?

If you have any questions or need assistance, please contact our support team at [support@timepay.ai](mailto:support@timepay.ai).
