YouTube API Quotas, please explain. Quota exceeded. How to solve?
Asked Answered
D

1

11

Can someone please explain me in simple language how these quotas work?

I know where is a similar question, but I want an explanation related to the screenshot below.

First, I opened the quotas page in Google Dev Console for YouTube API.

But I don't understand what these lines are and how they work, why there are several lines?

enter image description here

For example, I was trying to make a simple request like this

https://www.googleapis.com/youtube/v3/search?part=snippet&q=welcome&type=playlist&key=[MY_API-KEY]

Which returns me a json response:

{
  "error": {
    "code": 403,
    "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
    "errors": [
      {
        "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
        "domain": "youtube.quota",
        "reason": "quotaExceeded"
      }
    ]
  }
}

So, I assume it gives me an error because somewhere there is a quota = zero, because I only tried to make this request once.

What should I do to get rid of this error and be able to use the API?

Thank you.

Diestock answered 17/3, 2021 at 13:16 Comment(0)
V
12

project based quotas

The YouTube data api is a cost based quota as opposed to a request based quota.

With request based quotas you are given a quota of say 10000 requests that you can make, each request you make removes one from your quota.

The YouTube data api is a cost based quota. This means you are given a quota of say 10000 points which you can spend on requests. Each requests has a different cost.

uploading videos costs around 1600 points against your request so you can upload a limited number of videos yet list only costs 50 so you could do more lists then uploads before running out of quota.

I recommend having a look at the quota calculator which will help you understand the cost of each request against your quota allotment.

This video may also help you understand cost based quotas YouTube API and cost based quota demystified

As far as the error you are getting from the following request

https://www.googleapis.com/youtube/v3/search

As search.list method costs 100 quota points each time you request it, this and the error message would suggest that you have exceeded your quota. You need to either apply for an extension or make fewer reqeusts.

How to check your current quota allotment:

Go to https://console.cloud.google.com/ -> library -> search for youtube data api -> quota

enter image description here

user based quotas.

Besides that there are also user based quotas which are the number of requests a user can make per second these are flood protection quotas.

Virus answered 17/3, 2021 at 13:24 Comment(13)
So, where do I see this information in Dev Console? Why there are multiple lines? Why I cannot make a request? Where is that parameter that says that I have no quota for making this request?Diestock
edited to give you an idea of where to find your quota allotment.Virus
Yes, I saw that page, but I dont understand it. For example I have 2 sections both named "Queries". Dont know what the difference is and why there are 2 sections. Also, for the first one I have "Queries per day" = 0, "Queries per minute per user" = 180,000 and "Queries per minute" = 1,800,000. If I have a 1,800,000 per minute, how can I have 0 per day?Diestock
Per user are user based queries, that's the number of queries a user can make per day. You have 0 because its a new project or an old project and you didnt apply for verification. Try clicking on the pencil icon and setting it to 10000, if that doesn't work you will need to apply for quota.Virus
Any examples of how to request based on userIp to use user quotas? I'm taking the public ip of the user's machine and passing it along with the http request, but that doesn't seem to work, as I've already had problems with quotas being exceeded. The request is a get that queries playlists and videos. I'm using jquery and ajax for the request.Roughish
It depends upon the language you are using its just an optional parm so adding quotas=xyz or userip=127.0.0.1. Remember depending upon which quota you hit it make take a while for it to reset its midnight west cost usa that some of them reset. I am also not sure this trick still works its a five year old question. Just request addional qouta.Virus
My language is Brazilian PortugueseRoughish
@LeonardoSilva programming Language. Portuguese is not a programming language.Virus
Sorry, there was no understanding. I'm making the requests in javascript and also in C#. This is an example of a request I've been making, with userip, but it hasn't had any effect: googleapis.com/youtube/v3/… in C#Roughish
Im not sure what effect you are expecting to see. Your still going to get quota errors. The initial quota is very small. There is also no documentation evidence that userip and quota user even work with the YouTube API, its not in the documentation at all. Only under the default parmsVirus
10,000 points is really very little. Why does Youtube keep this quota so low? It barely equates to 6 uploads per day. And the process of requesting a quota increase seems complicated. And Youtube/Google doesn't seem very responsive... Is there a way that a small application, made as part of a personal project, could request a quota increase? Have there been people who succeeded in increasing the daily quota?Geometrician
@Geometrician its a development quota used for development your not expected to use it for ever. Your expected to request an increase. Its not complicated just fill out a form and wait. Lots of people get it increased just ask.Virus
That's crazy, I am developing an app and ran out of quota after a couple of hours doing some refreshes to see changes. For some perverted reason search.list doesn't contain viewCount so I do 1 extra query to get it (with all the IDs) maybe that has a high credit use.Angora

© 2022 - 2024 — McMap. All rights reserved.