Document types
TheDocumentType enum describes the file format:
| Value | Description |
|---|---|
PDF | PDF file |
DOCX | Microsoft Word document |
PLAINTEXT | Plain text file |
IMAGE | Image file |
XLSX | Microsoft Excel spreadsheet |
CSV | Comma-separated values |
PPTX | Microsoft PowerPoint presentation |
UNKNOWN | Unrecognized or unspecified format |
Document origins
TheDocumentOrigin enum describes where the document came from:
| Value | Description |
|---|---|
SOURCE | Uploaded directly by a user or integration |
GENERATED | Produced by the system (e.g. an AI-generated output) |
Ingest document
POST https://api-staging.knowledgestack.ai/v1/documents/ingest
Upload a file, create a document and its initial version (v0), and trigger the ingestion pipeline. This is the primary way to add content to Knowledge Stack.
The request must be multipart/form-data.
Request body (multipart)
The file to upload.
path_part_id of the parent folder. Must reference a FOLDER type path part.Document name. Defaults to the uploaded filename if omitted.
Ingestion pipeline mode. One of:
high_accuracy— default for PDF; uses high-quality conversionstandard— default for DOCX, XLSX, PPTX, PLAINTEXTsingle_chunk— default for IMAGE and CSV; treats the entire file as one chunk
Force a specific chunk type (
TABLE, IMAGE, or HTML). Only valid with single_chunk mode.Force secondary taxonomy (e.g.
picture, flowchart). Only valid with single_chunk mode and chunk_type=IMAGE.DPI for PDF page screenshots. Range 36–216. Defaults to
72.Response 201
Returns an IngestDocumentResponse.
ID of the created document.
ID of the created document version (v0).
Workflow ID for tracking ingestion progress.
Example
Ingest document version
POST https://api-staging.knowledgestack.ai/v1/documents/{document_id}/ingest
Upload a new file for an existing document, creating a new version and triggering ingestion. The new version is automatically assigned the next version number.
Path parameters
The document to create a new version for.
Request body (multipart)
The new file to upload.
Ingestion mode (same options as ingest document).
Force chunk type. Only valid with
single_chunk mode.Force secondary taxonomy. Only valid with
single_chunk and chunk_type=IMAGE.DPI for PDF page screenshots. Range 36–216. Defaults to
72.Response 201
Returns an IngestDocumentResponse with the new document_version_id.
Example
Create document
POST https://api-staging.knowledgestack.ai/v1/documents
Create a new empty document (with an empty v0 version) without uploading a file. Use this when you intend to populate the document manually via the sections and chunks APIs rather than through file ingestion.
Request body
Document name. 1–255 characters.
path_part_id of the parent folder.The document type. One of the
DocumentType enum values.The document origin. One of
SOURCE or GENERATED.Response 200
Returns a DocumentResponse.
Document ID.
Underlying path part ID.
Document name.
Parent folder’s path part ID.
Document type enum value.
Document origin enum value.
ID of the currently active version.
Full details of the active version. See Document Versions for field descriptions.
Full path from root.
Whether this document is system-managed.
Owning tenant.
Creation timestamp (ISO 8601).
Last update timestamp (ISO 8601).
Tags attached to this document.
Example
List documents
GET https://api-staging.knowledgestack.ai/v1/documents
List direct child documents of a parent folder.
Query parameters
Filter to documents in this folder. Defaults to the tenant’s shared root.
Sort order. One of
NAME, UPDATED_AT, CREATED_AT.Include tags in each result. Defaults to
false.Page size.
Pagination offset.
Response 200
Returns a paginated list of DocumentResponse objects.
Example
Get document
GET https://api-staging.knowledgestack.ai/v1/documents/{document_id}
Get a single document by ID, including its active version details.
Path parameters
The document ID.
Query parameters
Include tags in the response. Defaults to
false.Response 200
Returns a DocumentResponse. See Create document for field descriptions.
Example
Update document
PATCH https://api-staging.knowledgestack.ai/v1/documents/{document_id}
Rename a document, move it to a different folder, or change its active version. All fields are optional.
Path parameters
The document ID to update.
Request body
New document name. 1–255 characters.
Move the document to this parent folder (
path_part_id of the destination folder).Set a different version as the active version.
Response 200
Returns the updated DocumentResponse.
Example
Delete document
DELETE https://api-staging.knowledgestack.ai/v1/documents/{document_id}
Delete a document and all of its contents.
This is a cascading delete. All versions, sections, and chunks belonging to this document are permanently removed. This action cannot be undone.
Path parameters
The document ID to delete.
Response 200
Returns an empty {} on success.