# Knowledge Bases

Knowledge bases that ground your voice and workflow agents, plus the entries and sources inside them.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### POST /knowledge-bases/adopt

Adopt an existing voice-provider knowledge base into the unified system: links it in place (no duplicate), imports its web-page sources into search, and attaches any voice agents already using it. Pass retell_kb_id.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases-adopt.md)

### POST /knowledge-bases/:kb_id/attach

Attach a knowledge base to an agent so the agent's searches are grounded in it. agent_type is 'voice' or 'workflow'; agent_id is the voice agent or workflow agent UUID.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases-kb-id-attach.md)

### POST /knowledge-bases

Create a named knowledge base. Populate it via sync-help-center, sync-products, or by creating entries with this kb_id, then attach it to agents.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases.md)

### DELETE /knowledge-bases/:kb_id

Delete a knowledge base. Its entries are kept (unlinked); agent attachments are removed.

**Scopes:** `knowledge:delete` — [full detail](./knowledge-bases/delete-knowledge-bases-kb-id.md)

### POST /knowledge-bases/:kb_id/detach

Detach a knowledge base from an agent. The KB and its entries are kept.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases-kb-id-detach.md)

### GET /knowledge-bases/:kb_id

Fetch a knowledge base by UUID, with entry and attached-agent counts.

**Scopes:** `knowledge:read` — [full detail](./knowledge-bases/get-knowledge-bases-kb-id.md)

### POST /knowledge-bases/:kb_id/ingest-text

Add a block of text (e.g. an uploaded document's content) to a knowledge base as an embedded entry.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases-kb-id-ingest-text.md)

### POST /knowledge-bases/:kb_id/ingest-url

Fetch a web page, extract its text, and add it to a knowledge base as an embedded entry. Idempotent per URL.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases-kb-id-ingest-url.md)

### GET /knowledge-bases/:kb_id/agents

List the agents (voice or workflow) a knowledge base is attached to.

**Scopes:** `knowledge:read` — [full detail](./knowledge-bases/get-knowledge-bases-kb-id-agents.md)

### GET /knowledge-bases/:kb_id/entries

List the entries (documents) inside a knowledge base.

**Scopes:** `knowledge:read` — [full detail](./knowledge-bases/get-knowledge-bases-kb-id-entries.md)

### GET /knowledge-bases

List knowledge bases in the workspace. Pass agent_type + agent_id to list only the KBs attached to a given voice or workflow agent.

**Scopes:** `knowledge:read` — [full detail](./knowledge-bases/get-knowledge-bases.md)

### POST /knowledge-bases/:kb_id/sync-help-center

Ingest help-center articles into a knowledge base as embedded entries. Pass article_ids to select specific articles, or omit to sync all. Idempotent.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases-kb-id-sync-help-center.md)

### POST /knowledge-bases/:kb_id/sync-products

Ingest the active CRM product catalog into a knowledge base as embedded entries. Idempotent.

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/post-knowledge-bases-kb-id-sync-products.md)

### PATCH /knowledge-bases/:kb_id

Update a knowledge base (name, description, auto-resync settings).

**Scopes:** `knowledge:write` — [full detail](./knowledge-bases/patch-knowledge-bases-kb-id.md)
