Overview
Retrieves the hierarchical tree structure of files and folders in the drive. Items are returned as nested nodes with their children, up to a configurable depth. This is the primary endpoint for building a file explorer or navigation sidebar.Query Parameters
parentId(optional): Start the tree from this folder ID. Omit to get root-level items.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 nestedchildrentotalItems: Total number of items in the responsetruncated: Whether the result was truncated (max 500 items)nextParentIds: When truncated, IDs of leaf folders that have more children — use these asparentIdto continue fetching
id: The file or folder IDname: Display nametype: Eitherfileorfolderchildren: Array of nested child nodeshasChildren: Boolean indicating whether this node has children beyond what was returned (useful for lazy loading)
Lazy Loading
For large drive structures, useparentId and depth together for lazy loading:
- Fetch the root tree with a shallow depth (e.g.,
depth=2) - When a user expands a folder, fetch its subtree using
parentId={folderId}&depth=2 - Use the
hasChildrenflag to show expand indicators in the UI