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

# HTTP Server

A minimal HTTP server that exposes REST endpoints for text-to-speech synthesis. Useful as a reverse proxy — keeps your API key off the browser and lets your frontend call your own origin.

> [!TIP]
> [Source code](https://github.com/responsivevoice/examples/tree/main/node/server)

## Quick start

```bash
export RESPONSIVEVOICE_API_KEY="your-api-key"        # https://app.responsivevoice.org
export RESPONSIVEVOICE_API_SECRET="your-api-secret"  # "Server-to-server API secrets"
npm install
npm run server
# Server on http://localhost:3001
```

## Endpoints

| Method | Path                   | Description                   |
| ------ | ---------------------- | ----------------------------- |
| GET    | `/`                    | API documentation             |
| GET    | `/voices`              | List all voices               |
| GET    | `/voices/:lang`        | Voices by language            |
| POST   | `/synthesize`          | Synthesize speech (JSON body) |
| GET    | `/synthesize?text=...` | Synthesize via query params   |

## Calling from a frontend

```js
async function speak(text) {
  const response = await fetch('http://localhost:3001/synthesize', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ text, voice: 'UK English Female' }),
  });
  const audio = new Audio(URL.createObjectURL(await response.blob()));
  audio.play();
}
```

The server ships with permissive CORS headers (`Access-Control-Allow-Origin: *`). Tighten to your domain(s) before deploying anything public-facing.

## Next Steps

- [CLI Tool](/examples/cli) — same API client, command-line form
- [REST API](/rest-api/) — direct HTTP usage
- [API Client Reference](/api/api-client/src) — full client documentation
