Skip to main content
ScrapingRabbit

Blog · · 4 min read

Get YouTube Channel Stats With an API

Read a YouTube channel as JSON: subscribers, total views, video count, join date and links. Turn a @handle into a channel ID. Code, fields and limits.

A channel page holds a few numbers that people compare all the time: subscribers, total views and how many videos there are. Brands use them to vet creators, and analysts use them to track growth. This guide shows how to read them with a single GET request, and how to find a channel's ID from its handle.

Request a channel

Send the channel as a @handle, a link, or an ID that starts with UC. Every call needs an API key. New accounts get 100 free credits and a first key is created automatically on sign-up (it is shown once on the dashboard). Sign in at scrapingrabbit.com/login, then send the key in the x-api-key header (a Bearer token also works). The code below reads it from the SCRAPINGRABBIT_API_KEY environment variable, so no key is ever written into your code.

curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/youtube/channel?channel_id=@mkbhd"

A successful call costs 1 credit, as the OpenAPI file lists it. Only public information is returned.

A shortened real answer, read on 3 December 2026. The full answer is much longer, so we kept the fields this guide uses:

{
  "success": true,
  "data": {
    "about": {
      "subscribers": 21500000,
      "videos": 1871,
      "views": 5935220067,
      "joined_date": "Mar 21, 2008",
      "links": [
        { "title": "Twitter", "link": "http://twitter.com/MKBHD" },
        { "title": "Instagram", "link": "http://instagram.com/MKBHD" }
      ]
    },
    "channel": {
      "id": "UCBJycsmduvYEL83R_U4JriQ",
      "title": "Marques Brownlee",
      "handle": "http://www.youtube.com/@mkbhd",
      "subscribers": 21500000,
      "videos": 1871,
      "keywords": "MKBHD MarquesBrownlee Marques Brownlee",
      "is_family_safe": true
    }
  }
}

The answer also has the channel description, an avatar and banner address, the countries where it is available, and the video sections shown on the channel page. We left those out to keep the example short.

What the fields mean

FieldMeaning
about.subscribersSubscriber count, rounded by YouTube for large channels
about.videosNumber of public videos
about.viewsTotal views across the channel
about.joined_dateThe day the channel was created
about.linksThe links the owner put on the channel page
channel.idThe channel ID, which starts with UC
channel.titleThe channel name
channel.handleThe channel's @handle address
channel.keywordsThe keywords the owner set

Read it in code

async function channelStats(channel) {
  const url = `https://api.scrapingrabbit.com/v1/youtube/channel?channel_id=${encodeURIComponent(channel)}`;
  const res = await fetch(url, { headers: { "x-api-key": process.env.SCRAPINGRABBIT_API_KEY } });
  const body = await res.json();
  if (!body.success) return null;

  const { channel: info, about } = body.data;
  return {
    id: info.id,
    title: info.title,
    subscribers: about.subscribers,
    viewsPerVideo: Math.round(about.views / Math.max(about.videos, 1)),
  };
}

console.log(await channelStats("@mkbhd"));

The code divides total views by the number of videos to get an average per video, and it uses Math.max(about.videos, 1) so a channel with no videos does not cause a division by zero. For the channel above that gives about 3.17 million views per video, a number you can compare across channels of different sizes.

The same in Python:

import os
import requests

res = requests.get(
    "https://api.scrapingrabbit.com/v1/youtube/channel",
    params={"channel_id": "@mkbhd"},
    headers={"x-api-key": os.environ["SCRAPINGRABBIT_API_KEY"]},
    timeout=60,
)
body = res.json()
if body["success"]:
    about = body["data"]["about"]
    print(about["subscribers"], about["videos"], about["views"])

Find the channel ID from a handle

Some tools and databases want the UC ID, not the handle. The resolve endpoint turns one into the other for 1 credit:

curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/youtube/resolve?handle=@mkbhd"

A real answer, read on 3 December 2026:

{
  "success": true,
  "data": {
    "channel_id": "UCBJycsmduvYEL83R_U4JriQ",
    "title": "Marques Brownlee",
    "handle": "http://www.youtube.com/@mkbhd"
  }
}

It needs a handle that starts with @, or a link that contains one. Channels with no handle cannot be looked up this way. You do not need it just to read a channel, since the channel endpoint accepts the handle directly.

Things to plan for

  • Counts are a snapshot. They change constantly, so store the time you read them.
  • Large counts are rounded. YouTube rounds big numbers, so figures are close but not exact.
  • Hidden subscriber counts show as unavailable. Check for that before you do math on the field.
  • The answer can be large. It includes the channel's video sections, so parse only the fields you need.
  • Rate limits and credits. Each key is limited per minute: 10 requests on the free plan, 60 on Starter, 120 on Pro and 300 on Scale. Every successful call costs credits, so cache each channel, since the numbers move slowly.
  • Always check success. A failed request returns success: false, a code such as RATE_LIMITED or INVALID_API_KEY, and a message. Failed calls are not charged.

Try it without code

The free YouTube channel viewer works in the browser with no key and shows these fields for any public channel. The free channel ID finder turns a handle into the ID.

Try it yourself

Frequently asked questions

Can I use a @handle instead of the channel ID?

Yes. The channel endpoint accepts a @handle, a channel link, or a channel ID that starts with UC. If you need the ID itself, the resolve endpoint turns a handle into one.

Is the subscriber count exact?

No. YouTube rounds large counts, so the number is close but not exact. A channel that hides its subscriber count shows it as unavailable.

Do I need to be signed in to YouTube or own the channel?

No. Only public information is returned, so there is no login and the channel owner is not told.

More guides