Extract, translate and analyze YouTube video transcripts with one REST call. Get the full transcript of any public YouTube video with timestamps, plain text, every available caption language, AI translations into other languages, and handy metrics (word count, reading time, speaking time, reading level). No YouTube Data API quota, no OAuth, no scraping to maintain.
๐ Get your API key on RapidAPI ยท Open the playground ยท Pricing (free plan available) ยท Code examples
๐ฌ Need help or a faster response? Contact us on Telegram: @pintoflow
curl "https://youtube-captions.p.rapidapi.com/transcript?videoId=TDv56whosPQ" \ -H "X-RapidAPI-Key: YOUR_API_KEY" \ -H "X-RapidAPI-Host: youtube-captions.p.rapidapi.com"
- Why this API
- What you can build
- Quick start
- API reference
- Response format and errors
- Code examples
- Example projects
- Tips and best practices
- FAQ
- Support
- Any public video with captions. Manual captions, YouTube auto-generated captions and community captions.
- Timestamps included. Every segment has
startanddur(seconds), ready to turn into SRT / VTT subtitles or clickable chapters. - Every language at once. List the caption languages of a video, fetch one, or fetch all of them in a single call.
- Built-in translation. Translate a transcript into Spanish, French, German, Japanese, Korean, Chinese, Portuguese, Russian, Italian and more, with or without timing.
- Content metrics. Word count, character count, estimated reading and speaking time, and reading level for every transcript.
- Paste any URL.
/extract/videoidturnsyoutube.com/watch,youtu.be,embedand mobile links into a clean video id. - Clean JSON, consistent errors, and a free plan on RapidAPI.
| Project | How | Endpoints |
|---|---|---|
| AI video summarizer / "chat with a YouTube video" | Feed the plain-text transcript to an LLM (ChatGPT, Claude, Gemini, Llama) for summaries, key points, Q&A | /transcript/fulltext, /transcript |
| RAG knowledge base from YouTube | Chunk transcripts with timestamps, embed them, answer questions with links to the exact second | /transcript |
| Subtitle generator (SRT / VTT) | Convert timed segments to subtitle files for video editors and players | /transcript, /transcript/bylanguage |
| Subtitle translator | Create subtitles in 10+ languages with the original timing | /transcript/translated/text, /languages |
| Blog post / newsletter from videos | Turn talks, podcasts and tutorials into articles, show notes and social posts | /transcript/fulltext, /transcript/translated/full |
| SEO & content analysis | Extract keywords, topics and reading level from your or competitors' videos | /transcript, metrics |
| Searchable video archive | Index every word of a channel's videos and jump to the moment a phrase is said | /transcript |
| Language-learning app | Show dual-language transcripts, vocabulary lists and click-to-play lines | /transcript/bylanguage, /transcript/translated/text |
| Accessibility tools | Provide readable transcripts for deaf and hard-of-hearing users | /transcript, /transcript/all/text |
| Research & media monitoring | Collect transcripts in bulk to study political speeches, news, education or brand mentions | /transcript/all, /transcript |
| Chrome extension / Telegram or Discord bot | Paste a link, get the transcript, summary or translation back | /extract/videoid, /transcript/fulltext |
| Study notes & flashcards | Turn lectures into notes, quizzes and Anki cards | /transcript/fulltext |
Ready-to-run code for most of these lives in examples/.
- Get an API key. Open the YouTube Captions API on RapidAPI, subscribe (a free plan is available) and copy your
X-RapidAPI-Key. - Pick a video. Any public YouTube video with captions, e.g.
https://www.youtube.com/watch?v=TDv56whosPQโ video idTDv56whosPQ. - Call the API with the two RapidAPI headers:
curl "https://youtube-captions.p.rapidapi.com/transcript?videoId=TDv56whosPQ" \ -H "X-RapidAPI-Key: YOUR_API_KEY" \ -H "X-RapidAPI-Host: youtube-captions.p.rapidapi.com"
Base URL: https://youtube-captions.p.rapidapi.com ยท All endpoints are GET.
| # | Endpoint | What it returns | Parameters |
|---|---|---|---|
| 1 | GET /transcript |
Full transcript with timing (start, dur, text), detected language and metrics |
videoId |
| 2 | GET /transcript/fulltext |
Transcript as plain text (no timing) with metrics, ideal for LLMs | videoId |
| 3 | GET /transcript2 |
Same transcript in an alternative JSON structure | videoId |
| 4 | GET /languages |
Every caption language available for the video, manual or auto-generated | videoId |
| 5 | GET /transcript/all |
Transcripts in every available language, with timing | videoId |
| 6 | GET /transcript/all/text |
Transcripts in every available language, plain text | videoId |
| 7 | GET /transcript/bylanguage |
The native YouTube captions in a specific language | videoId, targetLanguage |
| 8 | GET /transcript/translated/full |
Transcript translated into another language, plain text | videoId, targetLanguage |
| 9 | GET /transcript/translated/text |
Transcript translated into another language, with the original timing | videoId, targetLanguage |
| 10 | GET /extract/videoid |
Video id extracted from any YouTube URL | videoUrl |
Bold = required. videoId is the 11-character YouTube id (e.g. TDv56whosPQ). targetLanguage is a language code such as en, es, fr, de, ja, ko, zh, pt, ru, it.
GET /transcript?videoId=VIDEO_ID
Extract the complete transcript with timing information and helpful metrics. Use it for subtitles, accessibility, content analysis and SEO, course material and podcast transcripts.
const res = await fetch('https://youtube-captions.p.rapidapi.com/transcript?videoId=TDv56whosPQ', { headers: { 'X-RapidAPI-Key': 'YOUR_API_KEY', 'X-RapidAPI-Host': 'youtube-captions.p.rapidapi.com', }, }); const body = await res.json(); console.log(body.data.metrics, body.data.transcript.slice(0, 3));
Example response:
{
"success": true,
"message": "Transcript retrieved successfully",
"data": {
"videoId": "TDv56whosPQ",
"transcript": [
{ "start": "0.080", "dur": "1.680", "text": "These are the four restrictions Marcus" },
{ "start": "1.760", "dur": "2.159", "text": "Rashford will face at Barcelona..." }
],
"detected_language": "en",
"metrics": {
"word_count": 1200,
"character_count": 8000,
"estimated_reading_time": "5 min",
"estimated_speaking_time": "8 min",
"reading_level": "Easy"
}
},
"error": null
}GET /transcript/fulltext?videoId=VIDEO_ID
The whole transcript as one block of text plus metrics. The fastest way to send a video to an LLM or a search index.
GET /transcript2?videoId=VIDEO_ID
Same transcript data with an alternative JSON structure, for applications that need a different shape.
GET /languages?videoId=VIDEO_ID
See every caption language before requesting one. Great for language pickers.
{
"success": true,
"message": "Available languages retrieved successfully",
"data": [
{ "languageCode": "en", "languageName": "English", "isAutoGenerated": false },
{ "languageCode": "es", "languageName": "Spanish", "isAutoGenerated": true },
{ "languageCode": "fr", "languageName": "French", "isAutoGenerated": true }
],
"error": null
}๐ก isAutoGenerated: false means manual captions written by the creator, usually the most accurate.
GET /transcript/all?videoId=VIDEO_ID
Every available language in one request. Useful for multilingual platforms, cross-language research and transcript databases.
GET /transcript/all/text?videoId=VIDEO_ID
Same as above but clean text without timing, for reading or analysis.
GET /transcript/bylanguage?videoId=VIDEO_ID&targetLanguage=LANG_CODE
The captions YouTube itself provides in that language (native, not machine-translated). Check /languages first.
GET /transcript/translated/full?videoId=VIDEO_ID&targetLanguage=LANG_CODE
Translate the transcript into the language you need.
import requests r = requests.get( "https://youtube-captions.p.rapidapi.com/transcript/translated/full", params={"videoId": "TDv56whosPQ", "targetLanguage": "es"}, headers={"X-RapidAPI-Key": "YOUR_API_KEY", "X-RapidAPI-Host": "youtube-captions.p.rapidapi.com"}, ) print(r.json())
GET /transcript/translated/text?videoId=VIDEO_ID&targetLanguage=LANG_CODE
The translation with the original timing preserved: perfect for synchronized subtitles in another language.
GET /extract/videoid?videoUrl=YOUTUBE_URL
Supports every common YouTube URL format:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://www.youtube.com/embed/VIDEO_IDhttps://m.youtube.com/watch?v=VIDEO_ID
curl "https://youtube-captions.p.rapidapi.com/extract/videoid?videoUrl=https://www.youtube.com/watch?v=TDv56whosPQ" \ -H "X-RapidAPI-Key: YOUR_API_KEY" -H "X-RapidAPI-Host: youtube-captions.p.rapidapi.com"
{ "result_": "TDv56whosPQ" }Successful responses use { "success": true, "message": "...", "data": ..., "error": null }. Errors use the same shape with success: false:
{
"success": false,
"error": {
"code": "NO_TRANSCRIPT_AVAILABLE",
"message": "This video doesn't have captions or transcripts available"
}
}| Code | Meaning | What to do |
|---|---|---|
NO_TRANSCRIPT_AVAILABLE |
The video has no captions | Try another video; don't retry |
INVALID_VIDEO_ID |
The id is malformed | Use /extract/videoid to get a clean id |
VIDEO_NOT_FOUND |
Video doesn't exist or is private | Only public videos work |
LANGUAGE_NOT_SUPPORTED |
The requested language isn't available | Check /languages or use a /translated/* endpoint |
RATE_LIMIT_EXCEEDED |
Too many requests | Slow down, retry with backoff, or upgrade your plan |
async function getTranscript(videoId) { const res = await fetch( `https://youtube-captions.p.rapidapi.com/transcript?videoId=${videoId}`, { headers: { 'X-RapidAPI-Key': process.env.RAPIDAPI_KEY, 'X-RapidAPI-Host': 'youtube-captions.p.rapidapi.com' } } ); const body = await res.json(); if (!body.success) throw new Error(`${body.error.code}: ${body.error.message}`); return body.data; } const { transcript, metrics } = await getTranscript('TDv56whosPQ'); console.log(`${metrics.word_count} words, ${metrics.estimated_speaking_time}`);
import os, requests def get_transcript(video_id): r = requests.get( "https://youtube-captions.p.rapidapi.com/transcript", params={"videoId": video_id}, headers={"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": "youtube-captions.p.rapidapi.com"}, timeout=60, ) body = r.json() if not body["success"]: raise RuntimeError(body["error"]["code"]) return body["data"] data = get_transcript("TDv56whosPQ") print(" ".join(seg["text"] for seg in data["transcript"])[:500])
<?php $ch = curl_init("https://youtube-captions.p.rapidapi.com/transcript?videoId=TDv56whosPQ"); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "X-RapidAPI-Key: " . getenv("RAPIDAPI_KEY"), "X-RapidAPI-Host: youtube-captions.p.rapidapi.com", ], ]); $data = json_decode(curl_exec($ch), true); foreach (array_slice($data["data"]["transcript"], 0, 5) as $seg) { echo $seg["start"] . "s " . $seg["text"] . PHP_EOL; }
All in examples/. Set RAPIDAPI_KEY and run.
| Example | What it does | Language |
|---|---|---|
transcript_to_srt.py |
Download any video's captions as .srt and .vtt subtitle files |
Python |
translate_subtitles.py |
Create translated subtitles (e.g. English โ Spanish) with original timing | Python |
summarize_video.py |
Summarize a video with an LLM (OpenAI-compatible): TL;DR, key points, chapters | Python |
video_qa_rag.py |
Ask questions about a video and get answers with clickable timestamps (no LLM needed) | Python |
batch_transcripts.py |
Bulk-download transcripts from a list of URLs to .txt + a metrics CSV |
Python |
find-in-video.js |
Search for a word or phrase and print youtube.com/watch?v=...&t= links to each moment |
Node.js |
telegram_transcript_bot.py |
Telegram bot: send a YouTube link, get the transcript file back | Python |
proxy-server.js |
Tiny Express backend that hides your RapidAPI key and caches results | Node.js |
transcript-viewer.html |
Web page: paste a link, pick a language, read the transcript with clickable timestamps | HTML / JS |
- Check
/languagesfirst when you need a specific language; use/transcript/bylanguagefor native captions and/transcript/translated/*when the language isn't available. - Prefer manual captions (
isAutoGenerated: false) when accuracy matters. - Use
/transcript/fulltextfor LLMs and search: fewer tokens than timed segments. - Cache transcripts on your side. A video's captions rarely change, and each call counts against your plan.
- Keep your key on a server. Don't ship
X-RapidAPI-Keyin a browser extension or mobile app; use a backend likeproxy-server.js. - Handle errors by
error.code, and don't retryNO_TRANSCRIPT_AVAILABLE,INVALID_VIDEO_IDorVIDEO_NOT_FOUND. - Respect creators. Transcripts belong to their creators; follow YouTube's terms and copyright rules when you republish content.
What types of videos work? Any public YouTube video that has captions: manual captions added by the creator, YouTube's auto-generated captions, or community-contributed captions.
How accurate are the transcripts? Manual captions are very accurate (95%+). Auto-generated captions are usually 80-90% accurate for clear speech; audio quality, accents, background noise and technical terms all play a part.
Can I get transcripts from private or unlisted videos? No, only public videos are accessible.
What's the difference between native and translated transcripts?
/transcript/bylanguage returns captions YouTube provides in that language. /transcript/translated/* machine-translates the original transcript into the language you ask for.
Does it work with YouTube Shorts and live stream recordings? Yes, as long as the video is public and has captions.
Do I need a YouTube Data API key or OAuth? No. You only need your RapidAPI key.
Can I use it in commercial projects? Yes: content management systems, education platforms, accessibility tools, SEO and content analysis tools, AI products and more.
What happens if a video has no captions?
You get a clear NO_TRANSCRIPT_AVAILABLE error.
How current is the data? Transcripts are fetched from YouTube in real time.
๐ฌ For questions, bug reports, feature requests or integration help, contact us on Telegram: @pintoflow. Include the endpoint and the video id you used.
- Open the YouTube Captions API on RapidAPI and subscribe (free plan available).
- Copy your
X-RapidAPI-Key. - Run one of the examples or call
GET /transcript?videoId=TDv56whosPQ.
If this repository helps you, give it a โญ so others can find it.
Keywords: YouTube transcript API, YouTube captions API, YouTube subtitles API, get YouTube transcript, download YouTube subtitles, YouTube to text, YouTube video to text API, YouTube SRT download, YouTube VTT, YouTube transcript JSON, YouTube transcript translation, YouTube caption extractor, YouTube transcript for ChatGPT, summarize YouTube video API, YouTube RAG, YouTube speech to text, video transcription API, auto-generated captions API, multilingual subtitles API, RapidAPI YouTube API, Node.js, Python, PHP.