Tree Browsing API
Dojo provides fast file tree browsing via API. Directory listings are instant regardless of repository size.
Browse repository tree
Section titled “Browse repository tree”GET /api/repos/{owner}/{name}/treeQuery parameters:
| Parameter | Required | Default | Description |
|---|---|---|---|
ref | — | main | Branch/bookmark to browse |
path | — | "" (root) | Directory path to list |
recursive | — | false | List all files recursively |
Example — list root directory:
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:
curl "https://dojo.ninja/api/repos/mies/dojo/tree?ref=main&path=src/components"Example — recursive listing (all files under a path):
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.
Browse workspace tree
Section titled “Browse workspace tree”Workspace tree includes both committed files and the workspace overlay (uncommitted changes):
GET /api/repos/{owner}/{name}/workspaces/{wsId}/treeSame parameters as the repo tree endpoint. Overlay files override base files, and deleted files are excluded.
Read file content
Section titled “Read file content”GET /api/repos/{owner}/{name}/file/{path}?ref=mainResponse:
{ "path": "README.md", "blob_id": "de0d7afecaf2...", "size": 25493, "data": "base64-encoded-content..."}Content is base64-encoded. Decode it to get the raw file bytes.
Entry format
Section titled “Entry format”Each entry in the tree response contains:
| Field | Type | Description |
|---|---|---|
name | string | File or directory name |
kind | "file" | "dir" | Entry type |
path | string | Full path from repository root |
blob_id | string? | Content hash (files only) |
size | number? | File size in bytes (files only) |