Skip to main content
get/knowledge-fs/spaces/{knowledge_base_id}/logical-documents/{document_id}
Request example
Response
get/knowledge-fs/spaces/{knowledge_base_id}/logical-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

knowledge_base_idstringrequired#
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_idstringrequired#
The document ID, from List Documents.

Responses

application/json
The document.
activeobject#
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_revisioninteger#
Number of the active revision. null while none is active.
created_atstring#
When the document was created, ISO 8601.
disabled_atstring#
When the document was disabled in Dify, ISO 8601.
disabled_by_subject_idstring#
Internal ID of whoever disabled the document. Not needed to call this API.
enabledboolean#
false after the document is disabled in Dify. Re-index Documents skips disabled documents.
idstring#
Document ID. It stays the same when the document's content is updated.
knowledge_space_idstring#
Internal ID of the knowledge base. Not the knowledge base ID in the path.
latest_taskobject#
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_idstring#
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_versioninteger#
Change counter. Send it as expectedRowVersion on Update Document Metadata, and as expectedRevision on Delete Document. It increases on metadata updates, when a new revision becomes active or the active revision's file is deleted, when the document's source is deleted with documents=keep, and when the document is enabled or disabled in Dify.
source_idstring#
Source the document came from. null for uploaded files.
statusstring#
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.
titlestring#
Document title.
updated_atstring#
When the document last changed, ISO 8601.
user_metadataobject#
Custom metadata, keyed by metadata field name. Change it with Update Document Metadata or in Dify.