Skip to main content
The Folders API provides endpoints for organizing chats and other resources into a hierarchical folder structure.

List Folders

endpoint
Retrieve all folders for the authenticated user

Authorization

Requires ENABLE_FOLDERS feature flag enabled and user permission features.folders or admin role.

Response

string
required
Unique identifier for the folder
string
required
Name of the folder
string
ID of the parent folder (null for root folders)
boolean
Whether the folder is expanded in the UI
object
Additional folder data including files and collections

Example Request

cURL

Example Response

200

Create Folder

endpoint
Create a new folder

Request Body

string
required
Name of the folder to create
string
ID of the parent folder (omit for root folder)

Example Request

cURL

Example Response

200
400 Bad Request

Get Folder by ID

endpoint
Retrieve a specific folder by ID

Path Parameters

string
required
Unique identifier of the folder

Example Request

cURL

Example Response

200
404 Not Found

Update Folder

endpoint
Update folder name or data

Path Parameters

string
required
Unique identifier of the folder to update

Request Body

string
Updated name for the folder
object
Updated folder data

Example Request

cURL

Example Response

200
400 Bad Request

Update Folder Parent

endpoint
Move folder to a different parent folder

Path Parameters

string
required
Unique identifier of the folder to move

Request Body

string
ID of the new parent folder (null to move to root)

Example Request

cURL

Example Response

200
400 Bad Request

Update Folder Expanded State

endpoint
Update whether the folder is expanded in the UI

Path Parameters

string
required
Unique identifier of the folder

Request Body

boolean
required
Whether the folder should be expanded

Example Request

cURL

Example Response

200

Delete Folder

endpoint
Delete a folder and optionally its contents

Path Parameters

string
required
Unique identifier of the folder to delete

Query Parameters

boolean
Whether to delete chats in the folder (default: true). If false, chats are moved to root.

Authorization

If the folder contains chats, requires chat.delete permission or admin role.

Example Request

cURL

Example Response

200
403 Forbidden
404 Not Found

Access Control

Folders Feature

  • Requires ENABLE_FOLDERS configuration flag to be enabled
  • Users must have features.folders permission or admin role
  • All folder operations are scoped to the authenticated user

Folder Integrity

  • Automatically validates parent folder existence
  • Orphaned folders are moved to root automatically
  • Files and collections are validated for user access
  • Invalid references are removed automatically

Nested Folders

  • Folders support hierarchical parent-child relationships
  • Deleting a parent folder recursively processes all subfolders
  • Moving folders validates name uniqueness within the target parent

Chat Integration

  • Folders can contain chats via folder_id association
  • Deleting folders with chats requires chat.delete permission
  • Chats can be moved to root or deleted based on delete_contents flag