Skip to main content
GET

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 session attribution: trimmed printable ASCII, at most 128 bytes. Invalid optional values are dropped; no session is created.

Query Parameters

registry
enum<string>

Package registry, required with name; mutually exclusive with repo_url.

Available options:
npm,
pypi,
hex,
crates,
vcpkg,
zig,
nuget,
maven,
packagist,
rubygems,
go,
swift
name
string

Package name, up to 255 UTF-8 bytes; encode scoped names as %40scope%2Fpackage.

version
string

Optional package version, up to 100 normalized bytes; omitted or blank retains latest-release intent. Forbidden with repo_url.

repo_url
string

Public GitHub, GitLab, or Codeberg repository root URL; cannot be combined with package parameters. HTTPS and git+https are supported on all three; GitHub also accepts http, git, ssh, and git+ssh. Use default ports and omit credentials, query strings, and fragments. Use HTTPS instead of scp-style shorthand.

git_ref
string

Repository-only branch, tag or SHA, omission preserves default-branch intent.

path
string
required

Required exact target-relative file path. No absolute, parent, NUL or trailing directory boundary.

start_line
integer

Positive inclusive source start. Omitted means 1. Explicit ranges require content; starts past EOF and ranges on empty text are source validation errors.

Required range: 1 <= x <= 2147483647
end_line
integer

Last line to read, inclusive; must be positive and not precede start_line. Omission reads to the end of the file. Values past the end are clamped. Requires the content group.

Required range: 1 <= x <= 2147483647
wait_timeout_ms
integer
default:20000

Time to wait for indexing: 0–60000 milliseconds, default 20000. The request deadline also includes the configured transport timeout.

Required range: 0 <= x <= 60000
fields
string
default:metadata,content

Comma-separated atomic metadata/content groups; both default. No empty values, leaf paths or wildcard. Range arguments require content; 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.

Response

Qualified source file

One exact file with mandatory source provenance and atomic selected groups.

code_index_state
enum<string>
required

Freshness of the served artifact; pending work is a typed error.

Available options:
current,
stale,
provisional
indexing_ref
string | null
required

Active source indexing reference, null when absent; may accompany serveable evidence.

is_binary
boolean
required

True for non-UTF-8 files; selected body and line counters are null.

path
string
required

Canonical target-relative source file path.

target_resolution
object
required

Requested intent, current resolution and actually served artifact.

content
object

Atomic source content group; omitted only when not selected.

metadata
object

Atomic metadata group; omitted only when not selected.