YouTube Subtitles API

The FetchTranscript YouTube Subtitles API downloads the captions of a YouTube video as an SRT subtitle file, as plain text or as JSON segments with start times and durations, in any language the video is captioned in. A second endpoint lists those caption tracks and tells you which ones the creator wrote and which ones YouTube generated automatically. You need an API key, not OAuth, and you do not need to own the video.

No credit card needed. One API key works on every endpoint.

Quick example: download an SRT file

GET/v1/transcripts/{video_id}?format=srt&lang=en
GET/v1/transcripts/{video_id}/languages

Ask for format=srt and save the text field of the response to a file. The SDKs return the SRT as a string directly.

# The SRT is in the "text" field of the JSON response
curl -s "https://api.fetchtranscript.com/v1/transcripts/jNQXAC9IVRw?format=srt&lang=en" \
  -H "X-API-Key: yt_your_api_key" | jq -r .text > me-at-the-zoo.en.srt

Sample response

The JSON returned for the request above, with the SRT shortened:

{
  "video_id": "jNQXAC9IVRw",
  "language": "en",
  "text": "1\n00:00:01,200 --> 00:00:05,318\nAll right, so here we are, in front of the elephants\n\n2\n00:00:05,318 --> 00:00:07,974\nthe cool thing about these guys is that they have really...\n\n...",
  "is_generated": false,
  "provider": "youtube_transcript_api",
  "metadata": {
    "title": "Me at the zoo",
    "author": "jawed",
    "thumbnail": "https://i.ytimg.com/vi/jNQXAC9IVRw/maxresdefault.jpg",
    "length_seconds": 19,
    "view_count": 449031223,
    "short_description": "..."
  }
}

And the file you get once the text field is saved as a .srt:

1
00:00:01,200 --> 00:00:05,318
All right, so here we are, in front of the elephants

2
00:00:05,318 --> 00:00:07,974
the cool thing about these guys is that they have really...

3
00:00:07,974 --> 00:00:12,616
really really long trunks

4
00:00:12,616 --> 00:00:14,421
and that's, that's cool

5
00:00:14,421 --> 00:00:18,452
And that's pretty much all there is to say

Illustrative values: a real response carries the live data of the video or channel you ask for.

FieldTypeDescription
video_idstringThe video ID you asked for.
languagestringThe language code of the captions you received, for example en or pt-BR.
textstringWith format=srt, the complete SRT file; with format=text, the captions as one plain-text string. Absent with format=json.
segmentsarrayWith format=json only: one object per caption line with text, start and duration in seconds.
is_generatedbooleanTrue for YouTube’s automatic captions, false for captions the creator wrote or uploaded.
providerstringWhere the captions came from; cache when they were served from FetchTranscript’s cache.
metadataobject | nullTitle, author, thumbnail, length_seconds, view_count and short_description of the video.

Parameters

ParameterInTypeDefaultDescription
video_idpathstringrequiredThe 11-character YouTube video ID. Both endpoints take it; anything else gets 400 invalid_video_id.
formatquerystringjsonsrt for SubRip subtitles, text for plain text, json for timed segments.
langquerystringfirst trackLanguage code, 2 to 10 characters, as returned by /languages. A short code also matches its regional variants: en finds an en-US track. Omit it to get the video’s first available caption track.

A video whose owner turned captions off gets 404 transcripts_disabled, a language that cannot be served gets 404 no_transcript_found, and a missing or private video gets 404 video_not_found. A format other than the three above is refused with a 422 validation error. None of these is billed.

List the caption languages of a video

Before downloading, ask which tracks exist. The languages endpoint returns every caption track of the video, manual and automatic, with the code to pass as lang. This video has five manual tracks and YouTube’s automatic English captions:

{
  "video_id": "dQw4w9WgXcQ",
  "languages": [
    { "language_code": "en", "language": "English", "is_generated": false, "is_translatable": false },
    { "language_code": "de-DE", "language": "German (Germany)", "is_generated": false, "is_translatable": false },
    { "language_code": "ja", "language": "Japanese", "is_generated": false, "is_translatable": false },
    { "language_code": "pt-BR", "language": "Portuguese (Brazil)", "is_generated": false, "is_translatable": false },
    { "language_code": "es-419", "language": "Spanish (Latin America)", "is_generated": false, "is_translatable": false },
    { "language_code": "en", "language": "English (auto-generated)", "is_generated": true, "is_translatable": false }
  ]
}
FieldTypeDescription
language_codestringThe code to pass as lang, for example en, de-DE or es-419.
languagestringThe name of the track as YouTube shows it, including “(auto-generated)” for automatic captions.
is_generatedbooleanTrue for an automatic speech-recognition track, false for a manual one.
is_translatablebooleanTrue when YouTube reports that it can machine-translate the track; false when it cannot or does not say.

Manual or auto-generated captions

YouTube videos can carry two kinds of captions. Manual captions are written or uploaded by the creator: they usually have punctuation, proper names spelled right and lines timed for reading. Auto-generated captions come from YouTube’s speech recognition: they exist on far more videos and in the video’s spoken language, but they can miss words and, in some languages, punctuation.

Both are available through the API. The is_generated flag, in the language list and in every subtitle response, tells you which one you have, so you can prefer manual tracks for subtitles you publish and accept automatic ones for search, analysis and summaries.

SRT, plain text or JSON

SRT is the subtitle format nearly every video editor, player and subtitle tool can import: numbered cues with HH:MM:SS,mmm start and end times. Plain text joins the caption lines into one string, the right input for reading, search or a language model. JSON gives you every line with its start and duration in seconds, so you can produce any other format yourself. WebVTT, for example, takes a dozen lines:

from fetchtranscript import FetchTranscriptClient

client = FetchTranscriptClient(api_key="yt_your_api_key")


def timestamp(seconds: float) -> str:
    hours, rest = divmod(seconds, 3600)
    minutes, secs = divmod(rest, 60)
    return f"{int(hours):02d}:{int(minutes):02d}:{secs:06.3f}"


data = client.transcripts.get("jNQXAC9IVRw", lang="en")  # format=json: timed segments
lines = ["WEBVTT", ""]
for segment in data["segments"]:
    end = segment["start"] + segment["duration"]
    lines += [f"{timestamp(segment['start'])} --> {timestamp(end)}", segment["text"], ""]

with open("me-at-the-zoo.en.vtt", "w", encoding="utf-8") as f:
    f.write("\n".join(lines))

Use cases

Subtitle files for editing

Bring the captions of your own videos into a video editor or a subtitle tool as a standard .srt file, with the cue timings already in place, then fix, restyle or re-time them.

Accessible players and courses

Show captions in your own player, learning platform or kiosk app for viewers who are deaf or hard of hearing, or who watch with the sound off.

Dual subtitles for language learners

Fetch the JSON segments in two languages and display them line by line, so learners can read the original and the translation of what is being said at the same moment.

Localization workflows

Start a human translation from the creator’s original-language SRT instead of transcribing the audio again, and keep the timings of every cue.

Caption audits

Check whether the videos of a channel have manual captions or only automatic ones, and in which languages, before a compliance review or an accessibility report.

Searchable video archives

Store every caption track with its timings so a search for a phrase lands on the exact second it is said, in any of the languages the video was captioned in.

Captions and the official YouTube Data API

Google’s YouTube Data API downloads caption tracks with captions.download. Its reference page says that a call costs 200 quota units, that the request must be authorized with OAuth, and that the method requires the user to have permission to edit the video.

FetchTranscript returns the captions that are publicly visible on any video, with an API key and no OAuth, at one credit per successful call. Listing the tracks is one more call; on the official API, captions.list costs 50 units according to Google’s quota cost table.

Pricing

A subtitle download costs one credit whatever the format or language, and listing a video’s languages costs one more. Videos without captions return an error and cost nothing.

  • 25 free calls every month, no credit card
  • Then $1 per 1,000 calls, pay as you go
  • Only successful calls are billed: errors cost nothing
  • Credits never expire; bulk packs from 10,000 calls for $9

See all prices and bulk packs →

Also in the MCP server for AI assistants

The FetchTranscript MCP server gives Claude, Cursor and other MCP clients the same data as tools: get_transcript and list_languages. list_languages marks automatic tracks, and get_transcript takes format: "srt" and a language, so an assistant can fetch the Spanish subtitles of a video when you ask for them.

Run it with uvx fetchtranscript-mcp and your API key in FETCHTRANSCRIPT_API_KEY; the MCP server guide has the configuration for each client. Tool calls are billed like API calls.

YouTube Subtitles API: frequently asked questions

How do I download YouTube subtitles as an SRT file?
Call GET /v1/transcripts/{video_id}?format=srt&lang=en. The response is JSON and its text field holds the complete SRT file: write it to a .srt file as it is. The SDKs do it in one line with get_srt in Python and getSrt in TypeScript.
Can I get YouTube’s auto-generated captions?
Yes. Automatic captions are listed by the languages endpoint with is_generated set to true, and every subtitle response tells you with is_generated whether you received an automatic or a manual track.
How do I know which languages a video has subtitles in?
Call GET /v1/transcripts/{video_id}/languages. It returns each caption track with its language code, its name and whether it was generated automatically. Pass the code as lang to download that track.
What if the video has no subtitles in the language I ask for?
FetchTranscript then tries YouTube’s automatic translation of an existing track. When that is not possible you get 404 no_transcript_found; a video whose captions are turned off gets 404 transcripts_disabled. Errors are not billed.
Do I need to own the video or use OAuth?
No. You can download the captions of any public video that has them with your FetchTranscript API key alone, sent in the X-API-Key header or as a Bearer token.
How much does a subtitle download cost?
One credit per successful call, in any format; listing the languages of a video is one more call. Every account gets 25 free calls per month, then it is $1 per 1,000 calls.

Download YouTube subtitles from your code

Create an account and get 25 free calls every month. Just need one file? The free transcript generator downloads SRT in the browser, no account needed.