GET
/datasets/{dataset_id}/documents/{document_id}/segmentsList Chunks
Returns a paginated list of chunks within a document, optionally filtered by keyword or indexing status.
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. Obtain it from [List Documents](/en/api-reference/documents/list-documents).
pageintegeroptional
Page number.
limitintegeroptional
Number of items per page. Server caps at `100`.
statusarray<string>optional
Filter chunks by indexing status, e.g. `completed`, `indexing`, `error`.
keywordstringoptional
Search keyword.
200List of chunks.
dataarray<object>optional
List of chunks.
doc_formstringoptional
Document chunking mode used by this document.
has_morebooleanoptional
Whether more items exist on the next page.
limitintegeroptional
Number of items per page.
pageintegeroptional
Current page number.
totalintegeroptional
Total number of matching chunks.
400`provider_not_initialize` : The knowledge base uses high-quality indexing but its embedding model is missing or misconfigured.
One documented failure
provider_not_initializeNo Embedding Model available. Please configure a valid provider in the Settings -> Model Provider.
provider_not_initialize
403- `forbidden` : Dataset api access is not enabled.
- `forbidden` : The API key is scoped to specific knowledge bases, and this knowledge base is not one of them.
One documented failure
forbiddenDataset api access is not enabled.
forbidden (api access)
404- `not_found` : Dataset not found.
- `not_found` : Document not found.
One documented failure
not_foundDataset not found.
not_found
Error handling
A 400 is returned: provider_not_initialize : The knowledge base uses high-quality indexing but its embedding model is missing or misconfigured. A 403 is returned: - forbidden : Dataset api access is not enabled.
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: Dataset not found.not_found: Document not found.