Direct mail API for developers and growth teams. Read the docs →

Coupon mailers by API: a postcard coupon each household can use once

Coupon mailers put an offer in the mailbox that people bring back to redeem. Sent through a direct mail API, each household gets its own postcard coupon with a code that works once, so every redemption points to the household and the mailing that brought it in, and a code shared online is only good for one use. Below: shared coupon mailers next to your own, what the coupon says, codes and barcodes per household, counting redemptions, cost, and the script.

On this page
  1. Shared coupon mailers or your own coupon postcard
  2. What a coupon postcard says
  3. One code per household, made before the API send
  4. Code: an automated coupon drop with a code per household
  5. Counting coupon mailer redemptions
  6. What coupon mailers cost by API
  7. Coupon mailer questions

Shared coupon mailers or your own coupon postcard

YoursShared mailerEvery home in the area, one code for everyoneACME BAKERY15% off your next orderK7QM-2XPAOne use. Ends Feb 28.Your own coupon postcardThe households you pick, one code each
Shared or your own. A shared mailer puts your coupon next to other businesses’ coupons, in front of every home in an area. Your own postcard carries only your offer, to the households you pick, each with a code of its own.
Shared coupon mailerYour own coupon postcard
Who gets itEvery home in a zoneThe households you choose
Next to itOther businesses’ couponsNothing else
The codeUsually one for everyoneOne per household
What you learnHow many came backWhich households came back

Your own card can go to your customers, the streets around a new location, or anyone on a list you build, as in targeted direct mail. To reach every home on a few routes instead, compare it with Every Door Direct Mail.

What a coupon postcard says

  • The offer, big: 15% off, a free side, $20 off a first service.
  • An end date, which gives people a reason to use it soon.
  • The terms: what it’s good for, one per household, not with other offers.
  • The code, typed in or scanned, and where to use it: in store, online, or both.
  • The name on the front, if you have it, up to 14 characters.

Coupons are advertising, so they fit USPS Marketing Mail, and USPS’s rulings treat a code like this, which only identifies the household to you, as a keycode rather than personal information. Layout rules for each side are in direct mail design.

One code per household, made before the API send

householdcode
h_1042K7QM-2XPA
h_1043R4TN-8WEC
h_1044B9HX-3LUD
15% off withK7QM-2XPARedeemed: h_1042
One household, one code. Make the codes before you mail, as one-use codes in your checkout or POS, and keep which household got which. A code that comes back tells you who used it and which mailing sent it. The codes here are made up.
  • Make the codes first. Random, not sequential, so nobody can guess the next one, and without characters people misread, like 0 and O. A promo_code can be up to 12 characters.
  • Load them as one-use codes in your checkout or POS before the cards go out.
  • Keep which household got which, so a redemption points back to the household and the drop.
  • For a register that scans, print each household’s code as a barcode or QR code: one image per household at a public https link, sent in merge.

Code: an automated coupon drop with a code per household

This makes a one-use code for every household (and reuses them on a re-run), saves them for your checkout, and mails a 6x9 coupon card to each household with its own code and barcode:

# Once per coupon drop. Env: MAILR_API_KEY.
# households.csv: id, name, first_name, line1, line2, city, state, zip
# mail/coupon/front.html and back.html: your design, with {{first_name}}, {{promo_code}} and, for a scannable
# code, <img src="{{barcode_image}}"> where each household's barcode image lives at a public https link.
import csv, os, requests, secrets

DROP = "feb-2027"
ALPHABET = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"  # no 0/O or 1/I/L to misread
code = lambda: "".join(secrets.choice(ALPHABET) for _ in range(4)) + "-" + "".join(secrets.choice(ALPHABET) for _ in range(4))

with open("households.csv", newline="") as f:
    homes = list(csv.DictReader(f))

# 1. Make one code per household and save them. Load codes.csv into your checkout or POS as one-use codes
#    before the cards go out. Re-running reuses the saved codes instead of making new ones.
codes = {}
if os.path.exists(f"codes-{DROP}.csv"):
    with open(f"codes-{DROP}.csv", newline="") as f:
        codes = {row[0]: row[1] for row in csv.reader(f)}
for h in homes:
    codes.setdefault(h["id"], code())
with open(f"codes-{DROP}.csv", "w", newline="") as f:
    csv.writer(f).writerows(codes.items())

# 2. Mail each household its own code, 1,000 per request.
front, back = open("mail/coupon/front.html").read(), open("mail/coupon/back.html").read()
for n, start in enumerate(range(0, len(homes), 1000)):
    chunk = homes[start:start + 1000]
    r = requests.post("https://api.mailr.dev/v1/batches", timeout=120,
        headers={"Authorization": f"Bearer {os.environ['MAILR_API_KEY']}", "Idempotency-Key": f"coupon-{DROP}-{n}"},
        json={"kind": "postcard", "size": "6x9", "verify": True, "front": front, "back": back,
              "merge": {"ends": "February 28"},  # the same on every card
              "recipients": [{"to": {"name": h["name"][:40] or "Current Resident", "line1": h["line1"],
                                     "line2": h["line2"] or None, "city": h["city"], "state": h["state"], "zip": h["zip"]},
                              "merge": {"first_name": (h["first_name"] or "Neighbor")[:14],
                                        "promo_code": codes[h["id"]],
                                        "barcode_image": f"https://acme.example/barcodes/{codes[h['id']]}.png"}}
                             for h in chunk],
              "description": f"Coupon drop {DROP}"})
    if r.status_code == 422:  # the error names the row to fix; nothing in this batch was sent
        print("batch", n, r.json()["error"]["message"])
        continue
    r.raise_for_status()
    print(r.json()["id"], r.json()["count"], r.json()["price"])
Run it with an mlr_test_ key first, and scan a barcode or two on the proofs: nothing prints or charges.

Counting coupon mailer redemptions

Every code that comes back at checkout is one household from one drop. Divide the codes used by the cards mailed for a redemption rate, and leave a random slice of the list without a card to see how many would have come in anyway, as in direct mail campaign. A win-back campaign uses the same code for customers who went quiet.

What coupon mailers cost by API

Households4x66x9
500$425.00$445.00
1,000$850.00$890.00
2,500$2,125.00$2,225.00
5,000$4,250.00$4,450.00

Pay as you go prices, with printing in full color on both sides, addressing and postage. Checking the addresses is extra. The discount itself is yours to give.

Coupon mailer questions

How much do coupon mailers cost?

On your own postcard through Mailr, $0.85 for a 4x6 and $0.89 for a 6x9 on pay as you go, with printing and postage. 1,000 households at 6x9 is $890.00.

Can every coupon have its own barcode?

Yes. Make one barcode image per household, put the images at public https links, and send each link in merge; the design shows it with <img src="{{barcode_image}}">.

Can people share the code online?

Only once, if it's a one-use code in your checkout or POS. That's the main reason to give each household its own.

How long should a mailed coupon last?

Long enough to arrive and be used: USPS Marketing Mail takes 3 to 10 business days, so give it a clear end date several weeks after the drop.

Do coupon mailers work?

Count it yourself: with a code per household and a slice of the list left unmailed, you'll see how many came in because of the card.

START SENDING

Put your first postcard in the mail

Create a key, send a test to yourself, and check the proof before anything prints.

Start sending
  • Postcards, flats and folded mailers
  • A proof before anything prints
  • Free test mode: nothing prints, nothing charges
  • A status for every piece

Free price sheet

Get the price sheet by email

Every postcard, letter, mailer and print product on every plan, with postage included.

We’ll email you the price sheet. By continuing you agree to the Terms and Privacy Policy.

Download the template kit?

mailr-kit.zip · about 310 KB · 59 text files

Only HTML, JSON and Markdown files. No programs, scripts or macros, nothing that installs or runs.