On this page
- Where B2B direct mail addresses come from, by API
- Checking office addresses before a B2B API send
- Which account stages send B2B direct mail by API
- B2B direct mail formats and prices by API
- Code: mail the buyers at your target accounts by API
- How to measure B2B direct mail sent by API
- B2B direct mail questions from API senders
Where B2B direct mail addresses come from, by API
Most of the work is getting a full street address for the office. Each tool gets there differently:
| Source | Where the office address is |
|---|---|
| HubSpot or Salesforce | The company or account record you already keep |
| ZoomInfo | Enrich Contacts: the street, city, state and ZIP where each person works |
| Apollo | The contact has the city and state; the street is on the account, joined by account id |
| Clay | An enrichment column, sent row by row from an HTTP API column |
Whichever it is, keep the person’s name and the company apart: the name goes on the first line and the company on its own line below it.
Checking office addresses before a B2B API send
| name | company | address | check |
|---|---|---|---|
| Dana Cole | Northwind | 500 Main St Ste 400 | Deliverable, business |
| Raj Patel | Contoso | 1 Market St | Suite missing |
| Lena Ortiz | Fabrikam | 22 Oak Ln | Residential |
| Sam Wu | Tailspin | 9 Harbor Way | Undeliverable |
- Suites. An office building usually needs a suite or floor. Without one, the check comes back
deliverable_missing_unit: the building is real, but the piece may not reach the person. Find the suite before you send. - Homes. The check also says whether an address is residential. A “work” address that comes back residential is someone’s home, and you decide whether to mail it.
- Old offices. Companies move and people change jobs, so check addresses close to the send, not when the list was built.
What each result means is in CASS-certified address verification, and USPS’s own address API is compared in USPS address verification API. Small businesses often get mail at a private mailbox; how to spot and address one is in CMRA addresses.
Which account stages send B2B direct mail by API
The stages already live in your CRM, so the mail can go out from the change itself. A HubSpot workflow on a deal moving to Closed won, or a Salesforce record-triggered flow on an opportunity, calls the API once; an Idempotency-Key built from the record id keeps a repeated trigger from sending twice. For lists you build outside the CRM, the Apollo, ZoomInfo and Clay pages each have a script that mails only the contacts added since the last run.
B2B direct mail formats and prices by API
| Piece | Good for | Price |
|---|---|---|
| 6x9 postcard | A short message to a buyer | $0.89 |
| 5.5x8.5 postcard | An invite to a dinner or event | $0.89 |
| 8.5x11 letter, mailed flat | A letter from a founder or the account team | $0.95 |
| 11x17 folded mailer | A case study or a product story | $1.39 |
Pay as you go prices, with printing, addressing and postage; plan prices and campaign totals are in direct mail cost. Put the person’s name and their company on the front, where they see it before anything else; which other fields to change per card is in personalized direct mail.
Code: mail the buyers at your target accounts by API
This checks every office address, sets aside the ones that need a person to look at them, and mails a 6x9 card to the rest with each buyer’s name, company and a code of their own:
# Run when the target list changes. Env: MAILR_API_KEY.
# buyers.csv: contact_id (up to 8 characters), account, first_name, name, company, line1, line2, city, state, zip
# mail/abm/front.html and back.html: your design, with {{first_name}}, {{company}} and {{promo_code}} in it
import csv, os, requests
API = "https://api.mailr.dev/v1"
H = {"Authorization": f"Bearer {os.environ['MAILR_API_KEY']}"}
mailed = set(open("mailed.csv").read().split()) if os.path.exists("mailed.csv") else set()
with open("buyers.csv", newline="") as f:
buyers = [b for b in csv.DictReader(f) if b["contact_id"] not in mailed]
# 1. Check every office address and sort out the ones that need a person to look at them.
send, fix = [], []
for start in range(0, len(buyers), 1000):
chunk = buyers[start:start + 1000]
r = requests.post(f"{API}/addresses/verify", headers=H, timeout=120,
json={"addresses": [{"name": b["name"][:40], "company": b["company"][:40] or None, "line1": b["line1"],
"line2": b["line2"] or None, "city": b["city"], "state": b["state"], "zip": b["zip"]}
for b in chunk]})
r.raise_for_status()
for b, v in zip(chunk, r.json()["data"]):
if v["deliverability"] == "deliverable" and v["residential"] is not True:
send.append({**b, "to": v["address"]})
else: # a missing suite, a home address or an address USPS doesn't deliver to
fix.append([b["contact_id"], b["company"], v["deliverability"], "home" if v["residential"] else ""])
with open("fix.csv", "w", newline="") as f:
csv.writer(f).writerows(fix)
# 2. Mail the rest, 1,000 per request, each with a code that names the contact.
front, back = open("mail/abm/front.html").read(), open("mail/abm/back.html").read()
for n, start in enumerate(range(0, len(send), 1000)):
chunk = send[start:start + 1000]
r = requests.post(f"{API}/batches", timeout=120, headers={**H, "Idempotency-Key": f"abm-q1-{n}-{chunk[0]['contact_id']}"},
json={"kind": "postcard", "size": "6x9", "front": front, "back": back,
"recipients": [{"to": b["to"], "merge": {"first_name": b["first_name"][:14],
"company": b["company"][:24],
"promo_code": f"Q1-{b['contact_id']}"}} for b in chunk],
"description": "Target accounts, Q1"})
r.raise_for_status()
with open("mailed.csv", "a") as f:
f.write("".join(b["contact_id"] + "\n" for b in chunk))
print(r.json()["id"], r.json()["count"], r.json()["price"])mlr_test_ key first: the address check is simulated, the cards are proofed, and nothing prints or charges.How to measure B2B direct mail sent by API
- A code or short link per contact, so a visit or a booking points back to the person and the account.
- Meetings booked at mailed accounts in the weeks after the cards are mailed, from the same CRM that sent them.
- Accounts you didn’t mail. Leave a random slice of the target list out and compare, the way direct mail campaign sets up a holdout.
B2B direct mail questions from API senders
What is B2B direct mail?
Mail from one business to people at another: a card to a buyer at a target account, an invite to an event, a welcome letter when a deal closes. It's addressed to a person, at their office, by company name.
Can I put the company name in the address?
Yes. Send it as company in the address, up to 40 characters, and it prints on its own line under the person's name.
What about people who work from home?
The address check marks each address residential or not, so you can see when a work address is a home. Whether you mail those is up to you; the script above sets them aside for a person to decide.
Which format works best for B2B mail?
A 6x9 card for a short message or an invite, at $0.89. A letter-style 8.5x11 flat when it should read like a letter from a founder, at $0.95. Prices are pay as you go with postage.
Can the mail go out from HubSpot or Salesforce directly?
Yes. A workflow in HubSpot or a record-triggered flow in Salesforce can call the API when a deal changes stage; both are set up on their integration pages.