Skip to main content
GET
/
repos
/
{owner}
/
{repo}
/
contents
/
{path}
Get contents
curl --request GET \
  --url https://gogs.example.com/api/v1/repos/{owner}/{repo}/contents/{path} \
  --header 'Authorization: <api-key>'
{
  "type": "file",
  "encoding": "<string>",
  "size": 123,
  "name": "<string>",
  "path": "<string>",
  "content": "<string>",
  "sha": "<string>",
  "url": "<string>",
  "git_url": "<string>",
  "html_url": "<string>",
  "download_url": "<string>",
  "_links": {
    "git": "<string>",
    "self": "<string>",
    "html": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Personal access token. Use format: token {YOUR_ACCESS_TOKEN}

Path Parameters

owner
string
required

Repository owner

repo
string
required

Repository name

path
string
required

File or directory path

Query Parameters

ref
string

Branch, tag, or commit. Defaults to the default branch.

Response

Success

type
enum<string>
Available options:
file,
dir,
symlink,
submodule
encoding
string
size
integer
name
string
path
string
content
string
sha
string
url
string
git_url
string
html_url
string
download_url
string