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

# Knowledge base

> Upload and manage KB documents via Public API v1 (metadata only).

Knowledge bases power agent answers during calls and messaging. You can manage documents via **Public API v1** or the dashboard.

## Public API (v1)

Requires scopes **`knowledge:read`** (list, metadata, billing preview) and **`knowledge:write`** (upload, delete). Request these when your API key is approved.

| Action          | Endpoint                                                    |
| --------------- | ----------------------------------------------------------- |
| List documents  | `GET /api/v1/knowledge-bases/documents`                     |
| Upload          | `POST /api/v1/knowledge-bases/documents` (multipart `file`) |
| Metadata        | `GET /api/v1/knowledge-bases/documents/{fileId}`            |
| Delete          | `DELETE /api/v1/knowledge-bases/documents/{fileId}`         |
| Billing preview | `GET /api/v1/knowledge-bases/upload-billing-info`           |

Supported file types: PDF, Word, Excel, TXT (max **50MB**).

**Security:** v1 returns metadata only — no file bytes and no download URL. Live keys may debit credits on upload when billing is enabled; sandbox keys skip debit.

## Linking to agents

1. `GET /api/v1/companies` / `GET /api/v1/knowledge-bases/documents` to pick ids
2. `POST` or `PATCH /api/v1/inbound-agents` with `companyId` and `selectedKnowledgebases: ["fileId", …]`
3. Confirm on `GET /api/v1/inbound-agents/{id}` (`companyId` + `selectedKnowledgebases` in the response)

See [Upload document](/api-reference/endpoint/knowledge-bases/upload-document) and [Healthcare HMS integration](/get-started/guides/healthcare-hms-integration).
