Skip to main content
POST
Update Document by Text

Authorizations

Authorization
string
header
required

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Path Parameters

dataset_id
string<uuid>
required

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

document_id
string<uuid>
required

Document ID. From List Documents.

Body

application/json
doc_form
enum<string>

Chunk structure: text_model for standard text chunking, hierarchical_model for parent-child chunks, qa_model for question-answer pairs.

Must match the knowledge base's existing chunk structure. When omitted, the knowledge base's existing structure is used, or text_model if it doesn't have one yet.

Available options:
text_model,
hierarchical_model,
qa_model
doc_language
string
default:English

Language of the document for processing optimization.

name
string

Document name. Required when text is provided.

process_rule
object

Processing rules for chunking.

retrieval_model
object

Controls how chunks are searched and ranked when querying this knowledge base.

text
string

Document text content.

Response

Document updated successfully.

batch
string

Batch ID for tracking indexing progress.

document
object