YouTube Transcript API
Get any YouTube video's transcript from your own code: send a link, get the text with timestamps. The API uses the same credits as the website, including 3 free credits a day.
Base URL https://api.youtubetranscript.net · OpenAPI 3.1 description
Authentication
Sign in and create a key on the API keys page of your account. You can hold up to 10 keys; the full key is shown once, when you create it. Revoke a key there and it stops working at once.
Send the key on every request in the Authorization header. An X-API-Key header with the same value also works.
Authorization: Bearer ytt_…SDKs
Official clients for 9 languages. Each reads your key from YTT_API_KEY, waits for transcripts that take longer by polling the job, retries safely with an Idempotency-Key, and returns one error type that carries the error code.
pip install youtubetranscript-netnpm install youtubetranscript-netgo get github.com/youtube-transcript/youtubetranscript-gocargo add youtubetranscript-netgem install youtubetranscript-netcomposer require youtubetranscript-net/youtubetranscript-netimplementation("net.youtubetranscript:youtubetranscript-net:0.1.1")dotnet add package youtubetranscript-net{:youtubetranscript_net, "~> 0.1"}
Get a transcript
POST /v1/transcript with a video link. If the transcript is ready within waitMs (up to 10000 ms), the answer is 200 with the transcript. Otherwise it is 202 with a jobId: poll GET /v1/transcript/job/{jobId} every couple of seconds until status is success or failed. The SDKs do this for you.
Send an Idempotency-Key header when you retry a POST, so a retry returns the same job instead of starting (and charging) another one.
curl https://api.youtubetranscript.net/v1/transcript \
-H "Authorization: Bearer $YTT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw", "waitMs": 10000}'from youtubetranscript_net import YouTubeTranscript
client = YouTubeTranscript() # reads YTT_API_KEY
result = client.transcripts.get("https://youtu.be/jNQXAC9IVRw") # waits for the job
for segment in result.transcript.segments:
print(segment.start, segment.text)import { YouTubeTranscript } from "youtubetranscript-net";
const client = new YouTubeTranscript(); // reads YTT_API_KEY
const result = await client.transcripts.get("https://youtu.be/jNQXAC9IVRw"); // waits for the job
for (const segment of result.transcript.segments) {
console.log(segment.start, segment.text);
}{
"status": "success",
"jobId": "4f0c…",
"language": "en",
"format": "json",
"lengthSeconds": 19,
"lengthText": "0:19",
"transcript": {
"platform": "youtube",
"externalId": "jNQXAC9IVRw",
"lang": "en",
"origin": "original",
"title": "Me at the zoo",
"channel": "jawed",
"segments": [
{ "text": "All right, so here we are, in front of the elephants", "start": 1.2, "duration": 2.16 }
]
}
}Languages and formats
language is a comma-separated priority list. en picks English captions, pt-BR,pt tries Brazilian then any Portuguese, auto takes the video's own captions in whatever language they are, and asr turns the speech into text when a video has no captions. GET /v1/transcript/info lists a video's caption languages for free.
format: text returns plain text instead of segments. Transcripts you got are saved to your library; download one as TXT, SRT, VTT, JSON or Markdown from GET /v1/library/transcripts/youtube/{videoId}/download?format=srt.
Playlists, channels and many videos
POST /v1/batch with a list of links, a playlist or a channel. Poll GET /v1/batch/{batchId} until status is completed, then download every transcript at once from /v1/batch/{batchId}/export as a ZIP of TXT, SRT, VTT or JSON files, or as one CSV. Retry the failed videos with POST /v1/batch/{batchId}/retry.
Batches are open once your account has bought a credit pack. GET /v1/usage shows how many videos one batch can hold.
Credits
The API spends the same credits as the website, by video length. Every account gets 3 free credits a day; credit packs on the pricing page add more. A video already in your library costs nothing, and a failed video is not charged.
A video that costs more than 10 credits first answers 409 CREDITS_CONFIRMATION_REQUIRED with the cost. Send the same request again with confirmCredits: true to accept it. GET /v1/usage returns your balance.
Rate limits
Each key gets 60 requests a minute, and 120 a minute for polling a job. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Over the limit the answer is 429 RATE_LIMITED with a Retry-After header in seconds.
Errors
Every error has the same body: {"error": {"code": "…", "message": "…"}}. Branch on code; message is for people.
- 401 API_KEY_REQUIRED or INVALID_API_KEY: no key, or a revoked one.
- 400 INVALID_VIDEO: the link is not a YouTube video, or the video does not exist.
- 402 INSUFFICIENT_CREDITS: not enough credits for this video.
- 404 NO_TRANSCRIPT or LANGUAGE_NOT_AVAILABLE: no captions in the languages you asked for; availableLanguages lists the ones there are.
- 409 CREDITS_CONFIRMATION_REQUIRED: repeat with confirmCredits: true.
- 429 RATE_LIMITED: wait Retry-After seconds. 5xx: safe to retry a GET, or a POST with the same Idempotency-Key.
Endpoints
Every endpoint takes the same key. Full request and response shapes are in the OpenAPI description.
POST /v1/transcriptGet a video's transcriptGET /v1/transcript/infoVideo details and caption languages (free)GET /v1/transcript/job/{id}Poll a transcript jobGET /v1/transcript/job/{id}/eventsFollow a job as Server-Sent EventsGET /v1/library/transcriptsList the transcripts in your libraryGET /v1/library/transcripts/{platform}/{externalId}Read a transcript from your libraryDELETE /v1/library/transcripts/{platform}/{externalId}Remove a transcript from your libraryGET /v1/library/transcripts/{platform}/{externalId}/downloadDownload a transcript as a fileGET /v1/usageYour credits and limitsPOST /v1/batchTranscribe many videos, a playlist or a channelGET /v1/batch/{batchId}A batch and its videosGET /v1/batch/{batchId}/exportDownload a batch's transcriptsPOST /v1/batch/{batchId}/retryRetry a finished batch's failed videosDELETE /v1/library/batches/{batchId}Delete a batch