The Holidays API provides holiday information on over 230 countries, regions, and territories around the world. It contains holiday data going back previous years as well as calendars in the future. The data incudes public holidays, different religious dates, bank holidays, and many other categories.
https://api.api-ninjas.com/v1/holidays
Returns a list of holiday entries for a given country and year. Each entry in the response contains the holiday name, date, day of the week, and the type of holiday.
country
requiredCountry name or ISO 3166-2 country code (preferred).
year
requiredCalendar year between 2010
and 2030
(inclusive). Note: not all countries are guaranteed to contain data going back to 2010.
type
optionalHoliday type filter. Possible values are:
major_holiday - combination of public_holiday , national_holiday , and federal_holiday |
public_holiday |
observance |
national_holiday |
federal_holiday (US only) |
season |
state_holiday |
optional_holiday |
clock_change_daylight_saving_time |
local_holiday |
united_nations_observance |
observance_christian |
bank_holiday |
common_local_holiday |
national_holiday_christian |
christian |
observance_hebrew |
jewish_holiday |
muslim |
hindu_holiday |
restricted_holiday |
official_holiday |
national_holiday_orthodox |
local_observance |
X-Api-Key
requiredAPI Key associated with your account.
https://api.api-ninjas.com/v1/holidays?country=CA&year=2021&type=public_holiday
Headers
X-Api-Key
Log in or sign up to get your API Key
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[
{
"country": "Canada",
"iso": "CA",
"year": 2021,
"date": "2021-04-02",
"day": "Friday",
"name": "Good Friday",
"type": "PUBLIC_HOLIDAY"
},
{
"country": "Canada",
"iso": "CA",
"year": 2021,
"date": "2021-09-06",
"day": "Monday",
"name": "Labour Day",
"type": "PUBLIC_HOLIDAY"
},
{
"country": "Canada",
"iso": "CA",
"year": 2021,
"date": "2021-12-25",
"day": "Saturday",
"name": "Christmas Day",
"type": "PUBLIC_HOLIDAY"
}
]
1
2
3
4
5
6
7
8
9
import requests
country = 'ca' # Canada.
year = '2022'
api_url = 'https://api.api-ninjas.com/v1/holidays?country={}&year={}'.format(country, year)
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.