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

# TypeScript SDK

> Typed client for Node, Bun, browsers and Workers.

# SDK — `@lupin/sdk`

```bash theme={null}
bun add @lupin/sdk   # workspace: already wired in this repo
```

```ts theme={null}
import { Lupin, LupinError, verifySignature } from "@lupin/sdk";

const lupin = new Lupin({ baseUrl: "https://api.lupin.dev", apiKey: process.env.LUPIN_API_KEY! });

// inboxes → threads → send, all snake_case like the wire
const inbox = await lupin.inboxes.create({ username: "support" });
await lupin.emails.send(inbox.inbox_id,
  { to: ["u@e.com"], subject: "Hi", track_opens: true }, "welcome-1");

try {
  await lupin.domains.verify("dom_…");
} catch (e) {
  if (e instanceof LupinError) console.log(e.status, e.body);
}

// realtime
const ws = new WebSocket(lupin.streamUrl({ event_types: ["email.received"] }));

// webhook receivers: verify HMAC hex of the RAW body first, parse after
const ok = await verifySignature(secret, rawBody, signatureHeader);
```

Namespaces: `agent`, `auth`, `organizations`, `inboxes`, `threads`,
`emails` (+ `raw`), `drafts`, `lists`, `domains`, `webhooks`, `metrics`,
`apiKeys`, `projects`. Bring your own `fetch` via `{ fetch }` for custom agents,
retries or Workers runtimes.
