# Malaysia Open Data Studio

Malaysia Open Data Studio pulls datasets from the official data.gov.my API and joins them into one flat table per run, for example population_thousands, income_mean_rm and cpi_annual_2010_100 by state and year. It covers income, demography, labour, prices, transport, tourism, education, agriculture and health presets, and costs $0.02 per joined pull, or $0.01 for a raw extract. Output is JSON, CSV or XLSX with CC BY 4.0 attribution.

## Key facts

- Price: from $0.02 per joined pull, $20.00 per 1,000
- Pricing model: Pay per event
- Output: JSON, CSV, Excel, XML, RSS via Apify datasets
- Access: Apify Console, REST API, Python and JS clients
- Version: Updated Nov 2026, build 0.4.9
- Usage: 100.0% successful runs (30 days)
- Actor: subimpact/my-open-data-studio

## Who it is for

- Analysts who need Malaysian state-level statistics in one spreadsheet
- Consultants building market sizing from official government data
- Data journalists charting inflation, income and ridership
- Teams feeding Malaysian public data into a RAG pipeline

## Use cases

### Income against inflation by state

Run the economy-by-state preset and the default output is 32 rows covering 16 states across two years, with population_thousands, income_mean_rm, income_median_rm and cpi_annual_2010_100 side by side. Divide income by the CPI index to get a real income figure per state, or chart the gap between mean and median to show how skewed each state's distribution is.

### Public transport ridership report

The public-transport preset collects LRT, MRT, monorail and KTMB ridership, which is otherwise spread across several source tables. Choose format csv and the joined file lands in the key-value store ready for Excel or Google Sheets. Pair it with the demography-by-state preset when you want ridership normalised by state population rather than read as a raw count.

### Tourism and arrivals tracking

tourism-arrivals delivers monthly tourist arrivals in one table, so a hospitality client can see seasonality without downloading a government portal export. Because the run summary record carries the row count and the year range, you can schedule it monthly and check that a new month actually arrived before you refresh a dashboard built on the previous file.

### A custom join for a study

Set preset to custom, list two to six dataset ids in customDatasets, and set customKey to ["state", "year"] with customJoinType left so no state is dropped for a missing year. customAgg set to mean collapses duplicate rows, and customParams passes extra API filters as JSON. That covers a bespoke indicator set without downloading each source table by hand.

### An AI-ready data pack

With aiReady on, each run also writes a JSON Schema, a data dictionary and sample rows, which is what an LLM needs to write correct queries against the table. The attribution sidecar carries the CC BY 4.0 source metadata, and the verification file records row count, year range and state coverage so you can cite how complete the pull was.

## Price events

- Joined pull (`joined-pull`): $0.02, lowest tier $0.02. One cross-dataset join delivered as flat CSV/JSON/XLSX (studio mode).
- Data extraction (`extract-pull`): $0.01, lowest tier $0.01. One raw dataset pull (1-5 datasets by ID, no join).

Prices from the Apify Store. Apify shows the final price before each run.

## How it compares with other Apify actors

Price per 1,000 pulls at Apify Store list prices, checked 20 Nov 2026.

| Actor | Price per 1,000 pulls (Free plan) | Higher plans (Gold) | Start fee per run | Platform usage | Users | Rating | Last build |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Malaysia Open Data Studio — Gov Data Joins (this API) | $20.00 | $20.00 | None | Included | 2 | No reviews yet | 18 Nov 2026 |
| [Malaysia & Singapore Open Data API (OpenDOSM, BNM, data.gov.sg)](https://apify.com/thriving_adder/sea-open-data) | Bills one record at a time from a selected dataset, rather than one joined dataset pull. | Same unit, see the first price column | $0.00005 | Included | 2 | No reviews yet | 29 Oct 2026 |
| [CKAN Open Data Exporter: Government Datasets & Files](https://apify.com/doggo/ckan-opendata-exporter) | Charges one item per dataset record exported from a CKAN portal, with no join step. | Same unit, see the first price column | $0.01 | Included | 3 | No reviews yet | 3 Jul 2026 |

### Where Malaysia & Singapore Open Data API (OpenDOSM, BNM, data.gov.sg) is stronger

- Covers Malaysian and Singaporean portals plus central bank data in one actor
- Every record carries licence, publisher and attribution text
- Option to drop personal data columns before export

### Where this API is stronger

- Returns a joined state and year table across population, income and consumer prices
- CSV, JSON and XLSX delivery plus webhook callbacks
- Output is shaped for analysis, with an AI ready option

### Where CKAN Open Data Exporter: Government Datasets & Files is stronger

- Works with any CKAN portal, not one national catalogue
- Can export the rows behind a specific resource id
- Dataset search returns organisation and metadata fields

### Where this API is stronger

- Malaysian datasets are joined by state and year out of the box
- One pull returns a tidy table with named columns, ready to chart
- Attribution text is written into the output for reuse under the licence

Open data access on the Store is mostly raw record delivery. thriving_adder/sea-open-data reads the same Malaysian and Singaporean portals but returns one record at a time, and doggo/ckan-opendata-exporter works with any CKAN catalogue. Neither joins datasets, so the join, formatting and delivery work is what this actor adds.

Prices are Apify Store list prices, checked 20 Nov 2026. Platform usage 'Paid separately' means Apify bills compute on top of the event price. Check each listing before you buy.

## Input

- `mode` (string, optional): studio = value layer (presets, joins, AI-ready package). extract = raw data pull of 1-5 datasets by ID (cheaper per-pull event).
- `datasetIds` (array, optional): REQUIRED when mode=extract: list of data.gov.my dataset ids to pull raw (1-5), e.g. population_state, cpi_state, hh_income_state. Leave empty to use studio mode.
- `preset` (string, optional): Which joined dataset to deliver. Legacy codes B1-B11 are still accepted (B1 = economy-by-state, B2 = demography-by-state, B3 = labour-market, B4 = prices-inflation, B5 = health-pandemic, B6 = public-transport, B7 = education-by-state, B8...
- `customDatasets` (array, optional): REQUIRED when preset=custom: list of data.gov.my catalogue ids to join (2-6), e.g. population_state, hh_income_state, cpi_state. Leave empty to use a preset.
- `customKey` (array, optional): For preset=custom: key parts to join on. Use 'year' (extracted from the date field) or raw field names like state, district. All datasets must share these keys.
- `customJoinType` (string, optional): inner keeps only keys present in every dataset; left keeps all keys from the first dataset.
- `customParams` (string, optional): For preset=custom: JSON object of extra API params applied to every dataset, e.g. {"filter": "overall@division"}. Must be valid JSON.
- `customAgg` (string, optional): none = keep raw rows (last value per key). sum = aggregate numeric values per key. mean = average numeric values per key.
- `format` (string, optional): File format delivered to the key-value store (dataset records are always JSON).
- `webhookUrl` (string, optional): POST the result file to this URL after the run (3 retries with backoff). Leave empty to skip.
- `aiReady` (boolean, optional): Also emit JSON Schema + data dictionary + sample rows for LLM/RAG ingestion.
- `includeAttribution` (boolean, optional): Attach source/licence metadata sidecar to every output.

### Example input

```json
{
  "datasetIds": [
    "population_state",
    "cpi_state"
  ],
  "customDatasets": [
    "population_state",
    "hh_income_state"
  ],
  "customKey": [
    "state",
    "year"
  ],
  "customParams": "{\"filter\": \"overall@division\"}"
}
```

## Output fields

- `state` (any): 
- `year` (any): 
- `population_thousands` (any): 
- `income_mean_rm` (any): 
- `income_median_rm` (any): 
- `cpi_annual_2010_100` (any): 

## Sample output

Trimmed from one of our own test runs. Personal data is redacted.

```json
[
  {
    "state": "Johor",
    "year": 2020,
    "population_thousands": 4009.7,
    "income_mean_rm": 7264,
    "income_median_rm": 5690,
    "cpi_annual_2010_100": 123.258333
  },
  {
    "state": "Johor",
    "year": 2022,
    "population_thousands": 4028.3,
    "income_mean_rm": 8517,
    "income_median_rm": 6879,
    "cpi_annual_2010_100": 130.625
  }
]
```

## How to run it

1. Leave mode at studio and choose a preset, for example economy-by-state, which is the default.
2. Set format to csv, json or xlsx depending on where the file is going.
3. Run in the Apify Console; the rows appear in the Dataset tab and the file is written to the key-value store.
4. Check the final summary record for the row count and year range, and read <preset>_verification.json for state coverage.
5. Download <preset>_join.csv for Excel or Sheets, or keep <preset>_ai_ready.json if a model will query the data.

### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/subimpact~my-open-data-studio/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"datasetIds":["population_state","cpi_state"],"customDatasets":["population_state","hh_income_state"],"customKey":["state","year"],"customParams":"{\"filter\": \"overall@division\"}"}'
```

### Python

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("subimpact/my-open-data-studio").call(run_input={
      "datasetIds": [
        "population_state",
        "cpi_state"
      ],
      "customDatasets": [
        "population_state",
        "hh_income_state"
      ],
      "customKey": [
        "state",
        "year"
      ],
      "customParams": "{\"filter\": \"overall@division\"}"
    })

for item in client.dataset(run["default_dataset_id"]).iterate_items():
    print(item)
```

### JavaScript

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

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('subimpact/my-open-data-studio').call({
  "datasetIds": [
    "population_state",
    "cpi_state"
  ],
  "customDatasets": [
    "population_state",
    "hh_income_state"
  ],
  "customKey": [
    "state",
    "year"
  ],
  "customParams": "{\"filter\": \"overall@division\"}"
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();

console.log(items);
```

### n8n

Use the Apify node (Run an Actor).
Actor ID: subimpact/my-open-data-studio
Input JSON: paste the example input below.

## Limits

- The economy-by-state preset returns 16 states across two years, because that is the coverage the source publishes.
- A custom join needs the data.gov.my dataset ids in advance; there is no catalogue search inside the Actor.
- Row coverage depends on what each government dataset publishes for a given year, so a left join can include empty indicator cells.
- Published output must keep the CC BY 4.0 attribution sidecar.

## FAQ

### What does a joined pull cost?

$0.02 per joined pull, which is one cross-dataset join delivered as a flat CSV, JSON or XLSX file, and $0.01 for a raw extract pull of one to five datasets by ID. The underlying data comes from Malaysia's free official API, so you pay for the join and packaging, not for the data.

### Do I need an API key for data.gov.my?

No. data.gov.my is a public API and the Actor calls it directly, with no key, no account and no scraping of the website. You only need an Apify account to run the Actor.

### Which presets are available?

economy-by-state, demography-by-state, labour-market, prices-inflation, health-pandemic, public-transport, education-by-state, tourism-arrivals, agriculture-commodities, public-safety, healthcare-capacity and custom. Legacy codes B1 to B11 still work as aliases, so an older saved input keeps running.

### Can I join datasets the presets do not cover?

Yes. Use preset custom with two to six data.gov.my dataset ids in customDatasets, choose key columns in customKey, and pick inner or left for customJoinType. customAgg can sum or average duplicates, and customParams passes extra API parameters as a JSON object. Extract mode pulls one to five datasets raw when you only need the source table.

### Which output formats are supported?

json, csv and xlsx, selected with format. The same rows are available in the Dataset tab for a one click export, and the file is written to the key-value store in the format you chose so a schedule or a webhook can pick it up.

### What licence applies to the data?

Malaysia's open data is published under CC BY 4.0, and every run writes an attribution sidecar with the source metadata. Keep that sidecar, or the attribution block, with any table you publish or share.

### Can I get the result delivered automatically?

Yes. Set webhookUrl and the result file is POSTed there after the run, which suits a scheduled monthly refresh into a warehouse or a Drive folder. The run also writes a verification file with the row count, year range and state coverage, so a downstream job can reject an empty pull.

## Links

- Page: https://subimpact.net/apis/my-open-data-studio/
- Category: https://subimpact.net/apis/category/open-data/
- Run on Apify: https://apify.com/subimpact/my-open-data-studio
- All data APIs: https://subimpact.net/apis/
- Catalogue JSON: https://subimpact.net/apis/catalogue.json
