# YouTube video transcript API

Get the transcript of a YouTube video by ID or link: the whole text and timed segments. lang chooses the language of the captions. One object a call; $0.0020 per call. Errors, timeouts and objects that do not exist are not charged.

- Endpoint: `GET https://onefeedapi.com/v1/youtube/videos/transcript/get`
- ID: `youtube.videos.transcript.get`
- Also known as: youtube captions, video subtitles, YouTube video captions
- Price: $0.0020 / call
- Live status is not on this page, which is a snapshot. Read it with `GET https://onefeedapi.com/v1/catalog/status`
- 30-day availability 100%: the share of time the endpoint was serving calls
- Returns: 1 object, one transcript object
- Returns the standard transcript object, the same on every platform
- `id` is in the link: `youtube.com/watch?v=<id>`. Or pass the whole link as `url`.
- [No code: try the YouTube transcript extractor →](https://onefeedapi.com/tools/youtube-transcript/)
- [Run it in the Playground](https://onefeedapi.com/console/playground/?capability=youtube.videos.transcript.get&params=%7B%22id%22%3A%22dQw4w9WgXcQ%22%7D)
- In Chinese: [YouTube 视频字幕 API](https://onefeedapi.com/zh/apis/youtube/videos/transcript/get/)

## What you get

The first 2 rows of a response recorded 2026-10-12 03:34 UTC.

| start | end |
| --- | --- |
| 0.4 | 4.24 |
| 2.08 | 6.56 |

## Parameters

| Parameter | Type | required | Description |
| --- | --- | --- | --- |
| `id` | text | give exactly one of `id`, `url` | Video ID. Example: `dQw4w9WgXcQ`. |
| `url` | text | give exactly one of `id`, `url` | Link to the video: a watch, shorts, embed, live or youtu.be link. Example: `https://www.youtube.com/watch?v=dQw4w9WgXcQ`. Full link: `https://www.youtube.com/watch?v=dQw4w9WgXcQ`. Short link: `https://youtu.be/dQw4w9WgXcQ`. |
| `lang` | text |  | Which language of captions to get, as a language code (en, es, ja, zh-Hans, say); left out, the captions of the video's own language come first. A video without captions in that language is answered as one without captions. Example: `en`. |
| `view` | text |  | How much of each item to return. All three cost the same. Values: `compact`, `standard` (default), `full`. |
| `fields` | list of text |  | Return only these fields. Each by its path, such as `author.name`. |

## Returned fields

`data.item` is one transcript object. Stable: fields are only ever added.

Three views: `compact` (the most used fields, long text cut short), `standard` (the default: every standard field) and `full` (adds `ext`, the platform's own fields). A field is in the view named and in every larger one.

| Field | Type | Description | From view | This endpoint |
| --- | --- | --- | --- | --- |
| `post_id` | text | ID of the post it belongs to. | `compact` | Yes |
| `status` | text | done: the text is here; processing: a long video is still being recognised and there is no text yet: call the same endpoint with job after retry_after_seconds seconds. Values: `done`, `processing`. | `compact` | Not provided here |
| `job` | text | A long video's job: call the same endpoint with it for the text, within 24 hours of submitting; only while processing. | `compact` | Not provided here |
| `retry_after_seconds` | integer | About how many seconds to wait before asking again; only while processing. | `compact` | Not provided here |
| `lang` | text | Language code. | `compact` | Yes |
| `text` | text | The whole text. Long text: the compact view keeps the first 500 characters and says so in `warnings`. | `compact` | Yes |
| `segments` | list of object | Timed segments. | `standard` | Yes |
| `segments[].start` | number | Start, in seconds. | `standard` | Yes |
| `segments[].end` | number | End, in seconds. | `standard` | Yes |
| `segments[].text` | text | Text of the segment. | `standard` | Yes |
| `segments[].speaker` | text | Who said the segment (1, 2…, one number a person); null where telling speakers apart was not asked for. | `standard` | Not provided here |
| `segments[].words` | list of object | The timing of each word (character) of the segment. | `full` | Not provided here |
| `segments[].words[].start` | number | Start, in seconds. | `full` | Not provided here |
| `segments[].words[].end` | number | End, in seconds. | `full` | Not provided here |
| `segments[].words[].text` | text | The word (character). | `full` | Not provided here |
| `duration` | number | Length of what was transcribed, in seconds; what an endpoint billed by the minute charges by. | `standard` | Not provided here |
| `post` | object | The post the words are from: title, caption, author, length, time posted, likes and comments, as far as the platform gives them. | `standard` | Not provided here |
| `post.title` | text | Title; none on a platform without titles. | `standard` | Not provided here |
| `post.text` | text | Caption or description. Long text: the compact view keeps the first 500 characters and says so in `warnings`. | `standard` | Not provided here |
| `post.url` | link | Link to the post. | `standard` | Not provided here |
| `post.published_at` | time | Time posted. | `standard` | Not provided here |
| `post.duration` | number | Length of the video as the platform gives it, in seconds. | `standard` | Not provided here |
| `post.author` | object | Author. | `standard` | Not provided here |
| `post.author.id` | text | Author's ID. | `standard` | Not provided here |
| `post.author.name` | text | Author's name. | `standard` | Not provided here |
| `post.metrics` | object | Engagement counts. | `standard` | Not provided here |
| `post.metrics.likes` | integer | Likes. | `standard` | Not provided here |
| `post.metrics.comments` | integer | Comments. | `standard` | Not provided here |
| `approximate` | list of object | Which numbers of this item are approximate or lower bounds; absent when all are exact. | `compact` | Yes |
| `approximate[].field` | text | Path of the field, such as metrics.views. | `compact` | Yes |
| `approximate[].kind` | text | Approximate, or a lower bound. Values: `approximate`, `lower_bound`. | `compact` | Yes |

A field with no value on an item is `null`. A field this endpoint cannot give is left out and listed in `meta.unavailable`.

Typical size of one item: `compact` 552 B, `standard` 6.6 KB, `full` 6.6 KB (measured on the response recorded 2026-10-12 03:34 UTC).

## Paging

One object per call: there is nothing to page.

## When you are charged

| Case | Charged |
| --- | --- |
| A result with data | $0.0020, once per call |
| The object does not exist (404) | not charged |
| Invalid parameters, a failure or a timeout | not charged |
| The most one call can cost | $0.0020 (send `X-Max-Price` to refuse anything above your own limit) |

Prices as read 2026-11-22 09:40 UTC, under price book 21, in effect since 2026-11-21 15:05 UTC; the Playground reads the price in force before a run.

## If the object does not exist

The answer is 404 `not_found` and nothing is charged. `reason` says which: `not_found` (it does not exist) or `private_or_deleted`.

## Errors

Every error has the same structure: `code`, `message`, `charged`, `retry`, `retry_after_seconds`, `param`, `docs_url`.

| HTTP | Code | Meaning | Charged | Retry |
| --- | --- | --- | --- | --- |
| 400 | `invalid_params` | A parameter is invalid | No | After a fix |
| 400 | `request_not_served` | This combination of parameters cannot be served at present | No | After a fix |
| 400 | `max_price_exceeded` | The most this call could cost is above the limit you set | No | After a fix |
| 401 | `unauthorized` | No credential was sent, or it is invalid, disabled or expired | No | No |
| 402 | `insufficient_balance` | The balance is too low | No | After a fix |
| 402 | `key_budget_exceeded` | This key's spending limit does not cover the call | No | After a fix |
| 402 | `run_budget_exceeded` | This run's amount or call limit does not cover the call | No | No |
| 403 | `account_suspended` | The account is suspended | No | No |
| 403 | `forbidden` | This credential may not use that option | No | No |
| 403 | `key_scope_denied` | This key may not call this endpoint | No | No |
| 404 | `not_found` | The object does not exist, is private or was deleted | No | No |
| 404 | `run_not_found` | No run under this run ID | No | No |
| 409 | `call_in_progress` | The call under this idempotency key is still running; ask again with the same key shortly | No | With the same idempotency key |
| 409 | `idempotency_conflict` | This idempotency key was used for a different request | No | After a fix |
| 410 | `run_expired` | This run has expired and starts no more calls | No | No |
| 429 | `rate_limited` | Too many requests, or too many calls in progress | No | Yes |
| 429 | `cost_cap_exceeded` | This account's allowance for today is used up | No | Yes |
| 429 | `uncharged_cost_limit` | Too many of this account's calls today returned nothing and were not charged; endpoints of this kind can be called again tomorrow (UTC) | No | Yes |
| 500 | `settlement_unknown` | Whether this call settled is not known; ask again with the same idempotency key, or look it up by request ID | Unknown: look the call up | With the same idempotency key |
| 500 | `internal_error` | The service failed | No | Yes |
| 502 | `upstream_failed` | No result came back this time and nothing was charged; retry shortly | No | Yes |
| 503 | `upstream_busy` | Busy just now; retry shortly | No | Yes |
| 503 | `capability_paused` | This endpoint is paused | No | Yes |
| 503 | `overloaded` | The service is busy; retry shortly | No | Yes |
| 504 | `timeout` | The data did not arrive in time; retry with the same idempotency key | No | Yes |

[All error codes](https://onefeedapi.com/docs/errors/)

## Request

The key is read from the environment; no key is ever written into a page.

### cURL

```bash
curl -G "https://onefeedapi.com/v1/youtube/videos/transcript/get" \
  --data-urlencode "id=dQw4w9WgXcQ" \
  -H "Authorization: Bearer $ONEFEED_API_KEY"
```

### Python

```python
# pip install onefeedapi
from onefeedapi import OneFeedAPI

dx = OneFeedAPI()  # reads ONEFEED_API_KEY
result = dx.youtube.videos.transcript.get(id="dQw4w9WgXcQ")
print(result["data"]["item"])
```

### TypeScript

```typescript
// npm i @onefeedapi/sdk
import { OneFeedAPI } from "@onefeedapi/sdk";

const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY
const result = await dx.youtube.videos.transcript.get({ id: "dQw4w9WgXcQ" });
console.log(result.data.item);
```

### CLI

```bash
onefeedapi call youtube.videos.transcript.get id=dQw4w9WgXcQ
```

### MCP

```json
{
  "mcpServers": {
    "onefeedapi": {
      "type": "http",
      "url": "https://onefeedapi.com/mcp",
      "headers": {
        "Authorization": "Bearer ${ONEFEED_API_KEY}"
      }
    }
  }
}
```

Add this to your MCP client, then ask your agent to call `youtube.videos.transcript.get`.

## Responses

### 200

From a response recorded 2026-10-12 03:34 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.

Size as sent: 7.1 KB in the standard view (1.1 KB compact, 7.1 KB full).

```jsonc
{
  "code": "ok",
  "request_id": "45a3a507-98c9-484f-a823-690b541e8c9d",
  "data": {
    "item": {
      "post_id": "pW1QdpFNg3a",
      "lang": "en",
      "text": "Hey everyone, today I am going through what I packed for weekend hiking. Short version: light, fits in one bag, hard to break. Let's go piece by piece.",
      "segments": [
        {
          "start": 0.4,
          "end": 4.24,
          "text": "Hey everyone, today I am going through what I packed for weekend hiking."
        },
        {
          "start": 2.08,
          "end": 6.56,
          "text": "Short version: light, fits in one bag, hard to break."
        },
        // … 61 more
      ]
    }
  },
  "warnings": [],
  "meta": {
    "capability": "youtube.videos.transcript.get",
    "result_status": "complete",
    "fetched_at": "2026-10-12T03:34:28.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "segments.speaker": "capability",
      "segments.words": "capability",
      "duration": "capability",
      "post": "capability",
      "status": "capability",
      "job": "capability",
      "retry_after_seconds": "capability"
    },
    "billing": {
      "amount": "0.002",
      "currency": "USD",
      "balance_after": "9.998"
    }
  }
}
```

### 400

An example written to the specification, not a recorded response.

```json
{
  "code": "invalid_params",
  "request_id": "444d22d1-c7b4-48f4-abd2-269834162620",
  "message": "A parameter is invalid",
  "message_zh": "参数不合法",
  "charged": false,
  "retry": "after_fix",
  "retry_after_seconds": null,
  "param": null,
  "problems": ["give exactly one of id, url"],
  "docs_url": "https://onefeedapi.com/docs/errors#invalid_params"
}
```

### 402

An example written to the specification, not a recorded response.

```json
{
  "code": "insufficient_balance",
  "request_id": "a9689c3c-18be-445e-84b0-4d5897e5870a",
  "message": "The balance is too low",
  "message_zh": "余额不足",
  "charged": false,
  "retry": "after_fix",
  "retry_after_seconds": null,
  "param": null,
  "required": "0.002",
  "available": "0",
  "top_up_url": "https://onefeedapi.com/console/billing/?amount=10",
  "next_step": "The balance does not cover this call ($0.002). Top up at top_up_url: $10 at least, about 5,000 calls at this price; Alipay or a card, and the balance never expires. Then send the same request again, unchanged. Nothing was charged for this one.",
  "next_step_zh": "余额不够这次调用（$0.002）。到 top_up_url 充值：最低 $10，按这次的价格约够 5,000 次；支付宝、银行卡都能付，余额不过期。到账后把同一个请求原样再发一次。这次没有扣钱。",
  "docs_url": "https://onefeedapi.com/docs/errors#insufficient_balance"
}
```

### 404

An example written to the specification, not a recorded response.

```json
{
  "code": "not_found",
  "request_id": "d235ee1d-1e08-4a21-82bb-5bde7da71140",
  "message": "The object does not exist, is private or was deleted",
  "message_zh": "对象不存在、私密或已删除",
  "charged": false,
  "retry": "no",
  "retry_after_seconds": null,
  "param": null,
  "reason": "not_found",
  "docs_url": "https://onefeedapi.com/docs/errors#not_found"
}
```

### 502

An example written to the specification, not a recorded response.

```json
{
  "code": "upstream_failed",
  "request_id": "95a28511-833e-4b48-a370-f3d8e5e2ed56",
  "message": "No result came back this time and nothing was charged; retry shortly",
  "message_zh": "这次没有取到结果，没有扣费，可以稍后重试",
  "charged": false,
  "retry": "yes",
  "retry_after_seconds": null,
  "param": null,
  "docs_url": "https://onefeedapi.com/docs/errors#upstream_failed"
}
```

This recorded response is 3,239 tokens as the platform's own JSON, 1,991 as OneFeedAPI's JSON, and 189 as an AI reads it through OneFeedAPI's MCP server: 94% fewer (counted 2026-11-06).

[This example as a JSON file](https://onefeedapi.com/apis/youtube/videos/transcript/get.example.json)

## Use it in your AI

`onefeedapi setup` gives the agents on your machine (Claude Code, Codex, Cursor) the OneFeedAPI MCP server and the base skill. The key is read from ONEFEED_API_KEY; none is written into a file.

MCP server: `https://onefeedapi.com/mcp`. The entry for your client is under MCP in the request examples of this page; then ask your agent to call `youtube.videos.transcript.get`.

Or paste this to any AI:

> Read https://onefeedapi.com/apis/youtube/videos/transcript/get.md and help me use the OneFeedAPI endpoint youtube.videos.transcript.get (YouTube video transcript).

[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fonefeedapi.com%2Fapis%2Fyoutube%2Fvideos%2Ftranscript%2Fget.md%20and%20help%20me%20use%20the%20OneFeedAPI%20endpoint%20youtube.videos.transcript.get%20%28YouTube%20video%20transcript%29.) · [Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fonefeedapi.com%2Fapis%2Fyoutube%2Fvideos%2Ftranscript%2Fget.md%20and%20help%20me%20use%20the%20OneFeedAPI%20endpoint%20youtube.videos.transcript.get%20%28YouTube%20video%20transcript%29.)

## Related

Part of OneFeedAPI's Social media data. The same key also works for: Creators, Ads, E-commerce.

The same thing on other platforms: [Bilibili video transcript (video to text)](https://onefeedapi.com/apis/bilibili/videos/transcript/get/), [Douyin video transcript (video to text)](https://onefeedapi.com/apis/douyin/videos/transcript/get/), [Kuaishou video transcript (video to text)](https://onefeedapi.com/apis/kuaishou/videos/transcript/get/), [Meta ad video transcript](https://onefeedapi.com/apis/meta/ads/transcript/get/), [Instagram video transcript](https://onefeedapi.com/apis/instagram/posts/transcript/get/), [TikTok video transcript](https://onefeedapi.com/apis/tiktok/videos/transcript/get/), [Weibo video transcript (video to text)](https://onefeedapi.com/apis/weibo/posts/transcript/get/), [LinkedIn video transcript](https://onefeedapi.com/apis/linkedin/posts/transcript/get/), [Reddit video transcript](https://onefeedapi.com/apis/reddit/posts/transcript/get/), [X video transcript](https://onefeedapi.com/apis/x/posts/transcript/get/), [Xiaohongshu video transcript (video to text)](https://onefeedapi.com/apis/xiaohongshu/videos/transcript/get/), [WeChat Channels video transcript](https://onefeedapi.com/apis/wechat_channels/videos/transcript/get/)

More Social media data on other platforms: [Douyin comment replies](https://onefeedapi.com/apis/douyin/comments/replies/list/), [Douyin hashtag videos](https://onefeedapi.com/apis/douyin/hashtags/videos/list/), [Bilibili comment replies](https://onefeedapi.com/apis/bilibili/comments/replies/list/), [Bilibili hot searches](https://onefeedapi.com/apis/bilibili/trends/list/), [Bilibili user profile](https://onefeedapi.com/apis/bilibili/users/get/), [Bilibili user videos](https://onefeedapi.com/apis/bilibili/users/videos/list/), [Bilibili video comments](https://onefeedapi.com/apis/bilibili/videos/comments/list/), [Bilibili video detail](https://onefeedapi.com/apis/bilibili/videos/get/), [Bilibili video search](https://onefeedapi.com/apis/bilibili/videos/search/)

YouTube endpoints: [YouTube channel profile](https://onefeedapi.com/apis/youtube/channels/get/), [YouTube channel search](https://onefeedapi.com/apis/youtube/channels/search/), [YouTube channel videos](https://onefeedapi.com/apis/youtube/channels/videos/list/), [YouTube comment replies](https://onefeedapi.com/apis/youtube/comments/replies/list/), [YouTube video comments](https://onefeedapi.com/apis/youtube/videos/comments/list/), [YouTube video detail](https://onefeedapi.com/apis/youtube/videos/get/), [YouTube video search](https://onefeedapi.com/apis/youtube/videos/search/), [YouTube video transcript](https://onefeedapi.com/apis/youtube/videos/transcript/get/), [YouTube channel posts](https://onefeedapi.com/apis/youtube/channels/posts/list/), [YouTube post detail](https://onefeedapi.com/apis/youtube/posts/get/)

Skills that use this endpoint: [Breaking down a hit](https://onefeedapi.com/skills/viral/), [Videos to text](https://onefeedapi.com/skills/transcripts/), [A creator's videos to text](https://onefeedapi.com/skills/creator-transcripts/)

Tools built on this endpoint: [YouTube transcript extractor: look it up (sign-in)](https://onefeedapi.com/tools/youtube-transcript/)

Related: [All YouTube endpoints](https://onefeedapi.com/apis/youtube/), [Social media data](https://onefeedapi.com/categories/social/), [The same thing on 13 platforms, side by side](https://onefeedapi.com/roles/transcripts-get/), [The transcript object's fields](https://onefeedapi.com/docs/objects/transcript/)

## Questions

### How much does the YouTube video transcript API cost?

$0.0020 per call. The most one call can cost is $0.0020.

### When am I not charged?

Errors, timeouts and objects that do not exist are not charged.

### What happens if the object does not exist?

The answer is 404 not_found and nothing is charged. reason says which: not_found (it does not exist) or private_or_deleted.

### Why is fetching YouTube captions myself refused on a cloud server (IP blocked, 429)? How does the API get them?

YouTube limits requests from data-centre addresses hard, so fetching captions from a cloud server often meets 429s, sign-in checks or no captions at all, and doing it yourself means buying proxies and keeping them working. With this endpoint your server sends OneFeedAPI one HTTPS request with your key and the video's ID or link; fetching the captions is OneFeedAPI's work, with no proxy or IP of yours to maintain. Each call is $0.0020, and a failed call is not charged. lang picks the captions' language.

## 30-day availability

100% of the time over the last 30 days, this endpoint was serving calls: at least one of its routes was taking them, so it was neither paused nor down.

A failed call is not charged.

[Every endpoint's state now, and each incident with whether anyone was charged: the status page](https://onefeedapi.com/status/)

---

Last checked 2026-11-22 09:40 UTC. Catalog revision dc959672dd18e2d0. [HTML version](https://onefeedapi.com/apis/youtube/videos/transcript/get/)
