SRT to Speech API¶
Pricing¶
10 credits per 1,000 characters
The cost is calculated based on the total character count of all text in the SRT file.
Overview¶
The SRT to Speech API converts SRT subtitle data into synchronized speech audio. This endpoint merges the generated audio or creates standalone audio files with timing matched to the subtitle timestamps.
Endpoint¶
- URL:
POST https://api.revidapi.com/paid/srt-to-speech/merge - Method:
POST
Request¶
Headers¶
x-api-key: Required. Your API key for authentication.Content-Type: Required. Must beapplication/json.
Body Parameters¶
Required Parameters¶
| Parameter | Type | Description |
|---|---|---|
subtitles |
array | List of SRT subtitles. Each item: index, start, end, text |
SRTItem structure:
{
"index": 1,
"start": "00:00:00,000",
"end": "00:00:04,000",
"text": "Subtitle content"
}
Optional Parameters¶
| Parameter | Type | Description |
|---|---|---|
voice_id |
integer | Recommended. Voice ID. See revidapi.com/text-to-speech/voice-library |
speed |
number | Speech speed multiplier (0.5 to 2.0). Default: 1.0 |
audio_name |
string | Output audio file name. Default: merged_audio |
mode |
string | merge (concatenate) or timeline (align to SRT timeline). Default: merge |
add_silence |
number | Add silence between segments (seconds). Default: 0.0 |
webhook_url |
string (URI) | URL to receive the result when processing is complete |
id |
string | Custom identifier for tracking the request |
Example Request¶
Minimal example (only subtitles + voice_id):
{
"subtitles": [
{"index": 1, "start": "00:00:00,000", "end": "00:00:04,000", "text": "First subtitle segment"},
{"index": 2, "start": "00:00:10,000", "end": "00:00:20,000", "text": "Second subtitle segment"}
],
"voice_id": 3001
}
Full example (like n8n working payload):
{
"subtitles": [
{"index": 1, "start": "00:00:00,000", "end": "00:00:04,000", "text": "Segment 1"},
{"index": 2, "start": "00:00:10,000", "end": "00:00:20,000", "text": "Segment 2"}
],
"voice_id": 3001,
"speed": 1,
"audio_name": "translated_audio",
"mode": "timeline"
}
curl -X POST "https://api.revidapi.com/paid/srt-to-speech/merge" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subtitles": [{"index": 1, "start": "00:00:00,000", "end": "00:00:04,000", "text": "Segment 1"}],
"voice_id": 3001,
"speed": 1,
"audio_name": "translated_audio",
"mode": "timeline"
}'
Response¶
Immediate Response (202 Accepted)¶
When a webhook URL is provided, the API returns an immediate acknowledgment with a task_id:
{
"code": 202,
"id": "srt-tts-request-123",
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "processing"
}
Success Response (via Webhook or Direct)¶
{
"code": 200,
"id": "srt-tts-request-123",
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"response": {
"audio_url": "https://tts.revidapi.com/audio/merged_audio.mp3",
"format": "mp3",
"duration": 120.5,
"characters": 5432,
"engine": "edge",
"mode": "merge"
},
"message": "success"
}
Error Responses¶
Invalid Request (400)¶
{
"code": 400,
"id": "srt-tts-request-123",
"message": "Invalid request: 'subtitles' is a required property"
}
Authentication Error (401)¶
{
"code": 401,
"message": "Invalid API key"
}
Workflow Recommendation¶
For asynchronous processing:
- Create Task: Send POST request to create the task
- Wait: Add a wait node (30-45 seconds) to allow server processing time
- Check Status: Use GET endpoint to check task status:
GET https://tts.revidapi.com/api/get/{task_id} - Retrieve Result: Once status is "completed", retrieve the output URL from the response
Usage Notes¶
- Character Counting: Credits are calculated based on the total character count of all subtitle text in the SRT file.
- SRT Format: The SRT file must be in standard SRT format with proper timestamps.
- Audio Synchronization: The generated speech is synchronized with the subtitle timestamps.
- Webhook Processing: When a webhook_url is provided, the request is processed asynchronously.
- Output Format: Choose the appropriate output format based on your needs (mp4 for video, mp3/wav for audio-only).
Common Issues¶
- Invalid SRT Format: Ensure the SRT file is properly formatted with valid timestamps
- URL Accessibility: Both srt_url and video_url must be publicly accessible
- Processing Time: Large files with many subtitles may take longer to process
Best Practices¶
- Use Webhooks: Always use webhooks for better reliability
- Unique IDs: Provide unique
idvalues for tracking - Test SRT Files: Validate SRT file format before submission
- Voice Selection: Choose voices that match the language and tone of your content