Housing Market API 整合指南
參考表格、端點說明、錯誤代碼和範例皆由 API 規格產生,在所有語言版本中均保留英文。名稱、參數和代碼在各處完全相同。
請求與回應範例
範例會從 HMA_API_KEY 環境變數讀取金鑰。回應中的值僅供說明。
檢查您的金鑰與位址
GET /v1/ping
curl -H "x-api-key: $HMA_API_KEY" \
"https://api.housingmarketapi.com/v1/ping"{
"ok": true,
"revision": "3f9c2a1",
"key": "acme-live",
"address": "203.0.113.7"
}列出物件
GET /v1/properties
curl -H "x-api-key: $HMA_API_KEY" \
"https://api.housingmarketapi.com/v1/properties?country=TH&listing_type=sale&property_type=condominium&limit=100"const base = 'https://api.housingmarketapi.com';
const headers = { 'x-api-key': process.env.HMA_API_KEY };
let cursor;
do {
const url = new URL('/v1/properties', base);
url.searchParams.set('country', 'TH');
url.searchParams.set('listing_type', 'sale');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers });
if (!res.ok) throw new Error(`${res.status} ${(await res.json()).error}`);
const page = await res.json();
for (const property of page.data) console.log(property.id, property.price);
cursor = page.next_cursor ?? undefined;
} while (cursor);import os
import requests
base = "https://api.housingmarketapi.com"
headers = {"x-api-key": os.environ["HMA_API_KEY"]}
params = {"country": "TH", "listing_type": "sale"}
while True:
res = requests.get(f"{base}/v1/properties", headers=headers, params=params)
res.raise_for_status()
page = res.json()
for prop in page["data"]:
print(prop["id"], prop["price"])
if not page["next_cursor"]:
break
params["cursor"] = page["next_cursor"]{
"data": [
{
"id": "kQ3vXr0bT1uYvW2aP8sLgA",
"country": "TH",
"listing_type": "sale",
"property_type": "condominium",
"province": "Example Province",
"province_id": 1,
"city": "Example City",
"city_id": 11,
"area": "Example District",
"area_id": 111,
"address": "Example Road",
"post_code": null,
"latitude": 13.75,
"longitude": 100.5,
"location_precision": "approximate",
"price": 4500000,
"price_max": null,
"currency": "THB",
"bedrooms": 2,
"bathrooms": 2,
"rooms": null,
"living_area": 65,
"living_area_sqm": 65,
"lot_area": null,
"lot_area_sqm": null,
"build_year": 2019,
"published_date": "2026-09-01T00:00:00Z",
"last_updated": "2026-10-02T08:30:00Z",
"features": [],
"appliances": [],
"neighbourhood": [],
"tags": [],
"developer": "Example Developer Co., Ltd.",
"summary": "Bright two-bedroom condominium close to the station.",
"description": "Bright two-bedroom condominium close to the station. Quiet building with a pool and gym.",
"location_text": null,
"images": []
}
],
"next_cursor": "EXAMPLE-OPAQUE-CURSOR",
"has_more": true
}讀取 Insights 端點
GET /v1/insights/prices
{
"data": [
{
"period_start": "2026-09-01",
"period_end": "2026-09-30",
"geography": {
"level": "city",
"id": 11,
"name": "Example City"
},
"suppressed": false,
"currency": "THB",
"median_price": 4200000,
"median_price_per_sqm": 68000,
"listing_count": 310
}
],
"meta": {
"country": "TH",
"level": "city",
"granularity": "month",
"suppression_min_cell": 10
},
"next_cursor": null,
"has_more": false
}錯誤範例
{
"error": "upgrade_required",
"message": "Insights are included in the Advanced tier."
}