X-Kit-Api-Key header, not as a Bearer token; that header is the OAuth path and a key sent that way is refused.
Things to know before you call:
- Kit pages by cursor. A list answers a
paginationblock withend_cursor,start_cursorandhas_next_page. Passend_cursorback asafterfor the next page, orstart_cursorasbeforefor the previous one, and stop whenhas_next_pageis false. - Only active subscribers are returned by default.
subscribers.listtakesstatus; passallto widen it, or one ofactive,inactive,bounced,complained,cancelled. canceled_atneeds the cancelled status. Asking for it beside any other status is refused, and the plugin checks that before the call rather than letting Kit answer 422.- Creating a subscriber with an address already on the list returns the existing one, so a create is safe to repeat.
- Custom field values go by
key, not label. A subscriber’sfieldsmap is keyed by the field’skey, such aslast_name. An unknown key is ignored and named in the responsewarningsarray rather than failing, so readwarningswhen a value seems missing. - Tag and form subscribes need an existing subscriber.
tags.tagSubscriberandforms.subscribefind the subscriber by address and answer 404 when there is none, so callsubscribers.createfirst for a new address. Subscribing through a form then applies the form’s incentive and recordsadded_at. - No bulk routes. Kit only accepts its
/v4/bulk/*routes with an OAuth token, and this plugin authenticates with an API key, so create subscribers one at a time withsubscribers.create. subscribers.unsubscribecannot be undone from here. It stops every future send to that person, and only they can resubscribe.- Rate limits. Kit enforces two request windows and sends
Retry-Afteron a 429, which the plugin honours before backing off. - Webhooks. The plugin does not receive Kit webhooks; Kit has a separate endpoint-management API that is not wrapped here.
- 16 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the Kit API key before the first call: More: API Key
pnpm corsair setup --plugin=kit --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.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.
Example API calls
List the first page of active subscribersWhat’s next
API reference
Every
kit.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.