Malaysia Public Holidays API

A simple, free API providing public holiday data for Malaysia states in JSON format. Updated automatically via GitHub Actions.

Generate API Data Status

Changelog

10/02/2026

API Endpoints

Get Available States

GET /api/states.json

Returns an array of supported states with their endpoint codes.

Example response:

[
  { "code": "sabah", "name": "Sabah" },
  { "code": "sarawak", "name": "Sarawak" }
]

Get Available Years (Sabah Compatibility)

GET /api/years.json

Returns available years for Sabah to preserve backward compatibility.

Example response:

[2023, 2024, 2025, 2026]

Get Holidays by State and Year

GET /api/{state}/{year}.json

Returns an array of holidays for the specified state and year.

Example request: /api/sabah/2025.json

Example response:

[
  {
    "date": "Jan 01",
    "holiday_name": "New Year's Day"
  },
  {
    "date": "Jan 29",
    "holiday_name": "Chinese New Year"
  },
  ...
]

Backward-compatible Sabah endpoint: /api/{year}.json

Get API Metadata

GET /api/metadata.json

Returns metadata about the API, including:

Example response:

{
  "last_updated": "2025-06-05T15:44:00.000Z",
  "state_count": 16,
  "default_state": "sabah",
  "states": [{ "code": "sabah", "name": "Sabah" }],
  "states_metadata": {
    "sabah": {
      "available_years": [2023, 2024, 2025, 2026],
      "failed_years": [],
      "total_years_available": 4,
      "year_range": "2023-2026"
    }
  }
}

Usage Examples

JavaScript (Fetch API)

// Get Sabah holidays for 2025
fetch('https://sabah-holiday.dydxsoft.my/api/sabah/2025.json')
  .then(response => response.json())
  .then(data => {
    console.log(data);
  })
  .catch(error => console.error('Error:', error));

Python (Requests)

import requests

# Get Sarawak holidays for 2025
response = requests.get('https://sabah-holiday.dydxsoft.my/api/sarawak/2025.json')
holidays = response.json()
print(holidays)

Data Source

Holiday data is scraped from Office Holidays, covering multiple Malaysia states.

Automation

The API data is automatically updated on the 1st of each year (Jan 01) via GitHub Actions. The script includes retry logic with exponential backoff to handle temporary failures when scraping data.

Customization

By default, the API generates data for a range of years from 2 years in the past to 2 years in the future, for every supported state.

GitHub Repository

The source code for this API is available on GitHub.