Skip to main content
POST
Find literal text in source and hosted docs

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-GitHits-Client-Name
string

Optional client attribution: trimmed printable ASCII, at most 80 bytes. Invalid optional values are dropped.

X-GitHits-Client-Version
string

Optional client-version attribution: trimmed printable ASCII, at most 80 bytes. Invalid optional values are dropped.

X-GitHits-Agent
string

Optional agent attribution: trimmed printable ASCII, at most 160 bytes. Invalid optional values are dropped.

X-GitHits-Session-ID
string

Optional caller-defined session ID: one to 64 ASCII letters, digits, underscores or hyphens, preserved exactly. Supply the header at most once. Invalid supplied IDs return 400 INVALID_SESSION_ID; no session is created.

Required string length: 1 - 64
Pattern: ^[A-Za-z0-9_-]{1,64}$

Body

application/json

One bounded grep page. Unknown, duplicate and null controls are rejected.

pattern
string
required

Required 1–200 UTF-8 bytes, without NUL. Whitespace is meaningful; JSON maxLength is not a UTF-8 byte bound.

Required string length: 1 - 200
targets
object[]
required

Ordered operands, 1 through 20. Producer expansion supports at most eight repository scopes and eight site scopes; split larger searches into separate requests.

Required array length: 1 - 20 elements
context_lines_after
integer<int32>
default:0

Independent following context count, 0 through 10; default 0.

Required range: 0 <= x <= 10
context_lines_before
integer<int32>
default:0

Independent preceding context count, 0 through 10; default 0.

Required range: 0 <= x <= 10
cursor
string

Opaque continuation; repeat identical targets in the same order and matching controls. Blank starts page one.

ignore_case
boolean
default:false

Default false is case-sensitive. True uses producer Unicode case folding.

max_matches
integer<int32>
default:100

Page-wide occurrence budget, 1 through 1000, default 100.

Required range: 1 <= x <= 1000
pattern_type
enum<string>
default:regex

Default regex uses RE2 with a literal anchor; set literal for plain text.

Available options:
regex,
literal
wait_timeout_ms
integer<int32>
default:0

First-page preparation wait, 0 through 210000 ms, default 0. Continuation never waits. Timeout does not stop preparation.

Required range: 0 <= x <= 210000

Response

One bounded page with searched, unvisited and unavailable scopes, safety evidence and exact reads

One bounded mixed-scope page with honest coverage and exact reads.

hits
object[]
required

Occurrences on this page, tagged as repository or site evidence.

Matched source or hosted page, discriminated by its physical kind.

next_cursor
string | null
required

Opaque continuation. Repeat identical ordered targets and matching controls.

targets
object[]
required

Every dispatched physical scope, including scopes not yet visited.

total_matches
integer<int64>
required

Number of occurrences returned on this page, not a total across pages.

Required range: x >= 0
traversal
enum<string>
required

Coverage state; inspect readiness and skipped content before concluding no matches.

Available options:
complete,
resumable_limit,
non_resumable_partial,
failed,
cursor_expired
unavailable_targets
object[]
required

Requested inputs omitted from searched scopes, with recovery guidance.