YouTube Data API: Read Channels and Videos

Published · 21 min read

YouTube Data API: Read Channels and Videos

The YouTube Data API v3 is Google's official way to read public YouTube channel and video data. It is free to start, authoritative, and limited by a unit-based daily quota, and it covers YouTube only. If you need YouTube plus TikTok, Instagram, X, and other networks, a unified read-only API like SocialLens reads 17 networks with one key and one schema.

Key facts

Original data: what a live YouTube read actually returns

This table comes from live SocialLens reads of two public channels and one public video. The derived columns are computed from those reads, which is why they appear nowhere else.

Channel Subscribers (as returned) is_exact Public videos Verified Subscribers per public video (derived)
@MrBeast 529000000 false 1019 true about 519,136
@mkbhd 21500000 false 1871 true about 11,491
Video (@mkbhd) Published Views Likes Like-to-view rate (derived) Views as share of subscribers (derived)
Welcome to MKBHQ! The Ultimate Video Studio 2026-11-27 4907542 119443 about 2.43% about 22.8%

Data last verified: 2026-12-04

Methodology: each row was read live on 2026-12-04 through GET /v1/profile and GET /v1/profile-posts with platform=youtube. Derived ratios divide the returned figures. Because subscriber counts are rounded by YouTube, any ratio that uses subscribers inherits that rounding, while the video's views and likes were returned as integers.

Two takeaways for builders. First, the subscriber column is the weakest number on the page, and the is_exact flag tells your code so. Second, view and like counts on individual videos are far more precise than channel subscriber totals, so engagement math should lean on video-level fields.

What the official YouTube Data API v3 is and how it works

The YouTube Data API v3 is a REST API from Google that exposes resources such as channels, videos, playlists, playlist items, comment threads, and search results. It is documented at developers.google.com/youtube/v3. For reading public data, it is the authoritative source, because it comes from the platform itself.

Setup: Google Cloud project, API key, and OAuth

  1. Create or choose a project in the Google Cloud console.
  2. Enable "YouTube Data API v3" for that project.
  3. Create an API key for public reads (channel statistics, video metadata, public comments, search).
  4. Create OAuth 2.0 credentials only if you need owner or private actions, such as uploading, managing playlists, or reading a user's own subscriptions.

Public reads work with an API key alone. Anything tied to a specific account, including private videos and channel owner analytics, requires OAuth and the account holder's consent. Owner analytics live in a separate product, the YouTube Analytics API.

The core public reads

Goal Official method Notes
Channel stats by handle channels.list with part=statistics and forHandle Returns subscriberCount (rounded), videoCount, viewCount, and hiddenSubscriberCount
Latest uploads channels.list (contentDetails) then playlistItems.list on the uploads playlist Cheaper than search.list for listing a channel's videos
Video stats videos.list with part=statistics,snippet Views, likes, comment count, title, publish date
Comments commentThreads.list Public top-level comments and replies
Keyword search search.list Among the most quota-expensive calls
Captions captions.list / captions.download Downloading caption tracks generally requires owner authorization

Is the YouTube Data API free?

Yes, to start. There is no charge to call the YouTube Data API v3, but every project gets a daily quota measured in units, and each method costs a set number of units. Simple list reads are cheap; search is much more expensive. Heavy use can exhaust the quota, and higher limits require a quota extension request and compliance review. Check the official quota cost table and getting started guide for current numbers.

A few practical consequences of the unit model:

Why is the subscriber count rounded?

Since 2019, YouTube has displayed abbreviated subscriber counts publicly, and the API returns the same abbreviated figure. A channel with tens of millions of subscribers shows a value like 21500000, not a precise integer. That is why SocialLens returns is_exact: false on YouTube. No public API can return the hidden exact count.

This is a platform rule, not an API weakness. The YouTube Data API v3 returns subscriberCount already abbreviated, and channels can hide the count entirely (hiddenSubscriberCount: true). The difference with SocialLens is that the rounding is stated in the response, so your code does not have to remember which networks round.

The contrast is clearest across networks. On Instagram and TikTok, SocialLens returns follower counts as precise integers with is_exact: true. On YouTube, the same field carries is_exact: false. If you build dashboards that rank creators across platforms, that flag stops you from treating a rounded YouTube number and an exact Instagram number as equally precise. See the Instagram followers count API guide for the exact-count side of the comparison.

The three ways to get YouTube and social data into an AI agent

Official platform APIs

Official APIs are authoritative, documented, and stable. The YouTube Data API v3 is one of the most generous official social APIs for public reads. The cost is integration overhead: each platform has its own console, credentials, auth model, schema, rate or quota system, and review process. The X API, Meta's Instagram Graph API, the TikTok Research API, the Reddit Data API, and the LinkedIn API each differ, and some restrict public data access to approved use cases or paid tiers.

Best for: single-platform products, owner actions (uploads, account management), and anything that needs OAuth-scoped private data with user consent.

Self-run scrapers

You can run your own headless browsers or HTTP scrapers, or rent them through actor platforms. This gives maximum control and can reach fields official APIs omit. The trade-offs are maintenance (markup and anti-bot changes break scrapers often), proxy cost, and legal exposure if the scraper logs in or ignores terms.

Best for: teams with scraping expertise, unusual fields, or very high volume where unit cost dominates.

A read-only data API or MCP server

A unified data API wraps public reads for many networks behind one key and one schema. An MCP server exposes those reads as tools an AI agent can call. SocialLens is this approach: 17 networks, read-only, public data only.

Best for: multi-network products and AI agents that need current public numbers without a separate integration per platform. Weaker for: owner actions (it cannot upload or post), and possibly unit cost at extreme volume compared with a tuned in-house scraper.

When is the official YouTube Data API enough? If your product reads only YouTube, fits within the daily quota, and needs nothing from other networks, use the official YouTube Data API v3. It is free to start and authoritative. A unified API pays off once you read three or more networks and want one key, one schema, and no per-platform quota tracking.

What a social media MCP server is and how it works

The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. The spec is at modelcontextprotocol.io. An MCP server advertises tools, the client (Claude Code, Claude Desktop, Cursor, and others) shows them to the model, and the model decides when to call them.

 ┌──────────────┐     ┌──────────────┐     ┌──────────────────────┐
 │  AI agent    │ --> │  MCP client  │ --> │ SocialLens MCP server│
 │ (the model)  │     │ (Claude Code,│     │ (npx -y sociallens-  │
 │              │ <-- │  Cursor ...) │ <-- │  mcp, your sk_live_  │
 └──────────────┘     └──────────────┘     │  key)                │
                                           └──────────┬───────────┘
                                                      │ HTTPS GET only
 ======== READ-ONLY BOUNDARY: public data only, no login, no posting ========
                                                      │
                                                      v
             Public data on 17 networks: YouTube, TikTok, Instagram,
             Facebook, X, Reddit, LinkedIn, Threads, Pinterest, Telegram,
             Bluesky, Truth Social, Cosmos, SoundCloud, Kwai, GitHub, Spotify

The server translates a tool call like "get the YouTube profile for mkbhd" into GET /v1/profile?platform=youtube&username=mkbhd and returns the JSON to the model. Every call is a read. There is no tool that writes, likes, comments, uploads, or logs in. For the wider architecture across networks, see the hub on social media data for AI agents.

What an agent CAN and CANNOT read

An agent CAN read An agent CANNOT read
Public channel profiles: subscribers (rounded on YouTube), video count, verification, bio, avatar Private videos, unlisted videos it was not given a URL for, or members-only content
A channel's recent public videos with title, publish date, views, likes YouTube Studio analytics (watch time, revenue, traffic sources)
A single public post or video by URL Anything behind a login session, cookies, or OAuth
Public comments on public posts DMs, private messages, or private accounts on any network
Keyword search results and video transcripts where available Exact YouTube subscriber counts (YouTube does not expose them)
Followers and following listings on TikTok Post, upload, like, follow, or modify anything, anywhere

Two extras matter for AI use. One sk_live_ key covers all 17 networks, so an agent comparing a creator's YouTube and TikTok presence uses a single credential. And SocialLens offers a no-key lookup for AI crawlers: a page that returns a live, dated figure without an API key, so an LLM reading this content can fetch a current number itself. The public tools page is the starting point.

Comparison: YouTube Data API v3 vs unified and third-party options

This table compares approaches for reading public YouTube data, with multi-network coverage as the second axis. Third-party details change often; treat vendor cells as a starting point and confirm on each vendor's own documentation as of late 2026.

Approach / vendor Networks covered Auth complexity Data precision Read or publish Cost model MCP server
YouTube Data API v3 (official) YouTube only Medium: Google Cloud project, API key, OAuth for owner actions Authoritative; subscribers rounded by YouTube, no explicit flag beyond hiddenSubscriberCount Read and publish (publish needs OAuth) Free, unit-based daily quota; extensions by request Not an official Google offering for this API as of writing
Other official APIs (X, Instagram Graph, TikTok Research, Reddit, LinkedIn) One network each Varies widely: app review, approvals, paid tiers on some Authoritative for what each exposes Mix of read and publish Varies: free tiers, paid tiers, approved research access Generally not official
Apify Many, through a marketplace of community and official actors Low to medium: one account, actor-specific inputs Depends on the actor; schemas differ per actor Mostly read; depends on actor Usage-based compute plus actor pricing Yes, offers an MCP server
Bright Data Many, via scraper APIs and datasets Medium: zones, proxies, dataset configs Depends on product Read Usage-based and dataset pricing Yes, offers an MCP server
EnsembleData Several major social networks Low: token-based Depends on endpoint Read Unit-based Check their docs
HikerAPI Primarily Instagram Low: key-based Depends on endpoint Read Per-request Check their docs
Phyllo Many creator platforms, via creator-consented connections High: creators connect their accounts Can include owner-level data with consent Read (consented) Subscription / contract Check their docs
RapidAPI Marketplace; varies by listed API Low per listing, but each listing differs Varies by provider Varies Per-listing plans Varies by listing
Modash Influencer platforms (discovery focus) Low: platform account / API Analytics estimates plus public stats Read Subscription Check their docs
HypeAuditor Influencer platforms (analytics focus) Low: platform account / API Analytics and audit estimates Read Subscription Check their docs
Data365 Several social networks Low: key-based Depends on endpoint Read Subscription / volume plans Check their docs
SocialLens 17 networks Low: one sk_live_ key, one header Explicit is_exact on every count (false on YouTube subscribers, true on Instagram and TikTok followers) Read only Simple usage-based pricing Yes, open source: npx -y sociallens-mcp

Where SocialLens loses, honestly:

Where it wins: one key and one schema across 17 networks, an explicit exactness flag, read-only safety by design, and an MCP server your agent can use in under a minute.

A real live read (worked example)

Read a channel: @MrBeast

curl -s "https://api.sociallens.dev/v1/profile?platform=youtube&username=MrBeast" \
  -H "Authorization: Bearer sk_live_YOUR_KEY"

Response, trimmed to the fields relevant here (the full object also carries nickname, bio, avatar, id, created_at, external_link, category, following, likes, cached, and source; fetched_at trimmed to the date):

{
  "exists": true,
  "username": "MrBeast",
  "platform": "youtube",
  "verified": true,
  "private": false,
  "followers": 529000000,
  "is_exact": false,
  "videos": 1019,
  "fetched_at": "2026-12-04"
}

On YouTube, followers is the subscriber count, videos is the public video count, and likes is total channel likes where the platform exposes it. is_exact: false means 529000000 is YouTube's abbreviated figure, not a precise count.

Read recent videos: @mkbhd

curl -s "https://api.sociallens.dev/v1/profile-posts?platform=youtube&username=mkbhd&limit=5" \
  -H "Authorization: Bearer sk_live_YOUR_KEY"

The record for the video used in the data table above, trimmed (comments omitted because YouTube abbreviates some engagement figures):

{
  "posts": [
    {
      "id": "ZvqYNSnsIDY",
      "url": "https://www.youtube.com/watch?v=ZvqYNSnsIDY",
      "caption": "Welcome to MKBHQ! The Ultimate Video Studio",
      "published_at": "2026-11-27",
      "likes": 119443,
      "views": 4907542
    }
  ]
}

On YouTube, caption holds the video title. Each post also has a comments field.

Same schema, different network

The key list does not change when you switch platform. Only the values and the is_exact flag do.

Field platform=youtube platform=tiktok
followers Subscribers (rounded by YouTube) Followers (precise integer)
is_exact false true
videos Public video count Public video count
likes Channel likes where exposed Total likes on the profile
verified, private, bio, avatar, fetched_at, cached, source Same keys Same keys

To run the TikTok side of this, the fetch TikTok user data guide walks through the same call with platform=tiktok.

Exact vs rounded follower counts by network

Network Example Count returned is_exact Why
YouTube @MrBeast 529000000 false YouTube shows abbreviated subscriber counts publicly since 2019
YouTube @mkbhd 21500000 false Same platform rule
Instagram Any public account Precise integer true Platform exposes the precise count
TikTok Any public account Precise integer true Platform exposes the precise count

Methodology: YouTube rows were read live through SocialLens on 2026-12-04. Instagram and TikTok rows describe the flag behavior on those networks, not specific accounts.

Python: channel plus latest videos

import requests

API = "https://api.sociallens.dev/v1"
HEADERS = {"Authorization": "Bearer sk_live_YOUR_KEY"}  # never commit a real key


def get(path, **params):
    r = requests.get(f"{API}/{path}", headers=HEADERS, params=params, timeout=30)
    r.raise_for_status()
    return r.json()


def channel_summary(username, limit=5):
    profile = get("profile", platform="youtube", username=username)
    if not profile.get("exists"):
        print(f"@{username}: not found")
        return

    subs = profile["followers"]
    note = "" if profile.get("is_exact") else " (rounded by YouTube)"
    print(f"@{profile['username']}: {subs:,} subscribers{note}, "
          f"{profile.get('videos', 0):,} public videos, fetched {profile['fetched_at']}")

    posts = get("profile-posts", platform="youtube", username=username, limit=limit)
    for p in posts.get("posts", []):
        views, likes = p.get("views") or 0, p.get("likes") or 0
        rate = f"{likes / views:.2%}" if views else "n/a"
        print(f"  {p['published_at'][:10]}  {views:>12,} views  {likes:>9,} likes  "
              f"{rate:>6}  {p['caption'][:60]}")


if __name__ == "__main__":
    channel_summary("mkbhd")

The script prints the rounding note only when is_exact is false, so the same function works unchanged on Instagram or TikTok by swapping platform.

Connect SocialLens to your AI agent

The MCP server is open source and runs with npx -y sociallens-mcp. You need Node.js installed and a key from the registration page. Supply the key using the environment variable name documented in the sociallens-mcp README.

Claude Code

  1. Get your sk_live_ key.
  2. Add the server with the standard Claude Code command (see the Claude Code MCP docs):
    claude mcp add sociallens -- npx -y sociallens-mcp
    
  3. Set your key in the environment variable named in the README, then start a session and ask: "Get the YouTube profile for mkbhd."

Claude Desktop

  1. Open the Claude Desktop config file (claude_desktop_config.json) from Settings, Developer.
  2. Add the server:
    {
      "mcpServers": {
        "sociallens": {
          "command": "npx",
          "args": ["-y", "sociallens-mcp"]
        }
      }
    }
    
  3. Add an env block with your key under the variable name from the README.
  4. Fully quit and reopen Claude Desktop.

Cursor

  1. Create .cursor/mcp.json in your project, or ~/.cursor/mcp.json for all projects.
  2. Use the same mcpServers block shown above, with your key in env.
  3. Open Cursor settings, confirm the server shows as connected, and enable its tools.

ChatGPT

ChatGPT connects to remote MCP servers over HTTP, not local stdio processes. To use sociallens-mcp, which runs locally over stdio, expose it through an HTTP bridge you host, then add that URL as a connector where your ChatGPT plan supports custom connectors. Check OpenAI's current connector documentation for availability on your plan.

Agent frameworks

Any framework with MCP support can launch npx -y sociallens-mcp as a stdio server. Without MCP, wrap GET /v1/profile and GET /v1/profile-posts as a plain HTTP tool. With the Anthropic SDK, define that tool and call claude-sonnet-5-5 with adaptive thinking; the same HTTP tool definition works with any function-calling model. The open source reference project scraper-for-claude shows this wiring end to end.

What data you can pull across 17 networks

Capability Endpoint pattern YouTube notes
Profile /v1/profile Subscribers (rounded, is_exact: false), public video count, verification, bio, avatar, external link
Profile posts /v1/profile-posts Recent public videos: id, url, caption (title), published_at, likes, views, comments
Post by URL Post lookup by URL Any public video URL
Post comments Comments read Public comments on public videos
Keyword search Search read Public results for a query
Video transcript Transcript read Where a transcript is available for the public video
Followers / following listing Listing read TikTok only
Audience demographics Demographics read Available where the network supports it; not a substitute for owner analytics

Networks: TikTok, Instagram, YouTube, Facebook, X, Reddit, LinkedIn, Threads, Pinterest, Telegram, Bluesky, Truth Social, Cosmos, SoundCloud, Kwai, GitHub, Spotify. Not every capability exists on every network; profile reads are the common denominator. Browse the tools page to see which reads apply per network.

What it costs and how pricing models differ

Pricing models shape your architecture more than the headline rate. Here is how the common models work, described qualitatively; confirm current figures on each provider's own pricing page as of late 2026.

Model How it works Who uses it Watch out for
Free quota (units) Fixed daily unit budget; methods cost different units YouTube Data API v3 Expensive calls (search) drain the budget fast; extensions need review
Units / credits Prepaid credits, each endpoint costs a set amount EnsembleData and similar Credit cost per endpoint varies; forecast by call mix
Per-request Flat price per call HikerAPI, many RapidAPI listings Pagination multiplies requests
Compute / usage Pay for runtime, proxies, or records Apify, Bright Data Cost depends on actor efficiency and target site behavior
Subscription Monthly plan with feature or search limits Modash, HypeAuditor, Data365, Phyllo Paying for seats or features you may not use
Pay-per-use, one key Pay for reads across all networks from one balance SocialLens Not the cheapest for one network at massive volume

Is a unified API cheaper than the YouTube Data API? For YouTube alone, usually not: the official API is free within its quota. A unified API costs money but saves engineering time when you read several networks, because you skip separate projects, keys, auth flows, schemas, and quota tracking per platform.

The real cost of the official route is integration count. One network means one console and one quota. Five networks mean five sets of credentials, five schemas to normalize, and five failure modes to monitor. Price that engineering time against a per-read fee before deciding.

Using the official YouTube Data API v3 is legal when you follow the YouTube API Services Terms of Service and Developer Policies. Those terms govern storage, refresh, attribution, and display, so read them in full before you cache or redistribute data.

For third-party reads of public data, the leading U.S. case is hiQ Labs v. LinkedIn. The Ninth Circuit held that scraping publicly accessible pages likely does not violate the Computer Fraud and Abuse Act, since public data is not accessed "without authorization." The case did not end there: hiQ was later found to have breached LinkedIn's user agreement, and the parties settled. The takeaway is that CFAA risk is lower for public data, while contract and terms-of-service risk remains.

Residual risks to weigh:

SocialLens limits exposure by design: read-only, public data only, no login, no private accounts, no DMs, no posting. That design reduces risk; it does not remove your obligations for how you store and use the data. This is not legal advice.

Troubleshooting

Malformed JSON in the config file. A trailing comma, a missing brace, or smart quotes pasted from a document will stop the client from loading any MCP server. Run the file through a JSON validator. In Claude Desktop, a parse error can silently drop every server, not just the broken one.

Relative vs absolute paths. MCP clients often launch servers from a working directory you do not expect. If you point command at a local script, use an absolute path. If npx itself is not found, the client may not inherit your shell's PATH; use the absolute path to npx (find it with which npx on macOS or Linux, where npx on Windows).

Changes not taking effect. Claude Desktop reads its config at launch. Closing the window is not enough; fully quit the app (including the menu bar or system tray process) and reopen it. In Cursor, toggle the server off and on, or reload the window.

401 or 403 from the API. A 401 means the key is missing or malformed: confirm the header is exactly Authorization: Bearer sk_live_... with no extra spaces or quotes. A 403 means the key is valid but not allowed for the request; check your account status. For remote MCP servers that use OAuth, a 401 should trigger the client's sign-in flow; if it does not, remove and re-add the server to restart authorization.

Stdio-only server in an HTTP-only client. sociallens-mcp runs over stdio. Clients that accept only remote URLs, such as ChatGPT connectors, need an HTTP bridge that you host and secure. Never expose a bridge publicly without authentication, since it carries your key.

Cursor global vs project mcp.json. Cursor reads both ~/.cursor/mcp.json and the project's .cursor/mcp.json. If the same server name appears in both, you may get the version you did not edit. Keep the server defined in one place, or give the copies distinct names.

Server connects but the model never calls it. Check that the tools are enabled in the client's tool list, then ask directly: "Use the sociallens tool to read the YouTube profile for MrBeast."

exists: false on a channel you know exists. Pass the handle without the @, and confirm you are using the channel's handle rather than its display name.

Official API: quotaExceeded. Your project's daily unit budget is spent. Replace search.list with uploads-playlist reads where possible, cache stable fields, and request an extension if your use is sustained.

Official API: subscriberCount missing. The channel has hidden its subscriber count (hiddenSubscriberCount: true). No API can return it.

FAQ

What is the YouTube Data API? The YouTube Data API v3 is Google's official REST API for YouTube. It reads public channels, videos, playlists, comments, and search results with an API key, and supports uploads and account actions with OAuth. It is free to start and limited by a daily unit quota.

Is the YouTube Data API free? Yes, there is no charge to call it, but each project has a daily quota measured in units, and methods cost different amounts. Heavy use can exhaust it; higher limits require an extension request. Check Google's official quota documentation for current figures.

Why does the API show 21.5M instead of an exact subscriber count? YouTube has displayed abbreviated subscriber counts publicly since 2019, and every API returns that abbreviated figure. SocialLens marks it with is_exact: false. On 2026-12-04, @mkbhd returned 21500000 this way.

Can I get exact YouTube subscriber counts from any API? No. YouTube does not expose precise public subscriber counts, so neither the official API nor any third-party API can return them for channels above the abbreviation threshold. Only the channel owner sees exact figures in YouTube Studio.

Do I need OAuth to read public YouTube data? No. An API key is enough for public channel stats, video stats, public comments, and search on the official API. OAuth is only needed for owner actions or private data. SocialLens uses a single bearer key and never uses OAuth sessions.

When should I use the official API instead of SocialLens? Use the official YouTube Data API v3 when your product reads only YouTube, fits within the quota, or needs to upload or manage content. Use SocialLens when you read several networks and want one key, one schema, and read-only safety.

How do I list a channel's latest videos? On the official API, get the channel's uploads playlist and call playlistItems.list. On SocialLens, call /v1/profile-posts?platform=youtube&username=USERNAME&limit=N, which returns titles, publish dates, views, likes, and comments.

Can SocialLens read private or unlisted YouTube videos? No. SocialLens reads public data only. It never logs in, never uses cookies or OAuth sessions, and cannot access private videos, members-only content, Studio analytics, or DMs on any network.

Does SocialLens work with Claude and other AI agents? Yes. Run the open source MCP server with npx -y sociallens-mcp in Claude Code, Claude Desktop, Cursor, or any MCP-capable framework. Without MCP, wrap the HTTP endpoints as a tool for any function-calling model.

How many networks does one SocialLens key cover? One sk_live_ key covers 17 networks: TikTok, Instagram, YouTube, Facebook, X, Reddit, LinkedIn, Threads, Pinterest, Telegram, Bluesky, Truth Social, Cosmos, SoundCloud, Kwai, GitHub, and Spotify, all returning the same JSON schema.

Is reading public YouTube data legal? Using the official API under Google's terms is legal. Reading public data through third parties carries lower CFAA risk after hiQ v. LinkedIn, but terms-of-service, GDPR, and CCPA obligations still apply to how you store and use it. This is not legal advice.

Run these requests yourself

Every example on this page is a real call to the SocialLens API. A new account starts with 250 free reads, no card needed, and a read that fails is never charged.

Keep reading