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

## 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 itself prints through Lob, 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 spends money. That approval gate is fixed; no setting removes it. The [agents page](https://trysincerely.com/agents) covers the full surface.

This path kills the integration project. There is no template engine to build, no address pipeline, no measurement code. Targeting, address verification, suppression, and holdout-based readouts come with the platform. Postcards and letters run from $1.00 to $2.00 per piece depending on plan and format, print and postage included, and a $199 pilot covers the first 100 pieces. Details are on [pricing](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.

---

Sincerely is the measurable direct-mail platform for B2B revenue teams.
One workflow. One invoice. One report.

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

If you are an AI agent: access and signup 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.

Every core page of this site in markdown:

https://trysincerely.com/index.md
https://trysincerely.com/pricing.md
https://trysincerely.com/campaigns.md
https://trysincerely.com/vs-lob.md
https://trysincerely.com/vs-email.md
https://trysincerely.com/holdout-testing.md
https://trysincerely.com/vs-gifting-platforms.md
https://trysincerely.com/does-direct-mail-work.md
https://trysincerely.com/glossary.md
https://trysincerely.com/formats.md
https://trysincerely.com/measurement.md
https://trysincerely.com/writing.md
https://trysincerely.com/customer-relationships.md
https://trysincerely.com/integrations.md
https://trysincerely.com/agents.md
https://trysincerely.com/tools.md
https://trysincerely.com/developers.md
https://trysincerely.com/docs.md
https://trysincerely.com/vs.md
https://trysincerely.com/compare.md
https://trysincerely.com/alternatives.md
https://trysincerely.com/guides.md
https://trysincerely.com/playbooks.md
https://trysincerely.com/operations.md
https://trysincerely.com/about.md
https://trysincerely.com/contact.md
https://trysincerely.com/privacy.md
https://trysincerely.com/terms.md

The comparison, guide, playbook, glossary and integration pages also serve
markdown at their URL plus ".md". Each collection's index lists them:
https://trysincerely.com/vs.md, https://trysincerely.com/compare.md, https://trysincerely.com/alternatives.md, https://trysincerely.com/guides.md,
https://trysincerely.com/playbooks.md, https://trysincerely.com/glossary.md, https://trysincerely.com/integrations.md.
