API Documentation
Everything you need to download YouTube subtitles and transcripts via the REST API. Start with Getting Started or jump to the API Reference. Also see the features overview.
Getting Started
GetYTSubtitles lets you download YouTube subtitles in seconds. No account, no API key, no setup required for basic use. For programmatic access, use the REST API described below.
Step 1: Find a YouTube Video
Copy the URL of any YouTube video that has subtitles or auto-generated captions.
Step 2: Call the API
Send a POST request to the subtitle endpoint:
POST https://getytsubtitles.com/api/subtitle
Content-Type: application/json
{
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"format": "txt"
}Step 3: Get the Response
You receive a JSON response with the subtitles. See the API Reference for details.
Code Examples
Working examples in popular languages. All examples use the same endpoint.
cURL
curl -X POST https://getytsubtitles.com/api/subtitle \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=VIDEO_ID","format":"txt"}'JavaScript (fetch)
const response = await fetch('/api/subtitle/', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
url: 'https://www.youtube.com/watch?v=VIDEO_ID',
format: 'json'
})
});
const data = await response.json();
console.log(data.subtitles);Python (requests)
import requests
resp = requests.post('https://getytsubtitles.com/api/subtitle', json={
'url': 'https://www.youtube.com/watch?v=VIDEO_ID',
'format': 'txt'
})
data = resp.json()
print(data['formatted'])Node.js
const https = require('https');
const body = JSON.stringify({
url: 'https://www.youtube.com/watch?v=VIDEO_ID',
format: 'srt'
});
const req = https.request('https://getytsubtitles.com/api/subtitle', {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
}, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => console.log(JSON.parse(data)));
});
req.write(body);
req.end();API Reference
Endpoint
POST /api/subtitle
Content-Type: application/jsonParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Full YouTube video URL |
format | string | No | Output format: srt, txt, json, formatted. Default: txt |
sentencesPerParagraph | number | No | Sentences per paragraph for formatted output. Range: 1-10. Default: 3 |
lang | string | No | Preferred language code (e.g. en, es). Auto-detected if omitted. |
Success Response
{
"success": true,
"videoId": "VIDEO_ID",
"language": "en",
"subtitles": [
{ "text": "Hello world", "start": 0.5, "duration": 2.1 }
],
"formatted": "Hello world..."
}Error Response
{
"success": false,
"error": "No subtitles found for this video"
}Rate Limits
No enforced rate limits for normal usage. Please avoid more than 10 requests per second.
Output Formats
SRT
Standard SubRip subtitle format with timestamps. Compatible with all major video players and editors.
VTT
WebVTT format with timestamps and styling support. Used by HTML5 video players.
Plain Text (TXT)
Clean text with no timestamps. Ideal for reading, summarizing, or feeding into other tools.
JSON
Structured data with full timing information. Perfect for developers building custom subtitle tools.
Formatted
Text grouped into readable paragraphs based on sentence count. Great for articles and blog posts.
Frequently Asked Questions
How do I get started?
Paste a YouTube URL into the homepage input field and click Download. For API access, send a POST request to /api/subtitle with the URL and desired format.
Does the API require authentication?
No. The API is completely free and requires no authentication or API keys. CORS is enabled for all origins.
What response format does the API return?
JSON with fields: success (boolean), subtitles (array), formatted (string), and metadata fields like language and videoId.
How do I handle errors?
The API returns success: false with an error message string. Always check the success field before processing.