Search code examples
google-apiyoutube-apiyoutube-data-api

Why does Google's YouTube Data API v3 "Queries per day" Quota increase more than I'm calling it?


I have the default 10,000 queries per day. I added some careful debugging output to my program that's making calls to see exactly how many calls I'm making:

https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 21 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 2 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 39 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 16 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 1 channelId
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 8 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 37 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 11 channelIds

total search = 8
total channels = 8 calls with 21+2+39+16+1+8+37+11 = 135 channelIds

8 + 8 + 135 = 151

I only made 16 http requests, 8 to search and 8 to channels. The id field in channels call is a comma separated list of ids. So counting each of those as another "hit" that's 135 more for the total of 151.

But, after running this my quota reported 808 hits from my 10,000 limit! Why the huge delta between what I'm calling and the quota hit?

Each one has maxResults set to 50, do I get charged for each result back vs each http call?


Solution

  • Correction you have 10000 units per day. Which does not mean that you can make 10000 requests.

    The YouTube Data API uses a quota system to ensure that developers use the service as intended and do not create API clients that unfairly reduce service quality or limit access for others.

    Projects that enable the YouTube Data API have a default quota allocation of 10,000 units per day, an amount sufficient for the majority of our API users. You can see your quota usage on the Quotas page in the API Console.

    As you can see the YouTube api is cost based each request implies a cost against your total quota.

    For example. The search.list method costs 100 points to make the request.

    Which give you 10000 / 100 = 100

    You can make 100 requests before you run out of quota.

    Useful links: