> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/ai/manage-documents.md).

# Manage documents

The knowledge-base API lets you **add**, **update**, **get**, **list**, and **delete** indexed documents. All operations use **HTTP transport**.

## Operations

| Method           | Action                                       |
| ---------------- | -------------------------------------------- |
| `addDocument`    | Create or index a new document by `recordId` |
| `updateDocument` | Replace content and optional metadata        |
| `getDocument`    | Fetch one document and its chunks            |
| `listDocuments`  | Paginated list with optional `type` filter   |
| `deleteDocument` | Remove a document by `recordId`              |

## Common parameters

| Field              | Required | Description                                    |
| ------------------ | -------- | ---------------------------------------------- |
| `senderId`         | Yes      | Acting user or service account id              |
| `recordId`         | Yes\*    | Stable document key (\*all except list)        |
| `content`          | Yes\*    | Text body (\*add and update)                   |
| `type`             | No       | Category label                                 |
| `metadata`         | No       | JSON object — e.g. `{ source: "help-center" }` |
| `limit` / `offset` | No       | Pagination for `listDocuments`                 |

{% hint style="warning" %}
Use **`transport: "http"`**. Document APIs are request/response — not delivered via `onMessage`.
{% endhint %}

## Typical flow

```
  addDocument (batch import)
       │
       ├─ updateDocument (on CMS publish)
       ├─ listDocuments (admin UI)
       ├─ getDocument (debug chunking)
       ├─ search (user queries) → see Semantic search
       └─ deleteDocument (retention / GDPR)
```

## Language guides

| Language                | Guide                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------- |
| JavaScript / TypeScript | [javascript-typescript.md](/product-docs/ai/manage-documents/javascript-typescript.md) |
| Dart / Flutter          | [dart-flutter.md](/product-docs/ai/manage-documents/dart-flutter.md)                   |

## Next steps

* [**Knowledge base overview**](/product-docs/ai/knowledge-base-overview.md)
* [**Semantic search**](/product-docs/ai/semantic-search.md)
