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

# ScheduleOnce plugin

> ScheduleOnce is OnceHub's meeting scheduling product; this plugin lists and fetches bookings, booking calendars, booking pages, event types, master pages, users, teams, contacts and SMS notifications, books time slots, cancels, reassigns and reschedules meetings, manages users, contacts and availability, and registers signed webhooks through the OnceHub REST API.

Use **ScheduleOnce** through Corsair: one client, typed API calls, and incoming webhooks.

ScheduleOnce runs on the OnceHub platform, and the OnceHub API (api.oncehub.com/v2) needs an Enterprise plan or a free trial: a key from any lower plan answers 403 with the message "Your account plan does not support API access." Create a key under Account Integrations, then APIs & Webhooks. Every request this plugin sends authenticates with an `API-Key` header carrying the raw key (no Bearer prefix). Accounts are allowed 5 requests per second; a 429 is retried three times with a 1, 2 and 4 second backoff.

Lists page with a cursor. `limit` defaults to 10 and caps at 100; `after` and `before` take an object ID and cannot be combined; every list answer carries `nextPageAfter`, the ID to pass as the next `after` (null on an empty page). The same three fields appear on every list operation. Bookings take `expand` with `owner`, `contact` and/or `conversation`, on a single booking and on lists alike; any other field answers 400.

A few fields are checked as enums, and the accepted members are exactly these: `role_name` on users takes `Administrator`, `Member` or `Team Manager`; contact `status` takes `Qualified`, `Sales qualified`, `Marketing qualified` or `Disqualified`, and any other value is refused before the request is sent; a booking's `location.type` takes `physical`, `virtual`, `virtual_static` or `guest_phone`; availability locations take `in_person_by_host`, `in_person_by_guest`, `online_dynamic_link`, `online_static_link` or `phone_by_guest`; weekday names are the case-sensitive English names `Monday` through `Sunday`.

`bookingCalendars.oneTimeLink` and `masterPages.oneTimeLink` return a single-use booking URL. Whoever holds the URL can book without signing in, so treat it as a credential: hand it to the guest and do not log it.

Thirteen event paths are registered under `bookings.*` and `conversations.*`; `bookings.booking` and `conversations.conversation` take any event of their family that has no handler of its own. Webhooks are signed per endpoint: each registered webhook carries its own signing secret, returned as `secret` by `webhooks.create`, `webhooks.get` and `webhooks.list` (and under View secret in the dashboard), so treat those responses as credentials. Deliveries carry `Oncehub-Signature: t=<unix seconds>,s=<hex>`, the HMAC-SHA256 of `<t>.<raw body>` keyed with that secret (several `s=` values mean key rotation, and any one match is accepted). Set `webhookSecret` or store the secret under `webhook_signature`, and the plugin verifies the signature in constant time and answers any delivery that fails a check with a non-2xx status: a timestamp more than 300 seconds old (possible replay), a missing or malformed header, a signature that does not match, or a secret that is not configured. Verification needs the exact bytes OnceHub sent, so hand `processWebhook` the body from `request.text()`, never `request.json()`.

**What you get:**

* 38 typed API operations
* 13 incoming webhook event types

## Setup

**1. Install**

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

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

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

```bash bun theme={null}
bun add corsair @corsair-dev/scheduleonce 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 { scheduleonce } from '@corsair-dev/scheduleonce';

export const corsair = createCorsair({
	plugins: [
		scheduleonce(),
	],
	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)
>
> Store the ScheduleOnce API key before the first call: `pnpm corsair setup --plugin=scheduleonce --tenant=acme api_key=<your-key>` (leave out `--tenant` without `multiTenancy`), or pass it as `key` in the plugin options. With Hub, each tenant enters their own key on the connect page. See [API key auth](https://docs.corsair.dev/concepts/api-key).
>
> ```ts theme={null}
> scheduleonce()
> ```
>
> 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: 'scheduleonce',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**List recent bookings**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.scheduleonce.api.bookings.list({ limit: 25 });
```

**Book a slot for a guest**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.scheduleonce.api.bookingCalendars.book({
	id: 'BKC-LDJ878496X',
	start_time: '2026-12-02T06:30:00Z',
	guest_time_zone: 'America/New_York',
	booking_form: { name: 'Dana Reed', email: 'dana.reed@example.com' },
});
```

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

## Webhooks

Point the OnceHub webhook at your Corsair HTTP handler and pass `webhookSecret` (or store the secret under `webhook_signature`). Every delivery carries `Oncehub-Signature: t=<unix seconds>,s=<hex>`, the HMAC-SHA256 of `<t>.<raw body>` keyed with that endpoint's secret; the plugin verifies it in constant time and rejects deliveries with a mismatching signature, a timestamp older than 300 seconds, or a missing or malformed header. Hand `processWebhook` the raw body from `request.text()`, not `request.json()`: a reparsed body can differ from the signed bytes.

```ts theme={null}
scheduleonce({
    webhookHooks: {
        bookings: {
            scheduled: {
                after: async (ctx, result) => {
                    console.log(result.data.type, result.data.id);
                }
            },
        },
    },
})
```

Mount your framework handler once (see [Frameworks](https://docs.corsair.dev/frameworks/next.md)), then point the provider at that URL. Full event list: [Webhooks](https://docs.corsair.dev/plugins/scheduleonce/webhooks.md). Concepts: [Webhooks](https://docs.corsair.dev/concepts/webhooks.md), [Hooks](https://docs.corsair.dev/concepts/hooks.md).

## What's next

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

> [card] [Webhooks](https://docs.corsair.dev/plugins/scheduleonce/webhooks.md)
>
> Event paths, payloads, and `webhookHooks` examples.

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