Stack Overflow API quota limits for authenticated versus anonymous requests
0 reputation · 30 Jul 2021, 01:51 UTC
0 reputation · 30 Jul 2021, 01:51 UTC
The Stack Overflow API implements tiered rate limiting to manage traffic across its endpoints. While the API provides headers such as X-Api-Quota-Limit and X-Api-Quota-Remaining to track usage in real-time, the specific thresholds differ based on the authentication method used for the request.
There is a documented distinction between unauthenticated requests and those utilizing an OAuth token. However, the exact delta in daily request quotas and the behavior of the API when transitioning from an anonymous state to an authenticated state during a single session remains unclear.
What are the specific daily request limits for unauthenticated clients compared to OAuth-authenticated clients? Does the API apply a separate IP-based limit in addition to the token-based quota?
35275 reputation · 30 Jul 2021, 13:39 UTC
For the current Stack Exchange API (v2.3), the daily request ceiling is:
In addition, the API enforces a per‑second burst limit of 10 requests per second for anonymous traffic and 20 requests per second for authenticated traffic. These burst limits are reflected in the X-RateLimit-Remaining header on each response.
The IP‑based 300‑request cap applies only to anonymous traffic. Once a valid key or OAuth token is presented, the request is governed solely by the key’s quota; the originating IP no longer limits the daily count. However, the per‑second burst limit still applies to all traffic regardless of authentication.
You can confirm the limits by inspecting the response headers of any successful request. Here’s a quick curl example for each case:
# Anonymous request – no key or token
curl -i "https://api.stackexchange.com/2.3/questions?order=desc&sort=activity&site=stackoverflow"
# Authenticated request – include your key or OAuth token
curl -i "https://api.stackexchange.com/2.3/questions?order=desc&sort=activity&site=stackoverflow" \
-H "Authorization: Bearer <YOUR_OAUTH_TOKEN>"
Look for the following headers in the response:
X-RateLimit-Limit – the maximum number of requests allowed in the current window.X-RateLimit-Remaining – how many requests you have left.X-RateLimit-Reset – the UTC timestamp when the counter will reset (midnight UTC).Example output for an anonymous call:
HTTP/1.1 200 OK
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 298
X-RateLimit-Reset: 1707993600
And for an authenticated call:
HTTP/1.1 200 OK
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9998
X-RateLimit-Reset: 1707993600
429 Too Many Requests response until the reset time.X-RateLimit-Remaining to avoid exceeding the 10,000‑request ceiling.These figures come from the publicly documented behavior of the API’s latest stable release. The Stack Exchange team may adjust limits in future updates, so keep an eye on the official FAQ and changelog. If you notice discrepancies, double‑check the headers on a fresh request or contact the API support team for clarification.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.