> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Documents

> Returns a paginated list of documents in the knowledge base. Supports filtering by keyword and indexing status.



## OpenAPI

````yaml /en/api-reference/openapi_knowledge.json get /datasets/{dataset_id}/documents
openapi: 3.0.1
info:
  title: Knowledge API
  description: >-
    API for managing knowledge bases, documents, chunks, metadata, and tags,
    including creation, retrieval, and configuration. **Note:** A single
    Knowledge Base API key has permission to operate on all visible knowledge
    bases under the same account. Please pay attention to data security.
  version: 1.0.0
servers:
  - url: '{apiBaseUrl}'
    description: The base URL for the Knowledge API.
    variables:
      apiBaseUrl:
        default: https://api.dify.ai/v1
        description: Actual base URL of the API
security:
  - ApiKeyAuth: []
tags:
  - name: Knowledge Bases
    description: >-
      Operations for managing knowledge bases, including creation,
      configuration, and retrieval.
  - name: Documents
    description: >-
      Operations for creating, updating, and managing documents within a
      knowledge base.
  - name: Chunks
    description: Operations for managing document chunks and child chunks.
  - name: Metadata
    description: >-
      Operations for managing knowledge base metadata fields and document
      metadata values.
  - name: Tags
    description: Operations for managing knowledge base tags and tag bindings.
  - name: Models
    description: Operations for retrieving available models.
  - name: Knowledge Pipeline
    description: >-
      Operations for managing and running knowledge pipelines, including
      datasource plugins and pipeline execution.
paths:
  /datasets/{dataset_id}/documents:
    get:
      tags:
        - Documents
      summary: List Documents
      description: >-
        Returns a paginated list of documents in the knowledge base. Supports
        filtering by keyword and indexing status.
      operationId: listDocuments
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Knowledge base ID.
        - name: page
          in: query
          schema:
            type: integer
            default: 1
          description: Page number to retrieve.
        - name: limit
          in: query
          schema:
            type: integer
            default: 20
          description: Number of items per page. Server caps at `100`.
        - name: keyword
          in: query
          schema:
            type: string
          description: Search keyword to filter by document name.
        - name: status
          in: query
          schema:
            type: string
            enum:
              - queuing
              - indexing
              - paused
              - error
              - available
              - disabled
              - archived
          description: Filter by display status.
      responses:
        '200':
          description: List of documents.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: Array of knowledge base objects.
                    items:
                      $ref: '#/components/schemas/Document'
                  has_more:
                    type: boolean
                    description: Whether more items exist on the next page.
                  limit:
                    type: integer
                    description: Number of items per page.
                  total:
                    type: integer
                    description: Total number of matching items.
                  page:
                    type: integer
                    description: Current page number.
              examples:
                success:
                  summary: Response Example
                  value:
                    data:
                      - id: a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac
                        position: 1
                        data_source_type: upload_file
                        data_source_info:
                          upload_file_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                        data_source_detail_dict:
                          upload_file:
                            id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                            name: guide.txt
                            size: 2048
                            extension: txt
                            mime_type: text/plain
                            created_by: ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4
                            created_at: 1741267200
                        dataset_process_rule_id: e1f2a3b4-c5d6-7890-ef12-345678901234
                        name: guide.txt
                        created_from: api
                        created_by: ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4
                        created_at: 1741267200
                        tokens: 512
                        indexing_status: completed
                        error: null
                        enabled: true
                        disabled_at: null
                        disabled_by: null
                        archived: false
                        display_status: available
                        word_count: 350
                        hit_count: 0
                        doc_form: text_model
                        doc_metadata: []
                        summary_index_status: null
                        need_summary: false
                    has_more: false
                    limit: 20
                    total: 1
                    page: 1
        '404':
          description: '`not_found` : Knowledge base not found.'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Dataset not found.
components:
  schemas:
    Document:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the document.
        position:
          type: integer
          description: Display position of the document in the list.
        data_source_type:
          type: string
          description: >-
            How the document was created. `upload_file` for file uploads,
            `notion_import` for Notion imports.
        data_source_info:
          type: object
          description: Raw data source information, varies by `data_source_type`.
        data_source_detail_dict:
          type: object
          description: Detailed data source information including file details.
        dataset_process_rule_id:
          type: string
          description: ID of the processing rule applied to this document.
        name:
          type: string
          description: Document name.
        created_from:
          type: string
          description: >-
            Origin of the document. `api` for API creation, `web` for UI
            creation.
        created_by:
          type: string
          description: ID of the user who created the document.
        created_at:
          type: number
          description: Creation timestamp (Unix epoch in seconds).
        tokens:
          type: integer
          description: Total number of tokens in the document.
        indexing_status:
          type: string
          description: >-
            Current indexing status. `waiting` for queued, `parsing` while
            extracting content, `cleaning` while removing noise, `splitting`
            while chunking, `indexing` while building vectors, `completed` when
            ready, `error` if failed, `paused` if manually paused.
        error:
          type: string
          nullable: true
          description: Error message if indexing failed. `null` when no error.
        enabled:
          type: boolean
          description: Whether the document is enabled for retrieval.
        disabled_at:
          type: number
          nullable: true
          description: Timestamp when the document was disabled. `null` if enabled.
        disabled_by:
          type: string
          nullable: true
          description: ID of the user who disabled the document. `null` if enabled.
        archived:
          type: boolean
          description: Whether the document is archived.
        display_status:
          type: string
          description: >-
            User-facing display status derived from `indexing_status` and
            `enabled` state.
        word_count:
          type: integer
          description: Total word count of the document.
        hit_count:
          type: integer
          description: Number of times the document has been matched in retrieval queries.
        doc_form:
          type: string
          description: >-
            Document chunking mode. `text_model` for standard text chunking,
            `hierarchical_model` for parent-child structure, `qa_model` for QA
            pair extraction.
        doc_metadata:
          type: array
          description: Metadata values assigned to this document.
          items:
            type: object
            properties:
              id:
                type: string
                description: Metadata field identifier.
              name:
                type: string
                description: Metadata field name.
              type:
                type: string
                description: Metadata field value type.
              value:
                type: string
                description: Metadata value for this document.
        summary_index_status:
          type: string
          nullable: true
          description: >-
            Status of the summary index for this document. `null` if summary
            indexing is not configured.
        need_summary:
          type: boolean
          description: Whether a summary needs to be generated for this document.
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        API Key authentication. For all API requests, include your API Key in
        the `Authorization` HTTP Header, prefixed with `Bearer `. Example:
        `Authorization: Bearer {API_KEY}`. **Strongly recommend storing your API
        Key on the server-side, not shared or stored on the client-side, to
        avoid possible API-Key leakage that can lead to serious consequences.**

````