When does Google Apps Script reset the daily quota? - google-apps-script

Daily quotas for Google services are described here. For example 100 email recipients per day. How is "day" defined when evaluating the quota? Does the quota get reset when it's midnight in my time zone? Or in Greenwich? Or do they count the statistics of the past 24 hours with a sliding time window?

For Apps Script it's seems no resource to get such info.
But you can check Google Cloud quotas help page to get an idea on how Google calculates per day quotas:
For per-day rate quotas: The Current usage is the total usage for far in the current 24-hour period for day-rate quotas.
Also see this related questions on when non-Apps Script quotas reset:
When does the daily error limit for the analytics API reset?
Google API: Quota Limit Reset Times and Timezone

The answer you are looking for is currently written here in this reference article:
Limits per day are applied over a rolling 24-hour period, not a set time of day.
So basically, quota limits are restored over a set of 1-24 hours starting from the recent period that it was depleted.
And, aside from that, these quota limits are not subject only to App Script, rather than the service quota it uses by their Google Service is all used by their designated quota reserve as explained here:
Note: In addition to the Apps Script quotas, some features have quotas created by the Google product they're associated with. A use of a product feature in Apps Script depletes all associated quota reserves. A feature becomes unavailable if any of the associated quotas are reached.
Side note:
As mentioned by CizRanger, the two conditions below are the requirements needed for you to increase your quota limits if you are using a Google Workspace account:
Your domain has cumulatively paid at least USD 100 (or equivalent)
At least 60 days have passed since reaching that payment threshold

This is a really good question!
Based on my experience the Quota reset for certain quotas is reset within 24 hours right after the last run of your script.
Moreover, you need to keep in mind that if you have a trial Google Workspace (After you convert from a free trial account to a paid subscription) this means that you need to:
1-Your domain has cumulatively paid at least USD $100 (or equivalent).
2-At least 60 days have passed since reaching that payment threshold.

Related

Quota on time-based gscript tiggers

I have got a script that I need to run periodically (preferably once every half hour). I have made an hourly trigger, but I'm not sure of the limitations on how many times this can be run in a day without hitting the quota for my standard Gmail account.
I have found the "Quotas for Google Services" page, however, I'm not sure what category it falls under and therefore how many triggers I can have daily.
Regarding the use of triggers, from https://developers.google.com/apps-script/guides/services/quotas
Feature
Consumer (e.g., gmail.com) and G Suite free edition (legacy)
Google Workspace accounts
Triggers total runtime
90 min / day
6 hr / day
Please bear in mind that other quotas might apply too.

Service invoked too many times for one day: urlfetch - Pretty sure quota not exceeded

we use a custom script to retrieve data from Bookeo API with UrlFetchApp.fetch. ยต
Everything went well but today, we have the following error "Service invoked too many times for one day: urlfetch"
We are aware of the limitation of 20.000 calls/day as mentionned here https://developers.google.com/apps-script/guides/services/quotas, but we don't think that we come close to this (maybe 1.000 - 1.500/day max)
The portion of the code where the error happen is
var responseBooking = UrlFetchApp.fetch(urlBooking);
So i'm sure it's related to quota issue
The weird thing is it's working like 1 time / 5-6 try
My questions are :
has Google changed it's quota limitation? (I didn't see any communication about it)
Is there a way to see how many calls was made for each service?
Is there a sort of chat for technical support for Google Apps Script?
Answer(s):
has Google changed it's quota limitation? (I didn't see any communication about it)
No.
Is there a way to see how many calls was made for each service?
No.
Is there a sort of chat for technical support for Google Apps Script?
No.
More Information:
Aside from the 20,000 calls/day limit, there are also limits which restrict the number of calls in short periods of time.
The quota works based on a rolling average of service invocations. You have a quota of 20,000 per day, but if you exceed the rate of ~0.231 calls per second (20,000/86,400) for a sustained period of time, you can still trigger an error.
You can rectify this by waiting for a while so that the impulse of invocations goes down. I would also suggest adding some form of exponential backoff to your code to stop this from happening again in future.
References:
Quotas for Google Services | Apps Script | Google Developers
Exponential backoff - Wikipedia

Google fit API quotas and limitation

Is there a quotas and request limitation when using google fit api? I want to use the google fit api and I'm curious if there is a limitation when using it.
You may check your project's Fitness API current limit of in the Google Developer Console. As I've checked my current project, the default limits are:
86,400 Queries per day
500 Queries per 100 seconds per user
1,000 Queries per 100 seconds
Daily quotas reset at midnight Pacific Time (PT). You can request more quota limits or view quotas for your other services on the Quotas page, found in IAM & admin.

New Google Maps Platform - How do I set my own usage limits?

In their notifications about the new billing system for the Google Maps APIs, Google very clearly state that you "can set usage limits to protect against unexpected increases". However, I haven't found any documentation regarding how to set these usage limits against an API key. Does anyone know how to do this?
To clarify, I would like to set my own daily usage limits against my API key to prevent it ever going over the free threshold for the static maps API.
I understand Google means that you can set your custom daily quota for each individual API in order to stay within free 200$, not a global per API key/project/Billing account daily quota. As far as I know there is no such thing as limit per daily usage in $ per Billing account yet.
There are alerts that you can establish in your Billing account and receive notifications if your usage is close to the defined budget. Have a look at the following document that explain how to set alerts:
https://cloud.google.com/billing/docs/how-to/budgets?hl=en
If your project uses only Static Maps API, it is easy to set daily quota to stay within 200$ per month. The price sheet says that you can have up to 100 000 free requests per month. That means 100 000 / 31 = 3225 free requests per day. You can go to Quota section of Static Maps API in your project
https://console.developers.google.com/google/maps-apis/apis/static-maps-backend.googleapis.com/quotas?project=YOUR_PROJECT_ID&duration=PT1H
and change your daily quota as shown in my screenshots
edit number requests per day
and you are set.
I hope this helps!
OK a bit late for reply, but maybe somebody else can use this.
You do get tons of free map hits etc.
If you don't link a pay account, then you are limited to 1 hit per day (that's google maps) which is useless. All other quotas like 10000 per 100 sec etc are secondary to the 1 hit per day.
Now once you have linked your pay account or a Credit Card etc, to google development console then you get full quota for free user, plus more if you go over your quota covered by your Credit Card.
However don't panic, for first year it's all free and you get $300 (at this moment) worth of free stuff.
Even if you go over this limit Google will first ask you if you wish to change to payment system or continue with free.
If you decide to pay then you will be charged per indicated on google dev site.
If you decide to go with free option then the service to your site will stop until next rotation, i.e. day or month etc depending on service.
see this table.
Unless you have millions of hit on your map page or app, then the free quota is more than enough for normal sites.
Here is a price calculator by google.
As you see you get a lot of unlimited stuff and some paid if you go over your recurring credit of $200 or $300
Google makes it so complicated because it involves people coming from old system and those registering between roll over etc.
perhaps this will help too.
You can also set budgets and alerts just in case you go over budget (via Billing section of dev site)
So in short :) you get tons of free and if you have a lot of visitors the surely you make some money to pay for the services.
Note that google charges for all their API services in 1 place so if you use say Geocoding and firebase and cloud dev etc then you will soon start paying.
Sorry for any typos, I did this fast.
Capping API Usage
Depending on the API, you can explicitly cap requests in a variety of ways, including: requests per day, requests per 100 seconds, and requests per 100 seconds per user.
You might want to limit the billable usage by setting caps. For example, to prevent getting billed for usage beyond the free courtesy usage limits, you can set requests per day caps.
For more info, check this doc: https://cloud.google.com/apis/docs/capping-api-usage

If i add places by my app

My app needs show some places by add javascript.
I read the places api just now,but i had a confusion: if i add many places by my server,can other people see it on my app immediately?and How did google charge for it
Yes, if you have your API KEY people will see the changes immediately.
about the charges for use;
The Google Places API Web Service enforces a default limit of 1,000 free requests per 24 hour period, calculated as the sum of client-side and server-side requests. If your app exceeds the initial limit, the app will start failing. You can increase this limit free of charge, up to 150,000 requests per 24 hour period.
The maximum limit for free usage is 150,000 requests per 24 hour period. If your app exceeds the limit, the app will start failing again. Purchase a Google Maps APIs Premium Plan license to get more than 150,000 requests per 24 hour period.
and more you can read from here.