Skip to content

Text to Speech API

One endpoint covers both plain text and SRT subtitles:

Step Request Cost
1. Create a job POST https://revidapi.com/v1/text-to-speech 10–15 credits per 1,000 characters
2. Get the result GET https://revidapi.com/v1/text-to-speech/{job_id} Free

Pricing

Charged by character count, at the rate of the voice you pick. The rate of each voice is shown in the Voice Library.

  • Standard voices: 10 credits / 1,000 characters
  • Premium voices: 15 credits / 1,000 characters

Credits are taken when the job is created. If the job fails, or its result is lost, the credits are refunded automatically.

Authentication

Send your API key in the X-API-Key header. Get it from the dashboard under API Key & Pricing.

1. Create a job

POST https://revidapi.com/v1/text-to-speech

Body

Send either text or srt.

Field Type Required Description
voice_id integer Yes Voice ID from the Voice Library, e.g. 9019
text string One of Text to read, up to 10,000 characters
srt string One of Raw SRT subtitle content. The audio follows the subtitle timing
speed number No 0.5–2.0. Default 1.0
mode string No SRT only. timeline (default for SRT): each line starts at its timestamp. merge: lines are joined back to back
audio_name string No Name of the output file

subtitles (an array of {index, start, end, text}) is also accepted in place of srt.

Example: text

curl -X POST "https://revidapi.com/v1/text-to-speech" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"voice_id": 9019, "text": "Hello, welcome to RevidAPI."}'

Example: SRT subtitles

curl -X POST "https://revidapi.com/v1/text-to-speech" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "voice_id": 9019,
    "srt": "1\n00:00:00,000 --> 00:00:03,000\nFirst line\n\n2\n00:00:04,000 --> 00:00:07,000\nSecond line",
    "mode": "timeline"
  }'

Response

{
  "success": true,
  "job_id": "7c1d9a2e-4b1f-4f7e-9a55-2f3c8e1b6d40",
  "status": "pending",
  "characters": 27,
  "credits": 0.41,
  "get_result": "https://revidapi.com/v1/text-to-speech/7c1d9a2e-4b1f-4f7e-9a55-2f3c8e1b6d40"
}

2. Get the result

GET https://revidapi.com/v1/text-to-speech/{job_id}

Poll every 2–3 seconds until status is completed or failed. A short sentence usually finishes in about 3 seconds; long text and subtitle files take longer.

curl "https://revidapi.com/v1/text-to-speech/JOB_ID" \
  -H "X-API-Key: YOUR_API_KEY"

Processing

{ "job_id": "7c1d9a2e-…", "status": "processing", "progress": 40 }

Completed

{
  "job_id": "7c1d9a2e-…",
  "status": "completed",
  "result": {
    "audio_url": "https://…/output.mp3",
    "format": "mp3",
    "duration": 2.1
  }
}

Download the file from result.audio_url. The link stays valid for 20 minutes, so save the audio on your side.

Failed

{ "job_id": "7c1d9a2e-…", "status": "failed", "message": "…" }

The credits for a failed job are refunded.

Errors

HTTP Meaning What to do
400 Missing voice_id, or neither text nor srt was sent Fix the body
401 Missing or invalid API key Check the X-API-Key header
402 Not enough credits Top up in the dashboard
404 Job not found (expired or lost). Credits for a lost job are refunded Create the job again

Notes

  • Keep polling at 2–3 second intervals; results are kept on the server for a limited time.
  • One voice_id decides the voice, the language and the price. You don't need to send an engine or a language.
  • /v1/tts, /v1/tts-srt, /v1/srt-to-speech/merge and /v1/tts/task are older paths. They still work for existing integrations, but new code should use /v1/text-to-speech only.