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

# TypeScript SDK

> Install and use @formitto/sdk — a typed client with a bundled webhook verifier.

`@formitto/sdk` is the official TypeScript client. It's generated from the same
OpenAPI spec that powers the [API reference](/api-reference/introduction), so it
always matches the live API, and it bundles a webhook signature verifier.

## Install

```bash theme={null}
npm install @formitto/sdk
```

## Quickstart

Instantiate the client with your API key, then call the resource namespaces:

```typescript theme={null}
import { Formittosdk } from "@formitto/sdk";

const formitto = new Formittosdk({ bearerAuth: "fmt_live_xxxxxxxx" });

// List forms
const { data } = await formitto.forms.listForms({});

// Get one
const form = await formitto.forms.getForm({ id: 123 });

// Create a form
const created = await formitto.forms.createForm({
  name: "Lead form",
  fields: [{ id: "f1", type: "email", label: "Email" }],
  domainId: 5,
});
```

## Ingesting submissions

Pass an `idempotencyKey` to safely retry without creating duplicates (see
[Submissions](/resources/submissions)):

```typescript theme={null}
const submission = await formitto.submissions.createSubmission({
  id: 123,
  idempotencyKey: "order-4567-submission",
  body: { formData: { Name: "Jane", Email: "jane@example.com" } },
});
```

## Verifying webhooks

The SDK bundles a constant-time signature verifier — no extra dependency:

```typescript theme={null}
import { webhooks } from "@formitto/sdk";

const ok = webhooks.verifySignature({
  payload: rawBody,
  signatureHeader: req.headers["x-formitto-signature"],
  secret: process.env.FORMITTO_WEBHOOK_SECRET,
});
```

See [Webhooks](/webhooks) for the full verification guide.

## Resource namespaces

| Namespace     | Methods                                                           |
| ------------- | ----------------------------------------------------------------- |
| `forms`       | `listForms`, `getForm`, `createForm`, `updateForm`, `archiveForm` |
| `submissions` | `listFormSubmissions`, `getSubmission`, `createSubmission`        |
| `calendars`   | `listCalendarWidgets`, `getCalendarWidget`                        |
| `bookings`    | `listCalendarBookings`, `getBooking`                              |
| `ecommerce`   | `listEcommerceWidgets`, `getEcommerceWidget`                      |
| `orders`      | `listWidgetOrders`, `getOrder`                                    |

## Links

* **npm:** [@formitto/sdk](https://www.npmjs.com/package/@formitto/sdk)
