Get Directories & files

View as Markdown
  • 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"

Last modified on Apr 22, 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/src%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