# Public Holidays: by country and year, long weekends (`examsens.ai/public-holidays`) Actor

Public holidays for more than 200 countries and territories and their states and provinces, any year, with local and English names and categories, plus long weekends with bridge days and a holiday check for any date. Computed offline from the open source holidays library.

- **URL**: https://apify.com/examsens.ai/public-holidays.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** Business, Travel
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.70 / 1,000 row returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Public Holidays: by country and year, long weekends

Public holidays for more than 200 countries and territories, and for their states and provinces, for any year from 1900 to 2100. Get every holiday with its local and English name, find the long weekends, or check whether a given day is a working day. Built for payroll, scheduling, delivery promises and travel planning.

### What you get

- Holidays: date, weekday, local name, English name, category, and whether the day is an observed substitute (such as Independence Day observed on a Friday).
- Long weekends: runs of three or more days off that include a public holiday, using each country's own weekend days. When one working day sits between a holiday and a weekend, you also get the longer break that taking that bridge day would create, with the bridge day named.
- Date check: for any date, or today in UTC, whether it is a public holiday, a weekend day or a working day, with the holiday names and the country's weekend days.

### Input

- Countries: two letter codes such as `US` or `JP`, or a country with a state or province such as `US-CA` or `DE-BY`. A subdivision adds its own holidays to the national ones.
- From year and to year: up to 30 years in one run (default: the current year).
- Holiday categories: public (default), bank, government, optional, school, half day, unofficial, armed forces, and working day transfers. A category a country does not define is skipped for it.
- Switches for holidays (on by default) and long weekends (off by default), and a date to check.

### Output

Rows of three types, each with `input`, `countryCode` and `subdivision`:

- `holiday`: `date`, `weekday`, `localName`, `name`, `category`, `observed`, `language`
- `longWeekend`: `year`, `startDate`, `endDate`, `dayCount`, `needBridgeDay`, `bridgeDays`
- `dateCheck`: `date`, `weekday`, `isPublicHoliday`, `holidayNames`, `isWeekend`, `isWorkingDay`, `weekendDays`

An unknown country code, an unknown subdivision (with the list of valid ones) or a malformed entry gives an item with `error`.

### Source

Holidays are computed inside the run by the open source `holidays` library (MIT license), which keeps the rules for each country and subdivision, including moving feasts and substitute days. No web service is called, so runs are fast and there is no rate limit. Rules can change by law; check dates far in the future with the authority that sets them.

### Pricing

Pay per event: one `row-returned` event per row returned. Errors are not charged. The run stops when it reaches the maximum charge you set.

### Support

Questions and problems: the Issues tab on this page. Replies are written by an AI assistant on behalf of the developer and reviewed by the developer.

# Actor input Schema

## `countries` (type: `array`):

Two letter country codes such as US or DE, or a country with a state or province such as US-CA or DE-BY. A subdivision adds its own holidays to the national ones.

## `startYear` (type: `integer`):

First year. Defaults to the current year.

## `endYear` (type: `integer`):

Last year. Defaults to the first year. At most 30 years in one run.

## `categories` (type: `array`):

Which kinds of holiday to include. A category a country does not define is skipped for that country.

## `includeHolidays` (type: `boolean`):

Return one row per holiday.

## `includeLongWeekends` (type: `boolean`):

Return runs of three or more days off around public holidays, and the ones a single bridge day would create.

## `checkDate` (type: `string`):

"today" (in UTC) or a date as YYYY-MM-DD. Adds one row per country saying whether that day is a public holiday, a weekend day or a working day.

## Actor input object example

```json
{
  "countries": [
    "US",
    "DE-BY"
  ],
  "categories": [
    "public"
  ],
  "includeHolidays": true,
  "includeLongWeekends": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "countries": [
        "US",
        "DE-BY"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/public-holidays").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "countries": [
        "US",
        "DE-BY",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/public-holidays").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "countries": [
    "US",
    "DE-BY"
  ]
}' |
apify call examsens.ai/public-holidays --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,examsens.ai/public-holidays"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/0vpqjQdLVRRbd6gVh/builds/ObtHfjOjhDFkvTE1y/openapi.json
