POST
/datasets/{dataset_id}/documents/download-zipDownload Documents as ZIP
Downloads one or more documents as a single ZIP archive. Only documents that were uploaded as files can be included.
- 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).
document_idsarray<string>required
Document IDs to include in the archive. Get them from [List Documents](/en/api-reference/documents/list-documents).
200ZIP archive containing the requested documents.
403- `forbidden` : Knowledge base API access is not enabled.
- `forbidden` : Sorry, you have reached the knowledge base request rate limit of your subscription.
- `forbidden` : You do not have permission to access this knowledge base.
- `forbidden` : You do not have permission for one of the requested documents.
- `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` : Document not found.
- `not_found` : Knowledge base not found. Also returned as "Only uploaded-file documents can be downloaded as ZIP." when a requested document has no uploaded file.
One documented failure
not_foundDocument not found.
not_found
Error handling
A 403 is returned: - forbidden : Knowledge base API access is not enabled.
forbidden: Sorry, you have reached the knowledge base request rate limit of your subscription.forbidden: You do not have permission to access this knowledge base.forbidden: You do not have permission for one of the requested documents.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: Document not found.not_found: Knowledge base not found. Also returned as "Only uploaded-file documents can be downloaded as ZIP." when a requested document has no uploaded file.