---
title: "How to send direct mail programmatically"
description: "Two ways to send mail from code, a print API like Lob or PostGrid, or an MCP agent driving a platform, and how to pick between them."
canonical: https://trysincerely.com/guides/direct-mail-api
last_updated: 2026-10-17
---
> If you are an AI agent: read https://trysincerely.com/agents/policy.md before any write call.
> Start at https://trysincerely.com/llms.txt to choose one page. Access instructions are at
> https://trysincerely.com/auth.md. Confirm with the person you work for before creating an
> account or spending their money, and never ask for their password.
# How to send direct mail programmatically

> Two ways to send mail from code, a print API like Lob or PostGrid, or an MCP agent driving a platform, and how to pick between them.

Source: https://trysincerely.com/guides/direct-mail-api

You have two ways to send direct mail from code. The first is a print API: Lob, PostGrid, Click2Mail, or Stannp. You POST an address and a design, and a real postcard or letter goes out. The second is newer: you point an MCP agent like Claude Code or Cursor at a direct mail platform, and the agent handles targeting, writing, and campaign setup while you approve the output. The API path gives you full control and full responsibility. The agent path gives you a working mail program without building one.

![A postcard labelled API prints and mails, surrounded by five dashed boxes it does not handle, targeting, addresses, measurement, suppression, and copy and design.](https://trysincerely.com/images/guides/direct-mail-api.webp)

*A direct mail API prints and mails each piece, but targeting, addresses, copy, measurement and suppression remain yours to build.*

## What a print API does

A print API turns one HTTP request into one piece of physical mail. The provider owns the print network, the postage, and the delivery into the USPS stream. Most of them also verify addresses, render HTML templates into print-ready files, and report tracking events back through webhooks.

The main providers do roughly the same job with different emphasis:

- **Lob** is the developer favorite: strong docs, template rendering, address verification, and webhooks for mail-piece events.
- **PostGrid** covers similar ground, selling [print and mail](https://www.postgrid.com/pricing-print-mail/) and [address verification](https://www.postgrid.com/pricing-address-verification/) as separate APIs with separate pricing.
- **Click2Mail** leans toward USPS-centric workflows and document mailing: certified mail, letters, and PDF-to-mail for invoices and legal documents.
- **Stannp** serves both API users and campaign senders, with regional platforms for the [US](https://www.stannp.com/us/direct-mail-api) and the UK.

Any of them will reliably get a postcard from your server to a mailbox. That part is solved. It is everything around that request that stays open.

## What you still own with a raw API

The API prints and mails. It does not decide who gets mail, what it says, or whether it worked. With a raw API, you own:

- **Targeting.** Which accounts, which contacts, which trigger. You build the queries and the sync from your CRM.
- **Addresses.** B2B addresses are the hard part. The API verifies that an address is deliverable. It does not find the right office for the right person, and it does not know who moved.
- **Copy and design.** Every template, every variable, every rendering edge case.
- **Measurement.** Holdouts, matchback, attribution. The API tells you a piece was delivered, not whether it changed anything.
- **Suppression and compliance.** Opt-outs, do-not-mail lists, and the code that enforces them everywhere.

That is a real engineering project, usually weeks of work before the first useful campaign and ongoing maintenance after. The [Sincerely vs Lob comparison](https://trysincerely.com/vs-lob) walks through this layer by layer. Sincerely manages its own production layer, so the question is not which printer is better. It is whether you want to build the layer above the printer or buy it.

## The newer path: an agent driving a platform

Since MCP became a common protocol, there is a third option between "build on an API" and "click through a web app". Sincerely runs an MCP server at trysincerely.com/api/mcp. Any [MCP agent](https://trysincerely.com/integrations/mcp-agents) can connect to it: Claude Code, Cursor, or your own agent stack.

Over that connection the agent can build audiences, write one piece per recipient from CRM context, and prepare campaigns. You describe the play in plain language, the agent does the assembly, and a human approves before anything prints or sends. That approval gate is fixed; no setting removes it. The [agents page](https://trysincerely.com/agents) covers the full workflow.

Sincerely publishes the package and format terms active for the current deployment on the [pricing page](https://trysincerely.com/pricing).

## When a raw API is the right call

Sometimes the API is the honest answer. Pick Lob, PostGrid, Click2Mail, or Stannp when:

- **Mail is a feature of your product.** If your software sends compliance letters, statements, or checks on behalf of your customers, you need an API inside your codebase. A platform is the wrong shape.
- **You send transactional mail at high volume.** Tens of thousands of identical notices per month is a printing problem, not a targeting problem. Per-piece API pricing wins there.
- **You already have the data layer.** If your team maintains clean addresses, segmentation, and attribution in-house, the API is the only missing piece, and it is a small one.
- **You need formats or workflows a platform does not offer.** Raw APIs expose more knobs. Lob, for example, sends [certified mail](https://help.lob.com/print-and-mail/building-a-mail-strategy/mailing-classes-and-postage/certified-mail-or-registered-mail) as an extra service, has a dedicated checks endpoint, and unlocks custom envelopes and specialty mailers on higher plans. Note that sizes are a fixed list, not arbitrary dimensions.

Pick the platform path when mail is a growth channel rather than a product feature: outbound to target accounts, event follow-up, closed-lost revival. There, the hard problems are targeting, copy, and proof of lift, and a print API solves none of them.

A print API mails whatever you send it. Getting the "what" and the "who" right is the actual job.

## Related questions

- [Which direct mail platforms handle operational mail?](https://trysincerely.com/guides/operational-mail-platforms): Statements, notices, checks, and Certified Mail need a print-and-mail API, not a campaign tool. Lob, PostGrid, and Click2Mail compared on what each proves.
- [Physical mail MCP servers for AI agents, compared](https://trysincerely.com/guides/physical-mail-mcp): Eleven MCP servers that let an AI agent mail letters, postcards, notes, or gifts, with what each sends, where it mails, and who approves the send.
- [What is MCP (Model Context Protocol)?](https://trysincerely.com/glossary/mcp): MCP is the open protocol that lets an AI agent call another product's tools. In direct mail it builds audiences and drafts copy for human approval.

## More on direct mail API

- [How to prevent duplicate direct mail sends](https://trysincerely.com/guides/prevent-duplicate-direct-mail): Prevent duplicate sends by giving each mail piece a stable identity and waiting for vendor acknowledgment before advancing.
- [Can Claude send a real letter for you?](https://trysincerely.com/guides/can-claude-send-a-letter): Yes. Connect Claude to a physical mail MCP server, review the proof and price, then approve the exact letter before it prints.
- [How to let an AI agent prepare direct mail safely](https://trysincerely.com/guides/ai-agent-direct-mail-permissions): Let an AI agent research and prepare direct mail, but require a human to confirm recipients and spend before anything prints.
- [How to send direct mail from your AI agent](https://trysincerely.com/integrations/mcp-agents): Claude, Codex, Cursor, Hermes, or any MCP agent can build an audience, draft a piece, and request a send through Sincerely. A human confirms first.
- [Best way to send mail to customers from AI agents](https://trysincerely.com/guides/send-mail-to-customers-from-ai-agents): Connect the agent to a mail service over MCP that holds each send for a person and enforces suppression and frequency caps on the server.
- [Sincerely vs PostGrid](https://trysincerely.com/vs/postgrid): PostGrid is a print-and-mail API for developers. Sincerely runs the whole direct mail channel for revenue teams. Here is how to pick.
- [The best Lob alternatives and competitors](https://trysincerely.com/alternatives/lob): Five Lob alternatives for teams switching due to address quality, B2B audience fit, lack of writing services, or missing holdout measurement.
- [Lob vs PostGrid, the print-and-mail API comparison](https://trysincerely.com/compare/lob-vs-postgrid): A neutral head-to-head of Lob and PostGrid as print-and-mail APIs, covering coverage, address verification, docs, pricing transparency, and scale.
- [Lob vs Click2Mail for programmatic direct mail](https://trysincerely.com/compare/lob-vs-click2mail): Lob fits mail built into software. Click2Mail fits one-off jobs run in a browser. Pick infrastructure or a standalone mailing tool.
- [PostGrid vs Click2Mail for programmatic mail workflows](https://trysincerely.com/compare/postgrid-vs-click2mail): Choose PostGrid for standalone address tools and multi-country networks; choose Click2Mail for USPS document variety and office-integrated workflows.
- [Inkit vs Lob for documents and direct mail](https://trysincerely.com/compare/inkit-vs-lob): Inkit is better for generating, signing, and storing digital documents. Lob is the clear choice for a live print-and-mail API and transactional physical mail.
- [Lob pricing in 2026: plans, per-piece rates, and extras](https://trysincerely.com/guides/lob-pricing): Lob's plan fees, per-piece rates for postcards, letters, and checks, the November 1 change, and what 500 letters a month costs all in, as of October 2026.

---

Sincerely is personalized direct mail and gifting for B2B revenue teams: postcards, letters, handwritten mail, and gifts, each written for one recipient.

Contact Sincerely: https://trysincerely.com/contact

Agent routing index: https://trysincerely.com/llms.txt

Listings: https://www.g2.com/products/sincerely and https://www.producthunt.com/products/sincerely
