Skip to content

GitHub API limits

This page documents the hard limits of the GitHub Code Search API that affect github-code-search. Understanding them helps you craft effective queries and plan your usage.

Result limits

LimitValueNotes
Max results1,000 itemsHard cap — GitHub returns at most 10 pages × 100 items/page for code search
Max paginationPage 10GitHub hard cap for the code search endpoint
Max query length256 charactersQueries exceeding this length are rejected by the API
Fork repositoriesExcluded by defaultAdd fork:true to the query string to include forks
Min query length≥ 1 non-qualifier termA query consisting only of qualifiers (e.g. language:TypeScript) is rejected

Stay under 1,000 results

If your query matches more than 1,000 files, github-code-search will only see the first 1,000. Use qualifiers (language:, path:, filename:) to narrow the results. See Search syntax for examples.

Rate limits

ScenarioLimit
Unauthenticated requests10 requests/minute
Authenticated (with GITHUB_TOKEN)30 requests/minute

github-code-search always authenticates with GITHUB_TOKEN. Each paginated search call consumes one request. A query returning 1,000 results requires 10 requests (10 pages × 100 items).

Rate limit exceeded

If the 30 req/min limit is reached, github-code-search surfaces a GitHub API error 403 or 429. Retry after the reset time indicated in the error output, or break the query into multiple narrower searches.

Query syntax constraints

ConstraintDetail
No regular expressionsCode search uses exact string and qualifier matching — regex patterns are not supported
Max boolean operators5 AND / OR / NOT per query
NOT operatorSupported for keyword exclusions (e.g. useFeatureFlag NOT deprecated)
Qualifier-only queriesNot allowed — at least one non-qualifier search term is required

NOT vs issue/PR search

The NOT operator is supported in GitHub Code Search, but its behaviour differs from issue/PR search. For code search, use it to exclude keywords — for example useFeatureFlag NOT deprecated, SECRET NOT filename:test.

Pagination behaviour

github-code-search automatically fetches all available pages (up to page 10) using the GitHub Code Search REST API with per_page=100. Results from all pages are aggregated before being shown in the TUI or printed.

If 1,000 results are returned and the last page is full, there may be additional results that are silently truncated by GitHub. Refine your query to avoid hitting the ceiling.

Official documentation

Released under the MIT License.