Replace a document
PUT /v1/knowledge-bases/{kb_id}/documents/{doc_id}
Replace a document’s content with a new file. The document is re-processed through the full ingestion pipeline (parse, chunk, embed, index), replacing all existing chunks.
The document keeps its ID, metadata, and position in the knowledge base. Only the content and chunks are replaced.
Returns the document record with pending status. Poll until ready or failed.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Example
kb_a1b2c3d4e5Knowledge base ID
Example
doc_f6g7h8i9j0Document ID
Request Body required
Section titled “Request Body required ”object
The replacement file. Same type restrictions as upload (max 50 MB, 16 supported types).
Optional JSON string of metadata to replace existing metadata.
Example
{"department": "engineering", "version": 3}Responses
Section titled “ Responses ”Document accepted for re-processing
object
object
Document ID (prefixed with doc_)
Example
doc_f6g7h8i9j0Parent knowledge base ID
Example
kb_a1b2c3d4e5Owning account ID
Example
acc_x9y8z7w6v5Original file name
Example
product-guide.pdfFile extension
Example
pdfFile size in bytes
Example
2048576Number of pages (for Tier 1 files, set after parsing)
Example
15Number of chunks generated from this document
Example
34Error message if status is failed
User-supplied metadata (filterable at search time)
object
Example
{ "department": "engineering", "version": 2}Internal storage path
Example
acc_x9y8z7w6v5/kb_a1b2c3d4e5/doc_f6g7h8i9j0/product-guide.pdfExample
2026-02-10T12:00:00.000ZExample
2026-02-10T12:01:30.000ZRequest validation failed
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)
object
Example
{ "error": { "code": "VALIDATION_ERROR", "message": "Invalid request body", "details": { "issues": [ { "path": [ "name" ], "message": "Required" } ] } }}Authentication failed or missing
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)
object
Example
{ "error": { "code": "AUTHENTICATION_ERROR", "message": "Invalid or missing API key" }}Resource not found
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)
object
Example
{ "error": { "code": "NOT_FOUND", "message": "KnowledgeBase not found: kb_nonexistent" }}Rate limit or usage limit exceeded
object
object
Machine-readable error code
Example
VALIDATION_ERRORHuman-readable error message
Example
Invalid request bodyAdditional error details (e.g., validation issues)