Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

APIs and integrations

GitHub REST API Primary vs Secondary Rate Limits and Which Header to Obey

In short

The primary limit is an hourly allowance set by how you authenticate, such as 60 requests unauthenticated or 5,000 with a personal access token. Secondary limits cap bursts: 100 concurrent requests, 900 REST points a minute, 90 CPU seconds a minute and content creation. The x-ratelimit headers describe the primary limit; retry-after belongs to secondary ones.

What is the difference between primary and secondary rate limits on the GitHub REST API?

A primary limit is a per-hour request allowance. GitHub works it out from the way you authenticate, and every response carries headers that show how much of it is left.

A secondary limit is a guard against bursts and expensive traffic. It does not count requests per hour. It looks at how many requests are in flight, how many points you spend per minute, how much CPU time you cause and how much content you create.

Both kinds of limit answer with a 403 or a 429. That is why a client cannot tell them apart from the status code alone, and why the headers matter more than the status.

Checked against: source 1

Which primary limit applies to my credential?

The number depends on what signs the request, not on the endpoint. These are the cases the REST rate-limit article lists.

Who makes the requestPrimary limit per hour
Unauthenticated (tied to the originating IP address)60
Personal access token, or a GitHub App or OAuth app acting for a user5,000, shared across all of them
GitHub App or OAuth app owned or approved by a GitHub Enterprise Cloud organization, acting for a member15,000
GitHub App installation token, not on Enterprise Cloud5,000 plus 50 per repository beyond 20 and 50 per org user beyond 20, capped at 12,500
GitHub App installation token on an Enterprise Cloud organization15,000
OAuth app using its client ID and secret for public data5,000 per app (15,000 if the app is owned by an Enterprise Cloud organization)
GITHUB_TOKEN in GitHub Actions1,000 per repository (15,000 for Enterprise Cloud resources)

Checked against: source 1

Why can one app drain my personal access token budget?

A user's 5,000 budget is shared by their personal access tokens and by any app acting on their behalf. GitHub's own example is an app with a 15,000 limit that makes 10,000 requests for you. That leaves your personal access tokens with nothing, even though the app still has 5,000 requests of its own.

So a script that works alone can start failing the day an integration is authorized on the same account. Check which credential is spending the budget before you raise any limit.

Two buckets sit outside this table. Git LFS has its own limit per minute, and the search endpoints have a custom limit separate from the main one. The rate-limit status endpoint reports them under their own names, such as core, search and graphql.

Checked against: source 1, source 3

What do the secondary limits measure?

GitHub lists six triggers. Treat them as separate meters, because one request can push several of them at once.

  • Concurrency: no more than 100 concurrent requests, shared between the REST and GraphQL APIs.
  • Points: no more than 900 points a minute for REST endpoints and 2,000 for GraphQL.
  • CPU time: no more than 90 seconds per 60 seconds of real time, of which at most 60 may be GraphQL. GitHub says you can estimate it from total response time.
  • Compute: requests that use excessive compute in a short time are limited. No number is published.
  • Content creation: generally no more than 80 content-generating requests a minute and 500 an hour. Some endpoints are lower, and actions in the web interface count too.
  • OAuth tokens: no more than 2,000 access token requests an hour for GitHub Apps and OAuth apps.

Checked against: source 1

How are points counted?

Most REST GET, HEAD and OPTIONS requests cost 1 point. Most POST, PATCH, PUT and DELETE requests cost 5. GraphQL costs 1 without mutations and 5 with them.

At those rates 900 points a minute is about 900 reads or about 180 writes. That arithmetic is mine, from the two docs numbers, and it holds only for endpoints with the default cost. GitHub says some REST endpoints have a different cost that is not shared publicly.

GitHub also says these limits can change without notice and that you may hit one for undisclosed reasons. Do not hard-code them as constants.

Checked against: source 1

Which response header tells my client what to do?

The five x-ratelimit-* headers describe the primary limit. They are limit, remaining, used, reset (UTC epoch seconds) and resource. There is no way to read the state of a secondary limit, so the only signal you get is the error and, sometimes, retry-after.

I would write the retry handler in this order, which follows GitHub's own rules.

  • On a 403 or 429, read retry-after. If it is present, wait that many seconds.
  • If x-ratelimit-remaining is 0, wait until the x-ratelimit-reset time. This is the primary-limit case.
  • If neither header helps, the message names a secondary limit. Wait at least one minute, then lengthen the wait exponentially and give up after a set number of retries.
  • GitHub warns that continuing to send requests while rate limited may get the integration banned.

Checked against: source 1, source 2

How do I stay under both limits?

For the primary limit, authenticate, and send conditional requests. Most endpoints return an etag, which you send back as if-none-match. A 304 does not count against the primary limit when the request carried an Authorization header. If a response includes x-poll-interval, wait at least that many seconds before polling again. Better still, use webhooks instead of polling.

For secondary limits, send requests one at a time through a queue and pause at least one second between POST, PATCH, PUT or DELETE requests.

Do not build pacing on an exact remaining count. Values can differ between responses because GitHub serves requests from several regions. The headers win over GET /rate_limit, which does not count against the primary limit but can count against a secondary one.

Checked against: source 1, source 2, source 3

What do the docs not say?

They give no threshold for the compute limit and no cost for the endpoints with undisclosed point values. They publish no way to check a secondary limit in advance.

This page also leaves out the GraphQL primary limit, the search endpoints and GitHub Enterprise Server. Read the GraphQL and search pages before you plan around those.

Checked against: source 1, source 3

What else do people ask?

Does a GitHub rate limit error always use status 429?

No. GitHub documents both <code>403</code> and <code>429</code> for primary and secondary limits, so read the headers and the message instead of the status code.

Can I check how close I am to a secondary limit?

No. GitHub states there is no way to check the status of a secondary limit. <code>GET /rate_limit</code> covers the primary buckets only.

Does calling GET /rate_limit use up my allowance?

It does not count against the primary limit, but it can count against a secondary limit, so do not call it in a tight loop.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. This page compares GitHub's own documents, fetched on 19 Nov 2026. I did not send test requests to GitHub for it, so nothing here is a measurement. It does not cover the GraphQL primary limit, search endpoints, GitHub Enterprise Server or any limit GitHub does not publish. Found a mistake? Tell me.

Keep reading

Next step

Have a project in mind?

Tell me about it. A discovery call within 48 hours.