Free YouTube transcript API: curl, REST, and MCP
Extract YouTube transcripts as plain text — free, straight from curl or any HTTP client. Also an MCP server for Claude Code, Codex, claude.ai, and other AI agents.
AI agents: the complete machine-readable API reference lives at https://youtube2text.org/api.md (index: /llms.txt).
How it works
Call GET or POST https://youtube2text.org/api/transcribe with a YouTube `url` and optional `maxChars`, authenticated with an `x-api-key` header. No key yet? GET https://youtube2text.org/api/demo-key returns a shared demo key. MCP clients can instead connect to https://youtube2text.org/mcp with OAuth.
# No key? Get the shared demo key first:
curl "https://youtube2text.org/api/demo-key"
# -> {"success":true,"apiKey":"yt_..."}
# Fetch a transcript (GET):
curl "https://youtube2text.org/api/transcribe?url=https://www.youtube.com/watch?v=VIDEO_ID&maxChars=5000" -H "x-api-key: YOUR_API_KEY"curl -X POST "https://youtube2text.org/api/transcribe" -H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" -d '{"url": "https://www.youtube.com/watch?v=VIDEO_ID", "maxChars": 5000}'Use it from AI models via MCP
# claude.ai (web or desktop): # Settings -> Connectors -> Add custom connector # URL: https://youtube2text.org/mcp # Then sign in with Google and click Allow. Done - OAuth handles the rest.
# Claude API (Messages) with the MCP connector:
{
"mcp_servers": [
{
"type": "url",
"url": "https://youtube2text.org/mcp",
"name": "youtube2text",
"authorization_token": "YOUR_API_KEY"
}
]
}# OpenAI Responses API:
resp = client.responses.create(
model="gpt-5",
tools=[{
"type": "mcp",
"server_label": "youtube2text",
"server_url": "https://youtube2text.org/mcp",
"headers": {"x-api-key": "YOUR_API_KEY"},
"require_approval": "never"
}],
input="Summarize https://www.youtube.com/watch?v=VIDEO_ID"
)Possible statuses and error codes
- UNAUTHORIZED: Missing or invalid key (401). Get one: GET /api/demo-key.
- TRANSCRIPT_UNAVAILABLE: No transcript available for this video (404).
- VIDEO_NOT_FOUND: Video not found (404).
- INVALID_URL: Invalid YouTube URL (400).
- RATE_LIMIT_EXCEEDED: Quota exhausted (429); retryAfterSeconds is returned. Create an account or upgrade for more.
- YOUTUBE_ERROR: Upstream YouTube failure (500); retry later.
Full reference
Complete machine-readable docs: https://youtube2text.org/api.md · index: /llms.txt · app & API keys: https://youtube2text.org/app/keys · source: github.com/dm-nosov/youtube2text