Skip to main content
get/datasets/{dataset_id}/documents/{document_id}
Request example
Response
get/datasets/{dataset_id}/documents/{document_id}

Authorization

Authorizationstringheaderrequired#

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_idstringrequired#
Knowledge base ID, from List Knowledge Bases. For a scoped key, copy the ID from the Dify URL.
document_idstringrequired#
Document ID. From List Documents.

Query parameters

metadataenum<string>#
all returns all fields including metadata. only returns only id, doc_type, and doc_metadata. without returns all fields except doc_type and doc_metadata.

Default: "all"

Options:allonlywithout

Responses

application/json
Document details. The returned fields depend on the metadata query parameter.
archivedboolean#
Whether the document is archived.
average_segment_lengthnumber#
Average character length of chunks.
completed_atnumber#
Unix timestamp when processing completed, null if not yet completed.
created_atnumber#
Unix timestamp of document creation.
created_bystring#
ID of the user who created the document.
created_fromstring#
Origin of the document. api for API creation, web for UI creation.
data_source_infoobject#
Data source details. For file uploads, this detail endpoint returns the full file object under upload_file (the list endpoint returns only upload_file_id).
data_source_typestring#
How the document was uploaded. upload_file for file uploads, notion_import for Notion imports.
dataset_process_ruleobject#
Knowledge-base-level processing rule configuration.
dataset_process_rule_idstring#
ID of the processing rule applied to this document.
disabled_atnumber#
Unix timestamp when the document was disabled, null if enabled.
disabled_bystring#
ID of the user who disabled the document, null if enabled.
display_statusstring#
Display-friendly indexing status for the UI.
doc_formstring#
Document chunking mode. text_model for standard text, hierarchical_model for parent-child, qa_model for QA pairs.
doc_languagestring#
Language of the document content.
doc_metadataobject[]#
Custom metadata key-value pairs for this document.
doc_typestring#
Document type classification, null if not set.
document_process_ruleobject#
Document-level processing rule configuration.
enabledboolean#
Whether the document is enabled for retrieval.
errorstring#
Error message if indexing failed, null otherwise.
hit_countinteger#
Number of times this document has been retrieved.
idstring#
Document identifier.
indexing_latencynumber#
Time taken for indexing in seconds, null if not completed.
indexing_statusstring#
Current indexing status, e.g. waiting, parsing, cleaning, splitting, indexing, completed, error, paused.
namestring#
Document name.
need_summaryboolean#
Whether the document needs summary generation.
positioninteger#
Position index within the knowledge base.
segment_countinteger#
Number of chunks in the document.
summary_index_statusstring#
Status of summary indexing, null if summary index is not enabled.
tokensinteger#
Number of tokens in the document.
updated_atnumber#
Unix timestamp of last update, null if never updated.