> 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/ai-history.md).

# AI history

When `sendAI` runs with **`saveHistory: true`** (the default), turns are stored server-side. Use **`fetchAIHistory`** to list them and **`deleteAIHistoryMessage`** to remove individual entries.

## Methods

| Method                                            | Purpose                                 |
| ------------------------------------------------- | --------------------------------------- |
| `fetchAIHistory({ senderId })`                    | List AI conversation history for a user |
| `deleteAIHistoryMessage({ senderId, messageId })` | Delete one stored message               |

{% hint style="info" %}
AI history APIs use **HTTP transport**. Responses return directly from the method call.
{% endhint %}

## Typical uses

| Use case             | Pattern                                                                           |
| -------------------- | --------------------------------------------------------------------------------- |
| **Support inbox UI** | `fetchAIHistory` on ticket open                                                   |
| **GDPR / privacy**   | `deleteAIHistoryMessage` on user request                                          |
| **Debug**            | Compare history with `sessionId` sessions                                         |
| **Audit**            | Cross-check with [session logging](/product-docs/ai/session-logging.md) dashboard |

## `saveHistory` flag

```js
// Stored (default)
await notifier.sendAI({ senderId, message, saveHistory: true });

// Ephemeral — routing, classification, workflow internals
await notifier.sendAI({ senderId, message, saveHistory: false });
```

→ How-to guide: [How to save AI message history](/product-docs/observability/save-ai-message-history.md) · [Observability overview](/product-docs/observability/observability.md)

## Language guides

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

## AI history vs chat history

| API              | Scope                                                                                        |
| ---------------- | -------------------------------------------------------------------------------------------- |
| **AI history**   | `sendAI` turns (`fetchAIHistory`)                                                            |
| **Chat history** | Realtime 1:1 messages between users — see [Chat history](/product-docs/chat/chat-history.md) |

## Next steps

* [**Sessions**](/product-docs/ai/sessions.md) — Continue conversations with `sessionId`
* [**Session logging**](/product-docs/ai/session-logging.md) — Operational dashboard logs
