Build an SEO-friendly site
Search engines may index your listing pages: Bright's IDX rules allow it. This guide shows how to build pages a search engine can read, with addresses that last, a sitemap, and removal that stays prompt, all within Bright's display rules (compliance).
The short version:
- Build each page on your server, with your secret key.
- Give each listing one address, by its
listingKey. - Write the title, the description and the structured data only from fields the API returned.
- Build your sitemap from the key list.
- Answer
410 Gonefor a listing that was removed, and drop every stored copy of it.
Build pages on the server
A page that fills itself in the browser, with a publishable key, is an empty page to many crawlers. Build listing pages and search pages on your server instead:
- Your server calls the API with its secret key (
sk_…), which never leaves the server, and sends finished HTML. No CORS, no key in the page. - Keep the publishable key (
pk_…) for what must run in the browser: a map that moves, a search box that completes as the visitor types, a favorite button (map search, autocomplete).
// A listing page, built on the server (Node 24, any framework).
app.get('/listing/:listingKey/:words?', async (req, res) => {
const r = await fetch(`https://api.apidata.one/v1/listings/${encodeURIComponent(req.params.listingKey)}`, {
headers: { Authorization: `Bearer ${process.env.APIDATA_SECRET_KEY}` },
});
if (r.status === 404) return res.status(removedKeys.has(req.params.listingKey) ? 410 : 404).send(gonePage());
if (!r.ok) return res.status(503).set('Retry-After', r.headers.get('retry-after') ?? '300').send(busyPage());
const { data: listing, compliance } = await r.json();
const canonical = listingPath(listing);
if (req.path !== canonical) return res.redirect(301, canonical); // the address changed: one address a listing
res.send(listingPage(listing, compliance, canonical));
});
One address for each listing
Use the listingKey to find a listing, never its street address:
// The slug ends with "-" and the listing key: cut that off to get the words.
function listingPath(listing) {
const words = listing.slug.slice(0, -(listing.listingKey.length + 1));
return `/listing/${listing.listingKey}/${words}`;
}
// /listing/805454359664/101-main-st-ardmore-pa-19003
// /listing/805454361120/ardmore-pa (a hidden address: city and state only)
- Look the listing up by the key alone. The words after it are decoration. When they don't
match the listing's current
slug, redirect to the address that does, and name that address in<link rel="canonical">. - The words come from
slug, never from your own reading of the address. When a seller asks that an address be hidden, the listing'sslugloses the street at once, and with the redirect above your old address stops showing it too. - A listing key is text. Live keys are digits today, and sandbox keys start with
SBX.
Titles, descriptions and structured data
Write them from the listing as the API returned it, at that moment:
function listingTitle(l) {
const where = l.address
? `${l.address.line1}, ${l.address.city}, ${l.address.state} ${l.address.postalCode}`
: `${l.statusLabel} listing`; // a hidden address: no street, in any tag
const price = l.price.list === null ? '' : ` | $${l.price.list.toLocaleString('en-US')}`;
return `${where}${price}`;
}
- A hidden address appears nowhere: not in the
<title>, the meta description, anog:tag, the structured data, an image'salttext or the page's address. A listing withaddressDisplay: "withheld"hasaddress: nullandlocation: null; write the page without them. - A null field stays out. A hidden price, hidden days on market, a Coming Soon listing's missing price history: leave them out of every tag, and never compute them.
- Structured data (schema.org JSON-LD) follows the same rule: only what the page itself shows.
function listingJsonLd(l, url) {
const data = {
'@context': 'https://schema.org',
'@type': 'RealEstateListing',
url,
name: listingTitle(l),
dateModified: l.updatedAt,
image: l.photos.primary ? [l.photos.primary.full ?? l.photos.primary.medium].filter(Boolean) : [],
};
if (l.price.list !== null) data.offers = { '@type': 'Offer', price: l.price.list, priceCurrency: 'USD' };
if (l.address)
data.about = {
'@type': 'Residence',
address: {
'@type': 'PostalAddress',
streetAddress: l.address.line1,
addressLocality: l.address.city,
addressRegion: l.address.state,
postalCode: l.address.postalCode,
},
...(l.location ? { geo: { '@type': 'GeoCoordinates', latitude: l.location.lat, longitude: l.location.lng } } : {}),
};
return JSON.stringify(data).replace(/</g, '\\u003c'); // safe inside a <script> tag
}
Every page built on the server carries the same disclosures as any other page with listings:
the compliance texts, your brokerage's name, and the listing office's name and contact near
the top of a detail page (what goes where). Photos keep
object-fit: contain.
A sitemap from the key list
GET /v1/listings/keys lists every listing the
API serves, by key, with the time it last changed. It is for your server, with the secret key:
// Every key the API serves, with when each last changed. About 210 requests for a million keys.
async function allKeys() {
const out = [];
let cursor = null;
for (;;) {
const url = new URL('https://api.apidata.one/v1/listings/keys');
url.searchParams.set('limit', '5000');
if (cursor) url.searchParams.set('cursor', cursor);
const r = await fetch(url, { headers: { Authorization: `Bearer ${process.env.APIDATA_SECRET_KEY}` } });
if (r.status === 429) {
await new Promise((done) => setTimeout(done, 1000 * Number(r.headers.get('retry-after') ?? 2)));
continue; // the same page again
}
if (!r.ok) throw new Error(`key list: ${r.status}`);
const page = await r.json();
out.push(...page.data); // { listingKey, updatedAt }
cursor = page.meta.page.nextCursor;
if (cursor === null) return out;
}
}
updatedAtis your<lastmod>. The list holds no address, so a sitemap entry's address is the key alone (/listing/805454359664); your page redirects it to the full address.- A sitemap file holds at most 50,000 addresses. With more, write several files and a sitemap index that names them.
- Rebuild it on a schedule, such as once a day. The route has a
limit of its own: one request every 2 seconds for
a key, with bursts of 5, so a full list takes a few minutes. Honour
Retry-Afteron a429. - A key that was on your last list and is not on this one has left the data. Take it out
of the sitemap, delete what you stored for it, and answer
410 Gonefor its page. - The list is for sitemaps. Do not use it to fetch every listing's detail ahead of time: build a listing's page when it is asked for (next section).
Caching and prompt removal
A removed listing must leave your site at once, stored pages included. So store as little as you can, for as short a time as you can:
- Build a page when it is asked for, from the API. To answer crawlers quickly you may keep a built page for a short while (minutes, not days) and rebuild it after that.
- Never show a stored page more than 12 hours old. That is the rule the API itself keeps for its own data.
- Drop a listing the moment its
listing.removednotice arrives: the stored page, any row and any image you kept. Remember only its key, so that its address answers410 Gone. Register a webhook endpoint, or readGET /v1/eventsevery minute. - A fetch that answers
404 listing_not_foundfor a listing you stored or served means the same: drop it, and remember its key as removed. For a key you never served, the same404says only "no such listing": the API can't tell a removed listing from one that never existed, and neither can you. - During a data stop (
500 data_stale), do not fall back to stored pages. Answer503with aRetry-Afterheader and a "temporarily unavailable" page; a search engine then keeps the page in its index and comes back later. - After an
account.reinstatednotice, re-check every listing you stored (why).
What to answer for a listing that is gone
| The listing | Answer | Why |
|---|---|---|
Removed from the data, and you know it: you got its listing.removed notice, or you served it before and it is missing from the key list |
410 Gone, with a plain page and links to search |
It tells a search engine to drop the page for good |
Never existed, or you can't tell: the API answers 404 listing_not_found for both, so a key you never served is this case |
404 Not Found |
A 410 for an address that never was a page tells a search engine nothing |
Live data is stopped (data_stale), or the API can't be reached |
503 with Retry-After |
The page stays indexed |
A 410 page shows nothing of the listing: no address, no photo, no price.
Crawlers count against your limits
Every page a crawler fetches makes your server call the API, and those calls count against your secret key's limits like any others. A crawler that takes thousands of pages in a burst can use up the bucket your visitors share.
- The short store above absorbs most of it: a page built a minute ago is not built again.
- Slow down a crawler that asks too fast: answer it
429or503withRetry-Afterfrom your own server before you call the API. - Search pages with many filters make endless addresses. Let crawlers index a small set (a
city's or a ZIP code's listings, built from
location.placeIdsorlocation.postalCodes) and mark the restnoindex.
See it working
The sample site at demo.apidata.one is built this way, on a sandbox
key: pages built on the server, addresses by listingKey, a sitemap from the key list, 410
for a removed listing, and every disclosure.
Checklist
- Listing and search pages built on the server with the secret key
- One address a listing, found by
listingKey; other spellings redirect to it - Title, description and structured data from the API's fields only; nothing for a null
- A hidden address in no tag, no address and no markup
- A sitemap from
GET /v1/listings/keys, rebuilt on a schedule,lastmodfromupdatedAt listing.removedhandled: every copy dropped,410 Gonefrom then on- No stored page shown past 12 hours, and none during
data_stale - The disclosures on every page a crawler can reach