# /midland/transactions/search

`POST /api/midland/transactions/search`

Price: 20 credits

Search Midland Realty's Hong Kong property deal archive — Land Registry records plus Midland's own transactions, covering the full history rather than a recent window. Filters cover sale or rental deals, free text, recency window, primary or secondary market, resale at a profit or a loss, unit features, record source, ownership class, the luxury segment, the eight-level geography, estate, phase, building, street and unit ids, MTR station with walking time, primary school net, universities, price, saleable area, price per area unit, building age, holding period, bedrooms, floor band and ordering. Each deal carries the transacted price and price per saleable area, areas, the previous deal price and date with the gain and holding period, room counts, floor and flat, the estate / phase / building, unit features, floor plans, coordinates and the deal record source.

## How to use it

Search Hong Kong property transactions recorded by Midland Realty. Always set count, plus lang / unit / currency for the output locale. transaction_type 'S' returns sale deals and 'L' rental deals; price holds the transacted amount in both cases. gain_percent and holding_period_years compare against the previous deal on the same unit. Leave transaction_date unset to reach the whole archive, or narrow it to a recent window. Slice by estate_ids, building_ids, int_sm_district_ids or unit_ids when you need deep history — a single query reaches at most 10000 records, so split large areas by district, estate or date window. Use midland/transactions with a deal id for the unit's full price history.

## 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)
- `transaction_type` (string, nullable) — Sale or rental deals. Unset returns both. (one of: "S", "L")
- `text` (string, nullable) — Free-text query matched against estate, building, street and district names. (minLength: 1)
- `transaction_date` (string, nullable) — Recency window. Unset searches the whole Land Registry archive back to the 1990s. (one of: "7days", "30days", "90days", "180days", "1year", "3year")
- `market_types` (array, nullable) — Primary (first-hand) or secondary market deals. (one of: "1", "2")
- `gains` (array, nullable) — Only deals resold at a profit or at a loss versus the prior deal. (one of: "profit", "loss")
- `features` (array, nullable) — Unit features recorded for the deal. (one of: "balcony", "utility_platform", "flat_roof", "carpark", "roof", "garden", "duplex", "triplex", "combined")
- `source` (string, nullable) — Record origin: Land Registry, Midland's own records or Hong Kong Property's. (one of: "landreg", "midland", "hkp")
- `property_types` (array, nullable) — Ownership class: private housing, HOS or TPS. (one of: "private", "hos", "tps")
- `is_deluxe` (boolean, nullable) — Only luxury-segment deals.
- `sort` (string) — Result ordering. (default: "default"; one of: "default", "price", "price_desc", "net_area", "net_area_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.
- `estate_ids` (array, nullable) — Estate ids (e.g. E000004419).
- `phase_ids` (array, nullable) — Estate phase ids.
- `building_ids` (array, nullable) — Building ids (e.g. B000055190).
- `street_ids` (array, nullable) — Street ids.
- `house_street_ids` (array, nullable) — Village-house street ids.
- `unit_ids` (array, nullable) — Unit ids, to pull the deal history of one flat.
- `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_price` (number, nullable) — Minimum transacted price or rent. (min: 0)
- `max_price` (number, nullable) — Maximum transacted price or rent. (min: 0)
- `min_net_area` (number, nullable) — Minimum saleable area. (min: 0)
- `max_net_area` (number, nullable) — Maximum saleable area. (min: 0)
- `min_net_ft_price` (number, nullable) — Minimum price per saleable area unit. (min: 0)
- `max_net_ft_price` (number, nullable) — Maximum price per saleable area unit. (min: 0)
- `min_holding_period` (number, nullable) — Minimum holding period in years before the resale. (min: 0)
- `max_holding_period` (number, nullable) — Maximum holding period in years before the resale. (min: 0)
- `bedrooms` (array, nullable) — Bedroom counts (0 = studio). (one of: "0", "1", "2", "3", "4+")
- `floor_levels` (array, nullable) — Floor bands: high, middle, low. (one of: "H", "M", "L")

## Response

### 200 — Successful Response

- `@type` (string) (default: "MidlandTransactionCard")
- `id` (string, required)
- `url` (string, nullable)
- `transaction_type` (string, nullable)
- `transaction_at` (integer, nullable)
- `market_type` (string, nullable)
- `source` (string, nullable)
- `original_source` (string, nullable)
- `tags` (array) (default: [])
- `price` (number, nullable)
- `price_per_net_area` (number, nullable)
- `area` (number, nullable)
- `net_area` (number, nullable)
- `previous_price` (number, nullable)
- `previous_transaction_at` (integer, nullable)
- `gain_percent` (number, nullable)
- `holding_period_years` (number, nullable)
- `bedroom_count` (integer, nullable)
- `sitting_room_count` (integer, nullable)
- `floor` (string, nullable)
- `floor_level` (object, nullable)
  - `@type` (string) (default: "MidlandRef")
  - `id` (string, nullable)
  - `name` (string, nullable)
- `flat` (string, nullable)
- `is_premium_paid` (boolean, nullable)
- `deal_type` (string, 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)
- `estate` (object, nullable)
  - `@type` (string) (default: "MidlandRef")
  - `id` (string, nullable)
  - `name` (string, nullable)
- `phase` (object, nullable)
  - `@type` (string) (default: "MidlandRef")
  - `id` (string, nullable)
  - `name` (string, nullable)
- `building` (object, nullable)
  - `@type` (string) (default: "MidlandBuilding")
  - `id` (string, nullable)
  - `name` (string, nullable)
  - `address` (string, nullable)
  - `first_op_at` (integer, nullable)
  - `floor_count` (integer, nullable)
  - `building_type` (string, nullable)
  - `latitude` (number, nullable)
  - `longitude` (number, nullable)
  - `streetview_latitude` (number, nullable)
  - `streetview_longitude` (number, nullable)
  - `streetview_angle` (integer, nullable)
- `features` (array) (default: [])
  - `@type` (string) (default: "MidlandRef")
  - `id` (string, nullable)
  - `name` (string, nullable)
- `floor_plans` (array) (default: [])
  - `@type` (string) (default: "MidlandFloorPlan")
  - `id` (string, nullable)
  - `name` (string, nullable)
  - `url` (string, nullable)
  - `source` (string, nullable)
  - `phase_id` (string, nullable)
  - `phase_name` (string, nullable)
  - `building_id` (string, nullable)
  - `building_name` (string, nullable)
  - `floor_from` (string, nullable)
  - `floor_to` (string, nullable)
  - `floor_text` (string, nullable)
- `image` (string, nullable)
- `location` (object, nullable)
  - `@type` (string) (default: "MidlandLocation")
  - `latitude` (number, nullable)
  - `longitude` (number, nullable)
- `listings_url` (string, nullable)
- `updated_at` (integer, 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.

