# /midland/estates/search

`POST /api/midland/estates/search`

Price: 20 credits

Search Hong Kong residential estates (屋苑) indexed by Midland Realty. Filters cover free text, estate name matching and exclusion, explicit estate ids, whether phases are merged or listed separately, ownership class, curated themes, developer, the eight-level geography, street and MTR station with walking time, primary school net, universities, average price per gross or saleable area unit, building age, estate facility groups, special unit features and required nearby amenities, plus ordering by price, deal volume, deal value or building age. Each estate carries live sale and rental listing counts, total units and blocks, the developer, occupation date, the saleable-area price with month-on-month change, the last twelve monthly average prices, yearly deal count, amount and price change, the geography chain, coordinates, walkable amenities, the primary school net and whether the estate is a component of the Midland Property Price Index.

## How to use it

Search Hong Kong residential estates tracked by Midland Realty. Always set count, plus lang / unit / currency for the output locale. Sort by net_ft_price to rank estates by saleable-area price, or by tx_count_desc for the most traded ones. Use include_phases to split large estates into their phases. Then call midland/estates with the id for the full estate profile, or midland/properties/search with estate_ids for the live listings.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `lang` (string) — Output language. Districts, estates, buildings and feature names are all translated. (default: "zh-hk"; one of: "zh-hk", "zh-cn", "en")
- `unit` (string) — Area unit used for areas and per-area prices. (default: "feet"; one of: "feet", "meter")
- `currency` (string) — Currency used for prices, rents and monthly payments. (default: "HKD"; one of: "HKD", "CNY")
- `min_building_age` (integer, nullable) — Minimum building age in years, counted from first occupation. (min: 0; max: 999)
- `max_building_age` (integer, nullable) — Maximum building age in years, counted from first occupation. (min: 0; max: 999)
- `count` (integer, required) — Max number of results to return (min: 1; max: 10000)
- `text` (string, nullable) — Free-text query matched against estate and district names. (minLength: 1)
- `estate_name` (string, nullable) — Match estates whose name contains this text. (minLength: 1)
- `exclude_estate_name` (string, nullable) — Drop estates whose name contains this text. (minLength: 1)
- `estate_ids` (array, nullable) — Restrict to these estate ids.
- `exclude_estate_ids` (array, nullable) — Drop these estate ids.
- `include_phases` (boolean, nullable) — Return each estate phase separately instead of merging them.
- `property_types` (array, nullable) — Ownership class: private housing, HOS or TPS. (one of: "private", "hos", "tps")
- `categories` (array, nullable) — Curated estate themes: pet-friendly, university neighbourhood, Northern Metropolis, above an MTR station. (one of: "pet", "university", "northern_metro", "above_mtr")
- `developer` (string, nullable) — Developer name (e.g. 新鴻基). (minLength: 1)
- `sort` (string) — Result ordering. (default: "default"; one of: "default", "tx_count_desc", "tx_amount_desc", "bldg_age", "bldg_age_desc", "net_ft_price", "net_ft_price_desc")
- `region_id` (string, nullable) — Region id: 10 Hong Kong Island, 20 Kowloon, 30 New Territories. (minLength: 1)
- `subregion_ids` (array, nullable) — Sub-region ids.
- `district_ids` (array, nullable) — District ids.
- `sm_district_ids` (array, nullable) — Small district ids.
- `combined_district_ids` (array, nullable) — Combined district ids.
- `int_district_ids` (array, nullable) — Internal district ids.
- `int_sm_district_ids` (array, nullable) — Internal small district ids.
- `street_ids` (array, nullable) — Street ids.
- `mtr_ids` (array, nullable) — MTR station ids.
- `walking_duration` (integer, nullable) — Max walking time in seconds to the selected MTR station. Only applied together with mtr_ids; the widest catchment the data holds is reached at 900. (min: 1)
- `school_net` (string, nullable) — Primary school net code. (minLength: 1)
- `university_ids` (array, nullable) — Universities whose neighbourhoods should be covered. (one of: "U01", "U02", "U03", "U04", "U05", "U06", "U07", "U08", "U09", "U10", "U11", "U12", "U13")
- `min_net_ft_price` (number, nullable) — Minimum average price per saleable area unit. (min: 0)
- `max_net_ft_price` (number, nullable) — Maximum average price per saleable area unit. (min: 0)
- `min_ft_price` (number, nullable) — Minimum average price per gross area unit. (min: 0)
- `max_ft_price` (number, nullable) — Maximum average price per gross area unit. (min: 0)
- `facility_groups` (array, nullable) — Estate-level facility groups. (one of: "FM02", "FM12", "FM01", "FM07", "FM10", "FM05", "FM09", "FM13", "FM14")
- `garden_features` (array, nullable) — Special unit features available in the estate. (one of: "MISCF00067")
- `nearby_facilities` (array, nullable) — Required nearby amenities. (one of: "carpark", "mall", "recreation", "mtr", "hospital", "park")

## Response

### 200 — Successful Response

- `@type` (string) (default: "MidlandEstateCard")
- `id` (string, required)
- `name` (string, nullable)
- `url` (string, nullable)
- `is_hos` (boolean, nullable)
- `developer` (string, nullable)
- `first_op_at` (integer, nullable)
- `image` (string, nullable)
- `sell_count` (integer, nullable)
- `rent_count` (integer, nullable)
- `total_unit_count` (integer, nullable)
- `total_block_count` (integer, nullable)
- `primary_school_net` (string, nullable)
- `is_index_component` (boolean, nullable)
- `index_net_ft_price` (number, nullable)
- `index_net_ft_price_change_percent` (number, nullable)
- `parent_estate_id` (string, nullable)
- `parent_estate_name` (string, nullable)
- `market_stat` (object, nullable)
  - `@type` (string) (default: "MidlandMarketStat")
  - `net_ft_price` (number, nullable)
  - `previous_net_ft_price` (number, nullable)
  - `net_ft_price_change_percent` (number, nullable)
  - `ft_price` (number, nullable)
  - `previous_ft_price` (number, nullable)
  - `ft_price_change_percent` (number, nullable)
  - `net_ft_rent` (number, nullable)
  - `transaction_count` (integer, nullable)
  - `transaction_amount` (number, nullable)
- `monthly_prices` (array) (default: [])
  - `@type` (string) (default: "MidlandEstateMonthlyPrice")
  - `date_at` (integer, nullable)
  - `avg_net_ft_price` (number, nullable)
- `yearly_transaction_count` (integer, nullable)
- `yearly_transaction_amount` (number, nullable)
- `yearly_net_ft_price` (number, nullable)
- `yearly_net_ft_price_change_percent` (number, nullable)
- `geo` (object, nullable)
  - `@type` (string) (default: "MidlandGeo")
  - `region` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
  - `subregion` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
  - `district` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
  - `sm_district` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
  - `combined_district` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
  - `int_district` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
  - `int_sm_district` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
  - `lux_district` (object, nullable)
    - `@type` (string) (default: "MidlandRef")
    - `id` (string, nullable)
    - `name` (string, nullable)
- `location` (object, nullable)
  - `@type` (string) (default: "MidlandLocation")
  - `latitude` (number, nullable)
  - `longitude` (number, nullable)
- `amenities` (array) (default: [])
  - `@type` (string) (default: "MidlandAmenity")
  - `type` (string, nullable)
  - `name` (string, nullable)
  - `walking_minutes` (integer, nullable)
- `sale_listings_url` (string, nullable)
- `rent_listings_url` (string, nullable)
- `transaction_history_url` (string, nullable)

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

The entity was not found, or a precondition failed

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

