Saved searches and alerts
A visitor saves a search and is told when a listing newly matches it. The API keeps the search and works out the matches; your site tells the visitor, by email or however you like. This guide walks through the whole loop.
- The visitor signs in to your site. Your server gives them an opaque client ID.
- They save a search:
POST /v1/saved-searches, with an alert frequency. - The API records a notice when listings newly match.
- Your server receives the notice (a webhook, or the events list) and fetches the listings.
- Your site sends the email, with the disclosures an email needs.
1. Who the visitor is
Saved searches belong to one visitor of your site. The API never sees who they are: your server chooses an opaque client ID for each (a UUID is fine; never an email address or a phone number) and speaks for them in one of two ways (authentication):
- from your server: your secret key plus
X-Client-Id: <the ID>; - from the browser: your publishable key plus
X-Client-Token, a short-lived token your server mints for that visitor withPOST /v1/client-tokens.
Keep the link between the client ID and the visitor's email address in your own database. You need it in step 5, and the API never has it.
2. Save the search
The criteria are the filters of a search, exactly as
POST /v1/listings/search
takes them, without paging or sorting:
curl -X POST "https://api.apidata.one/v1/saved-searches" \
-H "Authorization: Bearer $SK_TEST" -H "X-Client-Id: 6b1f0a52-visitor" \
-H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"name":"Ardmore under 500k","criteria":{"status":["active"],"price":{"max":500000},"location":{"placeIds":["pl_…"]}},"alertFrequency":"daily"}'
alertFrequencyis required:instant,daily,weeklyoroff. Ask the visitor; never guess it.- Send an
Idempotency-Key, so that a repeat after a lost answer does not save the search twice (idempotency). - A visitor may keep up to 100 saved searches.
- To save a search around a drawn shape (Premium), save the shape
first and put its
location.shapeIdin the criteria.
Show the visitor their searches with GET /v1/saved-searches, let them change the frequency
with PATCH, and delete with DELETE (reference).
Show each search's status. A search that reads paused_tier, paused_suspended or
paused_invalid is making no alerts, and the visitor should know. A paused_invalid search is
fixed by saving new criteria.
3. What alerts, and when
A listing alerts when it is new, when its price or status changes, or when it comes back on the market, and it matches the search at the moment the notice is made.
alertFrequency |
The notice is made |
|---|---|
instant |
after each data update, usually within minutes of the change |
daily |
once a day at 7:00 am Eastern, for the day before |
weekly |
Mondays at 7:00 am Eastern, for the week before |
off |
never: the search is only kept |
Listings that already match when the search is saved never alert. Your site shows those itself, at the moment of saving, with an ordinary search. The same holds after the criteria change and after alerts are turned back on.
4. Receive the notice
A notice is thin: IDs and the kind of change, never listing content.
{
"id": "evt_3yQ8mT1xKp7Zc2Nf5Rb9Wd",
"type": "saved_search.matches",
"createdAt": "2026-11-10T15:00:00.000Z",
"accountId": "0b9f6c1e-52a7-4c3e-9d41-7a6f0c2b8e15",
"clientId": "6b1f0a52-visitor",
"savedSearchId": "ss_Hq2Lw9Xc4Vb7Nm1Kp6Tz3R",
"listingKeys": ["300451207716"],
"changes": [{ "listingKey": "300451207716", "reasons": ["new"] }]
}
Take notices one of two ways (webhooks and notices):
- A webhook: the API sends each notice to an
https://address on your server (the webhooks guide). - The events list: your server asks
GET /v1/eventsevery minute for what is new. No public address is needed.
Either way, de-duplicate by the notice's id: the same notice can reach you twice.
5. Send the email
For each notice:
- Find the visitor by
clientIdin your own database. If they have unsubscribed, stop. - Fetch each listing in
listingKeysnow:GET /v1/listings/{listingKey}. Never build an email from a copy you stored.404 listing_not_found: the listing has left the data. Leave it out.500 data_stale: live data is stopped. Send nothing with listing content, and try later.
- Fetch
GET /v1/complianceonce for the texts the email must carry. - Send it from your own mail system, to that visitor only.
apidata.one never emails your visitors, and never has their addresses. An email that shows a listing is a display of Bright's data, with rules of its own: alert emails lists every element and where its text comes from.
Favorites alert too
A visitor's favorites make two kinds of notice, in the same way:
favorite.listing_updated (a price, a status, the photos or an open house changed) and
favorite.listing_removed (the listing left the data: the favorite is gone, and so must be
any copy of the listing you kept).
Try it now, on the sandbox
The sandbox changes by itself every 5 minutes, so a saved search there alerts before long. To see one at once, send a sandbox trigger with the saved search's ID, and read the notice within about 10 seconds:
curl -X POST "https://api.apidata.one/v1/sandbox/triggers" \
-H "Authorization: Bearer $SK_TEST" -H "X-Client-Id: 6b1f0a52-visitor" -H "Content-Type: application/json" \
-d '{"event":"saved_search.matches","savedSearchId":"ss_…"}'
curl -H "Authorization: Bearer $SK_TEST" "https://api.apidata.one/v1/events"
When a visitor leaves
DELETE /v1/clients/{clientId} removes everything the API holds for one visitor: favorites,
saved searches, saved shapes and their notices. Call it when a visitor closes their account
with you or asks to be forgotten (reference).
Good to know
- While your account is suspended no notice is made for a saved search or a favorite's
change, and what happened meanwhile never alerts later. After
account.reinstated, re-check the listings you stored. - After a downgrade to Basic, searches with Premium criteria read
paused_tier. Nothing is deleted, and they are active again when the account is Premium. - More than 500 matches at once are split over several notices.
- A very large data repair can hold alerts back for a person to look at (when a notice is late).