Folders
Folders
@toothfairyai/sdk@latest…Folder Management Module Handles folder CRUD operations for organizing documents.
Accessed via client.folders.
Methods
| Method | HTTP | Endpoint |
|---|---|---|
create | POST | POST /folder/create |
get | GET | GET /folder/get/{id} |
update | POST | POST /folder/update |
delete | DELETE | DELETE /folder/delete/{id} |
list | GET | GET /folder/list |
getRootFolders | — | derived |
getSubfolders | — | derived |
getTree | — | derived |
search | — | derived |
create
Create a new folder
async create(
name: string,
options: {
description?: string;
emoji?: string;
status?: string;
parent?: string;
} = {}
)
Endpoint: POST /folder/create · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | no | Unique identifier |
workspaceid | string | yes | Unique workspace identifier (UUID v4) |
name | string | yes | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
emoji | string | no | Emoji icon for the folder |
status | string | no | Current status of the resource |
Allowed: active, inactive |
| parent | string | no | ID of the parent folder (for nesting) |
| allowedTopics | string | no | List of topic IDs the agent is restricted to (max 10) |
| owner | string | no | Owner of this resource |
| createdBy | string | no | ID of the user who created this resource |
| updatedBy | string | no | ID of the user who last updated this resource |
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the folder |
owner | string | Owner of the folder |
name | string | Name of the folder |
description | string | Description of the folder |
emoji | string | Emoji character representing the folder |
status | string | Status of the folder |
Allowed: active, inactive |
| allowedTopics | object | List of topic IDs the agent is restricted to (max 10) |
| parent | string | Parent folder ID for nested folder structure |
| workspaceID | string | Unique workspace identifier (UUID v4) |
| createdBy | string | User ID who created the folder |
| updatedBy | string | User ID who last updated the folder |
| createdAt | string | Timestamp when this resource was created |
| updatedAt | string | Timestamp when this resource was last updated |
Example
const result = await client.folders.create('…');
get
Get a folder by ID
async get(folderId: string)
Endpoint: GET /folder/get/{id} · API service
Response
Returns the Folder object — fields documented in the create section above.
Example
const result = await client.folders.get('agent-id');
update
Update an existing folder
async update(
folderId: string,
options: {
name?: string;
description?: string;
emoji?: string;
status?: string;
parent?: string;
} = {}
)
Endpoint: POST /folder/update · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | Unique identifier |
workspaceid | string | no | Unique workspace identifier (UUID v4) |
name | string | no | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
emoji | string | no | Emoji icon for the folder |
status | string | no | Current status of the resource |
Allowed: active, inactive |
| parent | string | no | ID of the parent folder (for nesting) |
| allowedTopics | string | no | List of topic IDs the agent is restricted to (max 10) |
| owner | string | no | Owner of this resource |
| createdBy | string | no | ID of the user who created this resource |
| updatedBy | string | no | ID of the user who last updated this resource |
Response
Returns the Folder object — fields documented in the create section above.
Example
const result = await client.folders.update('agent-id');
delete
Delete a folder
async delete(folderId: string): Promise<
Endpoint: DELETE /folder/delete/{id} · API service
Response
Returns the Folder object — fields documented in the create section above.
Example
const result = await client.folders.delete('agent-id');
list
List folders in the workspace
async list(status?: string, limit?: number, offset?: number)
Endpoint: GET /folder/list · API service
Response
Returns the Folder object — fields documented in the create section above.
Example
const result = await client.folders.list();
getRootFolders
Get root folders (folders without a parent)
async getRootFolders()
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.folders.getRootFolders();
getSubfolders
Get subfolders of a parent folder
async getSubfolders(parentId: string)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.folders.getSubfolders('agent-id');
getTree
Get folder tree structure
async getTree()
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.folders.getTree();
search
Search folders by name
async search(searchTerm: string)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.folders.search('…');