Execute a grep-style regex search over the source code of a public package. This endpoint is useful for deterministically finding specific code patterns in packages before implementing solutions that use external dependencies. Supports multiple package registries including npm, PyPI, crates.io, and Go modules.
API key must be provided in the Authorization header
Package registry to search
crates_io, golang_proxy, npm, py_pi "npm"
Name of the package to search
"react"
Regex pattern to search for in the package source code
"useState|useEffect"
Specific version to search (optional, defaults to latest)
"18.2.0"
Language filter for search results
"TypeScript"
SHA256 hash of specific file to search in
Number of lines after each match to include
Number of lines before each match to include
Number of lines before and after each match to include
Maximum number of results to return
10
Format of the output results
content, files_with_matches, count