Get YouTube daily views
Returns daily view counts for a YouTube video including views, watch time, and subscriber changes. Requires yt-analytics.readonly scope (re-authorization may be needed). Data has a 2-3 day delay. Max 90 days, defaults to last 30 days.
API key authentication - use your Zernio API key as a Bearer token
In: header
Query Parameters
The YouTube video ID (e.g., "dQw4w9WgXcQ")
The Zernio account ID for the YouTube account
Start date (YYYY-MM-DD). Defaults to 30 days ago.
dateEnd date (YYYY-MM-DD). Defaults to 3 days ago (YouTube data latency).
dateResponse Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.analytics.getYouTubeDailyViews({ query: { videoId: 'video_abc123', accountId: 'account_abc123', },});console.log(data);{
"success": true,
"videoId": "dQw4w9WgXcQ",
"dateRange": {
"startDate": "2025-01-01",
"endDate": "2025-01-12"
},
"totalViews": 12345,
"dailyViews": [
{
"date": "2025-01-12",
"views": 1234,
"estimatedMinutesWatched": 567.5,
"averageViewDuration": 45.2,
"subscribersGained": 10,
"subscribersLost": 2,
"likes": 89,
"comments": 12,
"shares": 5
},
{
"date": "2025-01-11",
"views": 987,
"estimatedMinutesWatched": 432.1,
"averageViewDuration": 43.8,
"subscribersGained": 8,
"subscribersLost": 1,
"likes": 67,
"comments": 8,
"shares": 3
}
],
"lastSyncedAt": "2025-01-15T12:00:00Z",
"scopeStatus": {
"hasAnalyticsScope": true
}
}{
"error": "videoId is required"
}{
"error": "Unauthorized"
}{
"error": "Analytics add-on required",
"code": "analytics_addon_required"
}{
"error": "Access denied to this account"
}{
"success": false,
"error": "To access daily video analytics, please reconnect your YouTube account to grant the required permissions.",
"code": "youtube_analytics_scope_missing",
"scopeStatus": {
"hasAnalyticsScope": false,
"requiresReauthorization": true,
"reauthorizeUrl": "https://accounts.google.com/o/oauth2/auth?client_id=..."
}
}{
"success": false,
"error": "string"
}Get YouTube channel-level insights GET
Returns channel-scoped aggregate metrics from YouTube Analytics API v2. Saves you from looping /v1/analytics/youtube/daily-views over every video when you only need channel totals. Response shape matches /v1/analytics/instagram/account-insights so the same client handling works. Requires yt-analytics.readonly scope (412 with reauthorizeUrl if missing). Data has a 2-3 day delay (endDate is clamped accordingly). Max 89 days, defaults to last 30 days. Requires the Analytics add-on. NOT exposed: impressions (Studio thumbnail impressions) and impressionsClickThroughRate. YouTube Analytics API v2 does not expose these for any principal type, not channel owners, not Partner Program channels, not content owners with CMS access. The only way to get them is Studio CSV export. This is a Google-side limitation.
Get YouTube demographics GET
Returns audience demographic insights for a YouTube channel, broken down by age, gender, and/or country. Age and gender values are viewer percentages (0-100). Country values are view counts. Data is based on signed-in viewers only, with a 2-3 day delay. Requires the Analytics add-on.