Cortex supports various document formats and provides flexible upload options for both single files and bulk operations. In the web UI, uploading is done directly from the Documents page via the Upload button, which opens a drag-and-drop modal with collection selection. The modal closes immediately after files are selected — upload progress is shown inline in the document list. Once uploaded, use the graph button on the Documents page to bring the knowledge graph up to date. The button navigates to the Knowledge Graph page under Manage and auto-starts the right flow on arrival — no second click needed. On a fresh instance it reads Generate Graph and builds the full pipeline (entity extraction, relationship analysis, community detection). Once a graph exists it reads Update Graph and only extracts entities from the newly uploaded documents — the existing graph is never rebuilt from the Documents page; a full rebuild stays behind the explicit Regenerate Graph button (and its confirmation) on the Knowledge Graph page.
Supported Formats
| Format | Extension | Speed | Notes |
|---|---|---|---|
.pdf | ~1 s/page | Per-page ML layout analysis — fine for papers/reports, minutes for books; scanned PDFs slower still (OCR) | |
| EPUB | .epub | Seconds | E-books parsed natively — much faster than the same book as PDF; prefer uploading the EPUB when you have both. Kindle formats (.mobi, .azw) are not supported — convert them to EPUB first (e.g. with Calibre) |
| Plain Text | .txt | Instant | Direct text ingestion |
| Markdown | .md | Instant | Preserves formatting, headers, code blocks |
| Word | .docx | Seconds | Parsed natively — upload the .docx, not an "Export as PDF" of it |
Rule of thumb: upload the source format, not a rendering of it. Only PDFs and standalone images go through per-page ML analysis; every other format is parsed directly from its markup in seconds regardless of length. Books → EPUB, Office documents → the office file itself, web content → Web Import or HTML/Markdown. Reserve PDF for content that only exists as PDF.
Upload Methods
Single File Upload
Upload one file at a time with immediate processing:
Code
With a custom source (for API integrations):
Code
The source parameter lets you tag documents by origin. Defaults to "upload" for UI uploads. Set it to your app's identifier (e.g. "slack-bot", "notion-sync") when building integrations. Documents can be filtered by source in the UI.
Response:
Code
Bulk Upload
For uploading many files (100+), disable immediate processing and batch process later:
Code
Processing Pipeline
When a document is uploaded, it goes through these stages:
Tracking Progress
Get Document Status
Code
Response:
Code
Processing Status Values
| Status | Description |
|---|---|
pending | Uploaded, waiting for processing |
processing | Currently being processed |
completed | Successfully processed (text extraction done; images may still be analyzing in the background — check image_progress_current vs image_progress_total) |
failed | Processing failed (check logs) |
A document with status: "completed" may still have background image analysis running. The image_progress_current, image_progress_total, and image_progress_message fields in the document response track this progress. The Knowledge Graph pipeline (Step 1) treats these documents as still in-progress and will not advance to relationship analysis until all image analysis completes.
Startup recovery: If the backend is restarted while a document is mid-processing, on startup any document left in a transient state (processing/extracting) is reset to pending so it rejoins the queue instead of spinning forever. A WARNING log lists the reset document ids.
Degraded-document detection: Reprocessing an unchanged file with unchanged config normally short-circuits (delta-skip) to avoid redundant work. A document is treated as degraded — and always fully reprocessed regardless of the delta-skip — when it reached completed but yielded zero extracted entities or still has chunks missing embeddings. This ensures a document that processed incompletely (e.g. a transient LLM/embedding failure) is repaired on the next reprocess rather than silently skipped.
Custom Inputs
In addition to file uploads, you can add knowledge manually:
Q&A Pairs
Code
Plain Text
Code
Markdown
Code
Viewing Documents
You can view the original uploaded file for any document. The behavior depends on the file type:
- Markdown files (
.md): Rendered in an in-app viewer with full Markdown formatting (headings, tables, code blocks, etc.) - PDF files: Opened in a new browser tab for inline viewing
- Other file types: Opened in a new tab — the browser decides whether to display or download the file
Code
In the UI, click the eye icon on any document card to view it.
Document Management
List All Documents
Code
Delete a Document
When you delete a document, Cortex automatically:
- Cancels active processing - If the document is being processed, the task is stopped
- Removes chunks - All text chunks are deleted
- Cleans up entities - Orphaned entities (only in this document) are removed
- Cleans up communities - Empty communities are deleted
Code
Response:
Code
Reprocess a Document
Useful after updating extraction settings:
Code
Bulk Download (ZIP)
Download multiple documents as a ZIP archive. Supports large instances (1000+ documents) with ZIP64 and streaming:
Code
Response: A streamed application/zip file containing the original uploaded files. Duplicate filenames are automatically disambiguated (e.g., report.pdf, report (1).pdf).
In the UI, select documents on the Documents page and click the Download button in the bulk actions toolbar.
Bulk Delete
Delete multiple documents at once. All active processing is cancelled before deletion:
Code
Response:
Code
Delete All Documents
Delete the entire knowledge base (use with caution):
Code
This cancels all active processing tasks and removes all documents, chunks, entities, and communities.
Configuration
Control document processing behavior via environment variables:
Uploads are streamed in bounded chunks and rejected mid-stream with HTTP 413 once they exceed MAX_FILE_SIZE_MB, so an oversized file is never fully buffered into memory first. A multipart upload with no filename returns 400.
Code