Dify Knowledge Base icon

Dify Knowledge Base

Manage Dify AI knowledge base datasets, documents, segments, and metadata with comprehensive CRUD operations

Document → List

AI-generated

Overview

The node interacts with the "Document" resource of a knowledge base system, specifically supporting the "List" operation. It retrieves a list of documents from a specified dataset within the knowledge base. This is useful for scenarios where users want to fetch and review multiple documents stored in a dataset, such as for data analysis, content management, or further processing workflows.

Practical examples include:

  • Fetching all documents related to a particular project or topic stored in a dataset.
  • Paginating through large collections of documents to process them in batches.
  • Filtering documents by keywords or sorting them by creation date or position.

Properties

Name Meaning
Dataset ID The unique identifier of the dataset from which to list documents.
Additional Fields Optional parameters to refine the listing:
- Page Page number for pagination (default is 1).
- Limit Maximum number of results to return per page (minimum 1, default 50).
- Sort Sorting order of the results. Options are:
• Created At (Ascending)
• Created At (Descending)
• Position (Ascending)
• Position (Descending)
- Keyword Filter documents by a keyword string to narrow down the results.

Output

The output is an array of JSON objects representing the documents retrieved from the specified dataset. Each object contains the document's metadata and content fields as returned by the knowledge base API. The exact structure depends on the external service but typically includes identifiers, text content, creation timestamps, and other relevant document attributes.

This node does not output binary data.

Dependencies

  • Requires an API key credential for authenticating requests to the external knowledge base service.
  • Needs the base URL of the knowledge base API configured in the node credentials.
  • Relies on the external knowledge base API to support document listing with pagination, sorting, and filtering.

Troubleshooting

  • Common issues:

    • Invalid or missing Dataset ID will cause the request to fail.
    • Incorrect API credentials or base URL configuration will result in authentication errors.
    • Requesting pages beyond the available range may return empty results.
    • Using unsupported sort options or invalid filter keywords might lead to unexpected outputs or errors.
  • Error messages:

    • "The operation "list" is not supported for resource "document": Indicates a misconfiguration of the operation or resource parameters.
    • Authentication errors usually mention authorization failure; verify API key and base URL.
    • Network or timeout errors suggest connectivity issues with the external API.

Links and References

  • Refer to the official documentation of the external knowledge base API for details on document listing endpoints, pagination, sorting, and filtering.
  • n8n documentation on creating and configuring API key credentials.
  • General best practices for handling paginated API responses in workflow automation.

Discussion