Upload a document into a knowledge base
Register an uploaded document and dispatch it for indexing.
The HTTP connection covers only the upload phase: the request body
is streamed into the blob store, a pending document record is
persisted, the indexing task is dispatched, and the response is
returned. Parsing / chunking / embedding happen asynchronously in
a worker; the client tracks progress via
:func:list_knowledge_document_status.
Args:
knowledge_base_id (str):
The knowledge base to receive the document.
file (UploadFile):
The uploaded file (multipart/form-data).
content_type (str | None, optional):
Override the IANA media type used to route the upload.
user_id (str):
Injected authenticated user ID.
service (KnowledgeBaseService):
Injected knowledge base service.
Returns:
UploadKnowledgeDocumentResponse:
The server-assigned document id, filename, and the
initial lifecycle state (always "pending").
Headers
Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.
Path Parameters
The knowledge base id.
Body
Response
Successful Response
Response body after uploading a document into a knowledge base.
Server-assigned document identifier.
The original filename of the uploaded document.
Lifecycle state immediately after upload — always 'pending' in the happy path; surfaced so the client can seed its progress tracker without an extra round-trip.
pending, parsing, chunking, indexing, ready, error