GET/datasets/{dataset_id}/documents/{document_id}/download

Download Document

Returns a signed URL for downloading a document's original uploaded file.

2 parameters
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_idstringrequired
Document ID. From [List Documents](/en/api-reference/documents/list-documents).

3 status codes
200Download URL generated successfully.
urlstringoptional
Signed URL to download the original uploaded file.
403- `forbidden` : You do not have permission to access this document. - `forbidden` : Knowledge base API access is not enabled. - `forbidden` : Sorry, you have reached the knowledge base request rate limit of your subscription. - `forbidden` : The API key is scoped to specific knowledge bases, and this knowledge base is not one of them.

One documented failure

  • forbidden

    No permission.

    forbidden (no permission)

404`not_found` : Document not found. Also returned as "Uploaded file not found." when the stored file is missing, and "Document does not have an uploaded file to download." for non-file documents.

One documented failure

  • not_found

    Document not found.

    not_found

Error handling

A 403 is returned: - forbidden : You do not have permission to access this document.

  • forbidden : Knowledge base API access is not enabled.
  • forbidden : Sorry, you have reached the knowledge base request rate limit of your subscription.
  • 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. Also returned as "Uploaded file not found." when the stored file is missing, and "Document does not have an uploaded file to download." for non-file documents.