# Generate speech (quick)

> POST https://api.nabrah.ai/api/ext/tts/quick_generate

Group: Text to speech. Page: https://www.nabrah.ai/en/docs/api-reference/text-to-speech/generate-speech-quick

Generates speech with nabrah_tts_v1 and returns the audio bytes. Send JSON with the same fields as POST /api/ext/tts/generations, or `multipart/form-data` to clone a voice on the fly: upload a short `audio_file` of the voice with its transcript in `ref_text`, and `voice` becomes optional.

## Multipart requests

- **Fields**: Send the fields as separate form fields, or as one `request_json` field holding the JSON object, next to `audio_file`.
- **Credits**: Uses text-to-speech credits like POST /api/ext/tts/generations; 402 when the workspace has no credits left.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Response

### 200 Successful Response

## Request examples

### cURL

```bash
curl --request POST \
  --url 'https://api.nabrah.ai/api/ext/tts/quick_generate' \
  --header 'X-API-Key: <your-api-key>'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/tts/quick_generate"
headers = {"X-API-Key": "<your-api-key>"}

response = requests.post(url, headers=headers)
response.raise_for_status()
print(response.json())
```

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/tts/quick_generate", {
  method: "POST",
  headers: { "X-API-Key": "<your-api-key>" },
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("POST", "https://api.nabrah.ai/api/ext/tts/quick_generate", nil)
	req.Header.Set("X-API-Key", "<your-api-key>")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
