Add a document to a knowledge base

Registers a document. For file sources (pdf/docx/txt) the response carries a short-lived presigned PUT URL the client uploads to, then calls the complete endpoint. For url sources, ingestion starts immediately.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

kb_idstringRequired

Request

This endpoint expects an object.
namestringRequired
source_typeenumRequired
Allowed values:
source_urlstringOptional

Required when source_type is url.

size_byteslongOptional
Exact file size in bytes. REQUIRED (> 0) for file sources (pdf/docx/txt); omit for url. Bound into the presigned PUT's Content-Length, so the upload must send exactly this many bytes or S3 rejects it. Omitting it for a file source returns 400. (Expressed as prose, not a JSON-Schema if/then conditional, because the contract validator — kin-openapi — rejects 3.1 if/then siblings.)

Response

Document registered
chunk_countintegerOptional
created_atdatetimeOptional
error_messagestringOptional
idstringOptional
knowledge_base_idstringOptional
namestringOptional
size_byteslongOptional
source_typeenumOptional
source_urlstringOptional
statusenumOptional
updated_atdatetimeOptional
upload_urlstringOptional

Presigned PUT URL for file sources; empty for url sources.

Errors

400
Create Knowledge Base Document Request Bad Request Error
404
Create Knowledge Base Document Request Not Found Error
503
Create Knowledge Base Document Request Service Unavailable Error