# Sold and status rules

Source: https://help.ruuster.com/idx/compliance-sold-status

> The rules for showing sold listings, sold prices and listing statuses, and how the API applies each board's sold window.

## Which statuses you can show

The API returns the statuses your boards let you show: `active`, `coming_soon`, `pending`,
`under_contract` and, where a board allows it, `closed`. Each listing's `statusLabel` is the wording to
show. A listing that is withdrawn, expired or cancelled leaves the API, and its page answers 410.

## Sold listings

- **Only on boards that allow it.** `/v1/meta` `data.capabilities.sold` says per board whether sold
  listings may be shown (`allowed`) and for how long after the sale (`windowDays`).
- **Only inside the window.** A sale older than its board's window leaves the API: searches stop
  returning it and its listing answers 410.
- **The sold price** is `closePrice` on a closed listing, and the API returns it only from boards that
  show sold data.
- **Market numbers** about sales (median sold price, days on market, list-to-sale ratio) come only from
  boards that show sold data. Where none do, those numbers are null: hide them, never show a zero.

## Your pages

1. Build a sold page only for an area whose boards show sold data. Otherwise, link to the area's homes
   for sale.
2. Title it with what it shows, such as "Recently sold homes in Midtown". Don't call recent sales in an
   area your brokerage's sales unless you filtered to your own listings.
3. Keep a sold listing's own page live, marked sold, until the API answers 410 for it; then answer 410.
4. Never keep sold listings or sold prices from an earlier answer once the API stops returning them.

## Errors you may see

| Error | What to do |
|---|---|
| 400 `sold_period_required` | Add `soldPeriod` to a `status=closed` search. |
| 422 `sold_not_permitted` | The search's boards don't allow sold data, or disagree. Narrow it with `filterByMls` to boards that show sold data, or drop `closed`. |

[Sold listings and sold windows](https://help.ruuster.com/idx/guide-sold) shows the searches.
