Get all directories (folders)
Retrieve all directories (folders) in the workspace with hierarchical structure.
More details
More details
subfolders, or use cursor mode for a flat walk of every directory. Because a page carries whole subtrees, page size in bytes is driven by how deep those trees are; prefer cursor mode for large workspaces.Query Parameters:- page (optional): Page number for pagination (default: 1)
-
limit (optional): Number of TOP-LEVEL directories per page (default: 100). Subfolders nested under a returned root do not count against it, so this bounds rows, NOT total directories returned — a page whose subtrees expand past 5000 directories is rejected with 400; lower
limitor use cursor mode. -
search (optional): Case-insensitive substring match on the directory name. When present,
directoriesis a FLAT list of matches — nosubfoldersnesting — and each match carries its fullbreadcrumbspath. Omit it to get the nested tree.
- directories: Array of directory objects with nested subfolders
-
count: Total number of TOP-LEVEL directories, i.e. the number of page rows across all pages. Divide by
limitfor the page count. - currentPage: Current page number
- Basic information: id, name, description, status
- Hierarchy information: parentId, depth, breadcrumbs, subfolders
- Metadata: userId, organizationId, workspaceId
- Timestamps: createdAt, updatedAt
- isFromAutomatedRule: Indicates if directory was created by automation
- Directories are returned with their complete subfolder hierarchy
- Breadcrumbs provide the full path from root to current directory
- Subfolders array contains nested directories recursively
cursor query parameter (empty for the first page) and the response becomes { data, pagination: { limit, nextCursor, hasMore } } where data is a FLAT list of directories — no subfolders nesting; each row carries its breadcrumbs ancestor path instead. Follow nextCursor until hasMore is false. Cursors are bound to the search value they were minted with; keep it identical for every page of a walk.Query Parameters
Opaque pagination cursor. Provide the parameter (empty value for the first page) to switch to cursor pagination: the response becomes { data, pagination: { limit, nextCursor, hasMore } } with default limit 50 (max 100). Omit it entirely for legacy page/limit pagination. In cursor mode sortBy must be one of createdAt, updatedAt, _id, and cursors are bound to the sortBy/sortOrder they were minted with.
Response
The directories are retrieved. Offset mode (default) returns {directories, count, currentPage} as a nested tree; cursor mode (when the cursor query parameter is present) returns {data, pagination} where data is a FLAT list (no subfolders).
- Option 1
- Option 2
Directory tree: one row per TOP-LEVEL directory, carrying its nested subfolders recursively, and each row includes breadcrumbs. Pagination applies to these root rows, so a subfolder never appears as a row of its own. With the search query param the list is FLAT matches instead (empty subfolders).