Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YouTube Data API is counting too many requests

For the last few weeks, the YouTube Data API (v3) is showing a significant increase in requests. In fact, we hit the 50k quota limit every day, which means that requests in the afternoon/evening tend to fail with a quota exceeded error:

quota chart

However, this usage count is not correct. We use a single API key for making requests to the YouTube API, and the Google Cloud API counter only shows ~2k uses per day for that API key.

All requests to our server endpoint that calls the YouTube API also pass through Cloudflare, which similarly shows <2k requests per day.

We just make a single request to www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&... – is it possible that these requests count as multiple queries? Or is there any other reason that could explain the incorrect query counts? Thanks!

like image 956
Philipp Legner Avatar asked Oct 14 '25 14:10

Philipp Legner


1 Answers

This is a recurrent issue with the YouTube Data API quota system, that is caused by confusing terms used within Google's cloud console.

You have to acknowledge that YouTube's Data API quota system is not accounting for the number of queries one is making. Instead, the API attaches to each kind of its endpoint a quota cost, and, thus, is accounting for the sum of quota cost of all endpoint calls one is making.

Moreover, inspecting the quota costs page I mentioned above (or the official doc page of the endpoint for that matter), you'll see that the Search.list API endpoint is quite expensive: 100 units of quota cost.

Consequently, to reach a quota cost of 50000 units, your app has to issue only 500 calls to Search.list (this amounts on average to approximately one call at every three minutes per day).

like image 83
stvar Avatar answered Oct 17 '25 20:10

stvar