x-api-key header. A key created in test mode reads and writes test-mode data only, which is the right place to develop.
What to know before you print:
- An order spends money.
letters.create,postcards.createandselfMailers.createprint and post a physical item. There is no sandbox flag on the request: test mode is a property of the key. - Idempotency. Order creation accepts an
Idempotency-Keyheader, and PostGrid honours it for 24 hours. The plugin generates one per call; passidempotencyKeyin the input to reuse it so a retried request returns the original order instead of printing a second one. - Cancelling. An order can be cancelled only while its status is
ready. After that it is with the printer. For a send-as-soon-as-possible order that is roughly midnight Eastern on the following day. - Tracking. Every order carries
status, fromreadythroughprintingandprocessed_for_deliverytocompletedorcancelled. Live mail bound for the US also gainsimbStatus, the USPS stage, plusimbDateandimbZIPCode. - Paging is by offset. List routes take
skipandlimitand returntotalCount; page whileskipis below it by addinglimiteach time. - Addresses are corrected. A created contact may come back with a different address than it was sent, and
addressStatussays whether it wasverified,correctedorfailed. On an order, atoorfromcontact given with anidis sent as that id alone, soskipVerificationandforceVerifiedStatustake effect only on an inline contact (address fields, noid). - Webhooks. PostGrid can post delivery notifications to a URL you register in its dashboard, but this plugin does not handle inbound deliveries.
- 21 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 PostGrid API key before the first call: More: API Key
pnpm corsair setup --plugin=postgrid --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 recent lettersWhat’s next
API reference
Every
postgrid.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.