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

# TypeScript SDK

> Typed, zero-dependency TypeScript SDK for the Conare partner API — works in Node, Bun, Deno, and Cloudflare Workers on the global fetch runtime.

```bash theme={null}
bun add @conare/sdk   # or: npm i @conare/sdk
```

Works in Node 18+, Bun, Deno, and Cloudflare Workers through global `fetch`. Zero dependencies. Keep the `cint_...` key in a server-side secret manager.

## Setup

```ts theme={null}
import { Conare, ConareError, hasAnswer } from "@conare/sdk";

const conare = new Conare({
  apiKey: process.env.CONARE_API_KEY!,
});

// Side-effect-free deploy smoke test: key, namespace config, backend hop.
await conare.status();
```

## Recall at session start

```ts theme={null}
const recalled = await conare.recall({
  endUserId: "u_123",
  query: "what matters to this user right now",
});
if (hasAnswer(recalled)) {
  systemPrompt += `\n\nWhat we know about this user:\n${recalled.answer}`;
}
```

`hasAnswer` narrows the union: plans that run out of deep-recall quota degrade to raw results instead of throwing, so your prompt assembly never breaks.

## Save observations

```ts theme={null}
await conare.memories.save({
  endUserId: "u_123",
  content: "User prefers smaller islands and wants to avoid crowds.",
  containerTag: "conversation-observation",
});
```

## Client surface

| Method                                               | Purpose                                         |
| ---------------------------------------------------- | ----------------------------------------------- |
| `status`                                             | Authenticated, side-effect-free readiness check |
| `memories.save`, `memories.saveBatch`                | Append-only distilled observations              |
| `memories.search`                                    | Fast raw hybrid retrieval, no synthesis         |
| `memories.getSource`, `upsertSource`, `deleteSource` | [Source-owned lifecycle](/memory/lifecycle)     |
| `memories.lifecycleBatch`                            | Versioned bulk bootstrap with per-item outcomes |
| `recall`                                             | Citation-grounded personalized answer           |
| `suggestions`                                        | Up to five grounded proactive actions           |
| `deleteContainer`                                    | Drop one container's memories                   |
| `deleteUser`                                         | Complete end-user deletion (GDPR)               |

## Scoping retrieval

`search`, `recall`, and `suggestions` accept an optional `containerTag` that fences retrieval to one container before any synthesis. Tag every write with your workspace ID and scope every read with the same tag — one workspace's facts can never surface in another's answers.

## Observability

Every request sends a safe `X-Request-Id` (retries retain it); every response returns it, and `ConareError.requestId` exposes it for support correlation. Pass an `onResponse` hook to feed your metrics:

```ts theme={null}
const conare = new Conare({
  apiKey: process.env.CONARE_API_KEY!,
  onResponse(meta) {
    metrics.timing("conare.request", meta.durationMs, {
      status: String(meta.status),
      requestId: meta.requestId,
    });
  },
});
```
