# Youtube Transcript API (`transcriptdev/youtube-transcript-api`) Actor

YouTubeTranscript.dev turns YouTube videos into text. It uses captions in 100+ languages and AI transcription when captions are missing. Supports single videos and batches, TXT/SRT/VTT/JSON export, translation, and a REST API.

- **URL**: https://apify.com/transcriptdev/youtube-transcript-api.md
- **Developed by:** [Youtube Transcript Dev](https://apify.com/transcriptdev) (community)
- **Categories:** Developer tools, Integrations, Videos
- **Stats:** 29 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 transcripts

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTubeTranscript.dev - YouTube Transcript API

Real-time API for extracting YouTube transcripts and captions. Supports 100+ languages, batch processing, timestamped segments, and word-level timing. Proxies to the YouTubeTranscript.dev backend.

### Standby Mode Endpoints

This Actor runs in **Standby mode** — use it like a real-time API. No need to click Start; just send HTTP requests to the Actor hostname.

| Endpoint | Method | Description |
|----------|--------|--------------|
| `/` | GET | Health check. Returns service status. |
| `/transcribe` | POST | Transcribe a single YouTube video |
| `/batch` | POST | Transcribe multiple videos (batch) |
| `/batch/{batch_id}` | GET | Poll batch status (when POST /batch returns `processing`) |

### Authentication

Include your Apify API token in one of two ways:

1. **Query parameter:** `?token=YOUR_APIFY_TOKEN`
2. **Authorization header (recommended):** `Authorization: Bearer YOUR_APIFY_TOKEN`

### Request Examples

#### Single video (cURL)

```bash
curl -X POST "https://your_actor.apify.actor/transcribe?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"video":"dQw4w9WgXcQ","language":"en"}'
```

#### Single video (JavaScript)

```javascript
const response = await fetch('https://apify.com/service/https://your_actor.apify.actor/transcribe', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.APIFY_TOKEN}`,
  },
  body: JSON.stringify({
    video: 'dQw4w9WgXcQ',
    language: 'en',
    format: { timestamp: true },
  }),
});
const data = await response.json();
console.log(data.data.transcript.text);
```

#### Single video (Python)

```python
import requests

response = requests.post(
    'https://your_actor.apify.actor/transcribe',
    headers={
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {os.environ["APIFY_TOKEN"]}',
    },
    json={'video': 'dQw4w9WgXcQ', 'language': 'en'},
)
data = response.json()
print(data['data']['transcript']['text'])
```

#### Batch (cURL)

```bash
curl -X POST "https://your_actor.apify.actor/batch?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"video_ids":["dQw4w9WgXcQ","jNQXAC9IVRw"],"language":"en"}'
```

When POST /batch returns `status: "processing"`, poll until completed:

```bash
curl -X GET "https://your_actor.apify.actor/batch/BATCH_ID?token=YOUR_APIFY_TOKEN"
```

### Request Body

#### POST /transcribe

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| video | string | Yes | YouTube URL or 11-character video ID |
| language | string | No | Preferred language code (e.g. en, es). Default: en |
| source | string | No | `auto` (auto-generated) or `manual` (creator-provided). Default: auto |
| format | object | No | `{ timestamp: true, paragraphs: true, words: true }` |

#### POST /batch

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| video\_ids | array | Yes | Array of video URLs or IDs (max 100) |
| language | string | No | Preferred language code |
| source | string | No | `auto` or `manual` |
| format | object | No | Output format options |

### Response

Successful responses return JSON with:

- `request_id` / `batch_id` — Request identifier
- `status` — `completed`, `partial`, `processing`, or `failed` (for batch: poll GET /batch/{batch\_id} when `processing`)
- `data` — Transcript with `text`, `language`, `source`, optional `segments`, `paragraphs`, `words`
- `credits_used` — Credits consumed

### Pricing

This Actor uses **pay-per-event** pricing on Apify. You are charged per successfully processed transcript. Check the Apify Store for the current event price.

### FAQ

**Which videos are supported?**\
Public YouTube videos with captions (manual or auto-generated). Private, unlisted, or age-restricted videos are not supported.

**What if a video has no captions?**\
The API returns 404 with "No captions available for this video." If you run the actor from the Apify UI with input, the run completes and stores that error in the dataset instead of crashing.

**Which languages are supported?**\
All languages available on YouTube (100+). Set the `language` parameter to any ISO 639-1 code (e.g. en, es, de, ja, ko).

**Is ASR (audio transcription) available?**\
No. This Actor supports captions only. Videos without captions cannot be transcribed.

# Actor input Schema

## `video` (type: `string`):

YouTube URL (e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ) or 11-character video ID

## `language` (type: `string`):

Preferred language code (e.g. en, es, de). Falls back to any available if not found.

## `source` (type: `string`):

Auto-generated or creator-provided captions

## `format` (type: `object`):

Output structure

## Actor input object example

```json
{
  "language": "en",
  "source": "auto"
}
```

# Actor output Schema

## `apiUrl` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("transcriptdev/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 = {}

# Run the Actor and wait for it to finish
run = client.actor("transcriptdev/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 '{}' |
apify call transcriptdev/youtube-transcript-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,transcriptdev/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/sHpessS7avpjrEGz4/builds/62jIy3oNXO2U4t5HW/openapi.json
