YouTube Transcript API

Extract closed captions from YouTube videos as structured JSON. Token estimation, smart truncation, and keyword search with timestamps.

GET /api/youtube/transcript 5 sats

Get the full transcript of a YouTube video. Supports full text or timestamped segments with optional token-based truncation.

ParameterTypeDescription
videoIdstringYouTube video ID or full URL
formatstring"full" (default) or "segments" for timestamped chunks
maxTokensintOptional. Truncate transcript to fit within this token budget
curl "https://agent-commerce.store/api/youtube/transcript?videoId=dQw4w9WgXcQ&format=segments&maxTokens=1000"
GET /api/youtube/metadata 2 sats

Get video metadata without the transcript. Use as a cheap pre-check to see if a transcript exists and estimate its token count.

ParameterTypeDescription
videoIdstringYouTube video ID or full URL
curl "https://agent-commerce.store/api/youtube/metadata?videoId=dQw4w9WgXcQ"
GET /api/youtube/search 3 sats

Search within a video's transcript for keywords. Returns matching segments with timestamps and surrounding context.

ParameterTypeDescription
videoIdstringYouTube video ID or full URL
querystringKeyword or phrase to search for
limitintMax results (1-50, default 10)
curl "https://agent-commerce.store/api/youtube/search?videoId=dQw4w9WgXcQ&query=never+gonna&limit=5"
Usage tips: Accepts full YouTube URLs (youtube.com/watch?v=..., youtu.be/...) or bare 11-character video IDs. Not all videos have captions — use the metadata endpoint to check first. Auto-generated captions may contain transcription errors. Use maxTokens to fit transcripts into your LLM context window.

Value-Add

Upstream Source

YouTube closed captions via YoutubeExplode.