# How do I get a YouTube channel's subscriber count and stats through an API?

> Read a YouTube channel's subscribers, video count, total views, join date and country by @handle or channel ID, plus its latest videos' views. Price, Python, and the Data API's quota.

Canonical page: https://okdata.online/answers/youtube-channel-subscriber-count-api/

**Short answer: **Call YouTube channel profile with the @handle or the UC… channel ID: it returns subscribers and video count as YouTube shows them, and with view=full the channel's total views, the day it joined, its country and its About links, for $0.002 a channel. No Google Cloud project or API key is needed. If you already have one, the Data API's channels.list returns the same statistics for 1 quota unit per call, with subscriberCount rounded down to three significant figures.

A gaming-accessories brand keeps 60 YouTube channels on its sponsorship shortlist. Once a month the team updates subscribers, total views, join date and country for each, and checks how many views the latest uploads got, because an old channel's subscriber count often overstates who still watches. They have handles copied from channel links, not channel IDs.

## Profile: one call per channel

[YouTube channel profile](/apis/youtube/channels/get/) takes `username` (the handle, with or without @) or `id` (the 24-character channel ID that starts with UC).

| Field | Meaning |
|---|---|
| `followers` | Subscribers, as YouTube shows them on the channel |
| `posts` | Videos, as YouTube shows them |
| `name`, `bio`, `avatar_url`, `verified`, `url` | Channel details |
| `ext.views` | Total views of the channel |
| `ext.created_at` | The day the channel joined YouTube |
| `ext.country`, `ext.links`, `ext.banner_url` | Country, the links in its About section, banner |

The `ext` fields come with `view=full`. YouTube rounds both counts on the page (15.1M subscribers, 1.2K videos), so `followers` comes back as 15100000. Exact counts are not public.

## Recent views: one page of uploads

[YouTube channel videos](/apis/youtube/channels/videos/list/) lists a channel's uploads newest first, about 30 a page, with title, views, cover, length and roughly when each was published (YouTube says "3 weeks ago"). Add `type=short` for the channel's Shorts instead. The median views of the last 30 videos is a better reach figure than subscribers.

## Finding channels you don't know yet

[YouTube channel search](/apis/youtube/channels/search/) takes keywords and returns 20 channels a page with channel ID, name, the start of the description, avatar and subscribers, for $0.004 a page. Results carry no handle or verification badge; for the badge and the total views, pass the channel ID to the profile endpoint.

## A monthly sheet in Python

```python
import csv, datetime, os, statistics, requests

API = "https://api.okdata.online"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}

def get(path, **params):
    body = requests.get(API + path, headers=H, params=params, timeout=60).json()
    if body["code"] != "ok":
        raise RuntimeError(f"{body['code']}: {body['message']}")
    return body["data"]

today = datetime.date.today().isoformat()
with open("channels.csv", "a", newline="", encoding="utf-8") as f:
    w = csv.writer(f)
    for handle in ["mkbhd", "LinusTechTips", "veritasium"]:
        ch = get("/v1/youtube/channels/get", username=handle, view="full")["item"]
        vids = get("/v1/youtube/channels/videos/list", id=ch["id"])["items"]
        views = [v["metrics"]["views"] for v in vids if v["metrics"]["views"] is not None]
        w.writerow([today, handle, ch["id"], ch["followers"], ch["posts"], ch["ext"]["views"],
                    ch["ext"]["created_at"], ch["ext"]["country"],
                    int(statistics.median(views)) if views else ""])
```

## What it costs

| Job | Calls | Cost |
|---|---|---|
| One channel profile | 1 | $0.002 |
| 60 channels, profile and one page of videos | 60 + 60 | $0.24 |
| 100 channels found by keyword | 5 | $0.02 |
| 1,000 channel profiles | 1000 | $2.00 |

A handle or channel ID that does not exist comes back from the profile endpoint as `not_found`, charged like any lookup, and a call that fails at the data source is charged too. The video list cannot tell a missing channel from an empty one, which is why the script asks for the profile first and passes on its `id`.

## Limits

- Counts are rounded the way YouTube rounds them. A channel that hides its subscriber count has no public number, so check `followers` for null before you compare channels.
- Publish times in the video list are approximate, because YouTube shows them as "3 weeks ago". For an exact date and the like count of one video, use [YouTube video detail](/apis/youtube/videos/get/) at $0.002.
- The video list has one order, newest first. There is no most-viewed sort.
- There is no history. Keep a dated row per month, as the script does, to chart growth.

## The official YouTube Data API

With a Google Cloud project, `channels.list` with `part=statistics` returns `subscriberCount`, `viewCount` and `videoCount`, takes a comma-separated list of channel IDs or a `forHandle` in one request, and costs 1 quota unit per call. The default quota is 10,000 units a day, so for a fixed list of known channels it is the cheapest option and you should use it. Google's reference states that `subscriberCount` is rounded down to three significant figures and that `videoCount` counts public videos only. The quota is tighter for discovery: the default allocation includes 100 `search.list` calls a day. okdata fits when you do not want to run a project and keys, when you search for channels every day, or when an agent pulls the numbers alongside TikTok and X through the [MCP server](/mcp/). For one video's views, see [YouTube view counts](/answers/youtube-view-count-api/).

## Endpoints used

- [YouTube channel profile](https://okdata.online/apis/youtube/channels/get/) `youtube.channels.get`: $0.002 per call
- [YouTube channel videos](https://okdata.online/apis/youtube/channels/videos/list/) `youtube.channels.videos.list`: $0.002 per call · about 30 videos per page
- [YouTube channel search](https://okdata.online/apis/youtube/channels/search/) `youtube.channels.search`: $0.004 per call · about 20 accounts per page

## More about YouTube

- [YouTube API](https://okdata.online/apis/youtube/)
- [How to export YouTube comments for every video on a topic](https://okdata.online/guides/youtube-comments-export/)
- [How to get YouTube video transcripts from a keyword search](https://okdata.online/guides/youtube-video-transcript/)
- [How do I search YouTube channels by keyword and get their subscriber counts with an API?](https://okdata.online/answers/youtube-channel-search-api/)
- [How do I download transcripts for hundreds of YouTube videos at once?](https://okdata.online/answers/bulk-youtube-transcripts/)
- [How can I know what a social data job will cost before I run it?](https://okdata.online/answers/estimate-data-api-cost-before-running/)
- [How do I export YouTube comments to CSV or Excel?](https://okdata.online/answers/export-youtube-comments-csv/)
- [Is it legal to scrape public social media data?](https://okdata.online/answers/is-scraping-public-social-media-data-legal/)
- [Official platform APIs vs third-party data APIs (2026)](https://okdata.online/compare/official-apis-vs-data-apis/)
- [How to choose a social media data API (2026)](https://okdata.online/compare/social-media-data-apis/)

## Sources

Where people asked this (read 2026-11-15): 

- https://stackoverflow.com/questions/30723866
- https://stackoverflow.com/questions/69998628
- https://stackoverflow.com/questions/71271171

Updated 2026-11-15
