Get

  • GET
  • /workspaces
  • /:workspace
  • /projects
  • /:project_name
  • /repository
  • /contents
  • /:path

Returns the contents of the repository for the specified revision or HEAD

Request

REQUIRED SCOPES
REPOSITORY_READ
URL PARAMETERS
workspacerequiredstring
The human-readable ID of the workspace

Example: "my-company"

project_namerequiredstring
The human-readable ID of the project

Example: "my-project"

pathrequiredstring
The path to the file in the repository

Constraints: Pattern: .+

Example: "src/main.js"

GET PARAMETERS
revisionstring
The git revision (branch, tag, or commit) to retrieve contents from

Example: "main"

Response

RESPONSE BODY
Choose one of the following options
RepositoryContentsView
urlread-onlystring
API endpoint to GET this object
html_urlread-onlystring
Web URL to view this object in Buddy.works
contentsRepositoryContentView[]
RepositoryContentView
urlread-onlystring
API endpoint to GET this object
html_urlread-onlystring
Web URL to view this object in Buddy.works
content_typestring enum
The type of the content
Allowed enum:
FILE,
DIR,
SYMLINK,
SUB_MODULE,
EXTERNAL
encodingstring
The encoding of the content. Possible values: base64
sizeinteger
The size of the file in bytes (null for directories)
namestring
The name of the file or directory
pathstring
The path to the file or directory
contentstring
The base64-encoded content of the file (only for files)
targetstring
The target path for symbolic links

Last modified on Jan 26, 2026

Request example

CURL
curl -X GET "https://api.buddy.works/workspaces/:workspace/projects/:project_name/repository/contents/:path" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "Content-Type: application/json"

Response examples

Directory contents
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/repository/contents/src", "html_url": "https://app.buddy.works/my-workspace/my-project/repository/content/src", "contents": [ { "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/repository/contents/src/main", "html_url": "https://app.buddy.works/my-workspace/my-project/repository/content/%2Fsrc%2Fmain", "content_type": "DIR", "name": "main", "path": "/src/main" }, { "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/repository/contents/src/README.txt", "html_url": "https://app.buddy.works/my-workspace/my-project/repository/content/src%2FREADME.txt", "content_type": "FILE", "encoding": "base64", "size": 12, "name": "README.txt", "path": "src/README.txt", "content": "c2FtcGxlIHZhbHVl" } ] }
STATUS
200 Returns directory contents or file content
File content
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/repository/contents/src/main/java/Main.java", "html_url": "https://app.buddy.works/my-workspace/my-project/repository/content/src%2Fmain%2Fjava%2FMain.java", "content_type": "FILE", "encoding": "base64", "size": 117, "name": "Main.java", "path": "src/main/java/Main.java", "content": "cHVibGljIGNsYXNzIE1haW4gewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiSGVsbG8sIFdvcmxkISIpOwogICAgfQp9" }
STATUS
200 Returns directory contents or file content