# Filters and keyword search

Source: https://help.ruuster.com/idx/guide-filters

> Filter searches by price, beds, baths, size, lot, year, HOA, type, status, open houses, price changes, new construction, keywords and every advanced filter your boards offer.

Every filter your boards offer is available through the API, under one set of parameter names.
Filters narrow a search: they never widen it past its location.

## The main filters

| What | Parameters |
|---|---|
| Price | `priceMin`, `priceMax` (whole dollars) |
| Bedrooms and bathrooms | `bedsMin`, `bedsMax`, `bathsMin`, `bathsMax` |
| Living area and lot | `sqftMin`, `sqftMax`, `lotSqftMin`, `lotSqftMax` (square feet; an acre is 43,560) |
| Year built | `yearMin`, `yearMax` |
| HOA fee | `hoaMin`, `hoaMax` |
| Property type | `type` (repeat for several), `subtype` for homes: `house`, `condo`, `townhome`, `co-op`, `other` |
| Status | `status`: `active` (the default), `coming_soon`, `pending`, `under_contract`, `closed`; repeat for several |
| Open houses | `openHousePeriod`: `any`, `today_or_tomorrow`, `this_weekend`, `next_7_days` |
| Price changes | `priceReduction`: `0d` (today), `1d`, `2d`, `3d`, `7d`, `14d`, `30d`, `90d` |
| New listings | `listedSince`: `1d`, `3d`, `7d`, `14d`, `30d` (first on the market since midnight UTC that many days ago); pair it with `sort=newest` |
| Days on market | `daysOnMarketMax`: at most this many days |
| Changed by the MLS | `modifiedSince`: a period (`1d` to `30d`) or an ISO date or date-time, such as `2026-11-01` |
| New construction | `newConstruction=1` for new construction only, `0` to leave it out |
| Boards | `filterByMls`: a comma list of board search names from `/v1/meta` |

Repeat a parameter to send several values, as in `status=active&status=pending`. Never join them with
commas, except where a parameter says it takes a comma list.

This search asks for active and pending homes and townhomes in ZIP 30308 between $400,000 and
$900,000 with at least three bedrooms and two bathrooms:

cURL:

```bash
curl -s -G "https://idx.ruuster.com/v1/listings" \
  --data-urlencode zip=30308 \
  --data-urlencode status=active \
  --data-urlencode status=pending \
  --data-urlencode subtype=house \
  --data-urlencode subtype=townhome \
  --data-urlencode priceMin=400000 \
  --data-urlencode priceMax=900000 \
  --data-urlencode bedsMin=3 \
  --data-urlencode bathsMin=2 \
  --data-urlencode limit=24 \
  -H "Authorization: Bearer $IDX_SECRET_KEY"
```

TypeScript:

```typescript
import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });

const r = await idx.search({
  zip: "30308",
  status: ["active", "pending"],
  subtype: ["house", "townhome"],
  priceMin: 400000,
  priceMax: 900000,
  bedsMin: 3,
  bathsMin: 2,
  limit: 24,
});
if (!r.ok) throw new Error(`${r.error.code}: ${r.error.message}`);
console.log(r.data);
```

Python:

```python
import os

import requests

res = requests.get(
    "https://idx.ruuster.com/v1/listings",
    params={
        "zip": "30308",
        "status": ["active", "pending"],
        "subtype": ["house", "townhome"],
        "priceMin": "400000",
        "priceMax": "900000",
        "bedsMin": "3",
        "bathsMin": "2",
        "limit": "24",
    },
    headers={"Authorization": "Bearer " + os.environ["IDX_SECRET_KEY"]},
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(body["error"]["code"] + ": " + body["error"]["message"])
print(body["data"])
```

PHP:

```php
<?php

// Repeated names are sent once per value: http_build_query would add [] to them.
$pairs = [
    ['zip', '30308'],
    ['status', 'active'],
    ['status', 'pending'],
    ['subtype', 'house'],
    ['subtype', 'townhome'],
    ['priceMin', '400000'],
    ['priceMax', '900000'],
    ['bedsMin', '3'],
    ['bathsMin', '2'],
    ['limit', '24'],
];
$query = implode('&', array_map(fn ($p) => rawurlencode($p[0]) . '=' . rawurlencode($p[1]), $pairs));
$ch = curl_init('https://idx.ruuster.com/v1/listings' . '?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('IDX_SECRET_KEY')],
    CURLOPT_TIMEOUT => 30,
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body['ok']) {
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
```

Without `type`, a search covers every type your boards carry. `type=all` covers every type except
commercial ones. Rentals (`ResidentialLease`) appear only on accounts with rentals turned on.

`listedSince` reads each active listing's first on-market date, so a listing that comes back on the
market after a price change or a relist keeps its first date; a date in the future counts as today.
For other statuses it reads the board's days-on-market count. `listedSince` and `daysOnMarketMax` leave
out the boards that don't show Days on Market (Maine's, for one), since a site may not show how long
those listings have been for sale. `modifiedSince` finds any change the MLS made, such as a price,
status, photo or remarks change.

Sold listings need `status=closed` with a `soldPeriod`, and only on boards that show sold data:
[Sold listings and sold windows](https://help.ruuster.com/idx/guide-sold).

## Keyword search

`keywords` finds words in the listing's public description, such as `keywords=pool` or
`keywords=renovated`. Repeat it for several words. Up to ten keywords are accepted, each up to 60
characters. Only the public description is searched.

cURL:

```bash
curl -s -G "https://idx.ruuster.com/v1/listings" \
  --data-urlencode zip=30308 \
  --data-urlencode keywords=renovated \
  --data-urlencode keywords=garage \
  --data-urlencode limit=24 \
  -H "Authorization: Bearer $IDX_SECRET_KEY"
```

TypeScript:

```typescript
import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });

const r = await idx.search({
  zip: "30308",
  keywords: ["renovated", "garage"],
  limit: 24,
});
if (!r.ok) throw new Error(`${r.error.code}: ${r.error.message}`);
console.log(r.data);
```

Python:

```python
import os

import requests

res = requests.get(
    "https://idx.ruuster.com/v1/listings",
    params={
        "zip": "30308",
        "keywords": ["renovated", "garage"],
        "limit": "24",
    },
    headers={"Authorization": "Bearer " + os.environ["IDX_SECRET_KEY"]},
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(body["error"]["code"] + ": " + body["error"]["message"])
print(body["data"])
```

PHP:

```php
<?php

// Repeated names are sent once per value: http_build_query would add [] to them.
$pairs = [
    ['zip', '30308'],
    ['keywords', 'renovated'],
    ['keywords', 'garage'],
    ['limit', '24'],
];
$query = implode('&', array_map(fn ($p) => rawurlencode($p[0]) . '=' . rawurlencode($p[1]), $pairs));
$ch = curl_init('https://idx.ruuster.com/v1/listings' . '?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('IDX_SECRET_KEY')],
    CURLOPT_TIMEOUT => 30,
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body['ok']) {
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
```

## Advanced filters

`GET /v1/filters` lists every advanced filter your account can use: its `key`, its `label`, its type,
whether it belongs in the main bar or under "More filters" (`group`), the boards that show it and the
operators it takes. Send one as `f.<key>`:

- `f.<key>=value` for a value; repeat it for several values.
- `f.<key>Min=n` and `f.<key>Max=n` for a range.
- `f.<key>_o=and`, `or`, `not`, `zbyes` or `zbno` for the operator, where the filter takes one.

cURL:

```bash
curl -s -G "https://idx.ruuster.com/v1/listings" \
  --data-urlencode zip=30308 \
  --data-urlencode f.yearBuiltMin=2000 \
  --data-urlencode limit=24 \
  -H "Authorization: Bearer $IDX_SECRET_KEY"
```

TypeScript:

```typescript
import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });

const r = await idx.search({
  zip: "30308",
  limit: 24,
  f: {
    yearBuiltMin: 2000,
  },
});
if (!r.ok) throw new Error(`${r.error.code}: ${r.error.message}`);
console.log(r.data);
```

Python:

```python
import os

import requests

res = requests.get(
    "https://idx.ruuster.com/v1/listings",
    params={
        "zip": "30308",
        "f.yearBuiltMin": "2000",
        "limit": "24",
    },
    headers={"Authorization": "Bearer " + os.environ["IDX_SECRET_KEY"]},
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(body["error"]["code"] + ": " + body["error"]["message"])
print(body["data"])
```

PHP:

```php
<?php

$query = http_build_query([
    'zip' => '30308',
    'f.yearBuiltMin' => '2000',
    'limit' => '24',
], '', '&', PHP_QUERY_RFC3986);
$ch = curl_init('https://idx.ruuster.com/v1/listings' . '?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('IDX_SECRET_KEY')],
    CURLOPT_TIMEOUT => 30,
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body['ok']) {
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
```

To fill a dropdown with a filter's choices, call `GET /v1/filters/options?filterKey=<key>`. Pass the
search's other filters in `filters` (a JSON object) so the counts reflect them, and the visitor's
typing in `filterByValue`.

cURL:

```bash
curl -s -G "https://idx.ruuster.com/v1/filters/options" \
  --data-urlencode filterKey=type \
  -H "Authorization: Bearer $IDX_SECRET_KEY"
```

TypeScript:

```typescript
import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });

const r = await idx.filterOptions({
  filterKey: "type",
});
if (!r.ok) throw new Error(`${r.error.code}: ${r.error.message}`);
console.log(r.data);
```

Python:

```python
import os

import requests

res = requests.get(
    "https://idx.ruuster.com/v1/filters/options",
    params={
        "filterKey": "type",
    },
    headers={"Authorization": "Bearer " + os.environ["IDX_SECRET_KEY"]},
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(body["error"]["code"] + ": " + body["error"]["message"])
print(body["data"])
```

PHP:

```php
<?php

$query = http_build_query([
    'filterKey' => 'type',
], '', '&', PHP_QUERY_RFC3986);
$ch = curl_init('https://idx.ruuster.com/v1/filters/options' . '?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('IDX_SECRET_KEY')],
    CURLOPT_TIMEOUT => 30,
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body['ok']) {
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
```

A key `/v1/filters` doesn't list answers 422 `filter_not_supported`.

## Building the filter bar

The `Filters` recipe component is a plain GET form that uses these exact parameter names, so it works
with JavaScript turned off and its URLs read cleanly, such as `/search?zip=30308&bedsMin=3`. Read the
page's URL on the server with `fromSearchParams` from `@ruuster/idx`, which keeps the API's own names
and drops values it can't use.

<figure class="idx-shot"><img src="/idx-docs/screens/ours/filters-bar-1440.png" alt="The filter bar: the quick filters from 1741px and the More filters pill with its drawer, on a desktop (1440 px wide)" width="1440" height="900" loading="lazy" decoding="async"><figcaption>The filter bar from the search page recipe.</figcaption></figure>

<figure class="idx-shot"><img src="/idx-docs/screens/ours/filters-bar-375.png" alt="The filter bar: the quick filters from 1741px and the More filters pill with its drawer, on a phone (375 px wide)" width="375" height="812" loading="lazy" decoding="async"><figcaption>The filter bar from the search page recipe.</figcaption></figure>

The markup is `static/html/filters-bar.html` in `@ruuster/idx-recipes`. The [HTML and CSS recipe](https://help.ruuster.com/idx/recipe-html-css) shows how to fill it and which stylesheet and script to load.

Give it your filter list and "More filters" shows every filter your account offers, each with the
control its type calls for, so nobody has to know a field name:

```tsx
const filters = await idx.filters();
// ...
<Filters value={q} action="/search" layout="bar" filters={filters.ok ? filters.data : undefined} baseUrl="/api/idx" />
```

<figure class="idx-shot"><img src="/idx-docs/screens/ours/filters-drawer-dynamic-1440.png" alt="The More filters drawer built from the account's filter list, on a desktop (1440 px wide)" width="1440" height="900" loading="lazy" decoding="async"><figcaption>More filters, built from your account's own filter list.</figcaption></figure>

<figure class="idx-shot"><img src="/idx-docs/screens/ours/filters-drawer-dynamic-375.png" alt="The More filters drawer built from the account's filter list, on a phone (375 px wide)" width="375" height="812" loading="lazy" decoding="async"><figcaption>More filters, built from your account's own filter list.</figcaption></figure>

The markup is `static/html/filters-drawer-dynamic.html` in `@ruuster/idx-recipes`. The [HTML and CSS recipe](https://help.ruuster.com/idx/recipe-html-css) shows how to fill it and which stylesheet and script to load.

The filters of your own Ruuster filter panel come first, in its order, then every other filter under
"Advanced filters". A list's choices load from `GET /v1/filters/options` when the visitor opens
it. [Recipe components](https://help.ruuster.com/idx/recipe-components) lists the control each
filter type gets and the props that make a smaller panel. On a page with no server, the
[HTML and CSS recipe](https://help.ruuster.com/idx/recipe-html-css) builds the same rows in the
browser from one empty element.

## Filtered pages and search engines

A results page whose filters a visitor picked (price, beds, keywords and the other filters beyond
location, status and sort) comes back with `head.robots` set to `noindex,follow`. Filter combinations
are endless, and you want your curated area pages to rank instead. Send `indexable=1` on a page you
curate yourself, such as "Homes with a pool in Midtown", to make it indexable.
