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

# Shipday plugin

> Shipday delivery management API integration covering active delivery orders, takeout pickup orders, carriers, on-demand third-party dispatch, partner reporting, and real-time status and driver location webhooks.

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

Shipday authenticates requests with `Authorization: Basic <API_KEY>` using your raw Shipday API key (not base64-encoded).

Use a company API key for dispatch operations. The three `partners.*` operations require a separate partner API key. Put that key in the API key slot of a separate connection. Corsair sends it as `PARTNER-API-KEY` for those routes.

`orders.query` and `partners.queryOrders` accept inclusive `startCursor` and `endCursor` row positions. Shipday returns the newest matching orders first.

Key integration notes:

* **`orders.progress`** (`/order/progress/{trackingId}`) requires a premium Shipday plan and is rate-limited to 3 requests per minute per `trackingId`.
* **Delivery vs. pickup orders**: Delivery orders use `orderNo`, `orderItems`, `tip`, and `totalCost` on `orders.update`, whereas `orders.create` uses `orderNumber`, `orderItem`, `tips`, and `totalOrderCost`. Pickup (takeout) orders live under `/pickup-orders` and return HTTP 204 No Content on `pickupOrders.delete`.
* **Webhooks**: Shipday sends `orders.statusUpdated` (`POST` on order lifecycle changes, including `ORDER_PIKEDUP` with Shipday's wire spelling) and `carriers.locationUpdated` (Beta `LOCATION_UPDATE` events). Configure an optional validation token (up to 32 characters) via `webhookSecret` or `keys.set_webhook_signature` to verify the `token` header in constant time.

**What you get:**

* 27 typed API operations
* 2 incoming webhook event types

## Setup

**1. Install**

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

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

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

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

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

## Example API calls

**Retrieve active delivery orders**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.shipday.api.orders.list({});
```

**Insert a delivery order**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.shipday.api.orders.create({
	orderNumber: '99qT5A',
	customerName: 'John Mason',
	customerAddress: '556 Crestlake Dr, San Francisco, CA 94132, USA',
	customerPhoneNumber: '+14152392212',
	restaurantName: 'Popeyes Louisiana Kitchen',
	restaurantAddress: '890 Geneva Ave, San Francisco, CA 94112, United States',
});
```

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

## Webhooks

Fires when an order is assigned, started, picked up, delivered, failed, or has POD uploaded.

```ts theme={null}
shipday({
    webhookHooks: {
        orders: {
            statusUpdated: {
                after: async (ctx, result) => {
                    console.log('Order event:', result.data?.event, result.data?.order_status);
                }
            },
        },
    },
})
```

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/shipday/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/shipday/api.md)
>
> Every `shipday.api.*` operation with input and output types.

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