Skip to main content
GET
Get Document

Authorizations

Authorization
string
header
required

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

knowledge_base_id
string<uuid>
required

Knowledge base ID: the last segment of the Service API endpoint shown in the knowledge base's API Access dialog (…/knowledge-fs/spaces/<knowledge base ID>), and the segment after /datasets/new/ in the address bar.

document_id
string<uuid>
required

The document ID, from List Documents.

Response

The document.

active
object | null

The active revision: the content the knowledge base serves. Pass its revision to List Chunks and its document_asset_id to Get Document File. null while no revision is active.

active_revision
integer | null

Number of the active revision. null while none is active.

created_at
string

When the document was created, ISO 8601.

disabled_at
string | null

When the document was disabled in Dify, ISO 8601.

disabled_by_subject_id
string | null

Internal ID of whoever disabled the document. Not needed to call this API.

enabled
boolean

false after the document is disabled in Dify. Re-index Documents skips disabled documents.

id
string

Document ID. It stays the same when the document's content is updated.

knowledge_space_id
string

Internal ID of the knowledge base. Not the knowledge base ID in the path.

latest_task
object | null

The newest indexing task behind the document's revisions, with task_kind: document. Follow it with Get Document Indexing Task using its id. null when there is none, and always null in the Update Document Metadata response.

provider_item_id
string | null

For a document imported from a source, the item's identifier there: the providerItemId sent to Import Source Items, or the page_id of a website page.

row_version
integer

Change counter. Send it as expectedRowVersion on Update Document Metadata. It increases on metadata updates, when a new revision becomes active, and when the document is enabled or disabled in Dify.

source_id
string | null

Source the document came from. null for uploaded files.

status
string

pending (no revision active yet), ready (a revision is active), failed (the first revision failed to index and none is active), or deleting. A ready document stays ready when a later revision fails.

title
string

Document title.

updated_at
string

When the document last changed, ISO 8601.

user_metadata
object

Custom metadata, keyed by metadata field name. Change it with Update Document Metadata or in Dify.