Skip to main content
GET
A file in a repo

Path Parameters

owner
string
required
Example:

"patch"

slug
string
required
Example:

"demo-mod"

Query Parameters

ref
string

A branch, a tag or a full commit hash: the default branch unless you say. A branch comes before a tag of the same name, and refs/tags/v1 says which.

Pattern: ^\S{1,255}$
Example:

"main"

path
string
required

A file in the repo, from its top

Required string length: 1 - 4096
Example:

"docs/guide.md"

Response

The file

ref
string
required

The branch, tag or full commit hash it was asked for: the default branch unless given.

commit
string
required

The full commit hash that resolved to.

path
string
required
type
enum<string>
required
Available options:
blob,
exec,
symlink,
gitlink
mode
string
required
Example:

"100644"

hash
string
required

Its git object. For a submodule, the commit it's at, or empty when that can't be found.

size
integer
required

Its size in bytes: for a file in Git LFS, the big file's, not its pointer's.

binary
boolean
required

Whether it has no text to show: a NUL in its first 8 KB, not valid UTF-8, a big file or a submodule.

text
string | null
required

Its text, its first 512 KiB at most.

truncated
boolean
required

Whether text stops before the file does.

big_file
object | null
required

The big file, when this is a Git LFS pointer.

raw_url
string | null
required

Where a browser gets its bytes at this commit, from outside patch.gg. Null for a submodule.