Skip to main content
POST
/
tts
/
batch
Batch Text-to-Speech
curl --request POST \
  --url https://api.example.com/tts/batch \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>",
  "language": "<string>",
  "pause_duration": 123,
  "api_key": "<string>"
}
'

Overview

Process long text efficiently by automatically splitting it into chunks and combining the audio with pauses between segments. Ideal for long-form content like articles, books, or documentation.

Request Body

text
string
required
The text to convert to speech. Can be very long (10,000+ characters).
language
string
default:"en"
Language code (e.g., “en”, “es”, “fr”)
pause_duration
number
default:"800"
Pause duration in milliseconds between text segments
api_key
string
required
Your GistMag API key

Example Request

curl -X POST https://api.gistmag.co.uk/tts/batch \
  -H "Content-Type: application/json" \
  -d '{
    "text": "This is a very long text that will be automatically split into chunks...",
    "language": "en",
    "pause_duration": 800,
    "api_key": "your_api_key_here"
  }' \
  --output output.mp3

How It Works

  1. Text is automatically split at sentence boundaries
  2. Each segment is processed independently
  3. Audio segments are combined with pauses between them
  4. Final audio is normalized and exported as MP3

Response

The response is a single MP3 audio file containing the complete text with natural pauses. Content-Type: audio/mpeg Content-Disposition: attachment; filename=output.mp3

Example Usage

Python

import requests

response = requests.post(
    "https://api.gistmag.co.uk/tts/batch",
    json={
        "text": "Very long text here...",
        "language": "en",
        "pause_duration": 800,
        "api_key": "your_api_key_here"
    }
)

with open("output.mp3", "wb") as f:
    f.write(response.content)

Voice Cloning with Batch

For batch processing with voice cloning, use the /tts/batch/voice-clone endpoint.
Batch processing is more efficient for long text as it handles chunking and combining automatically, ensuring natural pauses between sentences.