BYTETOOLS

data.gov.my API

Free Malaysian government data API with no key: weekly fuel prices, CPI, trade and dozens of national indicators as flat JSON arrays. Tested curl example and live response.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the data.gov.my API?

data.gov.my is Malaysia's national data portal, offering a free, key-free REST API. Instead of a dataset catalogue it serves the data itself — fuel prices, consumer price indices, trade figures and other national series — as flat JSON arrays selected by a short dataset `id`.

Malaysia rebuilt its portal around a data-first API rather than a metadata catalogue, and the difference is refreshing. There is no `package_search` step and no resource URL to chase: `?id=fuelprice` returns the actual weekly RON95, RON97 and diesel prices as an array of flat objects, ready to chart. Nulls appear where a series had not started yet — the subsidised `ron95_budi95` and `diesel_skds` columns are null in early rows because those schemes did not exist then, which is honest and worth preserving rather than zero-filling.

A companion endpoint, `/opendosm`, carries the Department of Statistics Malaysia catalogue on the same host and interface — `?id=cpi_headline` returns the headline consumer price index back to 1980. Both accept `limit` and `sort`, and both return `series_type` on each row to distinguish levels from growth rates, which matters enormously if you plot them together. The base path redirects to a trailing-slash form, so use `/data-catalogue/` directly and skip the round trip.

Quick facts

Base URL
https://api.data.gov.my
Authentication
No API key for the public data catalogue. Some newer real-time endpoints on the same host require a token; the catalogue endpoints do not.
Rate limit
No published limit. Series are small, so cache the whole response rather than paging.
Pricing
Free. Data is published under the Malaysian government's open data terms.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the data.gov.my API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Fetch Malaysian retail fuel prices

GET https://api.data.gov.my/data-catalogue/?id=fuelprice&limit=1

curl
curl 'https://api.data.gov.my/data-catalogue/?id=fuelprice&limit=1'
JavaScript (fetch)
const res = await fetch("https://api.data.gov.my/data-catalogue/?id=fuelprice&limit=1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://api.data.gov.my/data-catalogue/?id=fuelprice&limit=1", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
[
  {
    "date": "2017-03-30",
    "ron95": 2.13,
    "ron97": 2.41,
    "diesel": 2.11,
    "ron95_skps": null,
    "diesel_budi": null,
    "diesel_skds": null,
    "series_type": "level",
    "ron95_budi95": null,
    "diesel_eastmsia": 2.11
  }
]

Parameters

ParameterTypeRequiredDescription
idqueryRequiredDataset identifier, such as `fuelprice`. This is the only required parameter. fuelprice
limitqueryOptionalRows to return. 1
sortqueryOptionalSort by column; prefix with `-` for descending order. -date
filterqueryOptionalColumn filter in `value@column` form. level@series_type
rangequeryOptionalRestrict a numeric or date column to a range. 2024-01-01:2024-12-31

Response fields

(root)array
A flat JSON array of row objects. There is no envelope, no `data` wrapper and no pagination metadata.
datestring
ISO date for the observation, weekly for fuel prices.
ron95 / ron97 / dieselfloat
Retail prices in Malaysian ringgit per litre.
ron95_budi95 / diesel_budi / diesel_skds / ron95_skpsfloat or null
Subsidy-scheme prices. Null before the scheme existed — do not coerce to zero.
diesel_eastmsiafloat
Separate East Malaysia diesel price; Sabah and Sarawak are priced differently from the peninsula.
series_typestring
`level` or a growth variant. Never plot the two together without checking this.

What you can build with the data.gov.my API

  • Chart Malaysian fuel prices over time without scraping
  • Track headline CPI through the companion OpenDOSM endpoint
  • Build a cost-of-living dashboard for Malaysia
  • Compare peninsular and East Malaysian diesel pricing
  • Feed Malaysian macro indicators into an economic model

Common errors and how to fix them

Empty array

The `id` does not exist or is misspelled.

Fix: Dataset IDs are lowercase with underscores. Browse the catalogue on developer.data.gov.my to confirm the exact identifier.

301 redirect

The path was requested without its trailing slash.

Fix: Call `/data-catalogue/` directly so the client does not have to follow a redirect on every request.

Nulls break a chart

Subsidy columns are null before their scheme launched.

Fix: Treat null as missing and start the series where data begins; zero-filling invents prices that never existed.

Series look wildly inconsistent

Level and growth rows were mixed.

Fix: Filter on `series_type` before plotting — `filter=level@series_type` keeps only absolute values.

data.gov.my API — frequently asked questions

Does data.gov.my need an API key?

No. The data catalogue endpoints are open and unauthenticated. Some newer real-time services hosted alongside them require a token, but nothing covered here does.

How is this different from a CKAN portal?

There is no metadata search step. You pass a dataset `id` and get the rows straight back as a flat array, so a chart is one request away rather than three.

What is OpenDOSM?

The Department of Statistics Malaysia catalogue, served from the same host at `/opendosm` with the same parameters. It carries the official statistical series — CPI, GDP, labour force — while `/data-catalogue` carries wider government data.

Why are some price columns null?

Because those subsidy schemes did not exist for the whole series. Nulls mark genuine absence, so preserve them rather than converting to zero, which would misrepresent early years as free fuel.

Tools that pair with this API

data.gov.my is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.