PATCH
/datasets/{dataset_id}/documents/status/{action}Update Document Status in Batch
Enables, disables, archives, or unarchives multiple documents in one request.
- IdempotentThe SDK sends
Idempotency-Key, so a retried request is only applied once.
dataset_idstringrequired
Knowledge base ID, from [List Knowledge Bases](/en/api-reference/knowledge-bases/list-knowledge-bases). For a scoped key, [copy the ID from the Dify URL](/en/api-reference/guides/knowledge#knowledge-base-id).
actionstringrequired
`enable` activates documents for retrieval, `disable` deactivates them, `archive` moves them to the archive, `un_archive` restores them from the archive.
document_idsarray<string>required
Document IDs to update. Get them from [List Documents](/en/api-reference/documents/list-documents).
200Documents updated successfully.
resultstringoptional
Operation result.
400`invalid_action` : Invalid action, or a document is in a state that does not allow the action (e.g. still indexing, or not completed).
One documented failure
invalid_actionInvalid action.
invalid_action
403- `forbidden` : Knowledge base API access is not enabled.
- `forbidden` : The API key is scoped to specific knowledge bases, and this knowledge base is not one of them.
One documented failure
forbiddenDataset api access is not enabled.
forbidden (api access)
404`not_found` : Knowledge base not found.
One documented failure
not_foundDataset not found.
not_found
Error handling
A 400 is returned: invalid_action : Invalid action, or a document is in a state that does not allow the action (e.g. still indexing, or not completed). A 403 is returned: - forbidden : Knowledge base API access is not enabled.
forbidden: The API key is scoped to specific knowledge bases, and this knowledge base is not one of them. A 404 is returned:not_found: Knowledge base not found.