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

# Read and erase a conversation

> Read what a customer asked, and erase it when they delete their account. No ticket, no email to us.

Each customer of the per-user door has one conversation per assistant. Your server can read it and erase it with your API key.

## Erase a customer's conversation

Call it when your customer deletes their account, or asks you to erase their data.

```ts theme={"system"}
import { Concatflow } from "@concatflow/node";

const concatflow = new Concatflow({ apiKey: process.env.CONCATFLOW_API_KEY! });

await concatflow.conversations.erase({
  assistantId: process.env.CONCATFLOW_ASSISTANT_ID!,
  partition: { customer_id: "4712" },
});
```

The `partition` is the one you send to `sessions.create` for that customer.

What happens:

* Questions, answers, displayed blocks and the partition are erased.
* Every open session of that customer is revoked at once. An assistant already open in their browser stops answering.
* The cost of past questions stays, with no content, so your monthly caps stay correct.
* Erasing a customer with no conversation succeeds. You can call it on every account deletion.

The next `sessions.create` for the same partition starts an empty conversation.

> [!NOTE]
>
> You are the data controller. Concatflow processes your customers' questions on your behalf. This call lets you honour an erasure request yourself, right away.

### Hook it to account deletion

```ts theme={"system"}
export async function deleteAccount(user: { id: string; customerId: string }) {
  await concatflow.conversations.erase({
    assistantId: process.env.CONCATFLOW_ASSISTANT_ID!,
    partition: { customer_id: user.customerId },
  });
  // …then delete the user in your own database.
}
```

Erase first. If the call fails, the account still exists and you can retry.

## Read a customer's conversation

Use it for support, or to answer a data access request.

```ts theme={"system"}
const thread = await concatflow.conversations.list({
  assistantId: process.env.CONCATFLOW_ASSISTANT_ID!,
  partition: { customer_id: "4712" },
});

for (const message of thread.messages) {
  console.log(message.at, message.role, message.text);
}
```

```json Response theme={"system"}
{
  "partition": { "customer_id": "4712" },
  "since": "2026-10-02T09:14:03.112000+00:00",
  "launcher": "bar",
  "questions": 1,
  "credits_cents": 12,
  "messages": [
    {
      "id": "…:q",
      "role": "user",
      "text": "Which invoices are still unpaid?",
      "at": "2026-10-02T09:14:03.112000+00:00",
      "credits_cents": null,
      "blocks": []
    },
    {
      "id": "…:a",
      "role": "assistant",
      "text": "You have two unpaid invoices.",
      "at": "2026-10-02T09:14:03.112000+00:00",
      "credits_cents": 12,
      "blocks": [{ "id": "a1b2c3d4e5f6", "kind": "table", "title": "Unpaid invoices", "spec": { "columns": ["invoice", "due"], "rows": [["F-2031", "2026-10-15"]], "truncated": false } }]
    }
  ]
}
```

A customer who never asked anything returns an empty thread: `since` is `null` and `messages` is empty. It is not an error.

`credits_cents` is in hundredths of a credit: `100` is one credit. Field details are in the [reference](https://docs.concatflow.com/reference/node/conversations-list.md).

## Retention

| Door | Questions and answers |
| - | - |
| Per-user | Kept until you erase them, or delete the assistant. The customer finds their history again. |
| Public | Anonymised after 30 days. Visitors are anonymous, and nothing reads an old public question. |

Deleting an assistant erases the conversations of all its customers.

## Partition encoding

The SDK sends the partition as `customer_id=4712`, several keys joined by `,`. For that reason, keys and values containing `,` or `=` are refused before any request is sent.


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