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

# Postiz plugin

> Social media scheduling API for publishing, scheduling and managing posts across connected channels.

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

Postiz schedules and publishes to more than thirty social platforms from one place. Create a key in Developer settings and paste it in; it travels in the `Authorization` header with no scheme prefix. For a self-hosted instance, also set the account's `base_url` to the instance's https URL, such as `https://postiz.example.com` (the plugin adds `/api/public/v1`). For Postiz Cloud, set it to `https://api.postiz.com`. An empty `base_url` also reaches Cloud, but Corsair then reports the account as partly set up. The `baseUrl` plugin option does the same for an inline key.

What to know before you publish:

* **The UI says channel, the API says integration.** Both mean one connected social account, and this plugin uses the API's word.
* **Three ways to create a post.** `posts.create` takes `type: 'draft'`, which saves without publishing; `'schedule'`, which queues for `date`; or `'now'`, which publishes as soon as Postiz accepts it. A draft may have no channels attached, and anything that will publish needs at least one, which the plugin enforces before sending.
* **Each platform has its own settings.** A post carries a `settings` object whose `__type` names the platform, and the rest follows that platform's schema. The plugin passes it through rather than guessing the fields.
* **Threads.** One post item's `value` is an array, so several entries make a thread, and `inter` sets the minutes between them.
* **Media must be uploaded first.** `media.uploadFromUrl` copies a public file into the library; then reference it in a post's `image` by its `id` and `path`. A body over 50 MB is rejected with 413.
* **Rate limit.** The create-post route allows 90 to 100 requests an hour for the whole instance, and scheduling several posts in one request is the way to stay inside it. Core retries a 429 three times, honouring Retry-After.
* **Scheduling is publishing.** `posts.changeStatus` with `status: 'schedule'` queues a post to go out at its stored date, so it is marked destructive like `posts.create`.
* **Paging.** `media.list` pages from 1 and returns `pages`; `notifications.list` pages from 0 and returns `hasMore`.
* **Deleting.** `posts.delete` removes every post in the group. A post already published stays live on the platform, because deleting here only forgets it.
* **Webhooks.** Postiz can notify another system when it publishes, but this plugin does not handle inbound deliveries.

**What you get:**

* 11 typed API operations

## Setup

**1. Install**

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

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

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

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

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

## Example API calls

**List the connected channels**

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

**Delete a post and everyone in its group**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.postiz.api.posts.delete({ id: 'post-123' });
```

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

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/postiz/api.md)
>
> Every `postiz.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.