Rate Limit Error #179480
Replies: 5 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.
|
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:
|
|
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. |
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
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?
All reactions