Working Days API

The Working Days API provides information about working days and non-working days (weekends and public holidays) for countries around the world.

/v1/workingdays GET

https://api.api-ninjas.com/v1/workingdays

Returns a list of working days and non-working days for a given country and year/month.

To check if a specific date is a working day, use the /v1/isworkingday endpoint instead.


Parameters

  • country  required

    2-letter ISO country code.

  • year  required

    Calendar year between 1980 and 2050 (inclusive).

  • month  optional

    Month number (1-12). If provided, returns data for just that month.

  • weekend  optional

    Comma-separated list of weekend days (mon,tue,wed,thu,fri,sat,sun). Defaults to sat,sun.

  • public_holidays  optional

    Whether to include public holidays as non-working days (true/false). Defaults to true.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

The response will be a JSON object with the following fields:

  • num_working_days

    Total number of working days in the period.

  • num_non_working_days

    Total number of non-working days in the period.

  • working_days

    List of dates that are working days.

  • non_working_days

    List of dates that are non-working days, with reasons and holiday names if applicable.

Sample Request Live Demo!

country
https://api.api-ninjas.com/v1/workingdays?country=US

Headers

X-Api-KeyLog in or sign up to get your API Key

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 { "num_working_days": 251, "num_non_working_days": 114, "working_days": [ "2025-01-02", "2025-01-03", "2025-01-06", "2025-01-07", ... ], "non_working_days": [ { "date": "2025-01-01", "reasons": ["public holiday"], "holiday_name": "New Year's Day" }, { "date": "2025-01-04", "reasons": ["weekend"] }, ... ] }

Code Examples

1 2 3 4 5 6 7 8 9 import requests country = 'US' # United States year = '2025' api_url = 'https://api.api-ninjas.com/v1/workingdays?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.

/v1/isworkingday GET

https://api.api-ninjas.com/v1/workingdays

Returns whether a given date is a working day for a given country.


Parameters

  • country  required

    2-letter ISO country code.

  • date  required

    Date in YYYY-MM-DD format. Must be between 1980-01-01 and 2050-12-31 (inclusive).

  • weekend  optional

    Comma-separated list of weekend days (mon,tue,wed,thu,fri,sat,sun). Defaults to sat,sun.

  • public_holidays  optional

    Whether to include public holidays as non-working days (true/false). Defaults to true.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

The response will be a JSON object with the following fields:

  • date

    The queried date.

  • country

    2-letter ISO country code.

  • day_of_week

    Day of the week (Monday through Sunday).

  • is_workday

    Whether the date is a working day.

  • non_working_reason

    List of reasons why the date is not a working day (if applicable).

  • public_holiday_name

    Name of the public holiday (if applicable).

Sample Request

https://api.api-ninjas.com/v1/isworkingday?country=US&date=2025-01-01

Sample Response

JSON
1 2 3 4 5 6 7 8 { "date": "2025-01-01", "country": "US", "day_of_week": "Wednesday", "is_workday": false, "non_working_reason": ["public holiday"], "public_holiday_name": "New Year's Day" }