# Singapore HDB Resale Flat Prices (Official data.gov.sg) (`leathered_luna/sg-hdb-resale-prices`) Actor

Sold prices for Singapore HDB resale flats from the official data.gov.sg dataset (Jan 2017 onwards), with median, mean, $/sqft and year-on-year stats. No API key.

- **URL**: https://apify.com/leathered_luna/sg-hdb-resale-prices.md
- **Developed by:** [SiennaWorks](https://apify.com/leathered_luna) (community)
- **Categories:** Real estate
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 sale records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Singapore HDB Resale Flat Prices (Official data.gov.sg)

Sold prices for **Singapore HDB resale flats**, from the official **data.gov.sg** collection (1990 to the latest month actually present in HDB's published files), plus median / mean / $ per sqft statistics and year-on-year change. No API key needed.

Built for property researchers, valuers, buyers, agents and AI agents that need official Singapore resale evidence rather than a listing site scrape.

### How this is different

- **Straight from the official files.** It downloads the CSVs in HDB's [Resale Flat Prices collection](https://data.gov.sg/collections/189/view) on data.gov.sg. No HTML scraping and no unofficial site. Each run records `source_latest_month` so you can see how current the published files are.
- **Area summary in the same run.** Median, mean, min and max in Singapore dollars, price per square foot, breakdowns by flat type and year, and year-on-year median change.
- **Newest first, with a hard cap.** Default 2,000 records, maximum 10,000. If the cap is hit, the summary sets `truncated: true`.
- **Filter by town, flat type and month range.** Towns use the official HDB names (TAMPINES, PUNGGOL, WOODLANDS, and so on).
- **History back to 1990** when you set `monthFrom` early enough. Files from March 2012 onwards are registration-date transactions; earlier files are approval-date transactions, as HDB publishes them.

### What you get

Sale records: `month`, `town`, `flat_type`, `block`, `street_name`, `storey_range`, `floor_area_sqm`, `flat_model`, `lease_commence_year`, `remaining_lease`, `resale_price_sgd`, `price_per_sqft_sgd`, `source`, `retrieved_at`.

Area summary: `transaction_count`, `truncated`, `price_sgd`, `price_per_sqft_sgd`, `by_flat_type`, `by_year`, `year_on_year_median_change_pct`, `source_earliest_month`, `source_latest_month`.

Price per square foot is calculated from `floor_area_sqm` using 1 sqm = 10.76391041671 sqft.

An example is in [`examples/example_output.json`](examples/example_output.json).

### Input

```json
{
    "towns": ["TAMPINES"],
    "flatTypes": ["4 ROOM"],
    "monthFrom": "2026-01",
    "monthTo": "",
    "includeSales": true,
    "includeSummary": true,
    "maxResults": 50
}
```

| Field | Meaning |
|---|---|
| `towns` | Optional official HDB towns. Leave empty for all (use a month range or cap). |
| `flatTypes` | Optional: `1 ROOM`, `2 ROOM`, `3 ROOM`, `4 ROOM`, `5 ROOM`, `EXECUTIVE`, `MULTI-GENERATION`. |
| `monthFrom` / `monthTo` | Inclusive `YYYY-MM`. Official files currently start at `1990-01`. Leave `monthFrom` empty to read only the newest official file. |
| `includeSales` / `includeSummary` | At least one must be on. |
| `maxResults` | 1–10,000, default 2,000. |

### Pricing (pay-per-event)

- **$0.0015 per sale record** ($1.50 per 1,000).
- **$0.01 per area summary** in the run.

Platform usage is included. Set a **maximum cost per run** in Apify Console for a hard cap. The Actor stops cleanly when the limit is reached.

### Notes

- Figures are **resale transactions published by HDB**, not asking prices and not private-condominium sales. From March 2012 the month is the registration month; before that it is the approval month. A published month can lag the contract date.
- This Actor returns only months that are **actually present** in the official files at run time. If HDB's "2017 onwards" file has not yet been extended, `source_latest_month` on the summary will show the last month in that file — it is not a promise of the current calendar month.
- Addresses in the dataset are at block and street level; unit numbers are not published.
- Price per sqft is computed by this Actor from the official floor area; HDB does not publish $/sqft as its own field.
- Data is reused under the [Singapore Open Data Licence](https://data.gov.sg/open-data-licence). Not affiliated with or endorsed by HDB or the Government of Singapore.

### Local development

```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pytest -q
```

### Changelog

- **0.1** — First version: official collection CSVs (1990 to the latest published month), town and type filters, month range, sale records, area summary, pay-per-event.

# Actor input Schema

## `towns` (type: `array`):

Optional. Official HDB towns, e.g. TAMPINES, PUNGGOL, WOODLANDS, JURONG WEST, SENGKANG, BISHAN. Leave empty for all towns (use a month range or maxResults cap).

## `flatTypes` (type: `array`):

Optional. One or more of: 1 ROOM, 2 ROOM, 3 ROOM, 4 ROOM, 5 ROOM, EXECUTIVE, MULTI-GENERATION.

## `monthFrom` (type: `string`):

Optional inclusive start month (YYYY-MM). Official files start at 1990-01. Leave empty to read only the newest official file.

## `monthTo` (type: `string`):

Optional inclusive end month. Leave empty for the latest published month.

## `includeSales` (type: `boolean`):

Turn off if you only want the area summary.

## `includeSummary` (type: `boolean`):

Median, mean, min, max, price per sqft, breakdowns by flat type and year, and year-on-year median change. Based on the sale records returned in this run.

## `maxResults` (type: `integer`):

Hard cap (1–10,000, default 2,000). Newest months are returned first. If the cap is hit, `truncated` is true on the summary.

## Actor input object example

```json
{
  "towns": [
    "TAMPINES",
    "PUNGGOL"
  ],
  "monthFrom": "2021-01",
  "includeSales": true,
  "includeSummary": true,
  "maxResults": 2000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "towns": [
        "TAMPINES",
        "PUNGGOL"
    ],
    "monthFrom": "2021-01"
};

// Run the Actor and wait for it to finish
const run = await client.actor("leathered_luna/sg-hdb-resale-prices").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "towns": [
        "TAMPINES",
        "PUNGGOL",
    ],
    "monthFrom": "2021-01",
}

# Run the Actor and wait for it to finish
run = client.actor("leathered_luna/sg-hdb-resale-prices").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "towns": [
    "TAMPINES",
    "PUNGGOL"
  ],
  "monthFrom": "2021-01"
}' |
apify call leathered_luna/sg-hdb-resale-prices --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,leathered_luna/sg-hdb-resale-prices"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tb2oQaAI0gKg9vSPx/builds/wAkIcTOzRY8kphkUd/openapi.json
