---
title: Convert Text to Speech API
slug: convert-text-to-speech
url: https://apyhub.com/apyhub/service/convert-text-to-speech
provider: ApyHub
categories: [Output Kit]
tags: [tts, text-to-audio, text-to-speech, text-to-voice]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 6
atoms: 750
mcp: true
alias: text-to-speech
---

# Convert Text to Speech API

Text to speech API: send text or a PDF by upload or URL, pick a male or female voice, and get an MP3 as a download or signed link. Free tier, no card.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/file` | What it does Uploads a document file and a selected voice gender, then returns the generated MP3 au… | 750 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/link` | What it does Converts the text content from an uploaded document into speech and returns a signed M… | 750 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-text-to-speech/text/file` | What it does Converts the provided text into an MP3 file download. You send the text and a voice ge… | 750 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-text-to-speech/text/link` | What it does Converts the submitted JSON text into a speech audio file and returns a signed MP3 lin… | 750 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/file` | What it does Converts the text content of a document available at a URL into an MP3 audio file. The… | 750 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/link` | What it does Extracts text from a document URL and returns a signed MP3 link. You send a document u… | 750 |

## Endpoint reference

### Convert uploaded document to MP3

`POST https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/file` · 750 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes |  |
| `gender` | body | string | yes | One of: male, female. Example: `male`. |

#### Quickstart

Upload a text file and choose a voice gender to generate speech.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/file" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/input.txt" \
  -F "gender=male"
```

#### What you'll get back

Returns a binary file response containing the generated audio.

### Convert uploaded document to signed MP3 link

`POST https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/link` · 750 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes |  |
| `gender` | body | string | yes | One of: male, female. |

#### Quickstart

Convert a file to speech by uploading the file and choosing a voice gender.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/link" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/audio-or-text-file" \
  -F "gender=male"
```

#### What you'll get back

Returns a JSON object with a `data` string field.

```json
{
  "data": "https://example.com/generated-audio.mp3"
}
```

### Convert JSON text to MP3 download

`POST https://api.eu.apyhub.com/apyhub/convert-text-to-speech/text/file` · 750 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `text` | body | string | yes | Example: `Hello world, this is a sample speech synthesis request.`. |
| `gender` | body | string | yes | One of: male, female. Example: `female`. |

#### Quickstart

Send text and a gender to generate speech audio from the supplied text.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-text-to-speech/text/file" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello world, this is a sample speech synthesis request.","gender":"female"}'
```

#### What you'll get back

Returns binary audio data (`string` with `binary` format), not a JSON object.

```text
(binary audio file)
```

### Convert JSON text to signed MP3 link

`POST https://api.eu.apyhub.com/apyhub/convert-text-to-speech/text/link` · 750 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `text` | body | string | yes | Example: `Hello world, this is a sample speech synthesis request.`. |
| `gender` | body | string | yes | One of: male, female. Example: `female`. |

#### Quickstart

Send the text and voice gender to generate a speech synthesis link.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-text-to-speech/text/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello world, this is a sample speech synthesis request.",
    "gender": "female"
  }'
```

#### What you'll get back

Returns a JSON object with a `data` string field containing the generated audio link.

```json
{
  "data": "https://..."
}
```

### Convert document URL to MP3

`POST https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/file` · 750 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Example: `https://assets.apyhub.com/samples/sample.pdf`. |
| `gender` | body | string | yes | One of: male, female. Example: `female`. |

#### Quickstart

Convert a file from a URL into speech by sending the file URL and voice gender.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/file" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://assets.apyhub.com/samples/sample.pdf",
    "gender": "female"
  }'
```

#### What you'll get back

Returns a binary file (`string` with `format: binary`) containing the generated audio.

```text
(binary audio file)
```

### Convert document URL to signed MP3 link

`POST https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/link` · 750 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Example: `https://assets.apyhub.com/samples/sample.pdf`. |
| `gender` | body | string | yes | One of: male, female. Example: `female`. |

#### Quickstart

Convert a file URL to speech by sending the source URL and voice gender.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://assets.apyhub.com/samples/sample.pdf",
    "gender": "female"
  }'
```

#### What you'll get back

Returns a JSON object with a `data` string field.

```json
{
  "data": "https://..."
}
```

## About

## What it does
The **Text to Speech API** turns written content into MP3 audio. Send up to 75,000 characters of `text` in a JSON body, upload a document as a `file`, or pass a document `url`, and choose a `male` or `female` voice with `gender`. The `/file` endpoints return the MP3 directly, and the `/link` endpoints return a JSON `data` field with a signed URL.

Because it accepts documents as well as text, it also works as a PDF to audio API: send a PDF and get it read aloud as an MP3, with no text extraction step on your side. Teams use the text to speech API to add read-aloud buttons to articles, narrate reports and training material, make content accessible to people who prefer listening, and send voice notifications from apps. It works from Python, Node.js or any language that can send an HTTP request.

There are two voices, male and female. For many voices, voice cloning or fine pronunciation control, a dedicated speech platform is a better fit.

To go the other way, use the [Speech to Text API](https://apyhub.com/apyhub/service/transcribe-speech-to-text). To shorten long documents before narrating them, use the [AI Summarize API](https://apyhub.com/apyhub/service/ai-summarize-api). AI agents can also call it through ApyHub MCP, for example to turn a summary into an MP3.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/apyhub/service/convert-text-to-speech
