This API endpoint retrieves all designated public holidays for a specified country and year. It requires a JSON payload with the country’s 2-letter ISO code and the year as input parameters.
POST /get-country-holidays
Content-Type
: application/jsonX-RapidAPI-Key
: 36d91600a6msh2661a0538a3d030p1dd9dfjsn7e5e980351f2X-RapidAPI-Host
: 'get-country-holidays.p.rapidapi.comThe request body must be a JSON object containing the following fields:
country_code
(string): The 2-letter ISO 3166-1 alpha-2 country code of the country for which you want to retrieve holidays.year
(string): The year for which the holidays are requested.{
"country_code": "US",
"year": "2023"
}
A successful response will be returned with HTTP status code 200 OK and will contain a list of holidays in JSON format. Each holiday object includes the name of the holiday, its date, and a brief description.
date
(string): The date of the holiday in YYYY-MM-DD format.name
(string): The name of the holiday.{"2024-01-01": "New Year's Day", "2024-01-15": "Martin Luther King Jr. Day", "2024-02-19": "Washington's Birthday", "2024-05-27": "Memorial Day", "2024-06-19": "Juneteenth National Independence Day", "2024-07-04": "Independence Day", "2024-09-02": "Labor Day", "2024-10-14": "Columbus Day", "2024-11-11": "Veterans Day", "2024-11-28": "Thanksgiving", "2024-12-25": "Christmas Day"}
The API may return the following error responses in cases where the request cannot be successfully processed:
country_code
and year
fields or if they are in an incorrect format.{
"error": "Invalid request format. Please ensure your JSON includes 'country_code' and 'year' as strings."
}
{
"error": "No holidays found for the specified country code and year, or country code not recognized."
}
{
"error": "An unexpected error occurred. Please try again later."
}
The following country codes can be used in the country_code attribute of the request body.