---
title: "YouTube Transcript API"
description: "Get YouTube transcripts with timestamps from your own code. REST API with API keys, JSON, TXT, SRT and VTT output, bulk playlists and channels, and an OpenAPI description."
canonical: "https://youtubetranscript.net/api"
markdown: "https://youtubetranscript.net/api.md"
---

# YouTube Transcript API

Get YouTube transcripts with timestamps from your own code. REST API with API keys, JSON, TXT, SRT and VTT output, bulk playlists and channels, and an OpenAPI description.

## Links

- [Canonical HTML](https://youtubetranscript.net/api)
- [Markdown](https://youtubetranscript.net/api.md)


Base URL: `https://api.youtubetranscript.net`. Create a key at https://youtubetranscript.net/account/api-keys. OpenAPI 3.1 description: https://api.youtubetranscript.net/openapi.json

## 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.

Header:

```http
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.

- Python: `pip install youtubetranscript-net` ([PyPI](https://pypi.org/project/youtubetranscript-net/), [source](https://github.com/youtube-transcript/youtubetranscript-python))
- JavaScript / TypeScript: `npm install youtubetranscript-net` ([npm](https://www.npmjs.com/package/youtubetranscript-net), [source](https://github.com/youtube-transcript/youtubetranscript-js))
- Go: `go get github.com/youtube-transcript/youtubetranscript-go` ([pkg.go.dev](https://pkg.go.dev/github.com/youtube-transcript/youtubetranscript-go), [source](https://github.com/youtube-transcript/youtubetranscript-go))
- Rust: `cargo add youtubetranscript-net` ([crates.io](https://crates.io/crates/youtubetranscript-net), [source](https://github.com/youtube-transcript/youtubetranscript-rust))
- Ruby: `gem install youtubetranscript-net` ([RubyGems](https://rubygems.org/gems/youtubetranscript-net), [source](https://github.com/youtube-transcript/youtubetranscript-ruby))
- PHP: `composer require youtubetranscript-net/youtubetranscript-net` ([Packagist](https://packagist.org/packages/youtubetranscript-net/youtubetranscript-net), [source](https://github.com/youtube-transcript/youtubetranscript-php))
- Java: `implementation("net.youtubetranscript:youtubetranscript-net:0.1.1")` ([Maven Central](https://central.sonatype.com/artifact/net.youtubetranscript/youtubetranscript-net), [source](https://github.com/youtube-transcript/youtubetranscript-java))
- C# / .NET: `dotnet add package youtubetranscript-net` ([NuGet](https://www.nuget.org/packages/youtubetranscript-net), [source](https://github.com/youtube-transcript/youtubetranscript-dotnet))
- Elixir: `{:youtubetranscript_net, "~> 0.1"}` ([Hex](https://hex.pm/packages/youtubetranscript_net), [source](https://github.com/youtube-transcript/youtubetranscript-elixir))

## 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:

```bash
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}'
```

Python SDK:

```python
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)
```

JavaScript SDK:

```javascript
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);
}
```

200 response:

```json
{
  "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

- `POST /v1/transcript`: Get a video's transcript
- `GET /v1/transcript/info`: Video details and caption languages (free)
- `GET /v1/transcript/job/{id}`: Poll a transcript job
- `GET /v1/transcript/job/{id}/events`: Follow a job as Server-Sent Events
- `GET /v1/library/transcripts`: List the transcripts in your library
- `GET /v1/library/transcripts/{platform}/{externalId}`: Read a transcript from your library
- `DELETE /v1/library/transcripts/{platform}/{externalId}`: Remove a transcript from your library
- `GET /v1/library/transcripts/{platform}/{externalId}/download`: Download a transcript as a file
- `GET /v1/usage`: Your credits and limits
- `POST /v1/batch`: Transcribe many videos, a playlist or a channel
- `GET /v1/batch/{batchId}`: A batch and its videos
- `GET /v1/batch/{batchId}/export`: Download a batch's transcripts
- `POST /v1/batch/{batchId}/retry`: Retry a finished batch's failed videos
- `DELETE /v1/library/batches/{batchId}`: Delete a batch
