Skip to main content
A concise guide to understanding and managing GitHub API rate limits. This covers the two types of limits GitHub enforces, how to check your current usage, best practices to avoid throttling, and examples for authenticating with a Personal Access Token (PAT) and fetching repository content.

Types of GitHub API rate limits

GitHub enforces two kinds of rate limits to keep the API stable and responsive.
  • Primary rate limits — apply to both authenticated and unauthenticated requests and are counted per hour.
    • Unauthenticated requests (tied to the requestor’s IP) are limited to 60 requests per hour.
    • Requests authenticated with a Personal Access Token (PAT) are generally allowed up to 5,000 requests per hour.
    • GitHub Apps, or enterprise-owned apps, may receive higher primary limits (for example, around 15,000 requests per hour).
A screenshot of the GitHub Docs page (dark theme) showing the REST API "Rate limits" documentation, including a left navigation menu and content about primary rate limits for authenticated users. The browser window and tabs are visible across the top.
  • Secondary rate limits — applied in addition to primary limits to protect the API from abusive or costly patterns. You may hit secondary limits when you:
    • Make too many concurrent requests,
    • Make a short burst of requests that require heavy compute,
    • Make too many requests per minute to the same endpoint, etc.
A dark-mode screenshot of the GitHub Docs REST API page titled "About secondary rate limits," showing the left navigation menu and article text describing concurrent-request and per-endpoint limits. The browser tabs and address bar are visible across the top.

How to check your current rate-limit status

You can monitor rate-limit status in two ways:
  1. Inspect the rate-limit response headers on every API response.
  2. Call the GET /rate_limit endpoint to get resource-specific limits.
Use the dedicated endpoint:
A typical unauthenticated JSON response (truncated):
Common rate-limit headers present on every response:
Quick reference table for the main X-RateLimit-* headers:
Inspect the X-RateLimit-* headers on every API response for quick monitoring. Use the GET /rate_limit endpoint when you need a full, resource-specific snapshot (core, search, graphql, etc.).

Best practices to avoid hitting rate limits

  • Avoid frequent polling — use webhooks when possible.
  • Reduce concurrency — limit simultaneous requests from a single client.
  • Use conditional requests (ETag + If-None-Match) to avoid downloading unchanged resources.
  • Batch requests where applicable and cache responses.
  • Authenticate API requests using a PAT, GitHub App, or OAuth token to increase your primary limits.
A dark-theme screenshot of the GitHub Docs page titled "Best practices for using the REST API," showing guidance such as "Avoid polling" and "Make authenticated requests" with a left navigation sidebar. The page includes links, a table of contents on the right, and code/header examples.

Increase your primary limits: generate a Personal Access Token (PAT)

Create a PAT from your GitHub account: Settings → Developer settings → Personal access tokens. For details see Creating a personal access token. Example: authenticated call to GET /rate_limit (replace YOUR_TOKEN):
After authenticating, the core limits and X-RateLimit-* response headers should show higher quotas (for PATs typically x-ratelimit-limit: 5000).

Fetch repository content (example)

Fetch a file from a repository with the contents endpoint — replace values as needed:
Typical file response (includes Base64-encoded content):
Decode Base64 content locally:

Actions REST APIs and SAML-protected organizations

When calling Actions endpoints (for example GET /repos/{owner}/{repo}/actions/runs), ensure your token has the required scopes and access to the repository:
If the repository belongs to an organization that enforces SAML single sign-on (SSO), you must explicitly grant your PAT access to that organization. Otherwise, API calls to organization-protected resources will be denied with a 403 response like:
If an organization enforces SAML SSO, grant your Personal Access Token access to that organization after generating it — otherwise API calls to organization-protected resources will fail with a 403.

Summary

  • Monitor usage via the GET /rate_limit endpoint and the X-RateLimit-* response headers.
  • Authenticate with a PAT, GitHub App, or OAuth token to increase primary rate limits (PATs typically get ~5,000 requests/hour).
  • Follow best practices (avoid polling, reduce concurrency, use conditional requests) to avoid primary and secondary limits.
  • If you access organization-protected resources and the organization uses SAML SSO, remember to grant your PAT access to the organization.
For more details, see: Granting PATs to an organization and strategies to avoid SAML-related access issues are discussed in a separate article.

Watch Video