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

# Corpus

> Manage the chatbot's knowledge base

The corpus is your chatbot's knowledge base. It's the content it uses to answer questions.

## Entry structure

Each corpus entry contains:

| Field        | Description            | Required |
| ------------ | ---------------------- | -------- |
| **Title**    | For organization       | Yes      |
| **Content**  | The text the bot knows | Yes      |
| **Segment**  | Associated context(s)  | No       |
| **Priority** | Relative importance    | No       |
| **Tags**     | Keywords for matching  | No       |

## Adding content

### Via the dashboard

1. Go to **Dashboard > Knowledge Base**
2. Click **Add entry**
3. Fill in the fields
4. Save

### Via the API

```bash theme={null}
curl -X POST https://api.animam.ai/tenants/{slug}/corpus \
  -H "Authorization: Bearer ak_your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Business hours",
    "content": "We are open Monday to Friday, 9am to 6pm.",
    "segment": "contact",
    "priority": 1
  }'
```

## Writing good content

### Recommended format

```markdown theme={null}
# Return Policy

You have 30 days to return a product.

## Conditions
- Unused product
- Original packaging
- Receipt

## Procedure
1. Log into your account
2. Go to "My Orders"
3. Click "Return"

## Exceptions
Personalized products are not returnable.
```

<Tip>
  Write as if you were talking to a customer. The bot naturally adopts this tone.
</Tip>

### Best practices

| Do                | Avoid             |
| ----------------- | ----------------- |
| Clear Q\&A format | Internal jargon   |
| Bullet points     | Walls of text     |
| Concrete examples | Vague information |
| Regular updates   | Outdated content  |

## Priority

Priority (1-10) determines which content is preferred in case of conflict:

* **10**: Critical (pricing, T\&C, security)
* **5**: Standard (general FAQ)
* **1**: Supplementary (anecdotes)

```json theme={null}
{
  "title": "Pro subscription price",
  "content": "The Pro subscription costs $49/month",
  "priority": 10
}
```

## Segments

Associate segments to contextualize:

```json theme={null}
{
  "title": "Shipping FAQ",
  "content": "Free shipping over $50...",
  "segment": "checkout"
}
```

This entry will only appear on pages with `data-segment="checkout"`.

## Bulk import

### CSV format

```csv theme={null}
title,content,segment,priority
"Hours","Open 9am-6pm","contact",5
"Price","$49/month","pricing",10
```

### Via the API

```bash theme={null}
curl -X POST https://api.animam.ai/tenants/{slug}/corpus/import \
  -H "Authorization: Bearer ak_your_token" \
  -F "file=@corpus.csv"
```

## Limits

| Plan       | Max entries | Max size/entry     |
| ---------- | ----------- | ------------------ |
| Starter    | 100         | 10,000 characters  |
| Pro        | 1,000       | 50,000 characters  |
| Enterprise | Unlimited   | 100,000 characters |
