Malaysia Public Holidays API

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

Generate API Data Status

API Endpoints

Get Available Years

GET /api/years.json

Returns an array of years for which holiday data is available.

Example response:

[2023, 2024, 2025, 2026]

Get Holidays for a Specific Year

GET /api/{year}.json

Returns an array of holidays for the specified year.

Example request: /api/2025.json

Example response:

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

Get API Metadata

GET /api/metadata.json

Returns metadata about the API, including:

Example response:

{
  "last_updated": "2025-06-05T15:44:00.000Z",
  "available_years": [2023, 2024, 2025, 2026],
  "failed_years": [2027],
  "total_years_available": 4,
  "year_range": "2023-2026"
}

Usage Examples

JavaScript (Fetch API)

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

Python (Requests)

import requests

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

Data Source

Holiday data is scraped from Office Holidays.

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 5 years in the future. This is automatically calculated based on the current year.

GitHub Repository

The source code for this API is available on GitHub.