GitHub Code Search API avatar

GitHub Code Search API

Pricing

Pay per usage

Go to Apify Store
GitHub Code Search API

GitHub Code Search API

Search public GitHub code and export structured code-hit records for developer research, package discovery, code intelligence, and technical lead generation.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Automly

Automly

Maintained by Community

Actor stats

0

Bookmarked

4

Total users

3

Monthly active users

a day ago

Last modified

Share

GitHub Code Search API helps you find public code snippets, files, and repository context from GitHub code search results. Use it for dependency discovery, implementation research, package intelligence, security review, and technical lead generation.

Why use this actor?

This actor turns GitHub code search into structured dataset rows you can filter, enrich, and route into AI workflows. It is useful when you need to discover how a library is used, find examples across repos, or identify code patterns in public projects.

Features

  • Search public GitHub code with flexible search queries
  • Filter by repository, language, filename, and path
  • Return repository context alongside each code hit
  • Capture text-match snippets when GitHub provides them
  • Optional token input for higher API limits and more reliable repeat runs
  • Pay-per-event pricing aligned to successful code-hit records only

Input

{
"query": "requests language:Python",
"maxResults": 20
}

Search inside a specific repository

{
"query": "api key",
"repo": "psf/requests",
"filename": "README.md",
"maxResults": 10
}

Input fields

  • query (string, required): GitHub code search query.
  • maxResults (integer): maximum code hits to return, capped at 100.
  • language (string): optional language qualifier appended to the search query.
  • repo (string): optional repository filter in owner/name format.
  • filename (string): optional filename filter.
  • path (string): optional path filter.
  • token (string): optional GitHub token stored as a secret when used.

Output

Sample record:

{
"recordType": "code-hit",
"query": "requests language:Python",
"repositoryFullName": "psf/requests",
"repositoryUrl": "https://github.com/psf/requests",
"repositoryDescription": "Python HTTP for Humans.",
"repositoryStars": 53500,
"repositoryForks": 9700,
"repositoryOwnerLogin": "psf",
"repositoryOwnerType": "Organization",
"fileName": "__init__.py",
"filePath": "requests/__init__.py",
"htmlUrl": "https://github.com/psf/requests/blob/main/requests/__init__.py",
"gitUrl": "https://api.github.com/repos/psf/requests/git/blobs/...",
"apiUrl": "https://api.github.com/repos/psf/requests/contents/requests/__init__.py",
"score": 1,
"language": "Python",
"matchedText": "..."
}

Use cases

  • Find real examples of how a library or API is used
  • Build developer prospecting lists from public code context
  • Research competitors, patterns, and implementation styles
  • Enrich AI prompts with source code examples
  • Monitor new code mentions of your product or package

Limits and caveats

  • GitHub search has public API limits, and unauthenticated requests are more constrained.
  • The actor returns public code search results only.
  • Very broad queries can return many matches; narrow the query for the best signal.

Pricing

This actor uses pay-per-event pricing:

EventPriceWhen it's charged
code-hit-produced$0.001 / itemPer code hit successfully produced

You pay only for results returned by the actor.

FAQ

Do I need a GitHub token?

No, but using a token improves reliability and rate limits for repeated runs.

Can I search a single repository?

Yes. Use repo:owner/name or the repo input field.

What if my run charge limit is reached?

The actor stops gracefully after the last chargeable result and keeps already produced items.