Skip to main content

Options

string
required
Path to the file within the repository.
string
Branch name, tag, or commit SHA. Defaults to the default branch.
boolean
When true, resolves the ref under the ephemeral namespace.
string[]
git blame -L-style range specs. Each entry is one -L argument: numeric ranges ("10,20"), regex anchors ("/getUser/,/^}/"), relative offsets ("10,+5"), half-open ranges ("10,", ",20"), a single line ("10"), or function names (":funcname"). Up to 16 specs per request. Omit to blame the whole file. (TypeScript: ranges, Python: ranges, Go: Ranges.)
boolean
Follow the file across renames and copies (passes -C -C -M to git blame).
number
Token TTL in seconds.

Response

string
The ref the blame ran against. When the request omitted ref, this is the repository’s default branch.
string
Echo of the requested file path.
string
The fully-resolved commit SHA that ref pointed to when the blame ran.
array
One entry per blamed line, in file order.
Each entry has:
  • lineNumber — 1-based line number in the file at ref
  • commitSha — commit that last touched the line
  • originalLineNumber — line number in the originating commit (differs after edits)
  • originalPath — path in the originating commit (differs after renames when detectMoves is on)
  • previousCommitSha — parent commit that touched the line; omitted for the initial commit
  • authorName, authorEmail
  • authorTime (parsed Date in TypeScript, datetime in Python, time.Time in Go)
  • rawAuthorTime — RFC 3339 string as returned by the server
  • committerName, committerEmail, committerTime, rawCommitterTime
  • summary — first line of the commit message

Notes

  • Commit metadata is duplicated per line in the SDK result; if you need a deduped commit map, group by commitSha client-side.
  • Each ranges entry is one git blame -L argument. Supported forms: a single line "10", a numeric range "10,20", an offset "10,+5" / "10,-5", a regex "/getUser/", a regex pair "/start/,/end/", regex + offset "/start/,+30", half-open ranges "10," and ",20", and ":funcname" for function-body targeting. Line numbers are 1-based and inclusive; ranges that resolve to lines outside the file return a 400, not a silent clamp. Up to 16 specs per request, each capped at 256 characters (regex content capped at 200).
  • Annotated tags are peeled to the underlying commit, so commitSha always equals the dereferenced commit (git rev-parse <ref>^{}).
  • Symlinks blame as a single line of the link-target text. Binary files (including ones that cross git’s 8 KiB heuristic via embedded NUL bytes) are blamed as text.
  • path may not contain NUL bytes.