Crawly.
Guide·2026-03-09

How to Extract YouTube Transcripts with an API

TL;DR: Use the Crawly transcript API to extract YouTube captions in plain text, timed segments, SRT, or VTT format with a single API call. It costs $0.001 per request, handles auto-generated captions, and supports multi-language extraction. No YouTube Data API key needed.

Why Extract YouTube Transcripts?

YouTube is the second largest search engine in the world with over 800 million videos. The text content inside those videos is an enormous dataset that most developers cannot easily access. Transcripts unlock this content for search, summarization, AI training, accessibility, and content repurposing.

Common reasons developers need YouTube transcripts:

  • RAG pipelines: Feed video content into LLMs for context-aware responses
  • Content repurposing: Turn videos into blog posts, newsletters, or social threads
  • Accessibility: Generate subtitles for embedding in custom players
  • Research: Analyze trends across thousands of videos
  • SEO: Create searchable text content from video
  • Education: Build study materials from lecture recordings

The Problem: YouTube Has No Public Transcript API

YouTube does not offer a public API for accessing video transcripts. The YouTube Data API v3 provides metadata like titles, descriptions, and comments, but captions require OAuth authentication with the video owner. You cannot programmatically access captions for videos you do not own through official channels.

This creates a gap. Developers resort to browser extensions, Python scraping libraries, or manual copy-pasting. These approaches are fragile, rate-limited, and break when YouTube changes their frontend. A dedicated transcript API solves this by handling the extraction server-side and returning clean, structured output.

Step-by-Step: Extract Your First Transcript

1. Get an API Key

Sign up at crawly.bikal.co and go to the API Keys page. Create a key. You get 100 free credits on signup, no credit card required. Each transcript extraction costs 1 credit ($0.001).

2. Make Your First Request

Send a POST request to /v1/transcript with a YouTube URL. The API accepts any valid YouTube URL format including youtube.com/watch?v=, youtu.be/, and youtube.com/shorts/.

curl -X POST https://api.crawly.bikal.co/v1/transcript \
-H "Authorization: Bearer cr_your_key" \
-H "Content-Type: application/json" \
-d '{"url": "https://youtube.com/watch?v=dQw4w9WgXcQ"}'

3. Choose Your Output Format

By default, the API returns plain text. You can request a specific format by adding the format parameter to your request body.

bash
curl -X POST https://api.crawly.bikal.co/v1/transcript \
-H "Authorization: Bearer cr_your_key" \
-H "Content-Type: application/json" \
-d '{"url": "https://youtube.com/watch?v=dQw4w9WgXcQ", "format": "srt"}'

Response Examples

Plain Text (default)

Returns the full transcript as a single string with no timestamps. Best for feeding into LLMs, summarization, and search indexing.

json
{
"success": true,
"transcript": "We're no strangers to love. You know the rules and so do I...",
"metadata": {
"title": "Rick Astley - Never Gonna Give You Up",
"duration": "3:33",
"language": "en"
}
}

Timed Segments

Returns an array of segments with start time, duration, and text. Best for building video indexes, search, and interactive transcripts.

json
{
"success": true,
"segments": [
{ "start": 0.0, "duration": 2.5, "text": "We're no strangers to love" },
{ "start": 2.5, "duration": 2.1, "text": "You know the rules and so do I" }
],
"metadata": {
"title": "Rick Astley - Never Gonna Give You Up",
"duration": "3:33",
"language": "en"
}
}

SRT

Returns SubRip subtitle format. Best for video players, subtitle editors, and offline use.

text
1
00:00:00,000 --> 00:00:02,500
We're no strangers to love
2
00:00:02,500 --> 00:00:04,600
You know the rules and so do I

VTT

Returns WebVTT format. Best for HTML5 video elements and web-based players.

text
WEBVTT
00:00:00.000 --> 00:00:02.500
We're no strangers to love
00:00:02.500 --> 00:00:04.600
You know the rules and so do I

Supported Formats

FormatValueDescriptionBest For
Plain texttextFull transcript as a single stringLLMs, summarization, RAG, search
Timed segmentssegmentsArray of objects with start, duration, textVideo indexing, interactive transcripts
SRTsrtSubRip subtitle formatVideo players, subtitle editing
VTTvttWebVTT formatHTML5 video, web players

Multi-Language Support

Crawly automatically detects the language of a video and extracts the best available transcript. It follows this priority order:

  1. Manual captions in the video's primary language
  2. Auto-generated captions in the primary language
  3. Manual captions in any available language
  4. Auto-generated captions in any available language

You can also request a specific language by passing the lang parameter. If the requested language is not available, the API returns the best available alternative and includes the actual language in the response metadata.

json
{
"url": "https://youtube.com/watch?v=example",
"lang": "es"
}

Common Errors and How to Handle Them

ErrorCauseSolution
TRANSCRIPT_UNAVAILABLEVideo has no captions (manual or auto-generated)Not all videos have captions. Check if the video has a CC button on YouTube.
VIDEO_UNAVAILABLEVideo is private, deleted, or region-lockedVerify the URL works in your browser. The API cannot access private videos.
INVALID_URLURL is not a valid YouTube video linkUse a standard youtube.com/watch?v= or youtu.be/ format.
RATE_LIMITEDToo many requests in a short timeWait and retry. The limit is 60 requests per minute.

Failed requests are automatically refunded. If a transcript cannot be extracted for any reason, you are not charged a credit.

Alternatives Compared

There are a few other ways to get YouTube transcripts programmatically. Here is how they compare:

MethodLanguageHostingFormatsReliability
Crawly APIAny (REST)ManagedText, segments, SRT, VTTHigh (server-side extraction)
youtube-transcript-api (Python)Python onlySelf-hostedJSON segmentsMedium (breaks on YouTube changes)
Manual browser scrapingAnySelf-hostedRaw HTMLLow (fragile, rate-limited)
YouTube Data API v3AnyGoogle CloudXMLHigh (only for owned videos)

The youtube-transcript-api Python library is a popular open-source option, but it runs on your own infrastructure y can break when YouTube updates their frontend. It also only outputs JSON segments, so you need to build your own SRT/VTT conversion. For production use, a managed API is more reliable.

Using with AI Tools (MCP)

If you use Claude, Cursor, or Windsurf, you can extract YouTube transcripts directly from your AI tool without writing any code. Crawly has an MCP server that connects to any MCP-compatible client.

Once configured, you can simply ask your AI: "Get the transcript of this YouTube video and summarize the key points." The AI handles the API call and returns the result in your chat.

Pricing

Each transcript extraction costs 1 credit ($0.001). No monthly subscription, no minimum commitment. Credits never expire. Failed requests are refunded automatically.

You get 100 free credits when you sign up. That is 100 transcript extractions at no cost. After that, purchase credits at pay.bikal.co.

Frequently Asked Questions

Can you get YouTube transcripts programmatically?

Yes. YouTube does not offer a public transcript API, but services like Crawly extract captions server-side and return them via a REST API. You send a YouTube URL and get back the transcript in plain text, SRT, VTT, or timed segments.

Is there a free YouTube transcript API?

Crawly offers 100 free credits on signup (100 transcript extractions). The open-source youtube-transcript-api Python library is fully free but requires self-hosting and only outputs JSON segments.

What YouTube URL formats are supported?

The API accepts youtube.com/watch?v=, youtu.be/, youtube.com/shorts/, and youtube.com/embed/ formats. You can pass the full URL with any query parameters and the API will extract the video ID automatically.

Can I get transcripts for videos in other languages?

Yes. The API automatically detects the best available transcript language. You can also request a specific language using the lang parameter. If manual captions are not available, it falls back to auto-generated captions.

What happens if a video has no captions?

The API returns a TRANSCRIPT_UNAVAILABLE error and the request is automatically refunded. You are not charged for failed extractions. About 15% of YouTube videos have no captions at all, so plan for this in your error handling.


Ready to start extracting transcripts? Get 100 free credits or read the transcript API docs for the full parameter reference.

Try Crawly.

100 free credits. No credit card required.