12

According to How API Keys Work, the default daily API limit -- which is per site, per day -- is 300.

I started with 300, as expected, but over a period of days, I've noticed that the remaining quota has now been whittled down to about 70 something:

{
"items":
    [
        { "user_id":0000,"display_name":"abc","account_id":00000 }
    ],
    "quota_remaining":70,"quota_max":300,"has_more":false
};

Even after the UTC reset today, the quota remaining is still the same. Is this a one time thing where when I use all of this up, that's it, I'm done for good, or is this a bug?

What's more, this doesn't in fact seem to be counting per-site, as I can change the site query parameter to any site on the network, and the count still decreases, as if this is not in fact measured per site, but instead, network-wide:

https://api.stackexchange.com/2.1/users?order=desc&sort=reputation&inname=abc&site=serverfault&filter=!*MxJcsxUhQG*kL8D&callback=test

As an aside, I don't believe I'll need an API key, since the app I'm building makes requests on behalf of each individual user, and since I really don't picture ever hitting the 300 daily cap since I'm caching the data in chrome.storage.local.

This assumes, of course, that the 300 cap is in fact a daily cap and not a lifetime cap. Otherwise, my users would be able to use this for a limited time, until their own lifetime quotas have been exceeded.

Is this a bug, or am I going to need to use even heavier caching, like writing data to a file on the users' filesystems? (euuuuughh - shivers at the thought...)


Two days later, I checked my quota again by hitting the API. It now says 299 out of 300, so it looks like it's been reset. It's currently Nov 8, 7:38 AM UTC, so I'll wait until it rolls over again and do another test.


It's now currently Nov 9, 6:25 AM UTC, and I just hit the API for the first time since my last edit, and I have 297 out of 300 remaining. Is this a bug, or does the quota not reset every 24 hours as documented?


Today is Nov 10, 4:08 AM UTC, and hitting the API today results in a refreshed quota. It does reset, but it doesn't appear to be resetting every 24 hours at 12:00 AM UTC.

1
  • 4
    I just encountered this. It was reset some time between 2015-01-31T20:02:45.579Z and 2015-01-31T20:06:00.431Z for me today. It's a bit hard to schedule the API requests when you don't know at what time it is reset... Jan 31, 2015 at 20:12

1 Answer 1

4

Update: Evidence now suggests that the API quota rolls over at a unique time for each app. 24 hours after that app-key, plus IP, combination made its first API call.
See this chat message.



The quota does reset every 24 hours, but the time seems to wander is custom for every app-instance. Some years ago, I seem to remember it resetting around midnight UTC, but it doesn't anymore.

Recently, the SmokeDetector bot started logging when its quota reset. Here are the logged times so far:

Day and Time (UTC)      Log entry
------------------      --------------
Dec 23  6:04 PM         API quota rolled over with 2001 requests remaining.
Dec 22  6:04 PM         API quota rolled over with 2014 requests remaining.
Dec 21  6:04 PM         API quota rolled over with 2851 requests remaining.
Dec 20  6:04 PM         API quota rolled over with 4665 requests remaining.
Dec 19 11:36 AM         API quota rolled over with 2580 requests remaining.
Dec 18 11:36 AM         API quota rolled over with 2824 requests remaining.
Dec 17  ???             Site + API + Bot glitch.  Rollover not certain.
Dec 16  5:06 PM         API quota rolled over with 1030 requests remaining.
Dec 15  5:05 PM         API quota rolled over with  900 requests remaining.
Dec 14  5:05 PM         API quota rolled over with 1896 requests remaining.
Dec 13  5:05 PM         API quota rolled over with 5506 requests remaining.
Dec 12  5:05 PM         API quota rolled over with 4118 requests remaining.
Dec 11  5:05 PM         API quota rolled over with 2598 requests remaining.
Dec 10  5:05 PM         API quota rolled over with 1640 requests remaining.
Dec  9  5:05 PM         API quota rolled over with 1624 requests remaining.
Dec  8  5:04 PM         API quota rolled over with 1981 requests remaining.
Dec  7  5:04 PM         API quota rolled over with 2866 requests remaining.
Dec  6  5:04 PM         API quota rolled over with 4596 requests remaining.

As you can see, the reset times tend to stay constant for a few days, then jump to a new time, then stay constant again. A "punctuated equilibrium".
We've yet to ascertain any rhyme or reason to it.
We now know that the time changes correspond with changes to the IP/server that the app was running on.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .