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

# Knowledge base API

> Manage your agent's knowledge base documents programmatically

The Knowledge base API gives you programmatic access to the documents that power your agent's knowledge base. You can use it to [create](/docs/api-reference/document/create-text-document), [retrieve](/docs/api-reference/document/get-document), [update](/docs/api-reference/document/update-document), and [delete](/docs/api-reference/document/delete-document) documents, as well as manage their metadata and individual chunks.

## Endpoints

| Endpoint | Description |
| --- | --- |
| **Document** |  |
| <Badge color="green" size="sm">GET</Badge> [Search documents](/docs/api-reference/kbpublicapidocument/search-documents) | Retrieve all documents in a project, or filter by type, page, and limit. |
| <Badge color="green" size="sm">GET</Badge> [Get document](/docs/api-reference/document/get-document) | Fetch a single document by ID, including its chunks and metadata. |
| <Badge color="blue" size="sm">POST</Badge> [Create document](/docs/api-reference/document/create-text-document) | Add a new document to the knowledge base from a URL or integration source. |
| <Badge color="blue" size="sm">POST</Badge> [Upload table document](/docs/api-reference/kbpublicapidocument/upload-table-document) | Upload structured table data as a knowledge base document, with optional chunking and LLM processing settings. |
| <Badge color="yellow" size="sm">PUT</Badge> [Replace document](/docs/api-reference/kbpublicapidocument/replace-document) | Replace an existing document's source and metadata entirely. |
| <Badge color="orange" size="sm">PATCH</Badge> [Update chunk metadata](/docs/api-reference/kbpublicapidocument/update-chunk-metadata-by-chunk-id) | Update the metadata on a specific chunk within a document. |
| <Badge color="orange" size="sm">PATCH</Badge> [Update chunk metadata by chunk ID](/docs/api-reference/kbpublicapidocument/update-chunk-metadata-by-chunk-id) | Update the metadata associated with the specified document chunk |
| <Badge color="red" size="sm">DEL</Badge> [Delete document](/docs/api-reference/document/delete-document) | Permanently remove a document from the knowledge base by ID. |

## Documents

Documents are the content sources your agent draws from when answering questions. Each document has a type - URL, PDF, DOCX, plain text, CSV, XLSX, or table - and is processed into chunks that get indexed for retrieval. You can [create documents](/docs/api-reference/document/create-text-document) from a URL or external integration, [upload structured table data](/docs/api-reference/kbpublicapidocument/upload-table-document) directly, or [replace](/docs/api-reference/kbpublicapidocument/replace-document) an existing document entirely when its source changes. URL documents support a `refreshRate` setting (`daily`, `weekly`, `monthly`, or `never`) that controls how often Voiceflow re-fetches and re-indexes the content.

## Chunks and metadata

When a document is processed, it's split into chunks, smaller segments of content that are individually indexed and retrieved during conversations. You can [update the metadata on a specific chunk](/docs/api-reference/kbpublicapidocument/update-chunk-metadata-by-chunk-id) to add context that improves retrieval accuracy without modifying the document itself.

## Knowledge base and environments

The knowledge base is project-wide: every [environment](/docs/documentation/deploy/environments/overview) in the project points at the same set of documents, and editing a document's content affects all of them. Individual environments hold their own pointers into that shared set, so you can add a document from a non-Main environment and only that environment will see it until the environment is merged into Main.

Listing documents, getting a document, and deleting a document accept an optional environment alias parameter. When provided, the request targets the document pointers for that environment. The create, upload, and update endpoints do not take it.
