# Malaysia Statistics API
> Official Malaysian economic statistics straight from the Department of Statistics Malaysia (DOSM) via its OpenDOSM open-data API — no key, read live. The cpi endpoint returns the headline Consumer Price Index (overall, all items, base 2010=100) for the latest month with the index level plus the month-on-month and year-on-year inflation rates, computed from the official series. The cpi/series endpoint returns the historical monthly CPI index and year-on-year rate over the last N months, ready to chart. The cpi/divisions endpoint breaks the latest CPI down across all thirteen COICOP divisions (food, housing, transport and so on) with the index for each. The dataset endpoint is a thin live gateway to any OpenDOSM data-catalogue id, returning its most recent rows, so you can reach DOSM's wider catalogue (labour, trade, population and more) beyond inflation. The meta endpoint documents the source. Live data from OpenDOSM, lightly cached. Live. 5 endpoints. This serves Malaysian national statistics; for the ringgit exchange rate or Bursa Malaysia equities use an FX / stock-exchange API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/malaysia-stats-api/..."
```

## Pricing
- **Free** (Free) — 290 calls/Mo, 2 req/s
- **Basic** ($11/Mo) — 18,800 calls/Mo, 6 req/s
- **Pro** ($28/Mo) — 96,500 calls/Mo, 22 req/s
- **Mega** ($64/Mo) — 438,000 calls/Mo, 55 req/s

## Endpoints

### Inflation

#### `GET /v1/cpi` — Malaysia CPI (latest month): index, MoM and YoY

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/malaysia-stats-api/v1/cpi"
```

**Response:**
```json
{
    "data": {
        "base": "2010 = 100",
        "index": 136.9,
        "period": "2026-04-01",
        "source": "Department of Statistics Malaysia (OpenDOSM, cpi_headline)",
        "country": "Malaysia",
        "indicator": "Consumer Price Index (overall, all items)",
        "change_mom_pct": 0.37,
        "change_yoy_pct": 1.94
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:36.275Z",
        "request_id": "058b7430-1ea1-4624-9d0a-3045a7aa4f68"
    },
    "status": "ok",
    "message": "Malaysia CPI retrieved",
    "success": true
}
```

#### `GET /v1/cpi/divisions` — Latest CPI across all 13 COICOP divisions

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/malaysia-stats-api/v1/cpi/divisions"
```

**Response:**
```json
{
    "data": {
        "base": "2010 = 100",
        "count": 13,
        "period": "2026-04-01",
        "source": "OpenDOSM cpi_headline",
        "country": "Malaysia",
        "divisions": [
            {
                "index": 159.6,
                "label": "Food & non-alcoholic beverages",
                "division": "01"
            },
            {
                "index": 178.1,
                "label": "Alcoholic beverages & tobacco",
                "division": "02"
            },
            {
                "index": 93,
                "label": "Clothing & footwear",
                "division": "03"
            },
            {
                "index": 132.5,
                "label": "Housing, water, electricity, gas & fuels",
                "division": "04"
            },
            {
                "index": 127.1,
                "label": "Furnishings & household equipment",
                "division": "05"
            },
            {
                "index": 133.5,
                "label": "Health",
                "division": "06"
            },
            {
                "index": 127.3,
                "label": "Transport",
                "division": "07"
            },
            {
                "index": 91.3,
                "label": "Communication",
                "division": "08"
            },
            {
                "index": 121.6,
                "label": "Recreation services & culture",
                "division": "09"
        
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/cpi/series` — Historical CPI index + YoY series

**Parameters:**
- `months` (query, optional, string) — Number of recent months (default 24, max 240) Example: `24`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/malaysia-stats-api/v1/cpi/series?months=24"
```

**Response:**
```json
{
    "data": {
        "base": "2010 = 100",
        "count": 24,
        "series": [
            {
                "index": 132.8,
                "period": "2024-05-01",
                "change_yoy_pct": 2
            },
            {
                "index": 133,
                "period": "2024-06-01",
                "change_yoy_pct": 1.99
            },
            {
                "index": 133.1,
                "period": "2024-07-01",
                "change_yoy_pct": 1.99
            },
            {
                "index": 133.2,
                "period": "2024-08-01",
                "change_yoy_pct": 1.91
            },
            {
                "index": 133.2,
                "period": "2024-09-01",
                "change_yoy_pct": 1.83
            },
            {
                "index": 133.4,
                "period": "2024-10-01",
                "change_yoy_pct": 1.91
            },
            {
                "index": 133.3,
                "period": "2024-11-01",
                "change_yoy_pct": 1.83
            },
            {
                "index": 133.4,
                "period": "2024-12-01",
                "change_yoy_pct": 1.68
            },
            {
                "index": 133.6,
                "period": "2025-01-01",
                "change_yoy_pct": 1.67
            },
            {
                "index": 134.1,
                "period": "2025-02-01",
                "change_yoy_pct": 1.51
            },
            {
    
…(truncated, see openapi.json for full schema)
```

### Catalogue

#### `GET /v1/dataset` — Fetch any OpenDOSM data-catalogue id

**Parameters:**
- `id` (query, optional, string) — OpenDOSM catalogue id (default cpi_headline) Example: `cpi_headline`
- `limit` (query, optional, string) — Rows to return (default 50, max 1000) Example: `50`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/malaysia-stats-api/v1/dataset?id=cpi_headline&limit=50"
```

**Response:**
```json
{
    "data": {
        "rows": [
            {
                "date": "2026-04-01",
                "index": 132.5,
                "division": "04"
            },
            {
                "date": "2026-04-01",
                "index": 121.6,
                "division": "09"
            },
            {
                "date": "2026-04-01",
                "index": 178.1,
                "division": "02"
            },
            {
                "date": "2026-04-01",
                "index": 159.6,
                "division": "01"
            },
            {
                "date": "2026-04-01",
                "index": 136.6,
                "division": "13"
            },
            {
                "date": "2026-04-01",
                "index": 127.3,
                "division": "07"
            },
            {
                "date": "2026-04-01",
                "index": 127.1,
                "division": "05"
            },
            {
                "date": "2026-04-01",
                "index": 159.6,
                "division": "11"
            },
            {
                "date": "2026-04-01",
                "index": 91.3,
                "division": "08"
            },
            {
                "date": "2026-04-01",
                "index": 117.3,
                "division": "12"
            },
            {
                "date": "2026-04-01",
                "index": 93,
                "division": "03"
            },
            {
    
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — API metadata

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/malaysia-stats-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "api": "Statistics Malaysia (OpenDOSM) API",
        "notes": "Live data from OpenDOSM; year-on-year and month-on-month computed from the index series. The dataset endpoint fetches any OpenDOSM data-catalogue id.",
        "source": "Department of Statistics Malaysia — OpenDOSM open-data API (api.data.gov.my)",
        "country": "Malaysia",
        "endpoints": [
            "/v1/cpi",
            "/v1/cpi/series",
            "/v1/cpi/divisions",
            "/v1/dataset",
            "/v1/meta"
        ],
        "documentation": "https://malaysia-stats-api.oanor.dev",
        "primary_indicator": "CPI headline (cpi_headline, monthly, base 2010=100, overall + 13 COICOP divisions)"
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:36.593Z",
        "request_id": "12464c42-7c5d-4dd6-a929-3590d9b847e6"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/malaysia-stats-api
OpenAPI spec: https://www.oanor.com/api/malaysia-stats-api/openapi.json
