v5

latestSwagger 2.0MIT2026-08-03485217850.7 KB
repository

Get the metadata and contents of requested files

See the POST method. This GET method supports using JSON encoded request body in query parameter.

get/repos/{owner}/{repo}/file-contents

Path parameters

ownerstring required

owner of the repo

repostring required

name of the repo

Query parameters

refstring

The name of the commit/branch/tag. Default to the repository’s default branch.

bodystring required

The JSON encoded body (see the POST request): {"files": ["filename1", "filename2"]}

Response

ContentsListResponse

contentstring

content is populated when type is file, otherwise null

download_urlstring

DownloadURL is the direct download URL for this file

encodingstring

encoding is populated when type is file, otherwise null

git_urlstring

GitURL is the Git API URL for this blob or tree

html_urlstring

HTMLURL is the web URL for this file or directory

last_author_datestring date-time
last_commit_messagestring

LastCommitMessage is the message of the last commit that affected this file

last_commit_shastring

LastCommitSHA is the SHA of the last commit that affected this file

last_committer_datestring date-time
lfs_oidstring

LfsOid is the Git LFS object ID if this file is stored in LFS

lfs_sizeinteger

LfsSize is the file size if this file is stored in LFS

modestring

mode is the Git file mode as an octal string, e.g. 100644 (regular), 100755 (executable), 120000 (symlink), 160000 (submodule)

namestring

Name is the file or directory name

pathstring

Path is the full path to the file or directory

shastring

SHA is the Git blob or tree SHA

sizeinteger

Size is the file size in bytes

submodule_git_urlstring

submodule_git_url is populated when type is submodule, otherwise null

targetstring

target is populated when type is symlink, otherwise null

typestring

type will be file, dir, symlink, or submodule

urlstring

URL is the API URL for this file or directory