Gets the metadata of all the entries of the root dir.
const url = 'https://gitea.com/api/v1/repos/example/example/contents';const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://gitea.com/api/v1/repos/example/example/contents \ --header 'Authorization: Basic <credentials>'This API follows GitHub’s design, and it is not easy to use. Recommend users to use our “contents-ext” API instead.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Owner of the repo
Name of the repo
Query Parameters
Section titled “Query Parameters”The name of the commit/branch/tag. Default to the repository’s default branch.
Responses
Section titled “Responses”ContentsListResponse
ContentsResponse contains information about a repo’s entry’s (dir, file, symlink, submodule) metadata and content
object
FileLinksResponse contains the links for a repo’s file
object
GitURL is the Git API URL for this file
HTMLURL is the web URL for this file
Self is the API URL for this file
content is populated when type is file, otherwise null
DownloadURL is the direct download URL for this file
encoding is populated when type is file, otherwise null
GitURL is the Git API URL for this blob or tree
HTMLURL is the web URL for this file or directory
LastCommitMessage is the message of the last commit that affected this file
LastCommitSHA is the SHA of the last commit that affected this file
LfsOid is the Git LFS object ID if this file is stored in LFS
LfsSize is the file size if this file is stored in LFS
Name is the file or directory name
Path is the full path to the file or directory
SHA is the Git blob or tree SHA
Size is the file size in bytes
submodule_git_url is populated when type is submodule, otherwise null
target is populated when type is symlink, otherwise null
type will be file, dir, symlink, or submodule
URL is the API URL for this file or directory
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