# YouTube API (`apidojo/youtube-api`) Actor

Real-time YouTube data over plain HTTP. Get videos, Shorts, channels, comments, transcripts, playlists and trending videos, or search YouTube, as JSON. No Google API key or quota limits. $0.003 per successful request, same price for every endpoint.

- **URL**: https://apify.com/apidojo/youtube-api.md
- **Developed by:** [API Dojo](https://apify.com/apidojo) (community)
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 api requests

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 API - Real-Time Videos, Channels, Comments & Transcripts

Call YouTube data like any REST API. This **YouTube API** is an always-on Apify Standby Actor: send a `GET` request, get JSON back in seconds. No runs to start, no datasets to poll, no Google API key or YouTube Data API quota.

Search videos, shorts, channels and playlists, look up videos and channels, page through channel uploads, comments, hashtags and trending videos, and pull video transcripts. All through 17 simple endpoints.

**💰 Pricing:** $0.003 per successful request | **⚡ Response:** live JSON, seconds | **🔓 No YouTube login or API key**

***

### 📋 Table of Contents

1. [How It Works](#-how-it-works)
2. [Quick Start](#-quick-start)
3. [Pricing](#-pricing)
4. [Endpoints](#-endpoints)
5. [Pagination](#-pagination)
6. [Response Format](#-response-format)
7. [Errors & Status Codes](#-errors--status-codes)
8. [Code Examples](#-code-examples)
9. [Free Plan](#-free-plan)
10. [Related Actors](#-related-actors)
11. [FAQ](#-frequently-asked-questions)
12. [Contact](#-contact)

***

### 🧭 How It Works

This Actor runs in [Apify Standby mode](https://docs.apify.com/platform/actors/running/standby). Instead of starting a run and waiting for a dataset, you call an HTTP endpoint and get the result in the response.

| | Classic Actor run | This YouTube API (Standby) |
| --- | --- | --- |
| **How you call it** | Start a run, wait, read the dataset | Plain `GET` request |
| **Latency** | Run startup + scraping | Live response, no startup |
| **Result** | Dataset items | JSON in the HTTP response |
| **Billing** | Per run / per item | **Per request** |
| **Best for** | Large batch jobs | Apps, bots, agents, dashboards |

Every endpoint returns one object or one page of results. Use the `cursor` to get the next page.

***

### 🚀 Quick Start

**1. Get your Apify API token** from [Console → Settings → API & Integrations](https://console.apify.com/settings/integrations?fpr=yhdrb).

**2. Call an endpoint:**

```bash
curl "https://apidojo--youtube-api.apify.actor/video/tWYsfOSY9vY" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

**3. Get JSON back:**

```json
{
  "status": 200,
  "message": "OK",
  "data": {
    "type": "video",
    "id": "tWYsfOSY9vY",
    "title": "I Survived 7 Days In An Abandoned City",
    "url": "https://www.youtube.com/watch?v=tWYsfOSY9vY",
    "duration": 1043,
    "views": 90078952,
    "...": "..."
  }
}
```

That's it. That request cost $0.003.

**Authentication:** send your Apify token in the `Authorization: Bearer <token>` header (recommended) or as a `?token=<token>` query parameter. The `Authorization` header is never forwarded to the upstream service.

***

### 💰 Pricing

One flat price, every endpoint.

| Event | Price | When it fires |
| --- | --- | --- |
| **Request** (`request-event`) | **$0.003** per call | Every successful request that returns data |

- **Same price for every endpoint.** A video lookup and a page of search results cost the same.
- **You only pay for responses that contain data.** Invalid requests (`400`), not-found results, plan and rate-limit refusals and upstream errors are **not charged**.
- **No platform fees, no compute units, no runs.** Just the per-request price.

#### Cost Examples

| Scenario | Requests | Cost |
| --- | --- | --- |
| Look up 1 video | 1 | **$0.003** |
| Fetch 100 videos by ID | 100 | **$0.30** |
| Search a keyword, 50 pages deep | 50 | **$0.15** |
| Look up 1,000 channels | 1,000 | **$3.00** |
| 10,000 calls in a month | 10,000 | **$30.00** |

> Paginated endpoints are charged per page. Following a `cursor` is a new request, so 10 pages = 10 requests = $0.03.

***

### 📚 Endpoints

All endpoints are `GET`. Base URL: `https://apidojo--youtube-api.apify.actor`

#### 🎬 Videos

| Endpoint | Description | Params |
| --- | --- | --- |
| `/video/{id}` | Full video details by ID, including streaming formats and captions | `id` (e.g. `tWYsfOSY9vY`), `type` (`video` or `shorts`) |
| `/video/{id}/comments` | Comments on a video | `id`, `sort` (`top` or `latest`), `cursor` |
| `/video/{id}/transcript` | Video transcript with timings and available languages | `id` (e.g. `vakHDzCoK_U`), `lang` (e.g. `en`) |

#### 📱 Shorts

| Endpoint | Description | Params |
| --- | --- | --- |
| `/shorts/{id}` | Full short details by ID | `id` (e.g. `jOcyYhsc1mA`) |

#### 📺 Channels

| Endpoint | Description | Params |
| --- | --- | --- |
| `/channel/{id}` | Full channel details by channel ID | `id` (e.g. `UCX6OQ3DkcsbYNE6H8uQQuVA`) |
| `/channel/handle/{handle}` | Channel ID for a handle | `handle` (e.g. `@MrBeast`) |
| `/channel/path` | Channel ID for a channel path | `channelPath` (required, e.g. `@MrBeast`) |
| `/channel/{id}/videos` | A channel's videos | `id`, `cursor` |
| `/channel/{id}/shorts` | A channel's shorts | `id`, `cursor` |
| `/channel/{id}/live-streams` | A channel's past live streams | `id`, `cursor` |

#### 🔎 Search

| Endpoint | Description | Params |
| --- | --- | --- |
| `/search/video` | Search videos by keyword | `query` (required), `duration`, `features`, `uploadDate`, `sortBy`, `lang`, `geo`, `cursor` |
| `/search/shorts` | Search shorts by keyword | `query` (required), `uploadDate`, `sortBy`, `lang`, `geo`, `cursor` |
| `/search/channel` | Search channels by keyword | `query` (required), `sortBy`, `lang`, `geo`, `cursor` |
| `/search/playlist` | Search playlists by keyword | `query` (required), `sortBy`, `lang`, `geo`, `cursor` |

Search filter values:

| Param | Allowed values |
| --- | --- |
| `sortBy` | `relevance`, `rating`, `upload_date`, `view_count` |
| `uploadDate` | `hour`, `today`, `week`, `month`, `year` |
| `duration` | `short`, `medium`, `long` |
| `features` | `hd`, `subtitles`, `creative_commons`, `3d`, `live`, `purchased`, `4k`, `360`, `location`, `hdr`, `vr180` |
| `lang` / `geo` | Language code (e.g. `en`, `es`, `fr`) / country code (e.g. `US`, `GB`, `DE`) |

#### #️⃣ Hashtags, Playlists & Trending

| Endpoint | Description | Params |
| --- | --- | --- |
| `/hashtag/{tag}` | Videos for a hashtag | `tag` (e.g. `banana`), `cursor` |
| `/playlist/{id}/videos` | Videos in a playlist | `id` (e.g. `PLdw1RMMZ1UiHDVfMHInANNUI9kn6KCOtS`), `cursor` |
| `/trending` | Current trending videos for a country | `geo` (e.g. `US`, `GB`, `DE`) |

> **Tip:** The video ID is the `v` value in the watch URL. In `https://www.youtube.com/watch?v=tWYsfOSY9vY` the ID is `tWYsfOSY9vY`. Only have a handle? Call `/channel/handle/{handle}` first to get the channel ID.

The full OpenAPI spec is available on the Actor's **API** tab in Apify Console.

***

### 🔄 Pagination

Paginated endpoints return a cursor with each page. Pass it back as the `cursor` query parameter to get the next page.

- Channel videos, shorts and live streams, hashtag, playlist and all search endpoints return it as `data.cursor`.
- Video comments return it as `data.nextCursor`.

```bash
## Page 1
curl "https://apidojo--youtube-api.apify.actor/search/video?query=beast&sortBy=upload_date" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"

## Page 2
curl "https://apidojo--youtube-api.apify.actor/search/video?query=beast&sortBy=upload_date&cursor=CURSOR_FROM_PAGE_1" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

Leave `cursor` empty for the first page and only pass a value returned by a previous response. A stale or made-up cursor returns zero results. Stop when the response has no cursor or the page comes back empty. Each page is one request ($0.003).

***

### 📊 Response Format

Every response has the same envelope:

```json
{
  "status": 200,
  "message": "OK",
  "data": { }
}
```

| Endpoint type | `data` contains |
| --- | --- |
| Single video / short / channel / transcript | One object |
| Channel ID lookups (handle, path) | `{ "channelId": "..." }` |
| Video lists (video search, channel videos, shorts and live streams, hashtag, playlist, trending) | `{ "results": [...], "cursor": "..." }` |
| Shorts search | `{ "results": [...], "cursor": "..." }` (short result objects) |
| Channel search | `{ "results": [...], "cursor": "..." }` (channel result objects) |
| Playlist search | `{ "results": [...], "cursor": "..." }` (playlist result objects) |
| Video comments | `{ "comments": [...], "nextCursor": "..." }` |

#### Video Result Object

Items in video lists look like this:

```json
{
  "type": "video",
  "id": "tWYsfOSY9vY",
  "title": "I Survived 7 Days In An Abandoned City",
  "description": "This was one of the hardest challenges weve ever",
  "url": "https://www.youtube.com/watch?v=tWYsfOSY9vY",
  "duration": "17:24",
  "views": "90,029,827 views",
  "publishDate": "3 days ago",
  "channel": {
    "id": "UCX6OQ3DkcsbYNE6H8uQQuVA",
    "name": "MrBeast",
    "url": "https://www.youtube.com/@MrBeast",
    "handle": "@MrBeast",
    "badges": ["verified"]
  },
  "thumbnails": [
    { "url": "//yt3.ggpht.com/fxGKYucJAVme-Yz4f", "width": 176, "height": 176 }
  ]
}
```

Result items can also include `richThumbnail` and `channel.thumbnails`. In list results `duration` and `views` are display text. In the full video object they are numbers.

#### Video Object

Key fields: `type`, `id`, `title`, `status`, `url`, `description`, `duration` (seconds), `views`, `channel` (`id`, `name`, `url`), `isLive`, `isPrivate`, `isFamilySafe`, `thumbnails`, `embedUrl`, `publishDate`, `uploadDate`, `streamingData` (`expiresInSeconds`, `formats`), `captions` (`captionTracks`, `audioTracks`, `translationLanguages`).

#### Short Object

Key fields: `type`, `id`, `title`, `url`, `description`, `duration`, `views`, `likes`, `comments`, `isLikesAllowed`, `isCommentsAllowed`, `isRatingsAllowed`, `channel`, `keywords`, `category`, `isLive`, `isFamilySafe`, `isPrivate`, `isExclusive`, `isEmbeddable`, `isUnlisted`, `thumbnails`, `embedUrl`, `publishDate`, `relativeDate`, `uploadDate`, `captions`, `videoPreviews`.

Short search results are smaller: `type`, `id`, `title`, `url`, `views`, `thumbnails`.

#### Channel Object

Key fields: `type`, `id`, `name`, `url`, `description`, `subscriberCount`, `videosCount`, `keywords`, `isVerified`, `isVerifiedArtist`, `isModerator`, `isFamilySafe`, `availableCountries`, `tags`, `tabs`, `thumbnails`.

Channel search results: `type`, `id`, `name`, `url`, `description`, `handle`, `subscriberCount`, `videosCount`, `isVerified`, `isVerifiedArtist`, `thumbnails`.

#### Playlist Result Object

`type`, `id`, `title`, `videoCount`, `url`, `author` (`id`, `name`, `url`).

#### Comment Object

`id`, `text`, `author` (`id`, `name`, `thumbnails`), `likeCount`, `publishedTimeText`, `isLiked`, `isPinned`, `isHearted`, `replyCount`.

#### Transcript Object

```json
{
  "type": "transcript",
  "id": "vakHDzCoK_U",
  "transcript": [
    { "text": "For 15 years, people have been asking", "dur": "4.08", "startTime": "0:00" }
  ],
  "selected": { "title": "English (auto-generated)", "languageCode": "en" },
  "availableLanguages": [
    { "title": "English (auto-generated)", "languageCode": "en" }
  ]
}
```

***

### ⚠️ Errors & Status Codes

Errors use the same envelope, without `data`. **Requests that return no data are not charged.**

| Status | Meaning | Charged? |
| --- | --- | --- |
| `200` | Success | ✅ $0.003 |
| `400` | Invalid parameters. `errors` lists what's wrong | ❌ |
| `404` | Unknown endpoint or nothing found | ❌ |
| `403` | Access not available on your plan or account | ❌ |
| `429` | Monthly free request limit reached | ❌ |
| `502` | Upstream error, safe to retry | ❌ |
| `503` | Plan check temporarily unavailable, retry shortly | ❌ |

Example `400`:

```json
{
  "status": 400,
  "message": "Bad request",
  "errors": ["query.query: query is required"]
}
```

***

### 💻 Code Examples

#### cURL

```bash
curl "https://apidojo--youtube-api.apify.actor/channel/UCX6OQ3DkcsbYNE6H8uQQuVA" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

#### Python

```python
import requests

BASE = "https://apidojo--youtube-api.apify.actor"
HEADERS = {"Authorization": "Bearer YOUR_APIFY_TOKEN"}

def search_videos(query, pages=5):
    videos, cursor = [], None
    for _ in range(pages):
        params = {"query": query, "sortBy": "upload_date"}
        if cursor:
            params["cursor"] = cursor
        res = requests.get(f"{BASE}/search/video", headers=HEADERS, params=params, timeout=300).json()
        data = res.get("data") or {}
        videos += data.get("results", [])
        cursor = data.get("cursor")
        if not cursor or not data.get("results"):
            break
    return videos

print(len(search_videos("beast", pages=3)))  # max 3 requests = $0.009
```

#### JavaScript / Node.js

```javascript
const BASE = 'https://apidojo--youtube-api.apify.actor';
const headers = { Authorization: `Bearer ${process.env.APIFY_TOKEN}` };

const res = await fetch(`${BASE}/channel/handle/@MrBeast`, { headers });
const { data: { channelId } } = await res.json();

const videos = await fetch(`${BASE}/channel/${channelId}/videos`, { headers }).then((r) => r.json());
console.log(videos.data.results.length, videos.data.cursor);
```

#### Video Comments

```bash
curl "https://apidojo--youtube-api.apify.actor/video/ZZ4lUpYu5BA/comments?sort=latest" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

#### Video Transcript

```bash
curl "https://apidojo--youtube-api.apify.actor/video/vakHDzCoK_U/transcript?lang=en" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

#### Trending Videos

```bash
curl "https://apidojo--youtube-api.apify.actor/trending?geo=US" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN"
```

***

### 🆓 Free Plan

Apify Free plan users can try this API with a limited number of free requests each month. When the monthly limit is reached, the API answers `429` until the next month. [Subscribe to a paid Apify plan](https://apify.com/pricing?fpr=yhdrb) for unlimited requests.

***

### 🌴 Related Actors

Need bulk exports to a dataset, CSV or Excel instead of live calls? Use our batch scrapers:

| Tool | Best For |
| --- | --- |
| ▶️ **[YouTube Scraper](https://apify.com/apidojo/youtube-scraper?fpr=yhdrb)** | Large video exports from search, URLs, playlists and channels |
| 🧰 **[YouTube Scraper API](https://apify.com/apidojo/youtube-scraper-api?fpr=yhdrb)** | Bulk videos, channels, playlists, search, trending, Shorts and live streams |
| 📺 **[YouTube Channel Scraper](https://apify.com/apidojo/youtube-channel-scraper?fpr=yhdrb)** | All videos from many channels |
| 🪪 **[YouTube Channel Information Scraper](https://apify.com/apidojo/youtube-channel-information-scraper?fpr=yhdrb)** | Bulk channel profiles, subscribers and stats |
| 💬 **[YouTube Comments Scraper](https://apify.com/apidojo/youtube-comments-scraper?fpr=yhdrb)** | Full comment exports with replies |
| 📃 **[YouTube Playlist Scraper](https://apify.com/apidojo/youtube-playlist-scraper?fpr=yhdrb)** | Bulk playlist videos and metadata |
| 📝 **[YouTube Transcript Scraper](https://apify.com/apidojo/youtube-transcript-scraper?fpr=yhdrb)** | Transcripts for large batches of videos |
| 📈 **[YouTube Trending Scraper](https://apify.com/apidojo/youtube-trending-scraper?fpr=yhdrb)** | Trending videos and rankings over time |

***

### ❓ Frequently Asked Questions

#### What is a Standby Actor?

A Standby Actor is an always-running web server on Apify. You call it over HTTP like any API and get the response directly. No runs to start or datasets to read. [Learn more](https://docs.apify.com/platform/actors/running/standby).

#### How much does it cost?

**$0.003 per successful request**, the same for every endpoint. 1,000 requests = $3. Failed and invalid requests are free.

#### Am I charged per video or per request?

Per request. A page of search results costs the same as a single video lookup.

#### Do I need a YouTube Data API key or Google account?

No. You only need an Apify API token. There is no YouTube Data API quota to manage.

#### How do I get more than one page of results?

Pass the cursor from the previous response as the `cursor` query parameter. Lists return it as `data.cursor`, comments as `data.nextCursor`. Each page is a separate $0.003 request. See [Pagination](#-pagination).

#### How do I find a channel ID from a handle?

Call `/channel/handle/{handle}` (for example `/channel/handle/@MrBeast`) or `/channel/path?channelPath=@MrBeast`. Both return `{ "channelId": "..." }`, which you can pass to the `/channel/{id}` endpoints.

#### Can I get transcripts in other languages?

Yes. Pass `lang` to `/video/{id}/transcript`. The response lists the transcript languages the video offers in `availableLanguages` and the one returned in `selected`.

#### How fast is it?

Responses come back live, usually within seconds. There is no run startup time.

#### Can I use it from an AI agent or bot?

Yes. It's a plain HTTP API with an OpenAPI spec, so it fits LLM tool calls, bots, backends and no-code tools that can make HTTP requests.

#### Where is the data stored?

Nowhere. Results are returned in the HTTP response only. For dataset, CSV or Excel exports, use one of the [batch scrapers](#-related-actors).

#### Can I access private videos?

No. Only publicly available data is returned.

***

### 📞 Contact

If you need any sort of support, please send an email to **apidojo10@gmail.com**. You name it, we get it.

***

**Ready to call YouTube data like an API?** One endpoint per question, $0.003 per answer, live JSON in seconds. Grab your Apify token and send your first request. ▶️

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

## `overview` (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("apidojo/youtube-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("apidojo/youtube-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 apidojo/youtube-api --silent --output-dataset

```

## MCP server setup

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