Why does GitHub API /search/code return zero results when browser search works?
07:24 18 Mar 2025

I’m trying to fetch all files of a particular extension (in this case, *.zip files) across all repositories in an organization using the GitHub API.

If I use the GitHub web search directly in the browser, this works perfectly:

https://github.com/search?q=org:ORGNAME+path:*.zip&type=code

I can see 27 results on the web UI.

However, when I try to use the API:

curl -H "Authorization: Bearer " "https://api.github.com/search/code?q=org:ORGNAME+path:*.zip"

I get:

{ "total_count": 0, "incomplete_results": false, "items": [] }

The token has all required scopes, and I am authenticated.

github github-api