YouTube Subtitle API
FastAPI backend • RQ workers • Cloudflare Pages frontend

Extract YouTube subtitles

Submits POST /api/subtitles. Cache hits return 200. Cache misses return 202 with a job_id and the UI auto-polls /api/job/{job_id}.

curl
            curl -X POST /api/subtitles \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","language":"en","clean_for_ai":true}'
          

Result

idle
Raw JSON

Frequently Asked Questions

What subtitle formats are supported?
The API extracts subtitles in plain text format by default. You can also download them as SRT, VTT, or JSON files using the download button. The original YouTube caption data is returned in the JSON response.
Why is my request taking longer than expected?
First-time requests for a video require processing and may take up to 90 seconds. Subsequent requests are cached and return instantly. The status indicator shows "queued" while processing and "finished" when complete.
What does "Clean for AI" do?
When enabled, this option removes common subtitle artifacts like music indicators [♪], sound effects, and repeated text. This produces cleaner text suitable for AI processing, summarization, or analysis.
Is there a rate limit?
Yes, the API has rate limiting to ensure fair usage. When you approach the limit, a warning banner will appear. If you exceed the limit, you'll receive a 429 response with a Retry-After header indicating when to try again.
Can I use this API programmatically?
Absolutely! The curl example shows the basic request format. Full API documentation is available at the Backend OpenAPI link above. The API supports both synchronous (cache hit) and asynchronous (cache miss) responses.

API Documentation

Endpoints

  • POST /api/subtitles — extract or enqueue
  • GET /api/subtitles/{video_id} — read cache
  • GET /api/job/{job_id} — poll async job status

Production

  • 3-tier cache: memory → Redis → Postgres
  • Rate limiting with 429 + Retry-After
  • Metrics: /metrics

Deploy the backend separately. Deploy this frontend to Cloudflare Pages and proxy /api/* via Pages Functions so browsers never see backend secrets.

Supported Formats

YouTube to SRT

Download subtitles as SubRip (.srt) format, compatible with most video players and editing software.

YouTube to VTT

Export subtitles as WebVTT (.vtt) format, ideal for web video players and HTML5 video.

YouTube to TXT

Extract plain text transcripts, perfect for content analysis, AI training, and documentation.