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

Just sold postcards: mail one by API when a listing closes

Just sold postcards tell the neighbors around a sale that the agent sold it. Sent through a direct mail API, they go out on their own: a job watches the MLS feed, and when a listing’s status changes to Closed, it mails a 6x9 card with the sold address and the agent’s name to every home in the agent’s farm. Just listed postcards work the same way from a change to Coming Soon or Active. A 500-home farm costs $445.00 per sale on pay as you go, printing and postage included.

On this page
  1. How just sold postcards work with a direct mail API
  2. Watch the MLS feed’s RESO Web API for a Closed status
  3. Who gets just sold postcards by API: the farm list
  4. What goes on just sold and just listed postcards sent by API
  5. Code: send just sold postcards by API when a listing closes
  6. Just sold postcard questions from API senders

How just sold postcards work with a direct mail API

Three pieces of data do all the work: the listing’s status, the address that sold, and the agent’s farm list. The MLS supplies the first two; the farm list is the agent’s own.

StandardStatus: ClosedThe agent’s farm, 500 homesJust sold postcards
One status change, one batch. When a listing’s status changes to Closed, the job mails every home in the agent’s farm except the one that sold.

Watch the MLS feed’s RESO Web API for a Closed status

Most MLS data reaches developers through the RESO Web API, from vendors such as Bridge, Trestle, Spark or MLS Grid. It has no webhooks, so the job reads every listing changed since its last run (filtered on ModificationTimestamp), compares each StandardStatus with the one it stored, and acts only on the change it cares about. A change to Closed sends just sold cards. A change to Coming Soon or Active sends just listed cards. The listing’s ListingKey goes into the Idempotency-Key, so a re-run never mails a farm twice for the same sale.

Who gets just sold postcards by API: the farm list

A farm is the set of homes an agent mails again and again, usually a few neighborhoods. Agents keep their own list. To build one, the owner’s mailing address for each home comes from the county assessor’s parcel data or an owner list from a provider such as PropStream; the targeted direct mail post covers both. Before each send:

  • Leave out the house that sold.
  • Keep one card per household.
  • Run an older farm list through NCOA for owners who moved, and add "verify": true to check every address.

What goes on just sold and just listed postcards sent by API

JUST SOLD418 Maple StAnother one sold on your street.Dana Reyes, Example Realty6x9JUST LISTED22 Birch LnOpen house Saturday, 1 to 3 pm.Dana Reyes, Example Realty6x11
Just sold and just listed. The sold address and the agent come from the listing; the open house date comes from the MLS too. Addresses and the agent here are made up.
  • Just sold, 6x9: the sold address, the agent’s name and photo, and a number or short link to ask what their own home is worth.
  • Just listed, 6x11: the listing photo, the address and the open house date, with a QR code to the listing if you like.

Both use your own HTML design with merge tags such as {{sold_address}} and {{agent_name}}, filled once for the whole batch since every home on the farm gets the same sale.

Code: send just sold postcards by API when a listing closes

# Run hourly. Env: RESO_BASE (your MLS feed's RESO Web API URL), RESO_TOKEN, AGENT_KEY, MAILR_API_KEY
# farm.csv: the agent's farm, one row per home: name, line1, line2, city, state, zip
# state.json: when the job last ran and each listing's status then (created on the first run)
import csv, datetime, json, os, re, requests

state = json.load(open("state.json")) if os.path.exists("state.json") else {"since": "2026-11-01T00:00:00Z", "status": {}}
now = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
norm = lambda s: re.sub(r"[^a-z0-9]", "", s.lower())

url = f"{os.environ['RESO_BASE']}/Property"
params = {"$filter": f"ModificationTimestamp gt {state['since']} and ListAgentKey eq '{os.environ['AGENT_KEY']}'",
          "$select": "ListingKey,StandardStatus,UnparsedAddress,ListAgentFullName", "$top": "200"}
changed = []
while url:  # the feed has no webhooks, so read what changed since the last run, page by page
    page = requests.get(url, params=params, headers={"Authorization": f"Bearer {os.environ['RESO_TOKEN']}"}, timeout=60).json()
    changed += page["value"]
    url, params = page.get("@odata.nextLink"), None

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

for l in changed:
    before = state["status"].get(l["ListingKey"])
    state["status"][l["ListingKey"]] = l["StandardStatus"]
    if l["StandardStatus"] != "Closed" or before == "Closed":
        continue  # only the change to Closed sends just sold cards
    street = norm(l["UnparsedAddress"].split(",")[0])
    homes = [h for h in farm if norm(h["line1"]) != street]  # not the house that sold
    for n, start in enumerate(range(0, len(homes), 1000)):
        r = requests.post("https://api.mailr.dev/v1/batches", timeout=60,
            headers={"Authorization": f"Bearer {os.environ['MAILR_API_KEY']}",
                     "Idempotency-Key": f"just-sold-{l['ListingKey']}-{n}"},  # a re-run never mails twice
            json={"kind": "postcard", "size": "6x9", "verify": True,
                  "front": open("mail/just-sold/front.html").read(), "back": open("mail/just-sold/back.html").read(),
                  "merge": {"sold_address": l["UnparsedAddress"].split(",")[0], "agent_name": l["ListAgentFullName"]},
                  "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"]}}
                                 for h in homes[start:start + 1000]],
                  "description": f"Just sold: {l['UnparsedAddress']}"})
        r.raise_for_status()
        print(l["ListingKey"], r.json()["id"], r.json()["count"], r.json()["price"])

state["since"] = now
json.dump(state, open("state.json", "w"))
Point it at a test key and a test listing first: the batch is checked and priced, a proof is made for each card, and nothing prints or charges.

Just sold postcard questions from API senders

Does Mailr connect to my MLS?

No. Your code reads the MLS feed, usually the RESO Web API through a vendor such as Bridge, Trestle, Spark or MLS Grid, and calls Mailr when a status changes.

When should a just sold postcard go out?

When the listing's status changes to Closed. The job above checks hourly, so the cards are in the mail within a day of the close.

How many homes should get one?

The agent's farm, whatever size it is. A batch holds up to 1,000 homes, and a larger farm goes out as several batches.

What does a just sold mailing cost?

A 6x9 postcard is $0.89 on pay as you go, printing and postage included, so a 500-home farm is $445.00. On the Agency plan ($149 a month) the card is $0.69.

Can the buyer get a card too?

Yes: a welcome-home card to the buyer at the new address, from the same status change. It's one of the moments on the real estate page.

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.