Skip to content

Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir

GET
/repos/{owner}/{repo}/contents/{filepath}
owner
required
string

Owner of the repo

repo
required
string

Name of the repo

filepath
required
string

Path of the dir, file, symlink or submodule in the repo

ref
string

The name of the commit/branch/tag. Default the repository’s default branch (usually master)

ContentsResponse

Media type application/json

ContentsResponse contains information about a repo’s entry’s (dir, file, symlink, submodule) metadata and content

object
_links

FileLinksResponse contains the links for a repo’s file

object
git
string
html
string
self
string
content

content is populated when type is file, otherwise null

string
download_url
string
encoding

encoding is populated when type is file, otherwise null

string
git_url
string
html_url
string
last_commit_sha
string
last_commit_when
string format: date-time
name
string
path
string
sha
string
size
integer format: int64
submodule_git_url

submodule_git_url is populated when type is submodule, otherwise null

string
target

target is populated when type is symlink, otherwise null

string
type

type will be file, dir, symlink, or submodule

string
url
string
Example generated
{
"_links": {
"git": "example",
"html": "example",
"self": "example"
},
"content": "example",
"download_url": "example",
"encoding": "example",
"git_url": "example",
"html_url": "example",
"last_commit_sha": "example",
"last_commit_when": "2026-04-15T12:00:00Z",
"name": "example",
"path": "example",
"sha": "example",
"size": 1,
"submodule_git_url": "example",
"target": "example",
"type": "example",
"url": "example"
}

APINotFound is a not found error response

Media type application/json
object
errors
Array<string>
message
string
url
string
Example generated
{
"errors": [
"example"
],
"message": "example",
"url": "example"
}