apyhub
AUDIO PROCESSING · FILE CONVERSION

Convert Text to Speech API

Hosted on ApyHub

What it does

Text to Speech converts plain text or document content into MP3 audio. Send a text string, a document file, or a document URL, and choose a voice gender of male or female. Depending on the endpoint, you either get the MP3 file directly or a JSON response with a signed download link.

Use Text to Speech when you need to turn reports, articles, training material, or support content into audio for listening on the go. If your content already lives in a document, send the uploaded file or its URL. If you already have the content in your app, send text directly. The service handles up to 75,000 characters for text input.

The response format is straightforward: binary MP3 for direct download endpoints, or { "data": "..." } for link-based endpoints. That makes it easy to plug into workflows that need immediate file delivery or asynchronous download handling.

Text to Speech fits product features like read-aloud mode, content playback for accessibility, internal training libraries, and document narration without building speech synthesis logic yourself.

▣ ENDPOINT 01 / 06
POST
Extract text from uploaded document and return MP3
https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/file

QUICKSTART

GUIDE

Quickstart

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

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.

TRY ITLIVE · 750 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*

About this endpoint

What it does

Uploads a document file and a selected voice gender, then returns the generated MP3 audio as binary data.

Request Body

ParameterTypeMandatoryDescription
fileStringYesBinary file upload containing the document to process.
genderENUMYesVoice gender to use for the audio output. Allowed values: male, female.

Response

Returns a binary file response containing the generated MP3 audio.

ParameterTypeMandatoryDescription
binaryStringYesThe MP3 audio file returned by the endpoint as binary data.

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 02 / 06
POST
Extract text from uploaded document and return signed MP3 link
https://api.eu.apyhub.com/apyhub/convert-text-to-speech/file/link

QUICKSTART

GUIDE

Quickstart

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

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.

{
  "data": "https://example.com/generated-audio.mp3"
}
TRY ITLIVE · 750 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*

About this endpoint

What it does

Converts the text content from an uploaded document into speech and returns a signed MP3 link. The request body includes the uploaded file and the voice gender to use.

Request Body

ParameterTypeMandatoryDescription
fileStringYesUploaded document file in binary format.
genderENUMYesVoice gender to use. Allowed values: male, female.

Response

Returns a JSON object with a data string field containing the signed MP3 link.

ParameterTypeMandatoryDescription
dataStringNoSigned MP3 link.

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 03 / 06
POST
Convert JSON text to MP3 download
https://api.eu.apyhub.com/apyhub/convert-text-to-speech/text/file

QUICKSTART

GUIDE

Quickstart

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

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.

(binary audio file)
TRY ITLIVE · 750 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Converts the provided text into an MP3 file download. You send the text and a voice gender selection in the request body, and the endpoint returns the generated audio as binary data.

Request Body

ParameterTypeMandatoryDescription
textStringYesText to synthesize. Maximum length: 75000 characters.
genderENUMYesVoice gender to use. Allowed values: male, female.

Response

Returns a binary file response containing the generated MP3 audio.

ParameterTypeMandatoryDescription
fileStringYesBinary audio content for the synthesized MP3 download.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 05 / 06
POST
Extract text from document URL and return MP3
https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/file

QUICKSTART

GUIDE

Quickstart

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

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.

(binary audio file)
TRY ITLIVE · 750 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Converts the text content of a document available at a URL into an MP3 audio file. The request takes the document URL and the speaker gender, and the response is a binary file stream.

Request Body

ParameterTypeMandatoryDescription
urlStringYesDocument URL in URI format.
genderENUMYesAllowed values: male, female.

Response

Returns a binary response containing the generated MP3 audio file. The success response is a single binary payload, not a JSON object.

ParameterTypeMandatoryDescription
binaryStringYesMP3 file content returned as a binary stream.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 06 / 06
POST
Extract text from document URL and return signed MP3 link
https://api.eu.apyhub.com/apyhub/convert-text-to-speech/url/link

QUICKSTART

GUIDE

Quickstart

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

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.

{
  "data": "https://..."
}
TRY ITLIVE · 750 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Extracts text from a document URL and returns a signed MP3 link. You send a document url and a voice gender, and the response returns a JSON object containing the generated link in data.

Request Body

ParameterTypeMandatoryDescription
urlStringYesDocument URL to process. Must be a valid URI.
genderENUMYesVoice gender to use. Allowed values: male, female.

Response

Returns a JSON object with a data string field containing the signed MP3 link. Success response schema: object with one top-level field, data as a string.

ParameterTypeMandatoryDescription
dataStringYesSigned MP3 link returned by the endpoint.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.