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

# Knowledge

> What agents know, and how you add to it.

Knowledge is what the business tells its agents: websites, files and short facts. An agent searches knowledge before it answers. See the [knowledge API](https://docs.impellabs.tech/api/knowledge.md).

## What knowledge holds

* **Documents.** A website or a file, read and cut into chunks that agents can search.
* **Facts.** Short statements with a key, such as hours or prices. A new value for a key replaces the old one.
* **Groups.** A named set of documents and facts.
* **The company brain.** The tone and the rules that every agent follows.

## Add a file

**1. Send the file**

Send it as `multipart/form-data` in the field `file`.

```bash theme={null}
curl -X POST https://api.impellabs.tech/api/v1/files \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@prices.pdf"
```

The answer has the file `id`. ImpelLabs reads the text next. The `status` is `pending`, then `ready` or `failed`, with a `reason`. A file type that cannot be read is refused with a message.

**2. Add it to knowledge**

```bash theme={null}
curl -X POST https://api.impellabs.tech/api/v1/knowledge/documents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_id": "FILE_ID"}'
```

The answer is the document: `id`, `kind`, `ref`, `title`, `chunks`, `note`, `tags` and `created_at`. A file with no text is refused.

## Add a website

Find the pages first, then choose which to read.

```bash theme={null}
curl -X POST https://api.impellabs.tech/api/v1/knowledge/sites/discover \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.yourbusiness.example"}'
```

```bash theme={null}
curl -X POST https://api.impellabs.tech/api/v1/knowledge/sites/read \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.yourbusiness.example", "pages": ["https://www.yourbusiness.example/prices"], "group_id": "GROUP_ID"}'
```

The read starts and the answer is `202` with `host`, `pages`, `state` (`reading`) and `read_id`. `group_id` is optional. An address that ImpelLabs may not read is refused.

## Groups and who reads what

Put documents and facts in a group to limit who reads them.

* Knowledge in no group belongs to the whole company.
* Connect an agent to groups to limit what it reads. A version has `knowledge_scope`: `selected` (its groups and what is in no group), `all_company` or `none`, and a list of `knowledge_groups`.
* The company brain can set knowledge in no group to `all` agents or to `strict`. With `strict`, only the Chief of Staff reads it.

A group has a `visibility` that says which people see it in the app: `personal` (only its maker), `chosen` (chosen members and departments, in `shared_members` and `shared_departments`) or `workspace`. Agents connected to a group read it whatever its visibility says.

## Sensitive data

Tag a document with `personal`, `health` or `payment` with `PATCH /api/v1/knowledge/documents/{document_id}` and `{"tags": [...]}`. Tagged data is for the team only: a customer and an agent in a customer's conversation never see it.

## Facts and conflicts

Change a fact with `PATCH /api/v1/knowledge/facts/{key}` and `{"value": "..."}`. When two sources disagree about a fact, ImpelLabs keeps a conflict until a person resolves it. List them with `GET /api/v1/knowledge/conflicts`.

## Questions with no answer

When an agent searches and finds nothing, it says it does not know. It records the question. A person with `knowledge.edit` can answer it later. The answer is saved as a fact.

## Who can change knowledge

Reading needs `knowledge.view`. Adding and removing needs `knowledge.edit`. A member can change what they added. Owners and admins can change everything. Documents are removed by archive: they leave search and are not deleted.


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