Overview
Retrieve all knowledge base folders for your organization. Folders help organize documents used by your AI assistants, making it easy to manage and structure your knowledge base. This endpoint returns a hierarchical structure of folders with their associated documents and subfolders.Use Cases
- Folder Selection: Display available folders when uploading documents
- Knowledge Base Browser: Build a file explorer interface
- Organization Overview: See how your knowledge base is structured
- Document Count: Understand content distribution across folders
- Assistant Configuration: Show folders linked to specific assistants
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Response Structure
Returns an array of folder objects with hierarchical structure:Folder Object
Field | Type | Description |
---|---|---|
id | string (UUID) | Unique folder identifier |
name | string | Folder name |
icon | string | null | Emoji/icon for the folder |
sort_order | number | Display order (lower numbers first) |
client_id | string (UUID) | Your organization ID |
parent_folder_id | string | null | Parent folder ID (null for root folders) |
source_url | string | null | Source URL if synced from external source |
source_type | string | null | Type of source (e.g., βconfluenceβ, βgdriveβ) |
is_public | boolean | Whether folder is publicly accessible |
created_at | string (ISO) | Folder creation timestamp |
updated_at | string (ISO) | Last update timestamp |
documents | array | Array of document objects in this folder |
subfolders | array | Array of nested folder objects |
Document Object (Simplified)
Field | Type | Description |
---|---|---|
id | string (UUID) | Document identifier |
name | string | Document name |
icon | string | Document icon/emoji |
Example Request
Example Response
Common Use Cases
1. Display Folder Tree
2. Find Folder by Name
3. Build Folder Dropdown
4. Count Total Documents
Hierarchical Structure
Folders are organized hierarchically:- Root Folders: Have
parent_folder_id: null
- Subfolders: Have
parent_folder_id
pointing to parent - Nesting: Unlimited depth of nested folders
- Documents: Each folder has
documents
array
Error Responses
Status Code | Description |
---|---|
401 | Unauthorized - Invalid or missing API key |
500 | Internal Server Error - Something went wrong |
Important Notes
- Hierarchical: Response includes full folder tree with nesting
- Document Summary: Only includes document id, name, and icon (not full content)
- Alphabetical: Folders typically sorted alphabetically
- No Pagination: Returns all folders in one request
- Empty Folders: Folders with no documents still appear
Related Endpoints
- POST /api/documents/assistant/folders - Create a new folder
- POST /api/documents/assistant/raw - Upload document to folder
- DELETE /api/documents/assistant/ - Delete a document
Performance Tips
- Cache Response: Folder structure changes infrequently
- Client-side Filtering: Filter and search folders on client side
- Lazy Loading: For large folder trees, consider lazy loading subfolders
Headers
API key needed to authorize the request