> ## 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.

# @concatflow/node

> The server library. Opens sessions and manages conversations with your secret API key.

```bash theme={"system"}
npm install @concatflow/node
```

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

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

const { token } = await concatflow.sessions.create({
  assistantId: process.env.CONCATFLOW_ASSISTANT_ID!,
  partitions: { customer_id: "4712" },
});
```

A thin, typed layer over the [HTTP API](https://docs.concatflow.com/reference/api/overview.md). Node 18 or later, no dependencies. It runs on your server only: it throws if it is loaded in a browser, where the key would be exposed.

## Reference

> **[Concatflow client](https://docs.concatflow.com/reference/node/client.md)**
>
> `new Concatflow({ apiKey })`, and where the key comes from.

> **[sessions.create()](https://docs.concatflow.com/reference/node/sessions-create.md)**
>
> Open a session for one logged-in customer.

> **[conversations.list()](https://docs.concatflow.com/reference/node/conversations-list.md)**
>
> Read a customer's conversation.

> **[conversations.erase()](https://docs.concatflow.com/reference/node/conversations-erase.md)**
>
> Erase it, when the customer deletes their account.

> **[Errors](https://docs.concatflow.com/reference/node/errors.md)**
>
> `ConcatflowError`: status, code, body.

## Guides

* [Per-user door](https://docs.concatflow.com/guides/per-user-door.md): the session route, in Express and Next.js.
* [Conversations and GDPR](https://docs.concatflow.com/guides/conversations.md).
* [Testing](https://docs.concatflow.com/guides/testing.md): unit-test your route without a network.


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