Can I set a quota sub-limit per YouTube API Key? - youtube-api

I have two different apps using a single YouTube API quota and each one is using its own key.
Is there a way to define that Key A may use X% of the quota and Key B may use Y%?
It is easy to see metrics by API key, but I have not been able to find a way to set a limit per key.
Thanks!

Quota for the Google apis is based upon the project. So when you create a new project in Google cloud console. All clients wither they be web, installed, mobile clients as well as service accounts. This includes api keys will all be under the same quota allowance.
If you want to be able to analytics requests you should know that the metrics shown in google cloud console are estimations they are not prefect.
There is no way to limit how many requests each key can make or even each client can make.

Related

Multiple Google account to fetch YouTube Data to avoid free quota breach

I have a specific requirement to capture YouTube Channel video and all its related comments/replies description etc for multiple companies/customers.
I will easily breach the daily quota limit, if i use only one Google account to fetch the data through Youtube Data API.
Can i use multiple google account and utilize free credit, will this be a breach or consider a DDOS attack?
If you try using multiple Google projects (I think it's quite similar for multiple accounts even if it may have lenient triggers) you will have your projects suspended. More precisely you will receive this email:
Immediate action required: Your Google Cloud Platform / API project
YOUR_PROJECT_NAME (id: YOUR_PROJECT_ID) is being suspended
Dear Developer,
We have recently detected your Google Cloud Project YOUR_PROJECT_NAME
(id: YOUR_PROJECT_ID) has been circumventing our quota restrictions
via multiple projects acting as one and is violating our Terms of
Service. Your project YOUR_PROJECT_NAME (id: YOUR_PROJECT_ID) has been
suspended.
You can request here a free quota increase.
Otherwise as of today as the process above is quite long AFAIK, you can use my open-source no-key service:
To make any YouTube Data API v3 request without any key/using your quota you can use: https://yt.lemnoslife.com/noKey/YOUR_REQUEST
For instance you can use: https://yt.lemnoslife.com/noKey/videos?part=snippet&id=VIDEO_ID instead of https://www.googleapis.com/youtube/v3/videos?part=snippet&id=VIDEO_ID

Twitter v2 APIs: Accessing monthly tweet cap via API

My app invokes the Twitter v2 APIs to retrieve users tweets.
According to the Twitter Dev Portal I have a monthly tweet cap of 500,000 tweets that I can retrieve, and this UI tells me how much I've used.
However, is there any way to retrieve this data via an API?
This page seems to imply it's just via the UI, but I'm surprised there is no way to retrieve this via an API. Is there any such way even for v1?
v1.1 had no volume cap, but does have rate limits, which you can access via the HTTP headers on GET requests. POST requests are different, and managed at the user account level.
In v2, at the time of writing, there is currently no way to access the cap and volume data via the API - it is only available in the UI.

Does YouTube Data API billing change if the APIs are called from GCP server or AWS server?

I'm building an Android app which embeds YouTube videos. I'm confused on how the billing works for the YouTube Data API v3. Is it dependent on whether the APIs are called from GCP server or AWS server?
The YouTube Data API, is a free API Google does not charge you for accessing this API. You are free to use it. Therefore no billing account is needed in order to access this API.
You do have a quota which limits the number of request that you can make to the API over a period of time.
Useful links
Quota cost calculator
YouTube API and cost based quota demystified

Youtube data API quota on using the same google client on different devices

The current youtube API quota is 10,000 units/day.
So what if I created an app and this app has 100 copies installed on different 100 devices and all of them use different IPs, would the quota be 10,000 units/day for every device (1M/day) or the 10,000 units would be distributed among the different copies?
Note that the requests will be executed on different devices. this is an embedded app., not a cloud one.
10,000 units/day is project based, not user based. IP address won't affect anything.
As you can see from the above image on the Queries per minute per user is user based, and detected via ip address, sending the quotauser parameter along with the request or sending an authorization header containing an access token.
In order to get around your 10k quota in this manner you would need to create 100 projects on google developer console and create credietnals for each of those projects and then each project would have 10k quota. However the drawback would be trying to get 100 projects though the google verification process.
You could just request an extension of your quota if you need more quota. 😊
Additional Clarifications
API key Used to access public data only and identifies your application to google
Client id and client secrete used to create a access token, will identify both the application and the user to google once a user is authorized and you are sending an access token authorization header with your request.
The quotaUser and userIp parameters can only be used for anonymous requests with some Google apis this has changed recently i am not sure if it still works with YouTube api private calls. userIp allows you to send any ip address with the request, and QuotaUser allows you to send any string for example your internal user id for the user making the requests. In the past this allowed for some hacking / work around for the per user quotas.
None of the above information will really help you as the quota you are trying to get around is a project based quota and not a user based quota. Its detecting the project associated with your client id / api key (depending upon what you are using) changing the IP or generating a new client under your project isnt going to help.
Really just request more quota
There are two ways an app is identified by the API:
the API key that the app uses when invoking the API endpoints (for reading only public data), or
the credentials data (i.e. access token) the app makes use of when calling in various endpoints (for reading only public data pertaining to any YouTube channel, or, otherwise, for reading/updating/deleting public and/or private data pertaining the YouTube account/channel that granted permissions of operation to the respective app).
Therefore, from the point of view of the API, it doesn't really matter if you are running N different instances of your app (i.e. programs running on concrete computers). The API accounts for the quota consumption of a given project created through Google developers console.
In this context of an app (as a concrete program) running on several machines that share API keys and/or credentials data, I recommend warmly to get familiar with the content of the DTOS specifications.

Increase quota limit for YouTube API

I want to increase the quota limit for YouTube Data API v3.
When I go to this form - https://services.google.com/fb/forms/ytapiquotarequest
I can't submit it, because 'reCaptcha v1 is shutdown'
Google Team, fix this problem, please.
There's a hack. Create multiple API keys in the Google developer console:
And loop through the list of these API keys. Again this is not a permanent solution, but if your request is limited this might be useful.

Resources