PATCH/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}

Update child chunk content

Updates the text content of a child chunk within a document chunk in a knowledge base. Provide the new text in content to replace the existing child chunk content. The response includes the updated child chunk object.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

4 parameters · 1 body field
dataset_idstringrequired
The UUID of the knowledge base containing the document.
document_idstringrequired
The UUID of the document containing the parent chunk.
segment_idstringrequired
The UUID of the parent chunk containing the child chunk.
child_chunk_idstringrequired
The UUID of the child chunk to update.

Child chunk update payload containing the replacement text.

contentstringrequired
Child chunk text content.

5 status codes
200Returns the updated child chunk object, including its content and metadata.
dataobjectoptional
400Returned when re-indexing the child chunk in the vector store fails; the response includes the underlying vector-store error.

One documented failure

  • invalid_param

    Vector store operation failed: [Errno 111] Connection refused

    invalid_param

403Returned when dataset API access is disabled, subscription capacity or request limits are reached, the plan does not permit the operation, or the API key is not scoped to the knowledge base.

One documented failure

  • forbidden

    Dataset api access is not enabled.

    forbidden (api access)

404Returned when the knowledge base, document, parent chunk, or child chunk does not exist.

One documented failure

  • not_found

    Dataset not found.

    not_found

503Returned on the Dify Cloud Sandbox plan when vector-space usage cannot be verified.

One documented failure

  • service_unavailable

    Unable to verify vector space usage right now. Please try again later.

    service_unavailable

Error handling

A 400 is returned when re-indexing the child chunk in the vector store fails; a 403 is returned when access, subscription capacity, request limits, or plan restrictions block the update. A 404 is returned when the knowledge base, document, parent chunk, or child chunk cannot be found; a 503 is returned when vector-space usage cannot be verified on the Cloud Sandbox plan. The dataset_id path parameter, document_id path parameter, segment_id path parameter, and child_chunk_id path parameter must be UUIDs. The request body must include content.