TubeToTranscript Logo
TubeToTranscript
Developer Guide

Get YouTube Transcripts as JSON with an API

One HTTPS request returns a video's captions as structured JSON, with a start time and duration for every line. Here are working examples in cURL, Python, and Node.js, plus how to turn the result into CSV or Excel.

1. Get an API key

Create a free account, then copy your key from the dashboard. The free key includes 10 successful requests so you can test your integration. Pro includes 1,500 API caption requests per month, with bursts of up to 50 per minute.

Send the key on every request, either as Authorization: Bearer YOUR_API_KEY or as x-api-key: YOUR_API_KEY. Keep it on your server: don't put it in front-end code or commit it to a repository. Load it from an environment variable, as the examples below do.

2. Make your first request with cURL

The endpoint is /api/v1/transcript. Pass the video as url. A full watch URL, a youtu.be link, a Shorts link, or a bare 11-character video ID all work.

GET request
curl "https://www.tubetotranscript.com/api/v1/transcript?url=https://www.youtube.com/watch?v=VIDEO_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

You can also POST a JSON body. Add language (for example es) to request a specific caption track. Without it, the default track is returned.

POST request with a language
curl -X POST "https://www.tubetotranscript.com/api/v1/transcript" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://youtu.be/VIDEO_ID", "language": "es"}'

3. Understand the JSON response

Response (shortened)
{
  "language": "en",
  "language_name": "English",
  "is_generated": false,
  "length_seconds": 642,
  "lengthText": "10:42",
  "metadata": {
    "videoId": "VIDEO_ID",
    "title": "Video title",
    "channel": "Channel name",
    "thumbnail": "https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg"
  },
  "transcript": [
    { "text": "Welcome back to the channel.", "start": 0.0, "duration": 2.4 },
    { "text": "Today we're looking at tides.", "start": 2.4, "duration": 3.1 }
  ],
  "available_languages": [
    { "code": "en", "name": "English", "is_generated": false },
    { "code": "es", "name": "Spanish", "is_generated": true }
  ]
}
  • transcript is an array of caption segments in order. start and duration are numbers in seconds, rounded to two decimals, so a segment ends at start + duration.
  • is_generated tells you whether the track came from YouTube's speech recognition. Treat those tracks as less reliable for names and numbers.
  • available_languages lists every caption track the video has. Use one of those codes as language in a follow-up request.
  • metadata gives you the title, channel, and thumbnail, so you don't need a separate YouTube Data API call to label results.

4. Python example

Uses the requests library (pip install requests).

Python
import os
import requests

API_KEY = os.environ["TUBETOTRANSCRIPT_API_KEY"]

resp = requests.get(
    "https://www.tubetotranscript.com/api/v1/transcript",
    params={"url": "https://www.youtube.com/watch?v=VIDEO_ID"},
    headers={"Authorization": f"Bearer {API_KEY}"},
    timeout=60,
)
resp.raise_for_status()
data = resp.json()

print(data["metadata"]["title"])
for seg in data["transcript"]:
    print(f'{seg["start"]:>7.2f}s  {seg["text"]}')

5. Node.js example

Uses the built-in fetch in Node 18 and later, with no extra packages.

Node.js (ES module)
const res = await fetch(
  "https://www.tubetotranscript.com/api/v1/transcript?url=" +
    encodeURIComponent("https://www.youtube.com/watch?v=VIDEO_ID"),
  { headers: { Authorization: `Bearer ${process.env.TUBETOTRANSCRIPT_API_KEY}` } }
);

if (!res.ok) {
  const err = await res.json();
  throw new Error(`${res.status} ${err.code}: ${err.error}`);
}

const data = await res.json();
const plainText = data.transcript.map((s) => s.text).join(" ");
console.log(plainText);

6. Export to CSV or Excel

Because every segment has the same three fields, the transcript array maps directly onto a table. With pandas, you can go from API response to spreadsheet in three lines:

Python + pandas
import pandas as pd

df = pd.DataFrame(data["transcript"])          # columns: text, start, duration
df["end"] = df["start"] + df["duration"]
df.to_csv("transcript.csv", index=False)       # opens in Excel / Google Sheets
df.to_excel("transcript.xlsx", index=False)    # needs: pip install openpyxl

For a one-off video, you don't need code: the YouTube to CSV tool downloads the same rows as a CSV file, and the YouTube to JSON tool downloads a JSON file from the browser.

7. Markdown for LLMs

If you are feeding the transcript straight into a language model, ask for Markdown instead of JSON by sending Accept: text/markdown. You get a title, video details, and one [MM:SS]-prefixed line per segment. The response includes an x-markdown-tokens header with a rough token estimate.

Markdown response
curl "https://www.tubetotranscript.com/api/v1/transcript?url=https://youtu.be/VIDEO_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: text/markdown"

8. Handle errors

Errors return JSON with a human-readable error message and a machine-readable code:

StatusCodeWhat to do
401API_KEY_REQUIRED / INVALID_API_KEYCheck that the header is sent and the key is active.
400INVALID_URLThe value isn't a recognizable YouTube link or video ID.
4xxTRANSCRIPT_DISABLED / TRANSCRIPT_NOT_AVAILABLEThe video has no usable captions. Don't retry.
4xxLANGUAGE_NOT_AVAILABLEPick a code from available_languages.
429Rate limit or quotaWait and retry with backoff, or upgrade if your quota is used up.

Only retry on 429 and 5xx responses. A missing-captions error won't change on retry, and failed caption lookups don't count against your allowance.

More endpoints

The same key works for batch requests (many videos in one call), playlists, and channel search, and there is an MCP server for AI assistants such as Claude and Cursor. See the API documentation for every endpoint, or the API overview for plans and use cases.

YouTube Transcript API FAQ

Find answers to common questions about generating and exporting YouTube transcripts.

Yes. Creating an account gives you a free API key with 10 successful requests to try the API. Pro includes 1,500 API caption requests per month. If you only need a few videos by hand, the web tool exports JSON and CSV without a key.
Complete YouTube Transcription Suite

Explore All Free YouTube Transcript Tools

Interlinked utilities for creators, researchers, developers, and AI engineers. Web tools are available without an account, subject to caption availability and fair-use limits.

Generator Alternatives

Compare free YouTube transcript tools side-by-side by format and signup.

Open Tool
AI Native

YouTube AI Transcript

AI-ready clean transcript engine for LLMs, Claude, and NotebookLM.

Open Tool
Popular

Transcript for ChatGPT

Pre-chunked transcripts with 1-click custom prompt presets.

Open Tool

Video Study Worksheet

Create timestamped review cues and flashcards from available captions.

Open Tool

Editable Video Blog Draft

Create an editable Markdown draft from an available transcript.

Open Tool
New

Transcript Translator

AI-translate a transcript into nearly 60 languages, not just YouTube’s own caption tracks.

Open Tool
Subtitles

YouTube to SubRip (.SRT)

Export timed subtitle files with exact sequential millisecond timestamps.

Open Tool

YouTube to WebVTT (.VTT)

Standard WebVTT cue files for HTML5 video players and LMS systems.

Open Tool

YouTube to Clean Text (.TXT)

Download continuous text dialogue without timestamps or noise.

Open Tool

YouTube to Markdown (.MD)

Export structured markdown with YAML headers for Obsidian & Notion.

Open Tool

YouTube to JSON (.JSON)

Structured start/duration data payloads for developers and NLP pipelines.

Open Tool

YouTube to CSV / Excel

Export time-aligned rows to Google Sheets, Airtable, and Excel.

Open Tool

Transcript Downloader Hub

Universal multi-format export hub supporting all file formats.

Open Tool

Without Timestamps

Extract clean prose with zero numbers or timecode clutter.

Open Tool

With Timestamps

Extract dialogue with clickable [00:00] timestamp markers.

Open Tool

In-Transcript Word Search

Search exact spoken phrases and instantly jump to timestamps.

Open Tool

Video Quote Finder

Find exact verbatim quotes with surrounding context and links.

Open Tool

Caption Availability Checker

Verify human and auto-generated subtitle streams for any URL.

Open Tool

Word Count & Speech Speed

Calculate speech WPM, character count, and estimated reading time.

Open Tool

Academic Citation Generator

Generate APA, MLA, Chicago, and Harvard video citations.

Open Tool

Transcript Text Cleaner

Strip [Music], [Applause], stray timestamps, and awkward line breaks.

Open Tool

Roman Urdu & Urdu Transcriber

Transcribe and transliterate Hindi/Urdu videos into Roman text.

Open Tool
Power Tool

Batch Multi-Video (Bulk)

Transcribe up to 30 YouTube videos in parallel into 1 combined file.

Open Tool

Full Playlist Transcriber

Provider-backed playlist enumeration and transcript export.

Open Tool

Channel Speech Search

Provider-backed search across supported channel transcript catalogs.

Open Tool

YouTube Shorts Transcriber

Extract captions and dialogue from vertical YouTube Shorts.

Open Tool
API

Developer REST API & MCP

Production REST API and native Model Context Protocol server.

Open Tool

API Documentation & SDKs

Full interactive documentation with Python, cURL, and Node.js examples.

Open Tool
Developer & Automated Workflows

Need to extract transcripts in bulk or connect to AI Agents?

Get your free developer API key with 10 free requests or connect TubeToTranscript directly to Claude Desktop and Cursor using native MCP.