api-umbrella icon indicating copy to clipboard operation
api-umbrella copied to clipboard

Suggested header: X-RateLimit-Period

Open benhealy opened this issue 8 years ago • 4 comments

When dealing with rate limits, we have X-RateLimit-Remaining to tell us how many requests we have left.

Unfortunately it is up to guesswork as to what period the remaining requests apply to, so we have to sleep for a guessed period, then make another request to find out whether the limit has renewed or is still in place.

What would be useful is another header (suggested name X-RateLimit-Period) that indicates the Date/Time that the count is reset to zero.

benhealy avatar Jul 31 '17 03:07 benhealy

@benhealy: Sorry for the delay, but thanks for the suggestion. I like this idea. Not sure when we'll get to it, but pull requests welcome.

One note on naming is that I think what you describe is more frequently referred to as X-RateLimit-Remaining (not that it's a real standard, but I think I've seen that more frequently, for example in GitHub's API: https://developer.github.com/changes/2013-07-02-rate-limit-reset/).

GUI avatar Oct 13 '17 04:10 GUI

Is your feature request related to a problem? Please describe. The API offers X-RATE-Limit and X-RATE-Remaining, but no X-Rate-resetAt.

Describe the solution you'd like The headers should include a X-Rate-ResetAt.

Describe alternatives you've considered The value could be a unix timestamp or a zoned date time.

Additional context X-Rate-resetAt is very valuable in case someone is reaching the limit, but it also fully specifies the rate limit per period. Currently, the information on the rate limit is 1,000 / unknown time period.

Nosferican avatar Oct 18 '19 17:10 Nosferican

FYI there's an ongoing work for standardizing ratelimit headers under HTTP, that is supported by various implementors and governments. See:

  • https://tools.ietf.org/html/draft-polli-ratelimit-headers-03
  • https://github.com/ioggstream/draft-polli-ratelimit-headers
RateLimit-Limit: 100
RateLimit-Remaining: 50
RateLimit-Reset: 60 <-- delta-seconds, like Retry-After

ioggstream avatar Jan 21 '20 09:01 ioggstream

For the long duration (30 days), it's hard to tell when the rate limit will be reset and doesn't seem to be working properly. Anyone knows where each rate limit's starting date is stored?

onaralili avatar Jan 19 '22 23:01 onaralili