Holidays API

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.

/v1/holidays GET

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.


Parameters

  • country  required

    Country name or ISO 3166-2 country code (preferred).

  • year  required

    Calendar year between 2010 and 2030 (inclusive). Note: not all countries are guaranteed to contain data going back to 2010.

  • type  optional

    Holiday 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

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

country
year
type
https://api.api-ninjas.com/v1/holidays?country=CA&year=2021&type=public_holiday

Sample Response

JSON
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 [ { "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" }, { "country": "Canada", "iso": "CA", "year": 2021, "date": "2021-01-01", "day": "Friday", "name": "New Year's Day", "type": "PUBLIC_HOLIDAY" }, { "country": "Canada", "iso": "CA", "year": 2021, "date": "2021-04-05", "day": "Monday", "name": "Easter Monday", "type": "PUBLIC_HOLIDAY" }, { "country": "Canada", "iso": "CA", "year": 2021, "date": "2021-05-24", "day": "Monday", "name": "Victoria Day", "type": "PUBLIC_HOLIDAY" }, { "country": "Canada", "iso": "CA", "year": 2021, "date": "2021-07-01", "day": "Thursday", "name": "Canada Day", "type": "PUBLIC_HOLIDAY" }, { "country": "Canada", "iso": "CA", "year": 2021, "date": "2021-11-11", "day": "Thursday", "name": "Remembrance Day", "type": "PUBLIC_HOLIDAY" } ]

Code Examples

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.