Analytics API
Account-level rollups, per-video and per-stream breakdowns, creator summary, revenue-oriented stats, and country geography rollups. Every endpoint is scoped to the API key owner.
Account analytics
Rollups for videos, streams, views in a rolling period, plus storage from quota.
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" \
"https://api.dcast.pro/api/v1/analytics/account?period=30d"period is parsed as a day count (e.g. 30 or 30d — the numeric prefix is used for the rolling window).
Response shape:
{
"success": true,
"data": {
"period": "30d",
"videosCount": 47,
"streamsCount": 12,
"viewsCount": 184213,
"storage": {
"usedBytes": 12345678901,
"limitBytes": 53687091200,
"availableBytes": 41341412299,
"usedPercent": 23,
"formatted": { "used": "11.5 GB", "limit": "50.0 GB", "available": "38.5 GB", "reserved": "0 B" },
"warnings": { ... }
},
"_legacy": { "videos": { "total": 47 }, "streams": { "total": 12 }, "views": { "total": 184213 } }
}
}videosCount and streamsCount are scalar counts. The names videos / streams are reserved for actual list endpoints (see below).
Compatibility aliases (same response shape): GET /account/analytics → /analytics/account, GET /summary → /analytics/summary, GET /stats → /analytics/stats.
Summary & stats
/analytics/summary — compact creator dashboard numbers: tier count, active subscribers, MRR-style rollup, video sales totals.
/analytics/stats — deeper revenue breakdown (monthly/annual splits, video sales, currency).
Both need a FULL_ACCESS key or the finance:read permission; other keys get 403 FINANCIAL_SCOPE_REQUIRED.
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" "https://api.dcast.pro/api/v1/analytics/summary"
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" "https://api.dcast.pro/api/v1/analytics/stats"Top videos (list)
Caller's top-N videos by the chosen metric.
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" \
"https://api.dcast.pro/api/v1/analytics/videos?period=30d&sortBy=views&page=1&limit=20"
# Response
{
"success": true,
"data": {
"videos": [
{
"id": "...",
"title": "...",
"thumbnailUrl": "https://...",
"durationSec": 612,
"publishedAt": "2026-05-20T12:00:00.000Z",
"views": 18421,
"likes": 314,
"comments": 42,
"watchTimeSec": 184213
}
],
"period": "30d",
"sortBy": "views",
"truncated": false,
"catalogTotal": 47,
"pagination": { "page": 1, "limit": 20, "total": 47, "pages": 3 }
}
}Query params: period — 7d | 30d | 90d | all (default 30d); sortBy — views | likes | comments | watchTime (default views; case-insensitive; watchTime ranks by watchTimeSec); page default 1; limit 1–100, default 20. Invalid values → 400 BAD_REQUEST with error.field.
Top streams (list)
Caller's top-N streams sorted by total viewers in the period.
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" \
"https://api.dcast.pro/api/v1/analytics/streams?period=30d&page=1&limit=20"
# Response
{
"success": true,
"data": {
"streams": [
{
"id": "...",
"title": "...",
"thumbnailUrl": "https://...",
"status": "OFFLINE",
"durationSec": 7200,
"peakViewers": 4218,
"totalViewers": 18421,
"totalWatchTimeSec": 9210500,
"startedAt": "2026-05-22T18:00:00.000Z",
"createdAt": "2026-05-20T09:00:00.000Z"
}
],
"period": "30d",
"truncated": false,
"catalogTotal": 12,
"pagination": { "page": 1, "limit": 20, "total": 12, "pages": 1 }
}
}Query params: period — 7d | 30d | 90d | all (default 30d); page default 1; limit 1–100, default 20.
Per-resource analytics
Drill into a single video or stream. Owner-scoped — foreign or deleted ids return 404 NOT_FOUND.
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" \
"https://api.dcast.pro/api/v1/analytics/videos/{videoId}?period=30d"
# Response — views + watch-time rollups (seconds)
{
"success": true,
"data": {
"videoId": "cmpm…",
"period": "30d",
"totalViews": 421,
"totalWatchTime": 124800,
"avgWatchTime": 296,
"viewsByDay": { "2026-05-21": 12, "2026-05-22": 18 },
"geography": { "United States": 184, "Germany": 71 },
"qualityBreakdown": { "1080p": 300, "720p": 121 }
}
}curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" \
"https://api.dcast.pro/api/v1/analytics/streams/{streamId}"
# Response — lifetime rollups (seconds)
{
"success": true,
"data": {
"streamId": "9c283f07…",
"totalViews": 612,
"peakViewers": 318,
"totalWatchTime": 502452,
"avgWatchTime": 821,
"duration": 4521,
"geography": { "United States": 184, "Germany": 71 }
}
}Query params (videos): period — a day count such as 7d, 30d or 90d (default 30d; all is not supported here and falls back to 30 days). Streams return all-time rollups for the stream's lifetime; for live tail data prefer the SSE endpoints in Streams API.
Geography
Aggregated country-level views across all your videos. This endpoint returns a summary — not a paginated list — so the response carries a _note sentence saying so. countries holds the top 20; cities and regions are always empty (reserved).
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" \
"https://api.dcast.pro/api/v1/analytics/geography"
# Response
{
"success": true,
"data": {
"countries": [
{ "country": "United States", "views": 84213 },
{ "country": "Germany", "views": 31204 },
{ "country": "Ukraine", "views": 18421 }
],
"totalViews": 184213,
"cities": [],
"regions": [],
"_note": "Summary aggregate (top 20 countries). Not paginated — cities and regions are reserved for future expansion."
}
}Security & scope
All analytics endpoints are scoped by creatorId = (caller's userId). You can never see another creator's rollups or per-resource breakdowns. pk_* keys cannot access platform-wide aggregates and cannot read raw per-viewer event logs — only the sanitized counts and country rollups shown above.
Related Documentation
For stream creation and management see Streams API. For monetization and payments see Monetization API.
Roadmap
Session-level and user-journey endpoints are not available yet. See Roadmap.
