Translate Subtitles
Translate SRT or VTT subtitle files while preserving all timestamps and formatting.
Endpoint
POST /v2/translate/subtitlesOnly the text content is translated. All timestamps, formatting, and subtitle structure are preserved exactly as provided.
Headers
X-API-KEY string (required)
: Your API key for authentication
Content-Type string (required)
: Must be application/json
Request Parameters
Body Parameters
format string (required)
: Subtitle format: "srt" or "vtt"
content string (required)
: The subtitle file content (SRT or VTT format)
source string (required)
: Source language code (e.g., "en", "fr") or "auto" for auto-detection
target string (required)
: Target language code (e.g., "en", "fr")
Example Request
curl https://api.translateplus.io/v2/translate/subtitles \
-H "X-API-KEY: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"format": "srt",
"content": "1\n00:00:01,000 --> 00:00:02,000\nHello world\n",
"source": "en",
"target": "es"
}'Success Response (200 OK)
{
"format": "srt",
"content": "1\n00:00:01,000 --> 00:00:02,000\nHola mundo\n"
}Response Fields
| Field | Type | Description |
|---|---|---|
format | string | The subtitle format ("srt" or "vtt") |
content | string | The translated subtitle content with timestamps preserved |
Features
- Format Support: Supports both SRT (SubRip) and VTT (WebVTT) subtitle formats
- Timestamp Preservation: All timestamps are preserved exactly as provided
- Structure Maintenance: Subtitle block structure and formatting are maintained
- Text Translation: Only the text content is translated, timestamps remain unchanged
- Multi-line Support: Handles multi-line subtitle text correctly
- Credits: Requires 1 credit per subtitle block (text entry)
How It Works
- Parses subtitle content into blocks (index, timestamp, text)
- Extracts text content from each block
- Translates each text block while preserving timestamps
- Reconstructs the subtitle file with translated text
Error Responses
400 Bad Request
Invalid request parameters:
{
"detail": "Format must be 'srt' or 'vtt'"
}402 Payment Required
Insufficient credits:
{
"detail": "Insufficient credits. You have 0 credit(s) remaining, but this request requires 5 credit(s). Please upgrade your plan to continue using the API."
}403 Forbidden
Invalid or missing API key:
{
"detail": "API key is required. Please provide X-API-KEY header."
}429 Too Many Requests
Rate limit exceeded:
{
"detail": "Rate limit exceeded. You have made 60 requests. Maximum allowed: 60 requests per minute. Please try again after 45 seconds."
}Credits
This endpoint requires 1 credit per subtitle block (text entry) in the file.