Documents

Get Document

Returns detailed information for a single document.

get/datasets/{dataset_id}/documents/{document_id}

Request

  • Base URL
    https://api.dify.ai/v1
  • URL
    https://api.dify.ai/v1/datasets/{dataset_id}/documents/{document_id}
  • Auth
    HTTP bearer

Path parameters

dataset_idstring uuid required

Knowledge base ID, from List Knowledge Bases. For a scoped key, copy the ID from the Dify URL.

document_idstring uuid required

Document ID. From List Documents.

Query parameters

metadata'all' | 'only' | 'without'

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.

Response

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 nullable

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_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 nullable

Unix timestamp when the document was disabled, null if enabled.

disabled_bystring nullable

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_typestring nullable

Document type classification, null if not set.

document_process_ruleobject

Document-level processing rule configuration.

enabledboolean

Whether the document is enabled for retrieval.

errorstring nullable

Error message if indexing failed, null otherwise.

hit_countinteger

Number of times this document has been retrieved.

idstring

Document identifier.

indexing_latencynumber nullable

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 nullable

Status of summary indexing, null if summary index is not enabled.

tokensinteger

Number of tokens in the document.

updated_atnumber nullable

Unix timestamp of last update, null if never updated.

Changes

No recorded changes to this operation across all 17 revisions of this API.