# YouTube Transcript API — RAG, Markdown, Chapters (`smartlinks/youtube-transcript-api`) Actor

Bulk YouTube transcripts, captions and subtitles to text: SRT, VTT, Markdown and timestamp-linked RAG chunks from videos, Shorts, playlists, channels and search. Failed videos are free.

- **URL**: https://apify.com/smartlinks/youtube-transcript-api.md
- **Developed by:** [SmartLinks](https://apify.com/smartlinks) (community)
- **Categories:** Videos, AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 85.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 successful transcripts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YouTube Transcript API — RAG, Markdown, Chapters

Turn bulk YouTube captions into transcripts ready for AI pipelines, with timestamped text and citation-ready RAG chunks.

- **100 videos in ~72 seconds in one run:** 87 transcripts delivered from a mixed 100-video batch in the 2026-11-18 benchmark below.
- **RAG chunks with timestamp deep links, Markdown, chapters and SRT/VTT** in one Actor. Chunks, Markdown and available chapters are included by default; select SRT or VTT with `format`.
- **Videos, Shorts, playlists, channels and search:** collect transcripts from URLs or keyword queries in an ordered batch.
- **Search inside transcripts:** Unicode keyword and phrase matches with timestamp quotes and watch links; optionally deliver only matching transcripts.
- **Only new videos:** persistent watch history skips previously delivered videos on scheduled runs, without fetching or charging them.
- **Failed, captionless, duplicate and reused videos are free.** Pay for unique delivered transcripts.

> **$1.50 per 1,000 delivered transcripts (Silver $1.30, Gold+ $1.20).** No start fee, no per-hour fee. Failed, captionless, duplicate and reused videos are free. Platform usage and residential proxy included.
>
> At the FREE / Bronze price: **1,000 delivered videos = $1.50**; **a 200-video channel = $0.30** if all 200 deliver captions (set `expandCollections: true` and `maxVideosPerChannel: 200`). The Actor's pricing tab shows your active price.

### Try it in 30 seconds

Open the input form, keep the two prefilled videos and click **Start**. Two delivered transcripts cost **$0.003** on FREE / Bronze; unavailable captions cost nothing. The same input as JSON:

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}
```

Open the default dataset for transcript rows and the key-value store's `OUTPUT` record for the run summary. Defaults include English language preference, timestamped segments, plain text, RAG chunks, Markdown and available chapters. Each video input gets a row in input order; collections expand to rows in listing order. Watch mode omits previously delivered videos entirely.

### Head-to-head benchmark (2026-11-18)

We ran the same fixed 100-video set (talks, tutorials, music, Shorts, non-English, videos over 2 hours, videos without captions) through this Actor and three popular YouTube transcript Actors from the Apify Store, each with default memory and one batch input, on 2026-11-18.

| Actor | Transcripts delivered | Run time for 100 | Price for this batch |
|---|---:|---:|---:|
| **This Actor** | **87/100** | **72 s** at `maxConcurrency: 16` (47 s and 86/100 at 50 with `timeoutSecs: 5`) | **$0.13** |
| Actor A | 85/100 | 76 s | $0.23 |
| Actor B | 87/100 | 138 s | $0.28 (billed per started video hour) |
| Actor C | 0/100: the 100-URL batch failed twice; 88/100 when split into five runs of 20 | 114 s over five runs | $0.09 |

Where both returned a transcript, our text was as complete as A and B and about 3% longer than C (median length ratio). No tool recovered the videos that have no captions. Numbers are from single runs on one date; YouTube availability and run times vary, so treat them as observations, not guarantees.

### Output example

A shortened successful row (illustrative caption text; other fields omitted):

```json
{
  "schemaVersion": 1,
  "inputIndex": 0,
  "videoId": "jNQXAC9IVRw",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "status": "ok",
  "errorCode": null,
  "retryable": false,
  "language": "en",
  "trackKind": "manual",
  "languageFallback": false,
  "segments": [{"start": 1.2, "duration": 2.16, "text": "Example caption"}],
  "text": "Example caption",
  "reused": false
}
```

Times are seconds. Successful rows retain both `segments` and `text`. Choose `format: "text"`, `"srt"`, `"vtt"` or `"markdown"` to also populate `formatted`; `"segments"` and `"json"` leave it null. Derived fields include `chunks`, `markdown` and `chapters`. Requested metadata contains available title, channel, channel ID, duration, publication date, views, likes, description, tags, thumbnail and category; missing values are null.

`availableTracks` lists the tracks supplied by the player response, including on `no_captions` and language-fallback rows: `[{"languageCode":"en","name":"English","kind":"manual","isTranslatable":true}]`. `kind` is `manual` or `asr`; unavailable names, language codes or translation flags are `null`. An observed absence is `[]`; an unknown list (including reuse of older rows) is `null`. No extra request is made to obtain this list. Oversized lists can be omitted as `null` with `truncationReasons: ["available_tracks_size_limit"]` to preserve the row-size cap.

With the default `includeMetadata: true`, the publication date is `metadata.publishDate`, even when `includeExtendedMetadata` is false. Listed channel/playlist videos also get dates at no extra event charge from one public feed request per source for its latest ~15 items, when available; player dates take precedence, and other videos need `includeExtendedMetadata` or a date filter for extra lookups when the player supplies no date. Unavailable dates remain `null`; `includeMetadata: false` makes `metadata` itself `null`, and failure rows can also have null metadata.

| Status | Meaning | Charged transcript event? |
|---|---|---|
| `ok` | Nonempty validated caption segments and matching text | Yes, except duplicates and reused results |
| `no_captions` | No caption tracks or no requested track kind | No |
| `no_match` | Captions fetched, but no requested transcript keyword matched; transcript text omitted | No |
| `private` | Explicit private, removed, copyright or nonexistent-video response | No |
| `age_restricted` | Explicit age/sign-in restriction | No |
| `blocked` | Access failure, empty timedtext or a processing limit; inspect `errorCode` | No |
| `invalid` | Rejected URL, disabled collection expansion or video outside the date range | No |

Check each row's `status`, `errorCode` and `retryable`, plus `OUTPUT.stopReason` and `OUTPUT.unprocessedRows`, before treating a run as complete. A successful run status can include unavailable videos, partial results or an intentional limit stop.

### RAG chunks, Markdown and chapters

All three derived outputs are included by default, at the same transcript event price. To reduce response size, set `includeChunks: false` and/or `includeMarkdown: false`.

```json
{
  "urls": ["https://youtu.be/aircAruvnKk"],
  "format": "markdown",
  "includeChunks": true,
  "chunkSize": 200,
  "chunkOverlap": 40
}
```

A shortened chunk example (illustrative text):

```json
{
  "id": "aircAruvnKk:content-and-settings-hash",
  "chunkId": "aircAruvnKk:content-and-settings-hash",
  "videoId": "aircAruvnKk",
  "language": "en",
  "start": 12.4,
  "end": 25.1,
  "text": "Example caption words for an embedding document.",
  "url": "https://www.youtube.com/watch?v=aircAruvnKk&t=12s",
  "wordCount": 7,
  "tokenEstimate": 12,
  "segmentStartIndex": 2,
  "segmentEndIndex": 5,
  "chapter": null
}
```

`chunks` use the selected unit, with a size limit and configurable overlap. For estimated tokens, both size and overlap are multiplied by four to form character windows. They retain cues in `segments` unchanged. A split cue keeps its full original timing; word timestamps are not inferred. Start/end cover all contributing cues, including overlapping cues. `tokenEstimate` is `ceil(characters / 4)`, not an exact model token count; scripts without whitespace can form a large single word in word mode; select `chars` or `tokens` to bound these. Character windows trim boundary whitespace. A chunk may cross a chapter boundary; its `chapter` is the chapter at its start. `id` and `chunkId` are aliases. IDs depend on video, language, content, timing and chunk settings. They stay stable across duplicate inputs and matching reuse, and change when the source or settings change.

`chapters` prefer structured Innertube chapter renderers when present. Otherwise they are parsed from three or more strictly ascending timestamp lines in the video description, beginning at zero. Invalid or absent chapter lists yield `[]`. The final chapter ends at the known duration, or `null` when unknown. These are source chapters, not AI-generated chapters, and titles retain the description's original language.

The `markdown` document escapes source text, includes a title, available channel, a video link, optional chapter headings and a timestamp link per paragraph. Paragraphs are grouped at chapter changes, pauses over five seconds, or a target of 30 seconds / 600 characters; original cue timing remains in `segments`. For example:

```markdown
## Example video

[Watch video](https://www.youtube.com/watch?v=aircAruvnKk)

Language: en

[0:12](https://www.youtube.com/watch?v=aircAruvnKk&t=12s) Example caption words.
```

Use each chunk as one vector-store document, with `id` as the stable key and `url`, `videoId`, `language`, `start` and `end` as citation metadata. Choose a chunk size suited to your embedding model. There is no embedding or LLM API dependency.

### Playlists, channels and search

```json
{
  "urls": ["https://www.youtube.com/@3blue1brown/videos"],
  "expandCollections": true,
  "maxVideosPerChannel": 10,
  "searchQueries": ["linear algebra tutorial"],
  "maxVideosPerSearch": 5,
  "max_results": 15
}
```

Sources are listed in order: URLs first, then queries. Bare channel URLs use their newest-first `/videos` tab; `/shorts` and `/streams` can be selected explicitly. Playlists retain playlist ordering. Video IDs are deduplicated for fetching and charging; each source keeps its own result rows. Collection rows contain `sourceUrl`; search rows contain `searchQuery`. `inputIndex` for queries follows the URL indices. `OUTPUT.sources` reports per-source outcomes including reused, filtered and missing-date rows; `OUTPUT.expansions` reports returned counts, source kind, effective listing limit (including the remaining plan allowance) and whether that limit was reached. The full collection size and number of missing videos are unknown (`null`); reaching the limit is reported as `truncated: true`. A shorter list also cannot prove full coverage. Listing failures produce free, retryable rows. Collection expansion respects the remaining `max_results` plan allowance (at most 10,000 rows); `max_results` also caps unique fetches.

#### Search inside transcripts

```json
{
  "urls": ["https://youtu.be/aircAruvnKk"],
  "searchInTranscripts": ["neural network", "learning"],
  "searchContextWords": 12,
  "onlyVideosWithMatches": true
}
```

`searchInTranscripts` searches returned caption text, independently of YouTube discovery via `searchQueries`. Supply up to 50 literal terms, each 1–100 characters. Matching ignores case using Unicode case folding and canonical normalization. Single words require whole-word boundaries; phrases match across whitespace and caption cues. Terms are trimmed and exact duplicates removed. Each delivered transcript includes `matches` with `term`, cue `start`/`end` in seconds, a `quote`, a timestamped watch `url` and zero-based `segmentIndex`. Quotes include up to `searchContextWords` words on either side (default 12, range 0–50). Times cover the contributing cues; word-level times are not inferred. Matches appear in caption order, with input term order breaking ties. At most 200 are retained per video; `matchesTruncated` signals omitted matches, while `matchCount` and per-term `matchCounts` count all occurrences.

Fetching still happens when `onlyVideosWithMatches: true`, with no extra cost to the user. A nonmatching transcript becomes a free `no_match` row without text, segments, chunks or Markdown; it does not trigger a transcript charge. With the default `false`, nonmatching transcripts are delivered and billed normally. With an empty term list and `onlyVideosWithMatches: true`, every fetched transcript is nonmatching. Successful retrievals still count as successes for the work budget. `OUTPUT.matchCounts` totals occurrences across delivered rows (including duplicate/reused rows); `OUTPUT.videosWithMatches` counts distinct delivered video IDs with hits. These totals include resumed rows.

Open the dataset's **Transcript matches** view, or export nested matches with `GET /v2/datasets/{datasetId}/items?unwind=matches&fields=videoId,metadata.title,matches.term,matches.start,matches.quote,matches.url`. The selected columns are video ID, title (when metadata is available), term, start, quote and URL; JSON retains the nested field names. The OUTPUT **Flattened transcript matches** link uses the same export.

#### Watch only new videos

```json
{
  "urls": ["https://www.youtube.com/@3blue1brown/videos"],
  "expandCollections": true,
  "onlyNewVideos": true,
  "watchId": "3blue1brown-daily",
  "maxVideosPerChannel": 100
}
```

The first run with empty history delivers normally and seeds a named `ytt-watch-` key-value store. Later runs omit already delivered IDs entirely: no row, caption fetch or charge. `OUTPUT.skippedSeenVideos` and the corresponding per-source counter report skipped planned video entries; skipped entries are not unprocessed work. Only validated transcripts actually stored in the dataset enter history, including free reused transcripts. Failures, captionless videos and `no_match` rows remain eligible next time. IDs are promoted at a normal run end, including an intentional budget stop; an interrupted run promotes its durable successful rows when it resumes and finishes. Saved plans, frozen history and idempotent history updates protect migrations/restarts without charging stored rows again.

`watchId` is optional (1–100 letters, digits, `_` or `-`). Without it, history is derived from normalized source URLs, search queries, expansion, retrieval and matching settings; source ordering and tracking parameters do not change the identity. An explicit ID shares history across input changes within this Actor. Changing only listing limits, concurrency, context size or output formatting retains the same history. The newest 100,000 delivered IDs are kept; older evicted IDs can be delivered again. Listings remain bounded: seen IDs count toward listing/plan limits, so choose enough listing coverage for uploads between runs. Overlapping scheduled runs can both deliver the same previously unseen video; use nonoverlapping schedules. Their completed histories are merged.

Schedule recipe: save an Apify **Task** with a channel URL, `expandCollections: true`, `onlyNewVideos: true` and a stable `watchId` (or keep the normalized inputs unchanged). Run it once to seed history, then attach a daily or weekly **Schedule**. Add a run-success webhook or Slack integration to notify your workflow and consume the dataset's new successful rows. An unchanged channel can produce an empty dataset.

### Switching from another transcript Actor

Paste your existing input JSON, it runs unchanged. Recognized fields are normalized before processing. A canonical field you set to a non-default value wins over an alias (platform-filled defaults do not); source URLs can be combined and deduplicated. Every supplied alias and ignored option is explained once in `OUTPUT.inputNotes` and the run log. Unknown fields are ignored and reported there too. An input with no URLs, channels or search queries returns a handled input error.

| Accepted field names | Our field / behavior |
| --- | --- |
| `youtube_url` (string or array), `videoUrl`, `videoUrls` | `urls` |
| `channel` (string or array), `channel_url` | `urls`; collection expansion defaults on for these sources. Handles and channel IDs work in `channel`. |
| `urls` strings or `{ "url": "..." }` objects | `urls`; object-shaped collection sources also default to expansion. |
| `searchKeywords` | `searchQueries` |
| `language`, `targetLanguage`, `translate_to` | `languages` preference list. Original captions only; if the language is absent, use normal fallback and report the returned language in the row. No machine translation. |
| `max_videos` | `maxVideosPerChannel` and `maxVideosPerSearch` unless their canonical fields are supplied. |
| `start_date`, `end_date` | `publishedAfter`, `publishedBefore`; valid `YYYY-MM-DD` or full ISO datetime, reduced to the supplied calendar date for inclusive filtering. |
| `include_metadata`, `include_extended_metadata` | `includeMetadata`, `includeExtendedMetadata` |
| `transcript_type` (`any`, `manual`, `generated`) | `track` (`any`, `manual`, `auto`) |
| `outputFormat`, `output_formats` | `format`; one supported format (first supported entry for an array). Additional/unsupported formats are ignored with a note. |
| `maxPagesPerUrl` | Ignored: listing pages vary in size. Use the per-collection/per-search video limits. |
| `scrapeShorts` | Ignored: existing listing behavior applies; there is no Shorts exclusion filter. |
| `include_transcript_text`, `preserve_formatting` | Ignored: successful rows always retain original text with existing caption cleanup. |
| `channel_transcripts`, `list_only` | Ignored: collections retrieve transcripts with normal billing. There is no listing-only mode. |

When language aliases conflict, priority is `language`, then `targetLanguage`, then `translate_to`; an explicit `languages` always wins. `outputFormat` takes priority over `output_formats` unless `format` is supplied. Unsupported optional track/format choices are ignored with notes. Canonical date inputs retain their existing `YYYY-MM-DD` requirement. The input form and its two-video prefill are unchanged; compatibility fields are accepted through JSON.

### API example

Start the Actor with your token in the Authorization header, then read its dataset. Replace `ACTOR_ID` with `smartlinks~youtube-transcript-api`. Keep tokens out of URLs, shared files and logs.

```bash
curl -X POST "https://api.apify.com/v2/acts/ACTOR_ID/runs?memory=1024&maxTotalChargeUsd=1" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://youtu.be/jNQXAC9IVRw"],"languages":["en"],"format":"text"}'
```

Wait for the run to finish before reading complete results. Use the returned `defaultDatasetId` with `GET /v2/datasets/{defaultDatasetId}/items`. Use `defaultKeyValueStoreId` with `GET /v2/key-value-stores/{defaultKeyValueStoreId}/records/OUTPUT`.

### MCP workflow

Connect your client to the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp), authenticate, and add `smartlinks/youtube-transcript-api` using the server's Actor tools. Example instruction:

> Run Actor smartlinks/youtube-transcript-api with `searchQueries: ["linear algebra tutorial"]`, `maxVideosPerSearch: 3`, `includeChunks: true`, `chunkSize: 200`, `chunkOverlap: 40`. Read the dataset, use only successful rows, and cite chunk URLs in the answer. Report missing transcripts.

API and MCP calls use the same input and output schemas. Read the default dataset for rows and `OUTPUT` for source coverage and incomplete work.

### FAQ

#### Does it transcribe audio or recover videos without captions?

No. It retrieves public captions supplied by YouTube, including available automatic captions. It does not download audio or run speech-to-text. Videos without captions return free `no_captions` rows. Private or sign-in-only captions are not supported.

#### Which languages and caption tracks can I request?

Set `languages` in preference order, for example `["en", "de"]`. Regional variants are matched next; if none match, another available language can be returned with `languageFallback: true`. Use `track: "manual"` or `"auto"` to require that kind, or `"any"` to favor manual captions within each language preference. If the requested kind is missing, the row is `no_captions`. Automatic captions can contain recognition errors. Translation is not offered as a supported feature.

#### How many videos can one run process?

Provide up to 10,000 URLs and/or 100 search queries. `max_results` defaults to 1,000 unique fetches and can be raised to 10,000. Channel/playlist listings default to 100 videos per source, search to 20; both can be raised to 1,000. Collection planning also stops at the remaining `max_results` row allowance. Time, listing, failure and charge limits can stop work earlier; consult `OUTPUT`. Listings can be partial even below their limit. See Limits and the full input reference below.

#### What is free, and what counts as one transcript?

One unique, validated, nonempty original transcript saved to the dataset counts as one event. Failed, captionless, duplicate, reused, date-filtered, `no_match` and oversized-original rows are free. Videos skipped by watch history produce no rows or charges. Video duration, chunks, chapters, keyword search and output formats do not multiply the event count. For example, 80 delivered originals, 15 failures and 5 reused rows cost **$0.12** on FREE / Bronze. There is no start or per-hour fee; platform usage and residential proxy are included. `max_cost_usd` adds an event fee cap, and Apify's maximum charge setting also applies.

#### Can I find timestamp quotes and return only matching videos?

Yes. Set `searchInTranscripts` and optionally `onlyVideosWithMatches: true`; see the search example above. Captions are still fetched, with no extra cost to the user. Nonmatching videos produce free `no_match` rows without transcript text. Match timestamps come from caption cues, and the first 200 hits per video are retained.

#### Can a scheduled run return only new channel videos?

Yes. Save a Task with the channel URL, `expandCollections: true` and `onlyNewVideos: true`, then attach a daily/weekly Schedule and a webhook or Slack integration. See the watch example above. Previously delivered IDs are skipped; failed, captionless and nonmatching videos are retried. History retains the newest 100,000 delivered IDs. Use a stable `watchId` to preserve history when changing inputs.

#### Can I resume a run or reuse a previous dataset?

A platform restart uses the saved plan and dataset; stored rows are not fetched or charged again. For a new run, set `previousDatasetId` to an accessible, separate dataset and submit the desired inputs again. Validated successful rows are reused free when language, track, legacy translation, chapter, metadata, extended-metadata and date-filter settings match. Prior failures are fetched again. Optionally set `resume_ids` to fetch only those video IDs; other uncached IDs receive free `not_selected_for_resume` rows. Output format and chunk settings can change without refetching. Reused content is a snapshot; omit `previousDatasetId` to request fresh captions.

#### How do publication-date filters work?

Use inclusive `publishedAfter` and/or `publishedBefore` dates in `YYYY-MM-DD` format. Filters apply to direct and listed videos before delivery and charging. Outside-range videos produce free `outside_date_range` rows; unknown dates produce free, retryable `publish_date_unavailable` rows. Listing limits apply before filtering, so filtered videos are not replaced by additional listing results. Extra date lookups can add latency. Without date filters, `includeExtendedMetadata: true` attempts extra date lookups while still delivering captions if the date remains unknown; it requires `includeMetadata: true`.

#### Is `tokenEstimate` an exact tokenizer count?

No. It is `ceil(characters / 4)`. With `chunkUnit: "tokens"`, chunk size and overlap use character windows four times the requested values. There is no model-specific tokenizer. For scripts without whitespace, use `"chars"` or `"tokens"` to bound windows; word mode can treat a long span as one word. Check exact token counts with your downstream model's tokenizer when needed.

#### Why can a video or collection be `blocked`, and what should I do?

YouTube can return bot checks, HTTP errors, empty caption responses or regional restrictions. A generic unavailable response is conservatively classified as `blocked` when the Actor cannot distinguish a video restriction from an access failure. Check `errorCode` and `retryable`, retry later, or lower `maxConcurrency`. Blocked rows are free; retrying does not guarantee captions.

A failed or empty playlist, channel or search listing is retried **once**, with a fresh proxy session when proxies are enabled, if the remaining work budget permits. Both attempts count toward `maxListingSources`. Duplicate sources share those attempts. If listing still fails, its free source row and the corresponding `OUTPUT.sources` and `OUTPUT.expansions` entries include a short, sanitized `errorCode` and `errorDetail`; coverage is `listing_failed_or_empty`. These diagnostics do not contain secrets or proxy URLs. Retry the source in a later run if appropriate.

### Related Actors by SmartLinks

- [PageSpeed Change Monitor](https://apify.com/smartlinks/pagespeed-change-monitor)
- [SEO Deploy Guard](https://apify.com/smartlinks/seo-deploy-guard)

### Limits

The Actor needs at least **512 MB** memory; the default **1,024 MB** is recommended for large batches. `maxConcurrency` defaults to 50 and accepts 1–50; higher concurrency can increase blocking. `timeoutSecs` defaults to 8 seconds per request and accepts 5–90. Run times and caption availability vary with YouTube, IP and region.

Public caption tracks only: no account cookies, login, audio transcription or guaranteed availability. Live and very long videos can have incomplete tracks. Source chapters and metadata may be missing; no chapters are generated from transcript text. Channel, playlist and search listings are bounded and cannot establish full collection coverage.

Run-wide work limits persist across restarts and apply independently of transcript fees:

| Limit | Default | Behavior |
|---|---:|---|
| `minAttemptsForSuccessRatio` | 200 | Stop new video work once at least this many attempts have fewer than 10% successes. |
| `maxConsecutiveFailures` | 500 | Stop after this many consecutive unsuccessful video attempts, including captionless, blocked, invalid, date-filtered and oversized originals. Reused rows are not attempts. |
| `maxRunSecs` | 3,000 s | Shared deadline for listing and retrieval across restarts; reserve ten seconds for finalization. In-flight work is cancelled at the deadline; completed results are retained. |
| `maxListingSources` | 200 attempts | Shared by channel, playlist and search listings, including retries. Duplicate sources share listings, even if empty or failed. |

Collection/search listing checks charge capacity and the remaining `max_results` plan allowance before starting. Collection planning stops when planned rows reach that allowance; listing failures count as planned rows too. Direct inputs beyond the fetch limit can receive free status rows. Inspect `OUTPUT` for limits and work left unprocessed.

Output is capped at **2,000 chunks per video**, **200 retained keyword matches** and a conservative **7.5 MB serialized row**. `chunkOverlap` must not exceed half of `chunkSize`. When derived output is too large, chunks are limited or derived fields are dropped; large match quotes can reduce retained matches further (`matchesTruncated: true`, total counts retained). Original `segments` and `text` are retained if they fit. Oversized metadata or chapters may be omitted. `truncated: true` and `truncationReasons` identify changes. If the original transcript cannot fit, the Actor returns a free `transcript_size_limit` row. It never charges for a partial original transcript. Caption, player and watch responses are limited to **12 MB decoded bytes per response** during transfer.

Caption text preserves literal angle brackets, including programming syntax; SRT/VTT and Markdown escape them for display. Recognized SRT/WebVTT cue markup is removed. `transferBytes` counts decoded response bodies, not billed residential transfer; platform usage records are authoritative.

### Full input reference

Provide at least one URL or search query. Defaults apply when a field is omitted.

| Field | Default | Meaning |
|---|---|---|
| `urls` | `[]` | Up to 10,000 YouTube URLs. Watch, Shorts, live video, embed and youtu.be URLs are normalized to a video ID. Tracking query parameters are discarded. |
| `searchQueries` | `[]` | Up to 100 keyword searches; provide URLs, queries or both. Does not require `expandCollections`. |
| `searchInTranscripts` | `[]` | Up to 50 literal caption-search terms, 1–100 characters each; Unicode case-insensitive words/phrases, with timestamp quotes. |
| `searchContextWords` | `12` | 0–50 words of quote context on each side of a hit. |
| `onlyVideosWithMatches` | `false` | Fetch captions but replace nonmatches with free `no_match` rows without transcript text; no extra fetching cost to the user. |
| `onlyNewVideos` | `false` | Skip IDs already delivered for this watch, without rows, caption fetching or charging. |
| `watchId` | Derived from normalized inputs | Optional 1–100 letters, digits, `_` or `-`; explicit identity keeps history across changed inputs. Newest 100,000 delivered IDs retained. |
| `maxVideosPerSearch` | `20` | 1–1,000 results per keyword query. |
| `publishedAfter` / `publishedBefore` | Unset | Inclusive `YYYY-MM-DD` date range, checked before delivery and charging. Unknown dates produce free retryable rows; outside-range videos produce free `outside_date_range` rows. The listing limit still applies before filtering. |
| `chunkUnit` | `words` | `words`, `chars` or estimated `tokens` (characters / 4); controls size and overlap. |
| `includeChunks` | `true` | RAG windows in the selected unit with stable IDs, timestamps, deep links, language, cue provenance and available chapter. |
| `chunkSize` / `chunkOverlap` | `200` / `40` | Maximum units per chunk / overlapping units, according to `chunkUnit`. Size 10–2,000; overlap must not exceed half of size. |
| `includeMarkdown` | `true` | Markdown document with timestamp links and available chapter headings. |
| `includeChapters` | `true` | Use structured source chapters, or parse at least three ascending description timestamps beginning at zero. Missing or ambiguous chapters return `[]`. |
| `languages` | `["en"]` | Ordered language preferences. Regional variants are matched next; if none match, another available language is returned with `languageFallback: true`. |
| `track` | `any` | `any`, `manual` or `auto`. Within each language preference, `any` favors manual captions. Missing requested track kinds return `no_captions`. |
| `format` | `segments` | `segments` (or `json`), `text`, `srt`, `vtt`, `markdown`. Every successful row always retains `segments` and `text`; other formats also populate `formatted`. |
| `includeExtendedMetadata` | `false` | Attempt extra publication-date lookups when player/feed dates are unavailable, without filtering out unknown dates. Listed channel/playlist feeds cover the latest ~15 items at no extra event charge. Requires metadata; extra lookups add latency, no extra event. |
| `includeMetadata` | `true` | Available title, channel, channel ID, duration, publication date, views, likes, description, tags, thumbnail and category. Missing values are `null`. |
| `maxConcurrency` | `50` | 1–50 simultaneous video jobs. Lower concurrency can reduce blocking. |
| `proxyConfiguration` | Apify Residential, US | Apify proxy selector; custom proxy URLs and disabling proxies are supported. Availability varies with IP and region. |
| `expandCollections` | `false` | Enable public channel/playlist listing. Expansion can be partial or blocked; consult `OUTPUT.expansions`. |
| `maxVideosPerChannel` | `100` | 1–1,000 videos per channel or playlist input. Collection planning also respects `max_results` (see Limits above). |
| `max_results` | `1000` | 1–10,000 unique videos fetched. Remaining work is reported as limited or unprocessed. |
| `max_cost_usd` | Unset | Additional transcript event fee cap, using the run's effective price. Caps transcript events; Apify's maximum charge setting also applies. Platform usage and residential proxy are included in the advertised price. |
| `previousDatasetId` | Empty | Reuse validated successful captions from an accessible previous dataset if retrieval settings match. Failed rows are fetched again. |
| `resume_ids` | `[]` | Optional video IDs to fetch on this attempt; other uncached IDs receive `not_selected_for_resume`. |
| `timeoutSecs` | `8` | 5–90 seconds per request. Up to three clients are attempted with staggered concurrent fallbacks and one bounded fresh-session retry for access or transient transport failure; slower requests are cancelled after a validated success. |
| `minAttemptsForSuccessRatio` | `200` | 1–10,000 video attempts before stopping if fewer than 10% succeed. Reused rows are not attempts. |
| `maxConsecutiveFailures` | `500` | 1–10,000 consecutive unsuccessful video attempts before stopping new work. |
| `maxRunSecs` | `3000` | 30–3,000 seconds across listing, retrieval and restarts; ten seconds reserved for finalization. |
| `maxListingSources` | `200` | 1–200 total channel, playlist and search listing attempts, including retries. Duplicate sources share their listing attempts. |

Only canonical YouTube URLs are accepted. Arbitrary URLs, credentials in input URLs, private hosts and unsupported paths are rejected without being requested or copied into results. Submit public videos you are authorized to process; account cookies and login are not supported.

Legacy compatibility: `translateTo` accepts a language code but is omitted from the input form; do not depend on translated output. If translation is unavailable, original captions can be returned. `translationRequested` records that input; `translationStatus` is `not_requested`, `translated`, `already_in_language` or `unavailable`. `language` identifies the returned language and `sourceLanguage` the selected original track. Leave `translateTo` unset for normal use.

# Actor input Schema

## `urls` (type: `array`):

YouTube video, shorts or youtu.be URLs. Playlist/channel URLs require expandCollections.

## `languages` (type: `array`):

Ordered language codes; regional matching then any available track is used as fallback.

## `track` (type: `string`):

Prefer manual captions within each language when any is selected.

## `format` (type: `string`):

Segments and text are always retained. SRT/VTT/text/Markdown also appear in formatted. json aliases segments.

## `includeMetadata` (type: `boolean`):

Return available title, channel, duration, publication date and views; missing values are null.

## `maxConcurrency` (type: `integer`):

Simultaneous video requests. Higher values can increase blocking.

## `expandCollections` (type: `boolean`):

List public playlist/channel video IDs, bounded per input. Listing can be partial or blocked.

## `maxVideosPerChannel` (type: `integer`):

Maximum listed video IDs per playlist or channel input.

## `max_results` (type: `integer`):

Maximum unique videos fetched. Collection expansion also stops when the planned row count reaches this limit. Stops and unprocessed rows are reported in OUTPUT.

## `max_cost_usd` (type: `number`):

Optional extra cap on transcript event fees, using the effective configured price. Platform usage has its own Apify run budget.

## `timeoutSecs` (type: `integer`):

Seconds per client request. Up to three clients can be attempted.

## `proxyConfiguration` (type: `object`):

Residential US by default. Custom proxies or no proxy can be selected; reliability differs.

## `previousDatasetId` (type: `string`):

Reuse validated successful rows with matching language, track and translation settings without transcript charge. Prior failures are retried.

## `resume_ids` (type: `array`):

When nonempty, fetch only these IDs; matching previous successful rows are reused. Other entries receive free retryable rows.

## `includeExtendedMetadata` (type: `boolean`):

Optional extra public metadata lookups when the player omits the publication date. Adds latency, no extra event. Unknown dates remain null; captions are still delivered. Requires includeMetadata.

## `publishedAfter` (type: `string`):

Inclusive YYYY-MM-DD. Unknown dates return free retryable rows; filtering can require an extra watch metadata request.

## `publishedBefore` (type: `string`):

Inclusive YYYY-MM-DD. Applied to listed and direct videos before delivery/charging.

## `searchQueries` (type: `array`):

Up to 100 keyword searches. Public video IDs only, bounded per query; search ordering is not exhaustive.

## `maxVideosPerSearch` (type: `integer`):

Maximum IDs listed per search query.

## `includeChunks` (type: `boolean`):

Add stable timestamp-linked word windows; original cues remain intact.

## `chunkUnit` (type: `string`):

Words, characters, or estimated tokens (characters / 4). Token sizing is not a model tokenizer.

## `chunkSize` (type: `integer`):

Maximum units per chunk, controlled by chunkUnit.

## `chunkOverlap` (type: `integer`):

Units shared by adjacent chunks; must not exceed half of chunkSize.

## `includeMarkdown` (type: `boolean`):

Add a document with timestamp links and available description chapters.

## `includeChapters` (type: `boolean`):

Parse three or more ascending description timestamps beginning at zero. No inferred chapters; unavailable chapters return an empty list.

## `minAttemptsForSuccessRatio` (type: `integer`):

Stop new video work after this many attempts if fewer than 10% succeed. Independent of charges; persisted across restarts.

## `maxConsecutiveFailures` (type: `integer`):

Stop new video work after this many consecutive unsuccessful attempts. Independent of charges; persisted across restarts.

## `maxRunSecs` (type: `integer`):

Seconds across listing, retrieval and restarts, including ten seconds reserved for storage, billing and OUTPUT.

## `maxListingSources` (type: `integer`):

Run-wide cap on playlist, channel and search listing attempts. Duplicate sources share a listing; checked before network work.

## `searchInTranscripts` (type: `array`):

Up to 50 literal terms (1–100 characters). Unicode case-insensitive whole-word search for single words and phrase matching across cues. Fetching still happens; no extra search fee.

## `searchContextWords` (type: `integer`):

Context words on each side of a hit. Match timestamps use the contributing caption cues.

## `onlyVideosWithMatches` (type: `boolean`):

Still fetches transcripts, but nonmatching videos produce free no_match rows without transcript text and are not charged. Fetching has no extra cost to the user. With no search terms, all fetched transcripts are nonmatching.

## `onlyNewVideos` (type: `boolean`):

Skip previously delivered video IDs for this watch: no row, fetch or charge. Empty history delivers normally. Failures and no_match rows are retried on later runs. History keeps the newest 100,000 IDs.

## `watchId` (type: `string`):

1–100 letters, digits, underscores or hyphens. Defaults to a hash of normalized source URLs, queries, retrieval and matching settings. Reuse an explicit ID to share history across changed inputs.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "languages": [
    "en"
  ],
  "track": "any",
  "format": "segments",
  "includeMetadata": true,
  "maxConcurrency": 50,
  "expandCollections": false,
  "maxVideosPerChannel": 100,
  "max_results": 1000,
  "timeoutSecs": 8,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "includeExtendedMetadata": false,
  "maxVideosPerSearch": 20,
  "includeChunks": true,
  "chunkUnit": "words",
  "chunkSize": 200,
  "chunkOverlap": 40,
  "includeMarkdown": true,
  "includeChapters": true,
  "minAttemptsForSuccessRatio": 200,
  "maxConsecutiveFailures": 500,
  "maxRunSecs": 3000,
  "maxListingSources": 200,
  "searchInTranscripts": [],
  "searchContextWords": 12,
  "onlyVideosWithMatches": false,
  "onlyNewVideos": false
}
```

# Actor output Schema

## `transcripts` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `matches` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw",
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("smartlinks/youtube-transcript-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw",
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("smartlinks/youtube-transcript-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}' |
apify call smartlinks/youtube-transcript-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,smartlinks/youtube-transcript-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/BtyHF2ZtMBGJT14PO/builds/fQSZdkOKbXnHjdpIW/openapi.json
