- Component
YouTube Analytics API
- Description
I am using the YouTube Analytics API to retrieve the peakConcurrentViewers
metric. I need to confirm if this metric can be obtained for archived live streams. I receive a 403 Forbidden error when attempting to retrieve this data.
Scope
API request with parameters used
GET https://youtubeanalytics.googleapis.com/v2/reports?ids=channel==MINE&metrics=peakConcurrentViewers&filters=video==-1aevWQtSZk&startDate=2024-06-01&endDate=2024-06-30
- Result
{
error: {
code: 403,
message: 'Forbidden',
errors: [ { message: 'Forbidden', domain: 'global', reason: 'forbidden' } ]
}
}
- Expected result
{
"kind": "youtubeAnalytics#resultTable",
"columnHeaders": [
{
"name": "peakConcurrentViewers",
"columnType": "METRIC",
"dataType": "INTEGER"
}
],
"rows": [
[
100
]
]
}
- Incidentally, if peakConcurrentViewers is changed to views, the response is returned correctly
- Is it 100% reproducible?
Yes, it occurs every time.
- Reproducible API explorer link
https://developers.google.com/apis-explorer/#p/youtubeAnalytics/v2/youtubeAnalytics.reports.query?ids=channel==MINE&metrics=peakConcurrentViewers&filters=video==-1aevWQtSZk&startDate=2024-06-01&endDate=2024-06-30
curl \
'https://youtubeanalytics.googleapis.com/v2/reports?endDate=2024-06-30&filters=video%3D%3D-1aevWQtSZk&ids=channel%3D%3DMINE&metrics=peakConcurrentViewers&startDate=2024-06-01&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed