documents

Upload a document file

Changed on

Upload a document file.

Accepts PDF, DOCX, PPTX, XLSX, HTML, CSV, JSON, XML, YAML, Markdown and plain text (conversion/service.DOCUMENT_FORMATS); anything else is a 415. Formats other than Markdown and plain text are converted to Markdown during the upload, within per-format limits (413) and a per-process number of concurrent conversions (429). A deployment with UPLOAD_CONVERSION=false converts nothing: it accepts Markdown and plain text only and refuses every other format with 415 DOCUMENT_CONVERSION_DISABLED. Every refusal and every failed conversion happens before anything is stored. Once uploaded, the document is ready for fact extraction.

A client of such a deployment converts the file itself and uploads the Markdown with three form fields about the original (v0.7.31.0): original_filename, original_sha256 and converter. The server stores them, cites the document by the original's name, and decides duplicates by the original's hash (services/document_dedup.py). They are the client's word about a file the server never receives, and only fit a Markdown or text upload (422 INVALID_ORIGINAL_METADATA).

post/documents/upload

Request

Query parameters

authorstring nullable
tagsstring nullable
source_urlstring nullable
descriptionstring nullable
original_datestring nullable
effective_fromstring nullable
pot_idstring uuid nullable

The POT this upload is for (v0.7.80.0): original_date is also stored as that POT's own date for the document (pot_original_dates), so a later date set for another POT never moves it. Only with original_date; 404 POT_NOT_FOUND for a POT not in the workspace.

Request body multipart/form-data

filestring binary required
original_filenamestring nullable

Name of the file the client converted to this Markdown

original_sha256string nullable

SHA-256 (hex) of the file the client converted to this Markdown

converterstring nullable

What produced this Markdown on the client, e.g. scipot-conversion/<v>

Response

Document uploaded, converted (if needed), and stored

document_idstring uuid required
filenamestring required
size_bytesinteger required
stored_bytesinteger required

What the document counts against the workspace's storage quota: the original plus its Markdown when the server converted it, else the file once.

typestring required
conversion_statusstring required
messagestring

Changes