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

QR code postcards: size, placement and a unique code per API recipient

On QR code postcards, the code should be at least an inch wide, dark on a light background, with a blank margin around it, inside the safe area and away from the address block. A short link makes a smaller code that scans more easily. To give every recipient a code of their own, make one image per person, host it, and pass its link as a merge value: a design with <img src="{{qr_image}}"> prints each person’s code on their card.

On this page
  1. Where a QR code goes on an API postcard
  2. QR code size, margin and contrast for printed API mail
  3. Short links make better QR codes on API mail
  4. One QR code for everyone, or a unique code per API recipient
  5. QR code postcard questions from API senders

Where a QR code goes on an API postcard

Anywhere inside the safe area, 0.125 inch in from the trim, except the block on the back where Mailr prints the address, postage and barcode (4 x 2.375 inches at the lower right). Put it next to the offer, with a line that says what scanning gets people, so the code has a reason to be scanned. How the rest of the card is laid out is in direct mail design.

15% off your next tripScan to see what’s new, or use code PEAK15 at checkout.1.1 inKeep clear
address, postage, barcode
A 6x9 back, to scale. The QR code sits next to the offer, at least 1 inch wide, inside the safe area and clear of the striped block where Mailr prints the address, postage and barcode.

QR code size, margin and contrast for printed API mail

  • Size. No QR standard sets a minimum size in inches; DENSO WAVE, which created the QR code, says larger modules read more reliably. Mailr’s templates call for at least 1 inch. At that width even a 33 x 33 module code has modules about 0.6 mm across, above the 0.396 mm minimum GS1 sets for codes people scan with a phone.
  • Margin. A standard QR code needs a blank border four modules wide on every side. Don’t let the background art or text run into it.
  • Error correction. Four levels restore roughly 7% (L), 15% (M), 25% (Q) or 30% (H) of a damaged code. M is the usual choice; a higher level gives more room for scuffs in the mail but makes the code bigger.
  • Contrast. Black on white is the safe choice. DENSO WAVE warns that some color pairs can’t be read at all and that text or images over the code break it; GS1 allows light modules on a dark background, but scan a proof before you mail it.

A QR code grows with what it holds: from 21 x 21 modules for the smallest version up to 177 x 177 for the largest. A long tracking URL makes a dense code that needs more room to scan well. GS1 recommends a short domain for the same reason. A link like acme.co/r/c1042 keeps the code small and still tells you exactly who scanned it. It’s the same idea as the short review_url field in Mailr’s templates, which allows 28 characters.

One QR code for everyone, or a unique code per API recipient

One code for everyone is just an image in the design. A code per person tells you who responded, and there are two ways to print it: A just listed card with a code to the listing is one example, in just sold postcards.

  • A batch with an image link per person. Make one QR image per recipient, put the images where they can be fetched over HTTPS, and send each link in merge. Merge tags work inside an image’s address, and a link can be up to 200 characters.
  • One request per piece with the code in the HTML. Draw the code into each piece’s own design, for example as an SVG from a QR library. This suits mail sent one at a time from a trigger.
first_nameqr_image
Ada…/qr/c1042.png
Marcus…/qr/c1043.png
Ada’s card, Ada’s code
A different code on every card. Each row carries a link to that person’s QR image; the design’s <img src="{{qr_image}}"> picks it up when the card is printed.
# pip install segno requests. customers.csv: id, name, first_name, line1, line2, city, state, zip
# Each customer gets a short link of their own (acme.co/r/<id>) and a QR image of it, served from a public folder.
import csv, os, pathlib, requests, segno

OUT = pathlib.Path("public/qr")             # whatever your web server or bucket serves at https://acme.co/qr/
OUT.mkdir(parents=True, exist_ok=True)

recipients = []
with open("customers.csv", newline="") as f:
    for c in csv.DictReader(f):
        link = f"https://acme.co/r/{c['id']}"  # short: fewer modules, an easier scan
        segno.make(link, error="m").save(str(OUT / f"{c['id']}.png"), scale=10, border=4)  # border 4 = the quiet zone
        recipients.append({
            "to": {"name": c["name"][:40], "line1": c["line1"], "line2": c["line2"] or None,
                   "city": c["city"], "state": c["state"], "zip": c["zip"]},
            "merge": {"first_name": c["first_name"][:14], "qr_image": f"https://acme.co/qr/{c['id']}.png"},
        })

# Upload public/qr first, then send. back.html has <img src="{{qr_image}}" style="width:1.1in;height:1.1in">.
for n, start in enumerate(range(0, len(recipients), 1000)):
    resp = requests.post(
        "https://api.mailr.dev/v1/batches",
        headers={"Authorization": f"Bearer {os.environ['MAILR_API_KEY']}", "Idempotency-Key": f"qr-mailer-{n}"},
        json={"kind": "postcard", "size": "6x9",
              "front": open("mail/front.html").read(), "back": open("mail/back.html").read(),
              "recipients": recipients[start:start + 1000], "description": "Spring mailer with QR codes"},
        timeout=60,
    )
    resp.raise_for_status()
    print(resp.json()["id"], resp.json()["count"], resp.json()["price"])
Send it with an mlr_test_ key first and scan a few proofs with your phone, straight off the screen. Test pieces never print or charge.

The same per-person image can carry a gift claim link, as in gift card mailers. A QR code is one more merge field. The others worth using, and what to keep off a card, are in personalized direct mail. Or a one-use coupon barcode, as in coupon mailers.

QR code postcard questions from API senders

What size should a QR code be on a postcard?

At least 1 inch wide, which is what Mailr's templates call for. No QR standard sets a minimum in inches; bigger modules scan more reliably, so use the room you have.

Can Mailr make the QR code for me?

No. Mailr prints what's in your design. Make the code with a library such as segno or qrcode, or any QR tool, and put the image in the design or pass its link as a merge value.

Can each postcard have a different QR code?

Yes. Merge tags work inside an image's address, so <img src="{{qr_image}}"> prints each recipient's own code when you send each person's image link as a merge value.

Do QR codes get a postage discount?

Not on their own. USPS's Integrated Technology Promotion takes 5% off postage when a QR code leads to something like augmented reality, video or a mobile purchase, and the mailer registers each mailing with USPS. Mailr's per-piece prices are fixed and don't include it.

Can the QR code go on the front?

Yes, anywhere inside the safe area. On the back, keep it out of the block at the lower right where the address, postage and barcode go.

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.