# YouTube: Get a video's transcript

`youtube/transcripts/get` · version 1.0.0 · pilot · 1 credits a call

The transcript of a YouTube video, line by line with when each is said, by chapter, and its whole text: as the video's "Show transcript" panel gives it.

Categories: Social media

## When to use

You need what is said in a YouTube video, from its id or any of its links: every line of its transcript with the moment it starts and ends (to quote, summarize, search or cite a moment), the chapter it belongs to, and the whole text at once. The transcript is the one the video's page shows: its author's captions in the video's language when it has them, else YouTube's own, made from its speech (`is_auto_generated`). For the video itself (its title, views, chapters, captions languages), use youtube/videos/get; its comments, youtube/comments/list.

## Call

```bash
curl https://api.lobstr.io/v2/run \
  -H "Authorization: Bearer $LOBSTR_API_KEY" \
  -H "content-type: application/json" \
  -d '{"source": "youtube", "operation": "transcripts/get", "options": {"video": "qsrVPdo6svc"}}'
```

It answers:

```json
{"object": "run", "status": "succeeded", "count": 1, "has_more": false, "next": null,
 "cost": {"credits": 1}, "balance": {"credits": 9990}, "results": [...]}
```

`cost` and `balance` are objects: a call's credits are `cost.credits`. `results` holds the records (below).

Beside `options`, the call takes:

| Parameter | Type | Description |
|---|---|---|
| `fields` | array of string | The record fields to keep, by path: inside an object with a dot (`ids.video_id`), in each item of a list with `[]` (`chapters[].title`, or with a dot: `chapters.title`); `object`, `id` and `position` always come. Left out: every field. |

## Options

| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| `video` | string | yes |  | The video: its id (11 letters, digits, - or _) or any of its links (youtube.com/watch?v=..., youtu.be/..., /shorts/..., /live/..., /embed/...). |

## Record

Each item of `results`. Every field is always present, `null` when the site gives nothing.

| Field | Type | Description |
|---|---|---|
| `object` | `"transcript"` |  |
| `id` | string | The video's id on YouTube, 11 characters. |
| `ids` | object |  |
| `ids.video_id` | string |  |
| `ids.channel_id` | string | null | Its channel's id (UC...). |
| `url` | string | The video's page. |
| `title` | string | null | The video's title. |
| `channel` | object | null | The channel that published the video. |
| `channel.id` | string | null |  |
| `channel.title` | string | null |  |
| `channel.handle` | string | null | Its @handle. |
| `channel.url` | string | null | Its page. |
| `language` | string | null | The transcript's language code (en, de...), the one the page shows. |
| `is_auto_generated` | boolean | null | Made by YouTube from the video's speech, not written by its author. |
| `chapters` | array | The video's chapters, as the transcript groups its lines; empty for a video without. |
| `chapters[].title` | string | null | As its author wrote it (Intro). |
| `chapters[].start_ms` | integer | null |  |
| `segments` | array | The lines of the transcript, in order. |
| `segments[].start_ms` | integer | null | When it is said, from the start of the video (to the second, as the panel starts it). |
| `segments[].end_ms` | integer | null | When it ends, to the millisecond (an automatic line may overlap the next). |
| `segments[].timestamp` | string | null | As shown (1:02:33). |
| `segments[].text` | string | The line, as the transcript writes it ([Music], ♪...). |
| `segments[].chapter` | string | null | The title of its chapter; null without chapters. |
| `text` | string | The whole transcript, its lines apart. |
| `source_url` | string | The video's page on youtube.com. |
| `observed_at` | string (date-time) |  |

Example:

```json
{
  "object": "transcript",
  "id": "k7Rt2mVxQ4s",
  "ids": {
    "video_id": "k7Rt2mVxQ4s",
    "channel_id": "UCa1B2c3D4e5F6g7H8i9J0kL"
  },
  "url": "https://www.youtube.com/watch?v=k7Rt2mVxQ4s",
  "title": "Sourdough for Beginners, Step by Step",
  "channel": {
    "id": "UCa1B2c3D4e5F6g7H8i9J0kL",
    "title": "Acme Kitchen",
    "handle": "@acmekitchen",
    "url": "https://www.youtube.com/@acmekitchen"
  },
  "language": "en",
  "is_auto_generated": true,
  "chapters": [
    {
      "title": "Intro",
      "start_ms": 0
    },
    {
      "title": "The starter",
      "start_ms": 135000
    }
  ],
  "segments": [
    {
      "start_ms": 0,
      "end_ms": 3840,
      "timestamp": "0:00",
      "text": "Hi, and welcome back to the kitchen.",
      "chapter": "Intro"
    },
    {
      "start_ms": 135000,
      "end_ms": 141220,
      "timestamp": "2:15",
      "text": "A starter is just flour and water, given time.",
      "chapter": "The starter"
    }
  ],
  "text": "Hi, and welcome back to the kitchen.\nA starter is just flour and water, given time.",
  "source_url": "https://www.youtube.com/watch?v=k7Rt2mVxQ4s",
  "observed_at": "2026-12-03T12:00:00Z"
}
```

## Price

1 credit a call, one video's whole transcript, however long. A video without a transcript, one that does not exist and a failed call are free.

## Errors

| Code | Status | Retry | Message |
|---|---|---|---|
| `ip_blocked` | 503 | yes | YouTube slowed down the IPs the call tried (429). Retry in a minute; failed calls are free. |
| `invalid_video` | 422 | no | `video` is a YouTube video: its id (dQw4w9WgXcQ) or one of its links (https://www.youtube.com/watch?v=dQw4w9WgXcQ, https://youtu.be/dQw4w9WgXcQ, a /shorts/ link). |
| `video_unavailable` | 404 | no | YouTube has no such video (removed, private, or never one). Not charged. |
| `transcript_unavailable` | 404 | no | The video has no transcript on YouTube: no captions of its author's, and none YouTube made (music without words, a video too new or in a language YouTube does not transcribe). Not charged. |
| `site_unavailable` | 503 | yes | YouTube did not answer properly; retry later (not charged). |
| `unexpected_answer` | 424 | no | YouTube answered in a shape we do not read yet; we are told and fix it (not charged). |
| `missing_api_key` | 401 | no | No API key: send it as `Authorization: Bearer <key>`. |
| `invalid_api_key` | 401 | no | The key is not valid, or not anymore. |
| `insufficient_credits` | 402 | no | The call costs more credits than are left. |
| `unknown_operation` | 404 | no | No such source and operation in the catalog. |
| `timeout` | 408 | yes | The call did not finish within its deadline (not charged). |
| `invalid_body` | 422 | no | The body is not a call: source, operation, options. |
| `invalid_options` | 422 | no | An option is missing or out of its contract; `param` names it. |
| `invalid_idempotency_key` | 400 | no | The Idempotency-Key header is not printable ASCII, or too long. |
| `concurrency_limit` | 429 | yes | The plan's calls at a time are all in progress (Free 1, Starter 2, Pro 10, Team 50); retry when one has finished (not charged, never queued). |
| `service_busy` | 503 | yes | Too many calls at once on the account; retry in a few seconds. |
| `balance_unavailable` | 503 | yes | The balance could not be read; retry in a few seconds. |

## Changelog

- **1.0.0** (2026-12-03): First version: a video's transcript by its id or any of its links, signed out, as its page's panel shows it: every line with when it starts and ends and its chapter, the chapters, the whole text, its language and whether YouTube made it.

Schema: https://api.lobstr.io/v2/catalog/youtube/transcripts/get · All operations: https://api.lobstr.io/v2/catalog.md
