POST /translator/translate/vtt

Translate VTT

Translate WebVTT subtitle files while preserving timing, cues, and styling.

Translation API

Translate WebVTT subtitle files while preserving all timing cues, styling, positioning, and metadata. Only the subtitle text is translated, maintaining synchronization with the original media. WebVTT is the standard subtitle format for HTML5 video.

HTTP Request

1
POST /translator/translate/vtt

Parameters

ParameterTypeRequiredDefaultDescription
sourcestringNo"auto"Source language code. Use auto for automatic detection
targetstringYesTarget language code

Request Body

Send the WebVTT content as the raw request body with Content-Type: text/plain.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
WEBVTT

00:00:01.000 --> 00:00:04.000
Welcome to the product demonstration.

00:00:04.500 --> 00:00:08.000
In this video, we will walk you through the key features.

00:00:08.500 --> 00:00:12.000
Let's begin with the dashboard overview.

Response

1
2
3
4
5
6
7
8
{
  "status": true,
  "data": {
    "translated_vtt": "WEBVTT\n\n00:00:01.000 --> 00:00:04.000\nBienvenue a la demonstration du produit.\n\n00:00:04.500 --> 00:00:08.000\nDans cette video, nous vous presenterons les fonctionnalites cles.\n\n00:00:08.500 --> 00:00:12.000\nCommencons par l'apercu du tableau de bord.",
    "source_language": "en",
    "source_language_name": "English"
  }
}

Response Fields

FieldTypeDescription
statusbooleanWhether the request was successful
data.translated_vttstringThe translated WebVTT content with timing preserved
data.source_languagestringDetected or specified source language code
data.source_language_namestringHuman-readable name of the source language

Code Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests

url = "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/vtt"

querystring = {
    "source": "auto",
    "target": "fr"
}

payload = """WEBVTT

00:00:01.000 --> 00:00:04.000
Welcome to the product demonstration.

00:00:04.500 --> 00:00:08.000
In this video, we will walk you through the key features.

00:00:08.500 --> 00:00:12.000
Let's begin with the dashboard overview."""

headers = {
    "Content-Type": "text/plain",
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "multi-format-ai-translator-the-most-complete.p.rapidapi.com"
}

response = requests.post(url, headers=headers, params=querystring, data=payload)
data = response.json()

with open("captions_fr.vtt", "w", encoding="utf-8") as f:
    f.write(data["data"]["translated_vtt"])

print("WebVTT captions translated and saved.")
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const url = "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/vtt";

const params = new URLSearchParams({
  source: "auto",
  target: "fr",
});

const vtt = `WEBVTT

00:00:01.000 --> 00:00:04.000
Welcome to the product demonstration.

00:00:04.500 --> 00:00:08.000
In this video, we will walk you through the key features.

00:00:08.500 --> 00:00:12.000
Let's begin with the dashboard overview.`;

const response = await fetch(`${url}?${params}`, {
  method: "POST",
  headers: {
    "Content-Type": "text/plain",
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "multi-format-ai-translator-the-most-complete.p.rapidapi.com",
  },
  body: vtt,
});

const data = await response.json();
console.log(data.data.translated_vtt);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
curl -X POST "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/vtt?source=auto&target=fr" \
  -H "Content-Type: text/plain" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: multi-format-ai-translator-the-most-complete.p.rapidapi.com" \
  -d 'WEBVTT

00:00:01.000 --> 00:00:04.000
Welcome to the product demonstration.

00:00:04.500 --> 00:00:08.000
In this video, we will walk you through the key features.'
Start building today

Get your API key and make your first request in under a minute.

Get Your API Key on RapidAPI