GET /v1/youtube/stats

YouTube channel stats API: average views and top videos by handle

Returns figures over the videos we have stored for one channel: how many (tracked_videos), total, average, median and max views, average duration, total likes and comments, average engagement rate, and the top 5 videos by views. Send q as an @handle or UC… channel id. The numbers cover the stored videos, not the channel's full history, and a channel we never crawled is a 404.

Price
$0.0010 per call
Batch
Yes, through /v1/batch
Failed calls
Not charged

Example request

curl
curl 'https://api.virev.ai/v1/youtube/stats?q=mkbhd' \
  -H "Authorization: Bearer $VIREV_API_KEY"
python
import os
import requests

response = requests.request(
    "GET",
    "https://api.virev.ai/v1/youtube/stats",
    params={
        "q": "mkbhd",
    },
    headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
print(response.json())

Parameters

NameInTypeDescription
q requiredquerystringYouTube @handle (case-sensitive), UC… channel id, or a youtube.com/@handle / /channel/UC… URL. Example mkbhd.

Example response

The example response of the API reference.

json
{
  "data": {
    "username": "mkbhd",
    "followers": 21100000,
    "tracked_videos": 30,
    "total_views": 106800000,
    "avg_views": 3560000,
    "max_views": 7300000,
    "median_views": 3700000,
    "avg_length_seconds": null,
    "top_videos": [
      {
        "youtube_video_id": "kBX5WH9b4M4",
        "title": "Macbook Neo Impressions: Reincarnated!",
        "views": 7300000,
        "length_seconds": null,
        "thumbnail_url": null
      },
      {
        "youtube_video_id": "eFUB_jL_XcM",
        "title": "So This is Peak Foldable",
        "views": 6400000,
        "length_seconds": null,
        "thumbnail_url": null
      }
    ]
  },
  "meta": {
    "cost": "$0.0010",
    "balance": "$0.7922",
    "request_id": "req_03e2cbfb2c088a8eebed5f7187097c5e"
  }
}

How it works

Performance analytics over a channel's tracked videos: tracked count, total/avg/max/median views, average duration, total likes/comments, average engagement rate, and the top 5 videos by views. Numbers describe the tracked corpus (tracked_videos), not the channel's full history; legacy sparse fields remain null.

Errors

StatusWhen
400The request parameters are invalid.
401Missing, malformed, or revoked API key.
402Balance is too low for this request.
404Channel not in the tracked corpus.
429Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged.
502The upstream fetch failed. You are not charged.
503Billing could not be confirmed, so no upstream data was returned.
504The upstream request timed out. You are not charged.

Guides that use this endpoint