Skip to main content
Getting content into Knowledge Stack is a two-step process: organise documents in folders, then ingest them. Once ingested, the pipeline converts your file into searchable chunks and makes them available for semantic search and AI threads.

Prerequisites

All requests require a valid API key passed as a Bearer token:
Authorization: Bearer <your-api-key>

1. Create a folder

Folders are the top-level containers for your documents. Every document must live inside a folder.
curl -X POST https://api-staging.knowledgestack.ai/v1/folders \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Docs",
    "parent_path_part_id": "<parent-folder-id>"
  }'
Request fields
FieldTypeRequiredDescription
namestringYesFolder name (max 255 characters)
parent_path_part_idUUIDYesID of an existing folder to nest this one under
The response returns a FolderResponse object including the folder’s id and path_part_id. Use the path_part_id when ingesting documents into this folder.

2. Ingest a document

The fastest path to ingestion is the all-in-one endpoint POST /v1/documents/ingest. It accepts a multipart form upload, creates the document and its first version, uploads the file, and kicks off the ingestion pipeline in a single call.
1
Upload the file
2
curl -X POST https://api-staging.knowledgestack.ai/v1/documents/ingest \
  -H "Authorization: Bearer <your-api-key>" \
  -F "file=@/path/to/your/report.pdf" \
  -F "path_part_id=<folder-path-part-id>" \
  -F "name=Q3 Financial Report" \
  -F "ingestion_mode=high_accuracy"
3
Form fields
4
FieldTypeRequiredDescriptionfilebinaryYesThe file to uploadpath_part_idUUIDYesThe path_part_id of the destination foldernamestringNoDocument name. Defaults to the filename if omittedingestion_modestringNoProcessing strategy (see Ingestion modes). Auto-resolved from file type when omitted
5
Response (201)
6
{
  "workflow_id": "ingest-doc:01929abc-...",
  "document_id": "d1e2f3a4-...",
  "document_version_id": "a1b2c3d4-..."
}
7
Save the workflow_id — you will use it to monitor progress.
8
Monitor ingestion status
9
Poll the workflow status endpoint until status is completed or failed.
10
curl -X GET "https://api-staging.knowledgestack.ai/v1/workflows/document_versions/<workflow-id>" \
  -H "Authorization: Bearer <your-api-key>"
11
Pipeline statuses
12
StatusMeaningpendingWorkflow is queued, not yet startedprocessingActively converting and chunking your documentcompletedChunks are indexed and ready to searchfailedPipeline encountered an error — check the error fieldcancelledWorkflow was cancelled before completion
13
You can also list all ingestion workflows for your tenant:
14
curl -X GET "https://api-staging.knowledgestack.ai/v1/workflows/document_versions?limit=20&offset=0" \
  -H "Authorization: Bearer <your-api-key>"

Ingestion modes

The ingestion_mode field controls how the pipeline converts and chunks your document. When you omit it, Knowledge Stack chooses the best mode for the file type automatically.
ModeBest forBehaviour
high_accuracyPDFs with complex layouts, tables, or mixed contentFull page-level rendering with layout analysis. Slower but most accurate
standardDOCX, XLSX, PPTX, PLAINTEXTText-extraction with structural chunking. Good balance of speed and quality
single_chunkImages, CSVs, or content you want stored as one unitTreats the entire file as a single chunk. No splitting occurs
For PDFs that are mostly text (reports, papers, manuals), high_accuracy is the default and usually the right choice. For plain text files where structure doesn’t matter, standard is faster.

Document types

The document_type field is used when creating a document manually (see below). Knowledge Stack uses this to validate and route the file appropriately.
ValueDescription
PDFPDF files
DOCXMicrosoft Word documents
PLAINTEXTPlain text files (.txt, .md, etc.)
IMAGEImage files (JPEG, PNG, etc.)
XLSXMicrosoft Excel spreadsheets
CSVComma-separated value files
PPTXMicrosoft PowerPoint presentations
UNKNOWNUse when the type cannot be determined

Alternative: Manual document creation

If you need more control — for example, when building the document record before the file is ready — you can create a document and version separately.
1
Create a document record
2
curl -X POST https://api-staging.knowledgestack.ai/v1/documents \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Architecture Decision Record",
    "parent_path_part_id": "<folder-path-part-id>",
    "document_type": "PLAINTEXT",
    "document_origin": "SOURCE"
  }'
3
This returns a DocumentResponse containing the id of the new document.
4
Create a version
5
curl -X POST https://api-staging.knowledgestack.ai/v1/documents/<document-id>/versions \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{}'
6
This returns a DocumentVersionResponse with a version_id.
7
Trigger ingestion on the version
8
curl -X POST "https://api-staging.knowledgestack.ai/v1/document_versions/<version-id>" \
  -H "Authorization: Bearer <your-api-key>" \
  -F "file=@/path/to/your/file.txt"
9
This uploads the file and starts the ingestion pipeline for that specific version.

Re-ingest / update a document

When a document changes, create a new version by calling the re-ingest endpoint. Upon successful ingestion, the new version automatically becomes the active version and the previous version’s index entries are deactivated.
curl -X POST https://api-staging.knowledgestack.ai/v1/documents/<document-id>/ingest \
  -H "Authorization: Bearer <your-api-key>" \
  -F "file=@/path/to/updated-report.pdf" \
  -F "ingestion_mode=high_accuracy"
The response is identical to the original ingest call — a new workflow_id and document_version_id are returned.

Document version actions

After ingestion, you can perform lifecycle actions on a specific document version using POST /v1/document_versions/{version_id}.
ActionDescription
reembedRe-runs embedding on all chunks in this version. Useful after updating chunk content or changing embedding models
curl -X POST "https://api-staging.knowledgestack.ai/v1/document_versions/<version-id>" \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"action": "reembed"}'
To archive or delete a version, use the DELETE /v1/document_versions/{version_id} endpoint.