D
DreamLake

API Reference

Nodes

Nodes represent folders in a materialized-paths tree within a project. Files (Video, Audio, etc.) reference their parent folder via folderId but are not nodes themselves.

Path convention:

  • Root-level: path = ",", name = "camera"
  • Depth 1: path = ",camera,", name = "front"
  • Depth 2: path = ",camera,front,", name = "rgb"

GET /nodes/children

List 1-level children of a node. If parentId is omitted, returns project root nodes.

PropertyValue
AuthJWT
DB roundtrips (by parentId)3 (2 effective)
DB roundtrips (root)4 (3 effective)

By parentId:

#QueryConditionParallel
1node.findUnique({ id: parentId })Always
2node.findMany({ projectId, path })Always
3node.count({ projectId, path })Always

Root (no parentId):

#QueryConditionParallel
1namespace.findUnique({ slug })Always
2space.findFirst({ nameprojectId, slug })Always
3node.findMany({ projectId, path: "," })Always
4node.count({ projectId, path: "," })Always

Query

ParamTypeRequiredDefaultDescription
parentIdstringNoParent node ID. Omit for root.
namespacestringIf no parentIdNamespace slug
projectstringIf no parentIdProject slug
pagenumberNo1Page number (1-based)
pageSizenumberNo50Items per page (max 200)

Response 200

{
  "nodes": [
    {
      "id": "node-id",
      "name": "camera",
      "kind": "folder",
      "leaf": 0,
      "path": ",",
      "createdAt": "2026-04-14T...",
      "updatedAt": "2026-04-14T..."
    }
  ],
  "page": 1,
  "pageSize": 50,
  "total": 2,
  "totalPages": 1
}

Errors

StatusCondition
400namespace and space missing when parentId omitted
404Parent node not found or deleted
404Namespace / project not found

GET /nodes/:nodeId/episodes

List all episodes under a node, including episodes in its descendants. Uses materialized path prefix matching.

PropertyValue
AuthJWT
DB roundtrips3 (2 effective)
#QueryConditionParallel
1node.findUnique({ id: nodeId })Always
2node.findMany({ projectId, kind: "episode", path startsWith ... })Always
3node.count(...)Always

Params

ParamTypeRequiredDescription
nodeIdstringYesParent node ID
pagenumberNoPage number (default 1)
pageSizenumberNoItems per page (default 50, max 200)

Response 200

{
  "episodes": [
    {
      "id": "node-id",
      "name": "ep-alpha",
      "path": ",project-a,",
      "kind": "episode",
      "episodeId": "episode-id",
      "nodePath": "/project-a/ep-alpha",
      "createdAt": "2026-04-24T...",
      "updatedAt": "2026-04-24T..."
    }
  ],
  "page": 1,
  "pageSize": 50,
  "total": 3,
  "totalPages": 1
}

If the node itself is an episode, it is included in the results. Includes episodes at any depth below the node.

Errors

StatusCondition
404Node not found or deleted

POST /nodes

Create a folder. All ancestor folders are auto-created.

PropertyValue
AuthJWT
DB roundtrips2 + N
#QueryCondition
1namespace.findUnique({ slug })Always
2space.findFirst({ nameprojectId, slug })Always
3–Nnode.upsert({ projectId, path, name })One per path segment
N+1node.findUnique({ id })Always

Creating /camera/front/new = 3 upserts.

Body

FieldTypeRequiredDescription
namespacestringYesNamespace slug
projectstringYesProject slug
pathstringYesFolder path (e.g. /camera/front/new)

Response 201

{
  "id": "node-id",
  "name": "new",
  "kind": "folder",
  "leaf": 0,
  "path": ",camera,front,",
  "createdAt": "2026-04-14T...",
  "updatedAt": "2026-04-14T..."
}

Errors

StatusCondition
400Missing fields or invalid path
400Cannot create root node (/)
404Namespace / project not found

PATCH /nodes/:id/rename

Rename a folder. Updates descendant folders' materialized paths in one updateMany.

PropertyValue
AuthJWT
DB roundtrips4
Descendant writesO(F) where F = descendant folder count
#QueryCondition
1node.findUnique({ id })Always
2node.findFirst({ projectId, path, name })Collision check
3$runCommandRaw updateManyUpdate descendants
4node.update({ id })Rename self

Body

FieldTypeRequiredDescription
namestringYesNew folder name

Response 200

{
  "id": "node-id",
  "name": "renamed",
  "kind": "folder",
  "leaf": 0,
  "path": ",camera,",
  "createdAt": "2026-04-14T...",
  "updatedAt": "2026-04-14T..."
}

Errors

StatusCondition
400name missing
404Node not found or deleted
409Name collision in same parent

PATCH /nodes/:id/move

Move a folder to a new parent. Updates descendant folders' materialized paths in one updateMany.

PropertyValue
AuthJWT
DB roundtrips4–5
Descendant writesO(F) where F = descendant folder count
#QueryCondition
1node.findUnique({ id })Always
2node.findUnique({ id: parentId })If parentId not null
3node.findFirst({ projectId, path, name })Collision check
4$runCommandRaw updateManyUpdate descendants
5node.update({ id })Update self

Body

FieldTypeRequiredDescription
parentIdstring | nullYesTarget parent node ID, or null for root

Response 200

{
  "id": "node-id",
  "name": "front",
  "kind": "folder",
  "leaf": 0,
  "path": ",lidar,",
  "createdAt": "2026-04-14T...",
  "updatedAt": "2026-04-14T..."
}

Errors

StatusCondition
400Cannot move across projects
400Cannot move into own subtree
404Node / target parent not found or deleted
409Name collision in target folder