Documents

Update Document by Text

Changed on

Updates a document's text content, name, or processing configuration. Re-indexes the document when its text changes.

post/datasets/{dataset_id}/documents/{document_id}/update-by-text

Request

  • Base URL
    https://api.dify.ai/v1
  • URL
    https://api.dify.ai/v1/datasets/{dataset_id}/documents/{document_id}/update-by-text
  • Auth
    HTTP bearer

Path parameters

dataset_idstring uuid required

Knowledge base ID, from List Knowledge Bases. For a scoped key, copy the ID from the Dify URL.

document_idstring uuid required

Document ID. From List Documents.

Request body

doc_form'text_model' | 'hierarchical_model' | 'qa_model'

text_model for standard text chunking, hierarchical_model for parent-child chunk structure, qa_model for question-answer pair extraction.

doc_languagestring

Language of the document for processing optimization.

namestring

Document name. Required when text is provided.

textstring

Document text content.

Response

Document updated successfully.

batchstring

Batch ID for tracking indexing progress.

Changes