I am working on a program to do some calculations with ad revenue from YouTube. I have set up OAuth 2.0 through the cloud console and have gotten access and refresh tokens that have the following scopes:
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/yt-analytics.readonly
https://www.googleapis.com/auth/yt-analytics-monetary.readonly
Making this request returns a valid response
https://youtubeanalytics.googleapis.com/v2/reports?ids=channel==123456789&metrics=views&dimensions=&startDate=1970-01-01&endDate=2050-01-01
{
"kind": "youtubeAnalytics#resultTable",
"columnHeaders": [
{
"name": "views",
"columnType": "METRIC",
"dataType": "INTEGER"
}
],
"rows": [
[
301
]
]
}
However, if I add estimatedAdRevenue
as a metric using the same authentication, the response is a 403.
{
"error": {
"code": 403,
"message": "Forbidden",
"errors": [
{
"message": "Forbidden",
"domain": "global",
"reason": "forbidden"
}
]
}
}
Because the query is successfully getting private data (view count), my assumption is that the 403 is because my channel is not monetized, but I can not find that anywhere in the documentation. My end-goal is to get a report of estimated ad revenue per video and I'm pretty sure that getting past this 403 is exactly what I need.
I was correct - the 403 is caused by not being a YouTube Partner and access to monetization.