Skip to content

YouTube Subtitles Downloader API

The YouTube Subtitles Downloader API enables you to extract and download subtitles/captions from any YouTube video. The API supports multiple output formats and automatic language detection, making it perfect for content creators, developers, and researchers.

Base URL: https://youtube-subtitles-downloader-api.p.rapidapi.com

  • Extract subtitles from any public YouTube video
  • Works with regular videos AND YouTube Shorts
  • Multiple output formats: SRT, VTT, TXT, JSON
  • Multi-language support
  • Fast processing times
  • Detailed metadata including video title, duration, and segment count
  • Automatic fallback to available languages

All requests must include your RapidAPI key in the headers:

Terminal window
x-rapidapi-key: YOUR_RAPIDAPI_KEY
x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com

Example 1: Long Video (15 min) - SRT Format

Section titled “Example 1: Long Video (15 min) - SRT Format”
Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/watch?v=z_bX3runikk&format=srt&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY"

Response:

{
"success": true,
"video_id": "z_bX3runikk",
"video_title": "Matthew McConaughey's Concerns Over AI",
"video_duration": 914,
"language": "en",
"format": "srt",
"total_segments": 469,
"total_characters": 15409,
"processing_time_ms": 699,
"subtitles": "1\n00:00,880 --> 00:02,879\nthe Joe Rogan Experience.\n\n2\n00:02,879 --> 00:05,439\nAnd then we got AI on the way. And when\n\n3\n00:05,440 --> 00:08,800\nreal AI hits, it'll probably be our\n\n4\n00:08,800 --> 00:11,360\ngovernor. It'll be our president. It'll\n..."
}

Save to file:

Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/watch?v=z_bX3runikk&format=srt&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \
| grep -o '"subtitles":"[^"]*"' | sed 's/"subtitles":"//;s/"$//' | sed 's/\\n/\n/g' > subtitles.srt

Example 2: YouTube Short (34 sec) - VTT Format

Section titled “Example 2: YouTube Short (34 sec) - VTT Format”
Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/shorts/ivTdEQ6wseU&format=vtt&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY"

Response:

{
"success": true,
"video_id": "ivTdEQ6wseU",
"video_title": "Are We Living in a Simulation Within a Simulation?",
"video_duration": 34,
"language": "en",
"format": "vtt",
"total_segments": 22,
"total_characters": 786,
"processing_time_ms": 898,
"subtitles": "WEBVTT\n\n1\n00:00:00.000 --> 00:00:01.360\nthe simulation theory. I'm glad you\n\n2\n00:00:01.360 --> 00:00:03.040\nbrought that up. You're also one of the\n..."
}

Save to file:

Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/shorts/ivTdEQ6wseU&format=vtt&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \
| grep -o '"subtitles":"[^"]*"' | sed 's/"subtitles":"//;s/"$//' | sed 's/\\n/\n/g' > subtitles.vtt

Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/watch?v=z_bX3runikk&format=json&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY"

Response:

{
"success": true,
"video_id": "z_bX3runikk",
"video_title": "Matthew McConaughey's Concerns Over AI",
"video_duration": 914,
"language": "en",
"format": "json",
"total_segments": 469,
"total_characters": 15409,
"processing_time_ms": 756,
"subtitles": "{\"video_id\":\"z_bX3runikk\",\"video_title\":\"Matthew McConaughey's Concerns Over AI\",\"video_duration\":914,\"language\":\"en\",\"total_segments\":469,\"segments\":[{\"start\":0.88,\"duration\":1.999,\"text\":\"the Joe Rogan Experience.\"},{\"start\":2.879,\"duration\":2.561,\"text\":\"And then we got AI on the way. And when\"}...],\"full_text\":\"...\"}"
}

Save to file:

Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/watch?v=z_bX3runikk&format=json&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" > subtitles.json

Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/shorts/ivTdEQ6wseU&format=txt&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY"

Save to file:

Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/shorts/ivTdEQ6wseU&format=txt&language=en" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
-H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \
| grep -o '"subtitles":"[^"]*"' | sed 's/"subtitles":"//;s/"$//' | sed 's/\\n/\n/g' > subtitles.txt

GET /

Get API information and usage instructions.

Response:

{
"name": "YouTube Subtitles Downloader API",
"version": "1.0.0",
"description": "Download subtitles from any YouTube video in multiple formats.",
"endpoints": {
"POST /download": "Download subtitles from YouTube URL (use query parameters: ?url=VIDEO_URL&format=srt&language=en)",
"GET /health": "Health check"
},
"formats": ["srt", "vtt", "txt", "json"],
"example": {
"method": "POST",
"endpoint": "/download?url=https://www.youtube.com/watch?v=ly6YKz9UfQ4&format=srt&language=en"
}
}

GET /health

Check if the API is operational.

Response:

{
"status": "ok",
"timestamp": 1704067200000
}

POST /download

Extract and download subtitles from a YouTube video.

Query Parameters Required

All parameters must be sent as query parameters in the URL, not in the request body.

Query Parameters:

ParameterTypeRequiredDescription
urlstringYesFull YouTube video URL
formatstringNoOutput format: srt, vtt, txt, json (default: srt)
languagestringNoLanguage code (default: en)

Successful Response (200 OK):

{
"success": true,
"video_id": "dQw4w9WgXcQ",
"video_title": "Rick Astley - Never Gonna Give You Up",
"video_duration": 213,
"language": "en",
"format": "srt",
"total_segments": 156,
"total_characters": 2847,
"processing_time_ms": 1234,
"subtitles": "1\n00:00:00,000 --> 00:00:02,500\nWe're no strangers to love\n\n2\n00:00:02,500 --> 00:00:05,000\nYou know the rules and so do I\n..."
}

Response Fields:

FieldTypeDescription
successbooleanWhether the request was successful
video_idstringYouTube video ID
video_titlestringTitle of the video
video_durationintegerVideo duration in seconds
languagestringLanguage code of the subtitles
formatstringOutput format used
total_segmentsintegerNumber of subtitle segments
total_charactersintegerTotal characters in subtitles
processing_time_msintegerProcessing time in milliseconds
subtitlesstringThe formatted subtitle content

Standard subtitle format, widely supported by video players.

1
00:00:00,000 --> 00:00:02,500
First subtitle line
2
00:00:02,500 --> 00:00:05,000
Second subtitle line

Web Video Text Tracks format, ideal for HTML5 video players.

WEBVTT
1
00:00:00.000 --> 00:00:02.500
First subtitle line
2
00:00:02.500 --> 00:00:05.000
Second subtitle line

Simple text format with all subtitles concatenated.

First subtitle line
Second subtitle line
Third subtitle line

Structured format with complete metadata and timing information.

{
"video_id": "dQw4w9WgXcQ",
"video_title": "Rick Astley - Never Gonna Give You Up",
"video_duration": 213,
"language": "en",
"total_segments": 156,
"segments": [
{
"start": 0,
"duration": 2.5,
"text": "We're no strangers to love"
}
],
"full_text": "Complete transcript..."
}

The API accepts various YouTube URL formats:

  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://www.youtube.com/shorts/VIDEO_ID
  • https://www.youtube.com/embed/VIDEO_ID
  • https://www.youtube.com/v/VIDEO_ID

The API supports all languages available on YouTube. Common language codes:

  • en - English
  • es - Spanish
  • fr - French
  • de - German
  • it - Italian
  • pt - Portuguese
  • ja - Japanese
  • ko - Korean
  • zh - Chinese
  • ru - Russian
  • ar - Arabic

Missing URL:

{
"error": "URL is required as query parameter: ?url=VIDEO_URL&format=srt&language=en"
}

Invalid YouTube URL:

{
"error": "Invalid YouTube URL"
}

Invalid Format:

{
"error": "Invalid format. Valid formats: srt, vtt, txt, json"
}

Missing or Invalid API Key:

{
"error": "Unauthorized"
}

No Captions Available:

{
"success": false,
"error": "Could not fetch subtitles: No captions available for this video",
"video_id": "dQw4w9WgXcQ",
"suggestion": "Make sure the video has captions/subtitles enabled in the requested language."
}

Perfect for testing and small projects

  • Price: $0/month
  • Monthly Requests: 300 (Hard Limit)
  • Max Video Duration: Unlimited
  • Support: Community

Ideal for individual developers

  • Price: $4.99/month
  • Monthly Requests: 5,000 (Hard Limit)
  • Rate Limit: 100 requests/hour
  • Max Video Duration: Unlimited
  • Support: Email

Best for growing businesses

  • Price: $14.99/month
  • Monthly Requests: 25,000 (Hard Limit)
  • Rate Limit: 200 requests/hour
  • Max Video Duration: Unlimited
  • Support: Priority Email

Enterprise-grade solution

  • Price: $39.99/month
  • Monthly Requests: 100,000 (Hard Limit)
  • Rate Limit: 500 requests/hour
  • Max Video Duration: Unlimited

The API enforces rate limits based on your subscription plan. When you exceed the rate limit, you’ll receive a 429 Too Many Requests response.

Rate Limit Headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1704070800

Always pass parameters in the URL as query parameters:

const videoUrl = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
const format = 'srt';
const language = 'en';
const apiUrl = `https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=${encodeURIComponent(videoUrl)}&format=${format}&language=${language}`;

Cache subtitle downloads to avoid redundant API calls for the same video.

Always implement error handling for cases where subtitles are unavailable.

try {
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'x-rapidapi-key': 'YOUR_KEY',
'x-rapidapi-host': 'youtube-subtitles-downloader-api.p.rapidapi.com'
}
});
const data = await response.json();
if (!data.success) {
console.error('Subtitles not available:', data.error);
}
} catch (error) {
console.error('Network error:', error);
}

Verify YouTube URLs client-side before making API requests.

  • Use SRT for video players and editing software
  • Use VTT for web video players
  • Use TXT for quick text analysis
  • Use JSON for programmatic processing and detailed metadata

Extract the subtitles field from the response using grep and sed:

Terminal window
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=VIDEO_URL&format=srt&language=en" \
-H "x-rapidapi-key: YOUR_KEY" \
-H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com" \
| grep -o '"subtitles":"[^"]*"' | sed 's/"subtitles":"//;s/"$//' | sed 's/\\n/\n/g' > subtitles.srt

async function downloadSubtitles(videoUrl, format = 'srt', language = 'en') {
const apiUrl = `https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=${encodeURIComponent(videoUrl)}&format=${format}&language=${language}`;
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY',
'x-rapidapi-host': 'youtube-subtitles-downloader-api.p.rapidapi.com'
}
});
const data = await response.json();
if (data.success) {
console.log(`Downloaded ${data.total_segments} segments`);
return data.subtitles;
} else {
throw new Error(data.error);
}
}
downloadSubtitles('https://www.youtube.com/watch?v=z_bX3runikk')
.then(subtitles => {
console.log(subtitles);
})
.catch(error => console.error(error));
import requests
def download_subtitles(video_url, format='srt', language='en'):
url = f'https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url={video_url}&format={format}&language={language}'
headers = {
'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY',
'x-rapidapi-host': 'youtube-subtitles-downloader-api.p.rapidapi.com'
}
response = requests.post(url, headers=headers)
data = response.json()
if data.get('success'):
print(f"Downloaded {data['total_segments']} segments")
return data['subtitles']
else:
raise Exception(data.get('error', 'Unknown error'))
subtitles = download_subtitles('https://www.youtube.com/watch?v=z_bX3runikk')
print(subtitles)
with open('subtitles.srt', 'w', encoding='utf-8') as f:
f.write(subtitles)
const axios = require('axios');
async function downloadSubtitles(videoUrl, format = 'srt', language = 'en') {
try {
const url = `https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=${encodeURIComponent(videoUrl)}&format=${format}&language=${language}`;
const response = await axios.post(url, null, {
headers: {
'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY',
'x-rapidapi-host': 'youtube-subtitles-downloader-api.p.rapidapi.com'
}
});
if (response.data.success) {
console.log(`Downloaded ${response.data.total_segments} segments`);
return response.data.subtitles;
}
} catch (error) {
console.error('Error:', error.response?.data || error.message);
throw error;
}
}
downloadSubtitles('https://www.youtube.com/shorts/ivTdEQ6wseU', 'srt')
.then(subtitles => {
const fs = require('fs');
fs.writeFileSync('subtitles.srt', subtitles, 'utf-8');
console.log('Subtitles saved to subtitles.srt');
})
.catch(console.error);
<?php
function downloadSubtitles($videoUrl, $format = 'srt', $language = 'en') {
$url = "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=" . urlencode($videoUrl) . "&format={$format}&language={$language}";
$headers = [
'x-rapidapi-key: YOUR_RAPIDAPI_KEY',
'x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
echo "Downloaded {$data['total_segments']} segments\n";
return $data['subtitles'];
} else {
throw new Exception($data['error']);
}
}
$subtitles = downloadSubtitles('https://www.youtube.com/watch?v=z_bX3runikk');
file_put_contents('subtitles.srt', $subtitles);
echo "Subtitles saved to subtitles.srt\n";
?>
require 'net/http'
require 'json'
require 'uri'
def download_subtitles(video_url, format = 'srt', language = 'en')
encoded_url = URI.encode_www_form_component(video_url)
url = URI("https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=#{encoded_url}&format=#{format}&language=#{language}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['x-rapidapi-key'] = 'YOUR_RAPIDAPI_KEY'
request['x-rapidapi-host'] = 'youtube-subtitles-downloader-api.p.rapidapi.com'
response = http.request(request)
data = JSON.parse(response.body)
if data['success']
puts "Downloaded #{data['total_segments']} segments"
return data['subtitles']
else
raise StandardError, data['error']
end
end
subtitles = download_subtitles('https://www.youtube.com/watch?v=z_bX3runikk')
File.write('subtitles.srt', subtitles)
puts 'Subtitles saved to subtitles.srt'

  • Generate subtitles for accessibility
  • Translate video content
  • Create closed captions for social media
  • Extract lecture transcripts
  • Create study materials
  • Build searchable video databases
  • Analyze video content at scale
  • Extract data from educational videos
  • Content categorization and indexing
  • Build video search engines
  • Create subtitle editing tools
  • Develop language learning applications

Q: Why do I need to use query parameters instead of request body?
A: All parameters must be passed in the URL as query parameters for the API to work correctly.

Q: Do I need to URL-encode the YouTube URL?
A: Yes, it’s recommended to use encodeURIComponent() in JavaScript or equivalent in other languages to properly encode the URL.

Q: What happens if a video doesn’t have subtitles?
A: The API will return an error indicating that no captions are available for the video.

Q: Can I download auto-generated subtitles?
A: Yes, the API supports both manual and auto-generated YouTube captions.

Q: Are there any restrictions on video length?
A: No, all plans support unlimited video duration.

Q: Does it work with YouTube Shorts?
A: Yes! The API works with both regular YouTube videos and YouTube Shorts.

Q: How accurate are the subtitles?
A: The accuracy depends on YouTube’s caption quality. Manual captions are more accurate than auto-generated ones.

Q: Can I use this for commercial projects?
A: Yes, all plans can be used for commercial purposes according to our terms of service.

Q: What’s the maximum number of requests I can make?
A: Each plan has specific monthly and hourly limits. Check the pricing section for details.

Q: How do I save the subtitles to a file?
A: Extract the subtitles field from the JSON response using grep and sed (shown in examples above), or use the code examples provided for your preferred programming language.


Need help? We’re here for you:


By using this API, you agree to:

  • Use the service only through RapidAPI
  • Not exceed your plan’s rate limits
  • Not abuse or attempt to bypass restrictions
  • Comply with YouTube’s Terms of Service
  • Use downloaded subtitles in accordance with copyright laws

Last updated: October 2025