Extract YouTube Transcripts with curl in 30 Seconds

You don't need an account, an SDK, or a headless browser to turn a YouTube video into plain text. youtube2text.org is a REST API: one call to get a key, one call to get the transcript.
Step 1: Grab the free demo key
curl -s https://youtube2text.org/api/demo-key
Response:
{"success": true, "apiKey": "yt_..."}
The demo key is shared and IP-limited (5 videos per month per IP) — perfect for trying things out or occasional scripting.
Step 2: Get a transcript
curl -s "https://youtube2text.org/api/transcribe?url=https://www.youtube.com/watch?v=VIDEO_ID&maxChars=5000" \
-H "x-api-key: yt_YOUR_KEY"
Success response:
{"result": {"videoId": "...", "title": "...", "pubDate": "2025-01-01T00:00:00-07:00",
"content": "full transcript text ...", "contentSize": 12345, "truncated": false}}
That's it. A few details worth knowing:
urlaccepts any YouTube form —watch?v=,youtu.be,embed, or a bare 11-character video id.maxCharstruncates the transcript (default and max: 150000). Handy when you're feeding the text into an LLM with a token budget.Authorization: Bearer <key>works as an alternative tox-api-key.- Prefer POST? Send JSON:
{"url": "...", "maxChars": 5000}to the same endpoint.
Handling errors
Every error comes back in the same machine-readable shape:
{"error": {"code": "RATE_LIMIT_EXCEEDED", "message": "...", "status": 429,
"docsUrl": "https://youtube2text.org/api.md", "retryAfterSeconds": 3600}}
The codes you'll actually see:
TRANSCRIPT_UNAVAILABLE— the video has no captions at all.RATE_LIMIT_EXCEEDED— quota used up;retryAfterSecondstells you when to retry.UNAUTHORIZED— missing or invalid key; fetch one from/api/demo-key.
When the demo key isn't enough
Sign in with Google at youtube2text.org/app/keys and create your own key: the free account also gets 5 videos/month, and paid plans go from 50/month to unlimited.
The complete machine-readable reference — parameters, every error code, MCP integration — lives at youtube2text.org/api.md. If you're wiring this into an AI agent instead of a shell script, read the MCP guide next.