Rate Limit Error #179480
Replies: 4 comments 3 replies
-
|
No, your current plan with a single Personal Access Token (PAT) will fail in production. The Search API has a much stricter rate limit of 30 requests per minute. The 5,000 requests/hour limit you see is for the core API (like getting repo info), not for search. Your entire user base would share that tiny 30/minute limit, and your app would be rate-limited almost instantly. Here are the correct solutions for a production app:
1 User: 30 requests/minute 1,000 Users: 30,000 requests/minute (30 for each user) This allows your app to scale with your user base.
|
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
To build a production app using the GitHub Search/Commit and Search/Code REST APIs, you'll need to consider the rate limits, which are much stricter for search endpoints compared to other GitHub API operations. As you noted, the 5,000 requests per hour rate limit applies to core API endpoints (like repository data), but for the search API, the limit is only 30 requests per minute per Personal Access Token (PAT). This means your current setup with a single PAT will likely fail in production once your user base grows, since the rate limit is shared across all users. Here are the recommended solutions:
|
Beta Was this translation helpful? Give feedback.
-
|
The rate limit for the Search API is much lower than for other GitHub operations. Using a single Personal Access Token (PAT) doesnβt work well as your number of users grows, because everyone shares the same limit of 30 requests per minute on that token. For production applications, the best option is to build a GitHub App. Each installation of the app gets its own 30 requests per minute limit, so you can scale according to how many users install it. Itβs also helpful to use caching for repeated queries, even if it wonβt cover every search your users make. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Hi team,
Iβve been using the GitHub Search/Commit and Search/Code REST APIs. Is it possible to use these APIs in a production application? Weβre planning to build some apps where, whenever a user submits a query, we use these REST APIs to fetch content from GitHub.
According to the official documentation, one approach is to hold the response until the API rate limit resets, but this negatively impacts the user experience. Weβre currently using a Personal Access Token (PAT) under an enterprise account, which i believe provides a limit of 5,000 requests per hour.
Are there any alternative suggestions for using these REST APIs in a production setup with a larger number of users?
Beta Was this translation helpful? Give feedback.
All reactions