Skip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!

Get the metadata and contents of requested files

GET
/repos/{owner}/{repo}/file-contents
curl --request GET \
--url 'https://gitea.com/api/v1/repos/example/example/file-contents?body=example' \
--header 'Authorization: Basic <credentials>'

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

owner
required
string

Owner of the repo

repo
required
string

Name of the repo

ref
string

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

body
required
string

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

ContentsListResponse

Media typeapplication/json
Array<object>

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

GitURL is the Git API URL for this file

string
html

HTMLURL is the web URL for this file

string
self

Self is the API URL for this file

string
content

content is populated when type is file, otherwise null

string
download_url

DownloadURL is the direct download URL for this file

string format: uri
encoding

encoding is populated when type is file, otherwise null

string
git_url

GitURL is the Git API URL for this blob or tree

string format: uri
html_url

HTMLURL is the web URL for this file or directory

string format: uri
last_author_date
string format: date-time
last_commit_message

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

string
last_commit_sha

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

string
last_committer_date
string format: date-time
lfs_oid

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

string
lfs_size

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

integer format: int64
name

Name is the file or directory name

string
path

Path is the full path to the file or directory

string
sha

SHA is the Git blob or tree SHA

string
size

Size is the file size in bytes

integer format: int64
submodule_git_url

submodule_git_url is populated when type is submodule, otherwise null

string format: uri
target

target is populated when type is symlink, otherwise null

string
type

type will be file, dir, symlink, or submodule

string
url

URL is the API URL for this file or directory

string format: uri
Examplegenerated
[
{
"_links": {
"git": "example",
"html": "example",
"self": "example"
},
"content": "example",
"download_url": "https://example.com",
"encoding": "example",
"git_url": "https://example.com",
"html_url": "https://example.com",
"last_author_date": "2026-04-15T12:00:00Z",
"last_commit_message": "example",
"last_commit_sha": "example",
"last_committer_date": "2026-04-15T12:00:00Z",
"lfs_oid": "example",
"lfs_size": 1,
"name": "example",
"path": "example",
"sha": "example",
"size": 1,
"submodule_git_url": "https://example.com",
"target": "example",
"type": "example",
"url": "https://example.com"
}
]

APINotFound is a not found empty response