# Knowledge Base

> The Knowledge Base is the core of your AI Agent's expertise. These endpoints manage its settings and report content processing status.

The Knowledge Base is the core of your AI Agent's expertise — it contains all the information your AI uses to answer questions. These endpoints let you manage the Knowledge Base configuration and track the processing status of its content.

The Knowledge Base draws from [Articles](/docs/api-reference/knowledge-base/articles) you create, import from websites, or upload as files. There is no retraining step: every article you create, update, or delete is processed automatically in the background, and takes effect in conversations as soon as it's done.

## Get Settings

Retrieve your Knowledge Base configuration.

**Scope: read_all**

`GET https://app.quickchat.ai/v1/api/knowledge_base/`

**Shell**

```shell
curl https://app.quickchat.ai/v1/api/knowledge_base/ \
  -H 'Authorization: Bearer <API_TOKEN>'
```

**Python**

```python
import requests

response = requests.get(
    url="https://app.quickchat.ai/v1/api/knowledge_base/",
    headers={"Authorization": "Bearer <API_TOKEN>"},
)
data = response.json()
```

**Response** `200 OK`

```json
{
  "one_word_description": "Support Agent",
  "short_description": "A helpful customer support assistant.",
  "ai_commands": ["Be polite", "Stay on topic"],
  "pending_embed_count": 0,
  "failed_embed_count": 0
}
```

| Field | Description |
|-------|-------------|
| `one_word_description` <br/> string | AI Agent name. Dashboard: **Identity > AI Persona > Name** |
| `short_description` <br/> string | System prompt / Main Prompt. Dashboard: **Identity > AI Persona > Main Prompt** |
| `ai_commands` <br/> array of strings | Behavioral guidelines, one per array item. Dashboard: **Identity > AI Persona > Guidelines**. Up to 250 items, 5,000 characters per item and 10,000 characters across all items. |
| `pending_embed_count` <br/> integer | Articles still being processed. `0` means everything you've submitted is live |
| `failed_embed_count` <br/> integer | Articles whose processing failed. Retry them with [Retry Failed Articles](/docs/api-reference/knowledge-base#retry-failed-articles) |

:::tip[Waiting for content to go live]
Poll this endpoint after a write and wait for `pending_embed_count` to reach `0`. Per-article status is also available as the `embed_state` field on [Articles](/docs/api-reference/knowledge-base/articles).
:::

:::note
These three fields (`one_word_description`, `short_description`, `ai_commands`) are shared with [Chatbot Settings](/docs/api-reference/chatbot-settings). Updating via either endpoint modifies the same underlying data.
:::

## Update Settings

**Scope: write_all**

`PATCH https://app.quickchat.ai/v1/api/knowledge_base/`

**Request Body**

| Parameter | Description |
|-----------|-------------|
| `one_word_description` <br/> string | AI Agent name |
| `short_description` <br/> string | System prompt / AI Agent description. The API accepts up to 25,000 characters on every plan; the in-app editor limits it to 15,000 characters on the Free plan and during a trial, and to 25,000 on paid plans. An oversized value returns `422`. |
| `ai_commands` <br/> array of strings | AI Guidelines, one per array item. Up to 250 items, 5,000 characters per item and 10,000 characters across all items. An oversized value returns `422`. |

:::note[How guidelines are stored]
Each array item is one guideline, saved exactly as you send it. Punctuation, semicolons included, is preserved. A guideline containing `;` used to come back as two separate guidelines, so if you avoided semicolons to work around that, you can stop.

This endpoint previously accepted guidelines of any length. The limits above are now enforced here too, and match [Chatbot Settings](/docs/api-reference/chatbot-settings) exactly.

Omit `ai_commands`, or send `null`, to leave the guidelines untouched. Send `[]` to clear them.
:::

**Shell**

```shell
curl -X PATCH https://app.quickchat.ai/v1/api/knowledge_base/ \
  -H 'Authorization: Bearer <API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "one_word_description": "Sales Bot"
}'
```

**Python**

```python
import requests

response = requests.patch(
    url="https://app.quickchat.ai/v1/api/knowledge_base/",
    headers={"Authorization": "Bearer <API_TOKEN>"},
    json={"one_word_description": "Sales Bot"},
)
data = response.json()
```

**Response** `200 OK` — Returns the updated Knowledge Base settings (same schema as [Get Settings](/docs/api-reference/knowledge-base#get-settings)).

## Retry Failed Articles

Reprocess every article whose processing failed. Articles that are already live or still in progress are left alone, and the call is safe to repeat.

Failed articles are also retried automatically, so this endpoint is only needed when you don't want to wait for that.

**Scope: write_all**

`POST https://app.quickchat.ai/v1/api/knowledge_base/retry_failed_embeds`

**Shell**

```shell
curl -X POST https://app.quickchat.ai/v1/api/knowledge_base/retry_failed_embeds \
  -H 'Authorization: Bearer <API_TOKEN>'
```

**Python**

```python
import requests

response = requests.post(
    url="https://app.quickchat.ai/v1/api/knowledge_base/retry_failed_embeds",
    headers={"Authorization": "Bearer <API_TOKEN>"},
)
```

**Response** `200 OK`

```json
{
  "retried": 2
}
```

| Field | Description |
|-------|-------------|
| `retried` <br/> integer | How many failed articles were queued for reprocessing |

## Retrain Knowledge Base **Deprecated**

`POST https://app.quickchat.ai/v1/api/knowledge_base/retrain/`

Retraining no longer exists — article changes are processed automatically. This endpoint is kept only so existing integrations keep working: it accepts the request, does nothing, and returns `200 OK`.

You can remove the call from your integration. If you were polling until retraining finished, wait for `pending_embed_count` to reach `0` in [Get Settings](/docs/api-reference/knowledge-base#get-settings) instead.

---
