Skip to main content
GET
/
public
/
v1
/
docs
/
tree
Document Tree
curl --request GET \
  --url https://api.copera.ai/public/v1/docs/tree \
  --header 'Authorization: Bearer <token>'
{
  "root": [
    {
      "_id": "<string>",
      "title": "<string>",
      "owner": "<string>",
      "createdAt": "<string>",
      "updatedAt": "<string>",
      "hasChildren": true,
      "children": [
        {}
      ],
      "icon": {
        "type": "<string>",
        "value": "<string>"
      },
      "cover": {
        "type": "<string>",
        "value": "<string>"
      },
      "starred": true,
      "parent": "<string>"
    }
  ],
  "totalDocs": 123,
  "truncated": true,
  "nextParentIds": [
    "<string>"
  ]
}

Overview

Retrieves the hierarchical tree structure of documents in the workspace. Documents are returned as nested nodes with their children, up to a configurable depth.

Query Parameters

  • parentId (optional): Start the tree from this document ID. Omit to get root-level documents.
  • depth (optional): Maximum nesting depth, 1-10. Defaults to 3.

Response

Returns a tree structure with:
  • root: Array of top-level tree nodes, each with nested children
  • totalDocs: Total number of documents in the response
  • truncated: Whether the result was truncated (max 500 docs)
  • nextParentIds: When truncated, IDs of leaf documents that have more children — use these as parentId to continue fetching

Authorizations

Authorization
string
header
required

Bearer token

Query Parameters

parentId
string

Start tree from this document. Omit for root-level documents.

Pattern: ^[0-9a-fA-F]{24}$
depth
number

Max nesting depth (1-10). Defaults to 3.

Required range: 1 <= x <= 10

Response

Default Response

root
object[]
required
totalDocs
number
required
truncated
boolean
required
nextParentIds
string[]