Search package or repository source text
Find literal text or regular-expression matches in a package or public repository. Results identify the matching files and lines, with optional surrounding lines and information about the enclosing function, class, or other symbol.
Use this endpoint to find usages, definitions, or a specific piece of code. For ranked search across multiple packages, repositories, or documentation sites, use POST /v1/searches.
Selector catalogue
Use the following selectors with the fields query parameter to choose which fields the response includes. See Choose what the response includes for details.
| Selector | Data | Default |
|---|---|---|
matches | Path, 1-based line number, exact line content, byte range and nullable file intent | Yes |
matches.context | Before/after line arrays; also selects matches and retrieves context | No |
matches.symbol | Nullable enclosing symbol; also selects matches and retrieves symbol details | No |
matches.* | Explicit bundle of all three groups | No |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Optional trimmed printable ASCII client name, maximum 80 bytes.
Optional trimmed printable ASCII client version, maximum 80 bytes.
Optional trimmed printable ASCII agent attribution, maximum 160 bytes.
Optional session attribution, maximum 128 printable ASCII bytes; malformed values are dropped.
Query Parameters
Finite comma-separated matches (default), matches.context, matches.symbol, matches.* union. Context and symbol imply matches. Unknown/empty/duplicate fields parameters and leaf selectors are rejected. At most 2048 decoded bytes.
Use the case-sensitive selectors in the catalogue. Order and duplicate selectors do not affect the result. ASCII whitespace around selectors is ignored. The decoded value is limited to 2048 UTF-8 bytes. Empty or unknown selectors and repeated fields query parameters return 400 VALIDATION_ERROR. A group does not include nested groups unless the catalogue says so; only listed wildcard bundles are supported.
2048Body
Required nonblank pattern, preserved verbatim; maximum 200 UTF-8 bytes, no NUL.
1 - 200Default false uses ASCII-only case folding; non-ASCII letters remain case-sensitive.
Common context count 0..10, default two when matches.context is selected. Explicit context input requires matches.context selection.
0 <= x <= 100..10 following lines; independently overrides context_lines.
0 <= x <= 100..10 preceding lines; independently overrides context_lines.
0 <= x <= 10Nonblank opaque cursor preserved unchanged. Bound to query parameters and resolved ref.
1Skip source-classified documentation when true.
Exclude intents after inclusion; same finite vocabulary as file_intent.
Source-owned file-intent vocabulary.
production, test, benchmark, example, generated, fixture, build, vendor Skip source-classified tests when true.
Case-insensitive extensions without leading dots, AND with path-selector union.
Inclusive intent: production, test, benchmark, example, generated, fixture, build or vendor.
production, test, benchmark, example, generated, fixture, build, vendor Repository-only branch, tag or SHA; omission preserves default-branch intent.
OR-ed glob array; braces/commas remain intact. Maximum 1000 combined path/prefix/glob selectors.
1000Default false excludes dotfiles and dot-prefixed segments.
Per-page match limit 1..1000, default 50.
1 <= x <= 1000Per-file cap 0..1000 within this page, default equals max_matches; zero disables per-file cap.
0 <= x <= 1000Literal substring by default; regex uses source-validated RE2, no lookaround/backreferences, content-index route requires a usable literal anchor.
literal, regex Package name, at most 255 UTF-8 bytes.
1Exact target-relative file or indexed directory; OR with prefix/globs.
1Literal prefix OR with path/globs; include trailing slash for directory boundary. Root-only dot is invalid.
1Package registry; required with name, exclusive with repository addressing.
Credential-free public GitHub, GitLab or Codeberg repository root; exclusive with package fields.
1Package version, at most 100 normalized bytes; omitted or blank means latest release.
One source indexing wait 0..60000 ms, default 20000; transport budget is added to the deadline.
0 <= x <= 60000Response
Qualified source grep page
Per-page binary files skipped, including invalid UTF-8.
x >= 0Source freshness; pending evidence is a typed error.
current, stale, provisional Per-page files considered after scope and filters.
x >= 0Per-page files actually scanned; content-index pruning can reduce this.
x >= 0Per-page files skipped for exceeding the source 5 MB limit.
x >= 0Exactly whether next_cursor is nonnull; false does not imply completeness.
Active source work reference; may accompany serveable evidence.
Required page matches in path then line order, including an empty array for zero hits.
Opaque continuation, null for complete or nonresumable deadline results.
Mandatory requested/resolved/served provenance.
Matches returned on this page, not a global total.
x >= 0Page caps and deadline qualification, retained for every selection.
none, max_matches, max_matches_per_file, deadline Distinct files contributing matches on this page.
x >= 0