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

# Overview

> Calculate tax, issue invoices and credit notes, and manage customers, products and webhooks.

Use **Quaderno** through Corsair: one client, typed API calls.

Quaderno uses **HTTP Basic auth** with your API key as the username and an
empty password. Create a key at
[quadernoapp.com/users/api-keys](https://quadernoapp.com/users/api-keys), then
store it for the `quaderno` integration.

**There is no shared host.** Every account answers on its own subdomain, so
the plugin needs the account name as a second credential: set
`quaderno({ account: 'acme' })` or store it with `keys.set_account_name`. A
key alone can find its account through `authorization`, whose `identity.href`
is that account's base URL.

Documents are legal records. Quaderno **cannot delete** an invoice once issued,
because tax law requires keeping it: `invoices.void` reverses it by recording
an offset payment and issuing a credit note beside it, and `void_reason` is
required. Creating any invoice, receipt or credit note consumes a document
number. A credit note is issued against an existing invoice (`invoice_id`),
and a receipt needs a `payment_method` because it records a sale that is
already paid.

The `deliver` operations email a document to the address on file for its
contact. They answer `delivered: true` and no document, and they are never
retried, because a second call sends a second email.

Lists answer a **bare array**, not an envelope. Page with `created_before`,
passing the previous page's `next_created_before`, which is `null` on the last
page. No route here takes a `cursor` parameter.

A missing record answers **401**, not 404, and so does a wrong key. The plugin
reads the message to tell them apart, so a bad id is reported as
`not_found_or_denied` rather than as an auth failure.

**What you get:**

* 48 typed API operations

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/quaderno better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/quaderno better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/quaderno better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/quaderno better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { quaderno } from '@corsair-dev/quaderno';

export const corsair = createCorsair({
	plugins: [
		quaderno(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.
>
> ```ts theme={null}
> quaderno()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'quaderno',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**List outstanding invoices**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.quaderno.api.invoices.list({ state: 'outstanding', limit: 10 });
```

**Create a customer**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.quaderno.api.contacts.create({
	first_name: 'Amelia',
	last_name: 'Chen',
	email: 'amelia.chen@example.com',
	country: 'US',
});
```

See the full list on the [API](https://docs.corsair.dev/plugins/quaderno/api.md) page.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/quaderno/api.md)
>
> Every `quaderno.api.*` operation with input and output types.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


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