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

# Knowledge Bases

> Build and manage AI knowledge bases that your voice agents draw on during calls.

## Overview

**Knowledge bases** are collections of documents and text that Sendora's AI voice agents retrieve from in real time during a call. When a prospect asks "What's your pricing?" or "Do you integrate with Salesforce?", the agent searches the relevant KB and answers accurately instead of hallucinating.

KBs support two source types via the API:

* **Text**, paste in raw content (FAQs, product sheets, objection handlers)
* **URL**, provide a web page URL and Sendora crawls and indexes it automatically

## Creating a knowledge base

```bash theme={"dark"}
curl -X POST https://api.sendora.ai/api/v1/public/knowledge-bases \
  -H "X-API-Key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product FAQ",
    "description": "Common questions about Sendora features and pricing"
  }'
```

Returns the created KB with an `id` you'll use to add sources and assign it to agents.

## Adding a text source

```bash theme={"dark"}
curl -X POST "https://api.sendora.ai/api/v1/public/knowledge-bases/{kb_id}/sources/text" \
  -H "X-API-Key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Pricing FAQ",
    "content": "Q: How much does Sendora cost?\nA: Sendora starts at $299/month for up to 5 seats..."
  }'
```

The content is chunked, embedded, and indexed within a few seconds. Check `status: "ready"` on the source before the agent goes live.

## Adding a URL source

```bash theme={"dark"}
curl -X POST "https://api.sendora.ai/api/v1/public/knowledge-bases/{kb_id}/sources/url" \
  -H "X-API-Key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://sendora.ai/pricing",
    "title": "Pricing page"
  }'
```

Sendora crawls the URL, strips navigation/footers, and indexes the main content. Crawling is async, poll the source status via `GET /knowledge-bases/{kb_id}/sources`.

## Listing sources

```bash theme={"dark"}
GET /api/v1/public/knowledge-bases/{kb_id}/sources
```

```json theme={"dark"}
{
  "sources": [
    {
      "id": "src_abc",
      "type": "text",
      "title": "Pricing FAQ",
      "status": "ready",
      "chunk_count": 4,
      "created_at": "2026-06-22T10:00:00Z"
    },
    {
      "id": "src_def",
      "type": "url",
      "url": "https://sendora.ai/pricing",
      "status": "indexing",
      "chunk_count": 0,
      "created_at": "2026-06-22T10:05:00Z"
    }
  ]
}
```

Possible `status` values: `pending`, `indexing`, `ready`, `error`

## Deleting a source

```bash theme={"dark"}
DELETE /api/v1/public/knowledge-bases/{kb_id}/sources/{source_id}
```

Removes the source and all its chunks from the index. The KB remains active.

## Assigning a KB to a voice agent

A KB becomes available to an agent when you assign it:

```bash theme={"dark"}
curl -X POST "https://api.sendora.ai/api/v1/public/voice-agents/{agent_id}/knowledge-bases" \
  -H "X-API-Key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "kb_id": "kb_abc123" }'
```

An agent can have multiple KBs. During a call, the agent searches all assigned KBs and picks the most relevant chunk.

## Unassigning a KB

```bash theme={"dark"}
DELETE /api/v1/public/voice-agents/{agent_id}/knowledge-bases/{kb_id}
```

The KB itself is not deleted, it's just unlinked from the agent.

## Full KB lifecycle example

```bash theme={"dark"}
# 1. Create the KB
KB=$(curl -sX POST .../knowledge-bases -d '{"name":"Objection Handlers"}' | jq -r .id)

# 2. Add a text source
curl -X POST ".../knowledge-bases/$KB/sources/text" \
  -d '{"title":"Pricing objection","content":"If they say too expensive: emphasize ROI..."}'

# 3. Assign to your voice agent
curl -X POST ".../voice-agents/agent_xyz/knowledge-bases" \
  -d "{\"kb_id\": \"$KB\"}"

# 4. Verify assignment
curl ".../voice-agents/agent_xyz/knowledge-bases"
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.