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

# InstaBox plugin

> InstaBox gives each agent a Linux machine in the cloud: machines (create, start, stop, suspend, resume, fork, resize, exec, files, ports, SSH tokens, desktop links, metrics, logs), snapshots and exports, workspace secrets, members and invites, usage, GitHub Actions CI jobs, and signed webhooks (93 operations).

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

The account stores one credential: an InstaBox API key (`ibk_...`, from
the dashboard's API keys page or `instabox keys create`), sent as
`Authorization: Bearer`. Its scopes decide which operations work. A key
belongs to one workspace and sees only that workspace's machines and
snapshots. Member, invite and workspace-secret changes need a workspace
key with `workspace:admin`; a personal org's key gets `403 missing_scope`
there.

* **Lifecycle calls** (create, start, stop, suspend, resume, fork,
  snapshot, delete) take an `Idempotency-Key`; the plugin sends a fresh one
  unless you pass `idempotency_key`. They answer with an operation; read its
  progress with `operations.get`.
* **Deletes** of a machine or snapshot need `X-Confirm-Delete` with its ID
  or exact name. The plugin sends the id from the call unless you pass
  `confirm_delete`.
* **Exec** (`machines.exec`) runs `cmd` through `bash -lc`, or `argv` with
  no shell, and waits for the exit (default 60 s, at most 600). Output is
  cut at 1 MiB per stream; download files with `machines.files.download`
  rather than `cat`.
* **Money.** Machines are billed per second while they run (vCPU, memory,
  storage, egress, GPUs). Creating, starting, resuming, waking, forking or
  restoring one, running a command in it, invites, SSH certificate and
  token issuing and every delete are `destructive`.
* **Webhooks.** Register an endpoint with `orgs.webhooks.create` and store
  the `whsec_` secret it returns as the webhook secret. Deliveries follow
  Standard Webhooks (`webhook-id`, `webhook-timestamp`, `webhook-signature`),
  and the plugin checks each one.
* **Rate limits.** A 429 `rate_limited` carries `Retry-After` and core
  retries it; a 429 `quota_exceeded` is a plan limit and is not retried.
* Not wrapped: routes that answer `403 permission_denied` to every API
  key and take only a dashboard or CLI sign-in (billing, API key
  management, Vault, sessions, support tickets, Discord, creating,
  deleting and moving workspaces, GitHub App installations), sign-in and
  OAuth flows, the WebSocket terminal, VNC and Orca tunnels, the desktop
  watch stream, the GitHub and Stripe webhook receivers, and deprecated
  `/v1/images` routes (use `snapshots.*`).

**What you get:**

* 93 typed API operations
* 12 incoming webhook event types

## Setup

**1. Install**

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

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

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

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

export const corsair = createCorsair({
	plugins: [
		instabox(),
	],
	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 InstaBox API key before the first call: `pnpm corsair setup --plugin=instabox --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}
> instabox()
> ```
>
> 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: 'instabox',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**List machines**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.instabox.api.machines.list({ limit: 20 });
```

**Run a command in a machine**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.instabox.api.machines.exec({ id: 'm_k3m7q2abx5wr4hj6zpcnfa2etd', cmd: 'uname -a && nproc', timeoutSeconds: 60 });
```

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

## Webhooks

This plugin registers **12** webhook event types. Configure the provider to POST to your Corsair HTTP handler, then use `webhookHooks` on the plugin factory.

See [Webhooks](https://docs.corsair.dev/plugins/instabox/webhooks.md) for every event path and payload shape, and [Webhooks concept](https://docs.corsair.dev/concepts/webhooks.md) for routing.

## What's next

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

> [card] [Webhooks](https://docs.corsair.dev/plugins/instabox/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.