GitHub returns 403 for both permission errors and rate limits. The headers tell you which one you actually hit — and retrying the wrong one can get your integration banned.
GitHub returns HTTP 403 for two different conditions: a rate limit and a permission error. A rate limit has either a retry-after header, or x-ratelimit-remaining: 0, or an error message mentioning a rate limit. A 403 with none of those three signals is a permission problem — retrying it wastes calls and can get the integration banned.
| Status | Signal | Meaning | What to do |
|---|---|---|---|
| 429 | Any | Rate limited | Follow retry-after, or wait for reset |
| 403 | retry-after present | Secondary rate limit | Wait exactly that many seconds |
| 403 | x-ratelimit-remaining: 0 | Primary rate limit exhausted | Wait until x-ratelimit-reset (UTC epoch) |
| 403 | Message contains "rate limit" or "abuse detection" | Secondary limit, no retry header | Wait at least 60s, then exponential backoff |
| 403 | None of the above | Permission error — not a rate limit | Do not retry. Fix the token or scopes. |
403 with no retry-after, no x-ratelimit-remaining: 0, and no rate-limit language in the body is a permission problem. Retrying it wastes calls and, per GitHub's own docs, "continuing to make requests while you are rate limited may result in the banning of your integration."
GitHub's REST API allows 5,000 requests per hour for authenticated PATs, 60 per hour unauthenticated, and 1,000 per hour per repository for the GITHUB_TOKEN in Actions. GitHub App installations get 5,000 per hour plus 50 per repository and 50 per user above 20. The REST and GraphQL APIs have separate primary budgets.
| Authentication | Limit | Scope |
|---|---|---|
| Unauthenticated | 60 /hr | Per IP address |
| Personal access token | 5,000 /hr | Per user |
GITHUB_TOKEN in Actions | 1,000 /hr | Per repository |
| GitHub App installation | 5,000 /hr | +50/repo and +50/user above 20 |
Secondary rate limits protect against bursts and abuse, and none of them can be measured from the response. Concurrency is capped at 100 shared across REST and GraphQL. REST points are capped at 900 per minute, GraphQL at 2,000 per minute. GitHub's docs state these limits can change without notice and there is no way to check how close you are to them.
| Dimension | Limit | Notes |
|---|---|---|
| Concurrent requests | 100 | Shared across REST and GraphQL |
| REST points per minute | 900 | GET/HEAD/OPTIONS = 1 pt; POST/PATCH/PUT/DELETE = 5 pts |
| GraphQL points per minute | 2,000 | No mutation = 1 pt; with mutation = 5 pts |
| Content-generating requests | 80 /min · 500 /hr | Includes actions taken in the web UI |
| CPU time | 90 s / 60 s real | Approximate via total response time |
A primary rate limit returns HTTP 403 with x-ratelimit-remaining: 0 and a x-ratelimit-reset epoch timestamp. A secondary limit also returns 403 or 429, but the body mentions "secondary rate limit" or "abuse detection mechanism". The x-ratelimit-remaining header is often non-zero during a secondary limit.
HTTP/1.1 403 Forbidden
x-ratelimit-limit: 5000
x-ratelimit-remaining: 0
x-ratelimit-used: 5000
x-ratelimit-reset: 1770000000
x-ratelimit-resource: core
{
"message": "API rate limit exceeded for user ID 12345.",
"documentation_url": "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api"
}
GitHub's own guidance is to honour retry-after first, then x-ratelimit-reset if remaining is 0, and otherwise wait at least 60 seconds with exponential backoff. Continuing to call while rate limited can get the integration banned. The optimal retry loop returns None for a permission 403 — meaning "do not retry, fix the token."
import time, random, httpx
def github_wait_seconds(r, attempt):
if r.status_code not in (403, 429):
return None
ra = r.headers.get("retry-after")
if ra:
return float(ra)
if r.headers.get("x-ratelimit-remaining") == "0":
reset = int(r.headers.get("x-ratelimit-reset", "0"))
return max(reset - int(time.time()), 0)
body = r.json() if r.content else {}
msg = body.get("message", "").lower()
if r.status_code == 429 or "rate limit" in msg or "abuse" in msg:
return 60 * (2 ** attempt) + random.random()
return None
Conditional requests are the only technique on this page that makes a request free. Send If-None-Match with the stored ETag, or If-Modified-Since with Last-Modified. If the resource is unchanged, GitHub returns 304 Not Modified, and a 304 does not count against your primary rate limit. A polling job that touches 1,000 resources hourly costs 1,000 requests the first time and close to 0 after that.
What this is. A dated record of GitHub's published REST and GraphQL API rate limits, error shapes, and retry behaviour. Numbers are copied verbatim from GitHub's own documentation on the date shown. This page does not track you, does not ask for your email, and does not sell anything.
Source: docs.github.com — REST rate limits
Wrong or stale? Open an issue — corrections are the point.
← All APIs · Stripe · Slack