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

# Add source

> Add a new source to an agent's knowledge base.

# Add knowledge source

Adds a new source to an agent's knowledge base. The source is queued for processing immediately after it's created.

```http theme={null}
POST https://app.chatnorris.ai/api/v2/chatbots/{chatbot_id}/knowledge
Authorization: Bearer <your_api_key>
Content-Type: application/json
```

**Required scope:** `chatbots:write`

***

## Path parameters

| Parameter | Type | Description |
| - | - | - |
| `chatbot_id` | string | Agent ID |

***

## Request body

The `type` field determines which other fields are required.

### Type `url` — web page or online document

| Field | Type | Required | Description |
| - | - | - | - |
| `type` | string | ✅ | `"url"` |
| `name` | string | ✅ | Descriptive name of the source |
| `source_url` | string | ✅ | Full URL of the page to index |

```json theme={null}
{
  "type": "url",
  "name": "Frequently asked questions",
  "source_url": "https://empresa.com/faq"
}
```

### Type `text` — free text

| Field | Type | Required | Description |
| - | - | - | - |
| `type` | string | ✅ | `"text"` |
| `name` | string | ✅ | Descriptive name of the source |
| `raw_content` | string | ✅ | Text content to index |

```json theme={null}
{
  "type": "text",
  "name": "Return policies",
  "raw_content": "Returns are accepted within 30 days of purchase..."
}
```

### Type `faq` — questions and answers

| Field | Type | Required | Description |
| - | - | - | - |
| `type` | string | ✅ | `"faq"` |
| `name` | string | ✅ | Descriptive name |
| `raw_content` | string | ✅ | Text with questions and answers (minimum 2 characters) |

```json theme={null}
{
  "type": "faq",
  "name": "Shipping FAQ",
  "raw_content": "How long does shipping take?\nStandard shipping takes 3-5 business days.\n\nDo you ship internationally?\nYes, we ship throughout Latin America."
}
```

***

## Response `201 Created`

The source is created with `status: "pending"` and processing starts in the background.

```json theme={null}
{
  "status": "success",
  "data": {
    "id": "src_xyz789",
    "name": "Frequently asked questions",
    "type": "url",
    "status": "pending",
    "created_at": "2026-06-30T18:00:00.000Z"
  }
}
```

> [!TIP]
>
> Processing is asynchronous. Check the source's status with [List sources](https://docs.chatnorris.ai/en/api-referencia/knowledge/listar.md) until `status` is `ready` or `error`.

***

## Common errors

| Code | Description |
| - | - |
| `INVALID_INPUT` | Invalid `type`, `name` is missing, `source_url` isn't a valid URL, or `raw_content` is empty |
| `NOT_FOUND` | The agent doesn't exist or doesn't belong to your organization |


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