> ## 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.

# Manage Knowledge via API

> Manage your knowledge bases programmatically using the Dify Knowledge Base API

Dify provides a complete set of Knowledge Base APIs that let you manage knowledge bases, documents, and chunks programmatically. This is useful for automating data synchronization or integrating knowledge base operations into CI/CD pipelines.

API access is enabled by default when you create a knowledge base. To start making API calls, all you need is your API credentials: an endpoint and a key.

<Info>
  A single Knowledge Base API key has access to **all visible knowledge bases** under the same account. Handle your credentials carefully to avoid unintended data exposure.
</Info>

## Get Your API Endpoint and Key

Navigate to **Knowledge** in Dify. In the top-right corner, click **Service API** to open the API configuration panel. From here you can:

* Get the Service API endpoint. This is the base URL for all Knowledge Base API requests.
* Click **API Key** to create new keys and manage existing ones.

  <Warning>
    Store your API key securely on the server side. Never expose it in client-side code or public repositories.
  </Warning>

## Manage API Access for a Knowledge Base

Every knowledge base is accessible via the Service API by default.

If you want to restrict API access to a specific knowledge base, open it, then click **API Access** in the bottom-left corner and toggle it off.

## API Reference

See the [Knowledge Base API Reference](https://docs.dify.ai/api-reference/knowledge-bases/list-knowledge-bases) for the complete list of endpoints, request/response schemas, error codes, and interactive examples.
