Skip to main content
GET
Get all directories (folders)
Retrieve all directories (folders) in the workspace with hierarchical structure. This endpoint returns a paginated list of directories including their nested subfolders with breadcrumb navigation for easy hierarchy tracking.

Use Cases

Folder Management

Browse and manage your workspace folder structure programmatically

File Organization

Understand folder hierarchy for automated file routing and organization

Navigation Systems

Build custom navigation interfaces with breadcrumb support

Automation Rules

Identify folders created by automation rules for workflow tracking

Query Parameters

This endpoint supports both pagination modes. Send the cursor parameter (empty value for the first page) to use cursor pagination; omit it entirely to keep the legacy page/limit response shape. See Pagination for the full comparison.

How pagination works here

Pagination is over top-level directories: one page row is one root folder, returned with its complete subtree. A subfolder is never a page row of its own — reach it through its root’s subfolders, or use cursor mode for a flat walk of every directory.
limit bounds page rows, not the total number of directories returned: subfolders nested under a returned root do not count against it. Because a page carries whole subtrees, its size in bytes is driven by how deep those trees are. A page whose subtrees expand past 5,000 directories is rejected with a 400 — lower limit, or use cursor mode.
In cursor mode the response is { data, pagination } and data is a flat list of directories with 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. Prefer this mode for large workspaces.
When search is present, directories is a flat list of matches with no subfolders nesting, and each match carries its full breadcrumbs path. Omit search to get the nested tree.
In offset mode, count is the total number of top-level directories — that is, the number of page rows across all pages. Divide by limit for the page count, not by the total number of directories in the workspace.

Response Structure

Directory Object

Each directory object contains:

Understanding the Hierarchy

The depth field indicates how deep a folder is in the hierarchy:
  • depth: 0 - Root level folders
  • depth: 1 - First level subfolders
  • depth: 2 - Second level subfolders, and so on
The subfolders array contains nested directories recursively. Each subfolder has the same structure as the parent directory, allowing you to traverse the entire hierarchy.
Folders created by automation rules are marked with isFromAutomatedRule: true. This helps distinguish manually created folders from those generated by workflow automation.

Authorizations

x-api-key
string
header
required

API key for authentication

Query Parameters

Case-insensitive substring match on the directory name. When present, directories is a FLAT list of matches (subfolders empty); each match carries its full breadcrumbs path. In cursor mode the cursor is bound to the search value.

Example:

"invoices"

page
number
default:1

Page number

Example:

1

limit
number
default:100

Number of items per page

Example:

100

sortBy
string
default:createdAt

Field to sort by

Example:

"createdAt"

sortOrder
enum<string>
default:ASC

Sort direction

Available options:
ASC,
DESC
Example:

"ASC"

cursor
string

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).

directories
object[]
required

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).

count
number
required

Total number of top-level directories — the number of rows across all pages, so count / limit is the page count. Not the total row count of the workspace; use cursor mode to enumerate every directory.

currentPage
number
required