Adverity
Adverity

Reputation: 11

Youtube Data API channel reports returning 403 response for certain metrics

We've implemented the channel report for YouTube Data API in our platform as documented.

Basically, whenever we're requesting metrics such as adImpressions we receive a 403 status code error response.

{
  "error": {
    "code": 403,
    "message": "Forbidden",
    "errors": [
      {
        "message": "Forbidden",
        "domain": "global",
        "reason": "forbidden"
      }
    ]
  }
}

We are aware of YouTube restricting ad-related metrics, if no ads are purchased in a certain period of time. However, our client has verified that they've paid for the adverts. The account used for requesting these details also has manager permissions, if that's relevant.

This is the example CURL request:

curl --location 'https://youtubeanalytics.googleapis.com/v2/reports' \
--header 'accept: application/json' \
--header 'accept-encoding: gzip, deflate' \
--header 'user-agent: (gzip)' \
--header 'x-goog-api-client: gdcl/2.140.0 gl-python/3.9.18' \
--header 'content-length: 5866' \
--header 'x-http-method-override: GET' \
--header 'content-type: application/x-www-form-urlencoded' \
--header 'authorization: Bearer ***' \
--data-urlencode 'metrics=likes,adImpressions' \
--data-urlencode 'startDate=2025-01-01' \
--data-urlencode 'endDate=2025-01-31' \
--data-urlencode 'ids=channel==UCrQPfnt2X3fef95kqVqYqAA' \
--data-urlencode 'dimensions=video' \
--data-urlencode 'filters=video==yZ-na0KZWTs,7ftlK-E1UJE,W72sqFPo4Qo.....' \
--data-urlencode 'alt=json'

We've already tested to see that other metrics such as likes, dislikes, comments, views etc work.

However, whenever adImpressions is included as a metric, we get the error.

Upvotes: 1

Views: 12

Answers (0)

Related Questions