- Test vs live keys. Keys prefixed
test_never print, mail, or verify real addresses: verifications return simulated outcomes and mailpieces stay virtual. Keys prefixedlive_spend real money per mailpiece and per verification. - Sends are physical.
postcards.sendandletters.senddispatch print jobs that cannot be recalled once in production, and each piece is billed. Pass anidempotency_key(at most 256 characters): Lob returns the original piece for 24 hours instead of mailing a duplicate. - Bulk US verification needs a live key.
usVerifications.bulkanswers a dummy response on atest_key; the single verification works in both modes. - Rate limits. Lob allows 150 requests per 5 seconds per key and endpoint (300 for the two US verification endpoints), and answers 429 with no
Retry-Afterheader. Corsair retries a 429 three times (after 1, 2 and 4 seconds). A 429 means Lob did nothing, so the retry is safe for sends too. - Mailpieces land as addresses. When you send with inline addresses, the response expands
toandfrominto full address objects. - Letter paper size.
letters.sendacceptssizeonly when the account pinsLob-Version2024-01-01 or newer; older versions reject it. - Every mail product sends for real on a live key.
checks.send,selfMailers.send,snapPacks.send,booklets.sendandcampaigns.sendprint, mail and bill like postcards and letters;checks.sendalso moves money from a verified bank account. Print orders (cards.createOrder,buckslips.createOrder) bill thousands of pieces at once. All of these aredestructive. - Cancels.
postcards.cancel,letters.cancel,checks.cancel,selfMailers.cancel,snapPacks.cancelandbooklets.cancelwork only before the piece goes to production (within the account’s cancellation window). - Campaigns. Create a campaign, add a creative (the artwork) and an upload (the audience), attach the CSV with
uploads.uploadFile, checkuploads.getReport, thencampaigns.send. Campaigns, uploads and Informed Delivery need those features enabled on the Lob account. - Features Lob turns on per account. On a new self-serve account, billing groups, snap packs, booklets, Informed Delivery and campaign creates answer 403, self mailers answer 404
unrecognized_endpoint, and buckslips and cards answer 422<feature>_not_allowed. Lob enables them on request.account.getBalanceneeds a live key; a test key gets 401 there. - Multipart.
uploads.uploadFileand the two Informed Delivery writes send files: pass a public URL,{ url }, or{ base64, filename }. - Webhooks. The plugin does not receive Lob webhooks; track deliveries by reading a mailpiece (
postcards.get,letters.get,checks.get, …).
- 105 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 Lob API key before the first call: More: API Key
pnpm corsair setup --plugin=lob --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
Look up the cities behind a ZIP codeWhat’s next
API reference
Every
lob.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.