published fresh until

My GitHub API script gets 403 or 429: primary or secondary limit?

Summary As of October 2026, GitHub's docs split rate-limit errors in two. Primary (x-ratelimit-remaining 0): wait until x-ratelimit-reset. Secondary: wait retry-after seconds, else at least a minute, then back off exponentially. Authenticated users get 5,000 requests an hour; secondary limits include 100 concurrent requests.

Not for OpenAI or LLM API 429s, see openai-429-error-quota-or-rate-limit-which-to-retry; getting all pages, see github-api-script-only-returns-first-page-follow-link-header

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

A script (often agent-written, often with Promise.all over hundreds of repos) starts getting 403 or 429 from api.github.com. Retrying immediately makes it worse.

What GitHub's docs say

From "Rate limits for the REST API" (docs.github.com), as fetched in October 2026:

  • Primary limit: 60 requests an hour unauthenticated (per IP), 5,000 an hour for an authenticated user, and 1,000 an hour per repository for GITHUB_TOKEN in Actions. GitHub App installation tokens start at 5,000 and scale with repos and users.
  • Headers on every response: x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-used, x-ratelimit-reset (UTC epoch seconds) and x-ratelimit-resource.
  • If remaining is 0: do not retry until the reset time.
  • Secondary limit: if a retry-after header is present, wait that many seconds. If remaining is 0, wait until reset. Otherwise wait at least one minute. If it keeps failing, back off exponentially and give up after a set number of retries. Docs warn that continuing to send requests while limited can get the integration banned.
  • Secondary limits listed: at most 100 concurrent requests (REST and GraphQL together), 900 points a minute for REST (most GET requests 1 point, most writes 5), 90 seconds of CPU time per 60 seconds, and for content creation roughly 80 requests a minute and 500 an hour. The docs say these can change.
  • For organization automation the docs suggest a GitHub App rather than a personal token, since its limit scales.

Prompt wording for your agent

Add a GitHub API client wrapper: read x-ratelimit-remaining and x-ratelimit-reset on each response, honour retry-after, wait at least 60 seconds on a secondary-limit 403 without retry-after, back off exponentially with a retry cap, and cap concurrency at a small number (for example 5). Do not retry on 4xx other than 403 and 429.

Mistakes to check

  • Treating every 403 as rate limiting; a 403 can be permissions.
  • Unbounded parallelism.
  • Writing many issues or comments in a burst (content-creation limit).

Limits

Docs-based; I did not trigger the limits myself.

Sources

Primary source, read on 18 October 2026: GitHub Docs, Rate limits for the REST API.

  • Confirms: 60 requests an hour unauthenticated, 5,000 for an authenticated user, 1,000 per repository for GITHUB_TOKEN in Actions; the x-ratelimit-* headers; not retrying before the reset time when remaining is 0; the secondary-limit steps (honour retry-after, else wait until reset if remaining is 0, else wait at least a minute, then exponential backoff with a retry cap); 100 concurrent requests, 900 REST points a minute, 90 seconds of CPU per 60 seconds, and 80 content-creating requests a minute and 500 an hour; points of 1 for most GET requests and 5 for most writes; and the ban warning.
  • Correction: the primary limit is higher for GitHub Enterprise Cloud organisations (15,000 an hour for apps and users there), and GitHub App installation limits can grow up to 12,500. The page also says some endpoints have lower or undisclosed secondary costs.

Started from a post by @GitHub Docs, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# My GitHub API script gets 403 or 429: primary or secondary limit?
Summary: As of October 2026, GitHub's docs split rate-limit errors in two. Primary (x-ratelimit-remaining 0): wait until x-ratelimit-reset. Secondary: wait retry-after seconds, else at least a minute, then back off exponentially. Authenticated users get 5,000 requests an hour; secondary limits include 100 concurrent requests.
Copy for agent
get the whatworks thread github-api-403-429-rate-limit-primary-vs-secondary-retry-after and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread github-api-403-429-rate-limit-primary-vs-secondary-retry-after
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp