Knowledge Base API
The Knowledge Base Service provides a centralized repository for managing and accessing personal data through files and documents. This service enables document storage, retrieval, and management while integrating with the AI backend for intelligent search capabilities.Base URL
All endpoints are prefixed with/api/v1/knowledgeBase
Authentication
All endpoints require authentication via Bearer token:Architecture Overview
The Knowledge Base Service is built on a Node.js backend, with graph-based data persistence in whichever graph database the instance is configured to use (Neo4j by default, ArangoDB as an alternative). The service consists of several key components:- Record Management - Core document storage and metadata handling
- File Storage Integration - Connects with external storage services
- Event Broadcasting - Kafka-based events for system integration
- AI Indexing - Automatic content indexing for search capabilities
- Storage Service - Handles actual file storage and versioning
- AI Backend - Processes and indexes content for search
- Enterprise Search - Provides search capabilities across the knowledge base
- IAM Service - Handles user authentication and authorization
- Configuration Manager - Manages application settings
Data Models
Records
Records represent the core entities in the knowledge base:- Metadata about stored content (name, type, source)
- References to physical files in storage
- Versioning information
- Indexing status and history
File Records
File Records contain file-specific metadata:- File format information (extension, MIME type)
- Size and storage information
- Access URLs and paths
- Checksum and integrity information
Knowledge Base
Knowledge Base represents a collection of records:- Organizational grouping of records
- Permission structure
- Metadata about the collection
API Endpoints
Knowledge Base Management
Knowledge Base Management
POST / - Create Knowledge Base
POST / - Create Knowledge Base
- Request
- Response
POST /api/v1/knowledgeBase/Request Body Parameters:GET / - List Knowledge Bases
GET / - List Knowledge Bases
- Request
- Response
GET /api/v1/knowledgeBase/Query Parameters:GET /:kbId - Get Knowledge Base
GET /:kbId - Get Knowledge Base
- Request
- Response
GET /api/v1/knowledgeBase/:kbIdPath Parameters:PUT /:kbId - Update Knowledge Base
PUT /:kbId - Update Knowledge Base
- Request
- Response
PUT /api/v1/knowledgeBase/:kbIdPath Parameters:DELETE /:kbId - Delete Knowledge Base
DELETE /:kbId - Delete Knowledge Base
- First, PipesHub lists the knowledge base’s uploaded files and schedules their removal. If either step fails, nothing is deleted and the request returns
503; try again. - A
200means the folders and records are gone from the graph. The indexing service then removes their search index (embeddings) and stored files. - Retries. If storage can’t remove a file, or the file’s record can’t be checked, the removal is retried until it succeeds, with no time limit. If a record still lists the file, the removal is retried for up to one day, then the file is kept, because that record was never deleted (see the Deletion note on the Storage page).
- Shared content. If a record in another knowledge base or connector has identical content, that record’s uploaded file and the shared search index stay. If the processed copy of that content was filed under the deleted knowledge base, it is moved to the surviving record’s storage location and keeps its document ID, so the surviving record isn’t re-indexed. If that handover fails, nothing is deleted from the knowledge base’s storage, and the release is retried until it succeeds.
- Request
- Response
DELETE /api/v1/knowledgeBase/:kbIdPath Parameters:Record Management
Record Management
GET /record/:recordId - Get Record By ID
GET /record/:recordId - Get Record By ID
- Request
- Response
GET /api/v1/knowledgeBase/record/:recordIdPath Parameters:PUT /record/:recordId - Update Record
PUT /record/:recordId - Update Record
- Request
- Response
PUT /api/v1/knowledgeBase/record/:recordIdPath Parameters:multipart/form-data (when uploading file)File Constraints:- Maximum file size: 30MB
- Supported MIME types: Based on extensionToMimeType mapping
- File extension must match existing record’s extension for versioned updates
409 Conflict, and the file keeps its old name, when another file of the same type in the same folder (or the knowledge base root) already has the new name. Names are compared ignoring case, so Report.pdf and report.pdf count as the same. A file of a different type may use the same name.updated_policy.pdf names the record updated_policy, and any recordName you send with the file is ignored. To rename a record, send recordName on its own, without a file.PUT /:kbId/record/:recordId/move - Move Record
PUT /:kbId/record/:recordId/move - Move Record
- Request
- Response
PUT /api/v1/knowledgeBase/:kbId/record/:recordId/movePath Parameters:409 Conflict, and the record stays where it was, when the destination folder (or the knowledge base root) already holds:- for a file, a file with the same name (ignoring case) and the same type. A file of a different type may share the name.
- for a folder, a folder with the same name (ignoring case).
DELETE /record/:recordId - Delete Record
DELETE /record/:recordId - Delete Record
403 Forbidden, and is removed by deleting the item in the source app.The result depends on the Labs setting Move Deleted Records to the Trash:- Off (the default): the record is removed from the graph database and can’t be restored.
- First, PipesHub schedules the removal of the record’s uploaded file. If that fails, nothing is deleted and the request returns
503; try again. - A
200means the record is gone from the graph. The indexing service then removes its search index (embeddings) and uploaded file. - Retries. If storage can’t remove a file, or the file’s record can’t be checked, the removal is retried until it succeeds, with no time limit. If a record still lists the file, the removal is retried for up to one day, then the file is kept, because that record was never deleted (see the Deletion note on the Storage page).
- Shared content. If another record has identical content, the shared search index and processed content stay until the last copy is deleted.
- First, PipesHub schedules the removal of the record’s uploaded file. If that fails, nothing is deleted and the request returns
- On: the record goes to the trash. It disappears from search, chat and listings at once, and its uploaded file is kept until the scheduled cleanup. Until then, it can be restored with
POST /record/:recordId/restoreor from the collection’s Recently deleted page; see How long items stay. The response hassoftDeleted: trueand the delete’sbatchId.
- Request
- Response
DELETE /api/v1/knowledgeBase/record/:recordIdPath Parameters:GET /:kbId/trash - List Recently Deleted Items
GET /:kbId/trash - List Recently Deleted Items
itemCount is the number of records an item holds. For a multi-select delete, rootCount is how many items were selected, and otherRootNames names up to three of them besides name. To restore an item, pass its id to POST /record/:recordId/restore.Needs Move Deleted Records to the Trash on in Labs. The list holds only what the caller may restore: owners and writers see every item, file organizers see single files only, and other roles get 403 Forbidden. OAuth apps need the kb:delete scope.- Request
- Response
GET /api/v1/knowledgeBase/:kbId/trashPath Parameters:POST /record/:recordId/restore - Restore Deleted Record
POST /record/:recordId/restore - Restore Deleted Record
kb:delete scope.- Request
- Response
POST /api/v1/knowledgeBase/record/:recordId/restorePath Parameters:POST /records/restore - Restore Several Deleted Records
POST /records/restore - Restore Several Deleted Records
POST /record/:recordId/restore does. If several ids belong to one delete, that delete is restored once. Each id gets its own outcome in results, so one refusal doesn’t block the others, and the response is 200 whatever the outcomes.- Request
- Response
POST /api/v1/knowledgeBase/records/restoreRequest Body:GET /stream/record/:recordId - Stream Record Content
GET /stream/record/:recordId - Stream Record Content
- Request
- Response
GET /api/v1/knowledgeBase/stream/record/:recordIdPath Parameters:POST /reindex/record/:recordId - Reindex Record
POST /reindex/record/:recordId - Reindex Record
- Request
- Response
POST /api/v1/knowledgeBase/reindex/record/:recordIdPath Parameters:Upload Operations
Upload Operations
POST /:kbId/upload - Upload to Knowledge Base or Folder
POST /:kbId/upload - Upload to Knowledge Base or Folder
- Request
- Response
POST /api/v1/knowledgeBase/:kbId/uploadPath Parameters:multipart/form-dataFile Constraints:- Maximum files per upload: 1000
- Maximum file size: 30MB per file
- Supported MIME types: Based on extensionToMimeType mapping
- File paths must be unique and not contain invalid characters
- A file is skipped when its name (ignoring case) and type match a file already in its destination folder, or another file in the same upload going to that folder. Files with the same name going to different folders, such as
docs/Report.pdfandarchive/Report.pdf, are both created. In the upload’s event stream (text/event-stream), a skipped file gets afile:failedevent withreason: "DUPLICATE_NAME",stage: "index"anderrors: ["A file named \"<name>\" already exists in this location; it was skipped."]. The rest of the upload goes ahead, each file with its own event (file:succeededwhen added), and the stream ends withdone.
/api/v1/knowledgeBase/kb123456/upload?folderId=folder456.Folder Operations
Folder Operations
PUT /:kbId/folder/:folderId - Update Folder
PUT /:kbId/folder/:folderId - Update Folder
- Request
- Response
PUT /api/v1/knowledgeBase/:kbId/folder/:folderIdPath Parameters:DELETE /:kbId/folder/:folderId - Delete Folder
DELETE /:kbId/folder/:folderId - Delete Folder
- With Move Deleted Records to the Trash off (the default): PipesHub first schedules the removal of every uploaded file in the folder; if that fails, nothing is deleted and the request returns
503. A200means the folder and its contents are gone from the graph for good. Their embeddings and stored files are removed afterwards, with the same retries asDELETE /record/:recordId. - With Move Deleted Records to the Trash on in Labs: the folder and its contents go to the trash as one item, which can be restored from the collection’s Recently deleted page. Their uploaded files are kept until the scheduled cleanup.
- Request
- Response
DELETE /api/v1/knowledgeBase/:kbId/folder/:folderIdPath Parameters:Administrative Operations
Administrative Operations
/api/v1/connectors, and take a connector instance ID:GET /api/v1/connectors/:connectorId/stats- Indexing statistics for a connector. Needs only the ID.POST /api/v1/connectors/:connectorId/reindex- Reindex a connector’s records. The body is optional: send{ "statusFilters": [...] }to reindex only the records with those indexing statuses.POST /api/v1/connectors/:connectorId/resync- Resync a connector’s records. The body must includeconnectorName(the connector’s name), and may includefullSync: truefor a full resync. A request withoutconnectorNameis refused.
stats/:connector, reindex-all/connector and resync/connector endpoints no longer exist.Event System
The Knowledge Base Service broadcasts events through Kafka to notify other services about record changes. These events trigger actions like content indexing, search updates, and audit logging.Event Types
Event Payload Structure
New Record Event
New Record Event
Update Record Event
Update Record Event
Deleted Record Event
Deleted Record Event
Schema Definitions
Record Schema
Record Schema
File Record Schema
File Record Schema
Knowledge Base Schema
Knowledge Base Schema
Upload Schema
Upload Schema
Error Handling
All endpoints return structured error responses with specific HTTP status codes:requestId identifies the request in the server’s logs, so include it when you report a problem.
Common Error Codes:
400 Bad Request- Invalid request parameters, file validation errors401 Unauthorized- Missing or invalid authentication403 Forbidden- Insufficient permissions404 Not Found- Resource not found409 Conflict- Name already in use: a file of the same type, or a folder, already has that name in that location413 Payload Too Large- File size exceeds limit422 Unprocessable Entity- Validation errors500 Internal Server Error- Server errors, backend service failures
- File extension mismatch for versioned updates
- Unsupported MIME types
- File size exceeds 30MB limit
- Invalid file path characters
- Duplicate name: a file whose name and type match a file in its destination folder, or another file in the same upload going there, is skipped with a
file:failedstream event, reasonDUPLICATE_NAME. The rest of the upload goes ahead.
Integration with AI Indexing
When a record is created or updated, the Knowledge Base Service:- Stores the file metadata in the graph database
- Uploads the file content to the Storage Service
- Publishes a Kafka event with the file metadata and download URL
- The AI Backend consumes these events and:
- Downloads the file content
- Extracts text and structured data
- Processes the content for search indexing
- Updates the indexing status in the Knowledge Base
Security and Permissions
- All endpoints require valid JWT authentication
- Admin endpoints require additional role verification
- File uploads are validated for MIME type and size
- Access control is enforced at the organization level
- File content is streamed securely through signed URLs
- Upload paths are sanitized to prevent directory traversal
Rate Limits and Constraints
- File Upload: Maximum 30MB per file by default (set in platform settings), 1000 files per upload
- Pagination: Maximum 100 items per page
- Search Terms: Maximum 1000 characters
- Knowledge Base Names: 1-255 characters
- File Paths: Must not contain invalid characters or be duplicated