Skip to content

headwindz/public-holidays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Public holidays API

A comprehensive public holidays API providing holiday data for 60 countries and regions across multiple years (2020-2026). Built with Next.js and TypeScript.

๐ŸŒ Doc: https://public-holidays.toolhub.run/

Features

  • ๐ŸŒ 60 countries & regions - Comprehensive coverage of public holidays worldwide
  • ๐Ÿ“… Multiple years - Data available for 2020, 2021, 2022, 2023, 2024, 2025, and 2026
  • ๐Ÿš€ Fast API - Built on Next.js API routes for optimal performance
  • ๐ŸŽจ Interactive documentation - Built-in API tester and documentation
  • ๐Ÿ“ฑ Responsive design - Works seamlessly on all devices

Supported countries

The API covers 60 countries and regions including:

  • ๐Ÿ‡จ๐Ÿ‡ณ China (cn)
  • ๐Ÿ‡บ๐Ÿ‡ธ United States (us)
  • ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom (uk)
  • ๐Ÿ‡จ๐Ÿ‡ฆ Canada (ca)
  • ๐Ÿ‡ฆ๐Ÿ‡บ Australia (au)
  • ๐Ÿ‡ฉ๐Ÿ‡ช Germany (de)
  • ๐Ÿ‡ซ๐Ÿ‡ท France (fr)
  • ๐Ÿ‡ฏ๐Ÿ‡ต Japan (jp)
  • ๐Ÿ‡ฎ๐Ÿ‡ณ India (in)
  • ๐Ÿ‡ง๐Ÿ‡ท Brazil (br)
  • ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico (mx)
  • And 48 more...

See the data directory for the complete list of country codes.

API usage

Endpoint

GET https://public-holidays.toolhub.run/api/public-holidays?year={year}&code={code}

Parameters

  • year (required) - The year for which to retrieve holidays (e.g., 2020, 2021, 2022, 2023, 2024, 2025, 2026)
  • code (required) - The ISO 3166-1 alpha-2 country/region code (e.g., cn, us, uk, ca)

Example request

curl "https://public-holidays.toolhub.run/api/public-holidays?year=2025&code=cn"

Example response

{
  "data": [
    {
      "localName": "ๅ…ƒๆ—ฆ",
      "name": "New Year's Day",
      "code": "CN",
      "fixed": true,
      "global": true,
      "counties": null,
      "launchYear": null,
      "types": ["Public"],
      "startDate": "2025-01-01T00:00:00.000Z",
      "endDate": "2025-01-01T23:59:59.999Z"
    },
    {
      "localName": "ๆ˜ฅ่Š‚",
      "name": "Spring Festival (Chinese New Year)",
      "code": "CN",
      "fixed": false,
      "global": true,
      "counties": null,
      "launchYear": null,
      "types": ["Public"],
      "startDate": "2025-01-28T00:00:00.000Z",
      "endDate": "2025-02-04T23:59:59.999Z"
    },
    {
      "localName": "ๆธ…ๆ˜Ž่Š‚",
      "name": "Tomb Sweeping Day (Qingming Festival)",
      "code": "CN",
      "fixed": false,
      "global": true,
      "counties": null,
      "launchYear": null,
      "types": ["Public"],
      "startDate": "2025-04-04T00:00:00.000Z",
      "endDate": "2025-04-06T23:59:59.999Z"
    },
    {
      "localName": "ๅŠณๅŠจ่Š‚",
      "name": "Labor Day",
      "code": "CN",
      "fixed": true,
      "global": true,
      "counties": null,
      "launchYear": null,
      "types": ["Public"],
      "startDate": "2025-05-01T00:00:00.000Z",
      "endDate": "2025-05-05T23:59:59.999Z"
    },
    {
      "localName": "็ซฏๅˆ่Š‚",
      "name": "Dragon Boat Festival",
      "code": "CN",
      "fixed": false,
      "global": true,
      "counties": null,
      "launchYear": null,
      "types": ["Public"],
      "startDate": "2025-05-31T00:00:00.000Z",
      "endDate": "2025-06-02T23:59:59.999Z"
    },
    {
      "localName": "ๅ›ฝๅบ†่Š‚ / ไธญ็ง‹่Š‚",
      "name": "National Day & Mid-Autumn Festival",
      "code": "CN",
      "fixed": true,
      "global": true,
      "counties": null,
      "launchYear": 1949,
      "types": ["Public"],
      "startDate": "2025-10-01T00:00:00.000Z",
      "endDate": "2025-10-08T23:59:59.999Z"
    }
  ]
}

Error responses

400 bad request - Missing required parameters

{
  "error": "Both year and code parameters are required"
}

404 not found - Data not available for specified year/country

{
  "error": "Data not found for the specified year and country/region code"
}

Getting started

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm

Installation

  1. Clone the repository:
git clone https://github.com/headwindz/public-holidays
cd public-holidays
  1. Install dependencies:
pnpm install
  1. Run the development server:
pnpm dev
  1. Open http://localhost:3000 to view the application

Build for production

pnpm build
pnpm start

Project structure

public-holidays/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ””โ”€โ”€ public-holidays/
โ”‚   โ”‚       โ””โ”€โ”€ route.ts           # API endpoint
โ”‚   โ”œโ”€โ”€ globals.css                # Global styles
โ”‚   โ”œโ”€โ”€ layout.tsx                 # Root layout
โ”‚   โ””โ”€โ”€ page.tsx                   # Landing page
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ 2020/                      # 2020 holiday data
โ”‚   โ”œโ”€โ”€ 2021/                      # 2021 holiday data
โ”‚   โ”œโ”€โ”€ 2022/                      # 2022 holiday data
โ”‚   โ”œโ”€โ”€ 2023/                      # 2023 holiday data
โ”‚   โ”œโ”€โ”€ 2024/                      # 2024 holiday data
โ”‚   โ””โ”€โ”€ 2025/                      # 2025 holiday data
โ”‚       โ”œโ”€โ”€ cn/
โ”‚       โ”‚   โ””โ”€โ”€ index.json
โ”‚       โ”œโ”€โ”€ us/
โ”‚       โ”‚   โ””โ”€โ”€ index.json
โ”‚       โ””โ”€โ”€ ...                    # 60 countries total
โ””โ”€โ”€ package.json

Technology stack

  • Framework: Next.js 15 with App Router
  • Language: TypeScript
  • Styling: Tailwind CSS
  • Package manager: pnpm

Data sources

Holiday data is generated by AI and includes:

  • Fixed national holidays
  • Movable holidays (Easter, Lunar New Year, Ramadan, etc.)
  • Holiday durations
  • Bank holidays

Note: While the data is generated with care, please verify critical dates with official government sources for production use. If you find any discrepancies, feel free to open an issue.

Contributing

Contributions are welcome! Please feel free to submit a Issue or Pull Request.

License

This project is open source and available under the MIT License.

About

public holidays open apis

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published