Skip to content

Tree Browsing API

Dojo provides fast file tree browsing via API. Directory listings are instant regardless of repository size.

GET /api/repos/{owner}/{name}/tree

Query parameters:

ParameterRequiredDefaultDescription
refmainBranch/bookmark to browse
path"" (root)Directory path to list
recursivefalseList all files recursively

Example — list root directory:

Terminal window
curl "https://dojo.ninja/api/repos/mies/dojo/tree?ref=main" \
-H "Authorization: Bearer $TOKEN"
{
"path": "",
"entries": [
{ "name": "docs", "kind": "dir", "path": "docs" },
{ "name": "packages", "kind": "dir", "path": "packages" },
{ "name": "README.md", "kind": "file", "path": "README.md", "blob_id": "de0d7a...", "size": 25493 }
]
}

Entries are sorted with directories first, then files alphabetically.

Example — list subdirectory:

Terminal window
curl "https://dojo.ninja/api/repos/mies/dojo/tree?ref=main&path=src/components"

Example — recursive listing (all files under a path):

Terminal window
curl "https://dojo.ninja/api/repos/mies/dojo/tree?ref=main&path=src&recursive=true"

Returns all files as a flat list — useful for getting a full picture of a directory.

Workspace tree includes both committed files and the workspace overlay (uncommitted changes):

GET /api/repos/{owner}/{name}/workspaces/{wsId}/tree

Same parameters as the repo tree endpoint. Overlay files override base files, and deleted files are excluded.

GET /api/repos/{owner}/{name}/file/{path}?ref=main

Response:

{
"path": "README.md",
"blob_id": "de0d7afecaf2...",
"size": 25493,
"data": "base64-encoded-content..."
}

Content is base64-encoded. Decode it to get the raw file bytes.

Each entry in the tree response contains:

FieldTypeDescription
namestringFile or directory name
kind"file" | "dir"Entry type
pathstringFull path from repository root
blob_idstring?Content hash (files only)
sizenumber?File size in bytes (files only)