You could use external Holiday API to retrieve holidays in a RESTful manner.
List of endpoints:
GET /v1/holidays/{countryCode}/upcoming
GET /v1/holidays/{countryCode}/search/date/{holidayDate}
GET /v1/holidays/{countryCode}/search/year/{year}
GET /v1/holidays/search/date/{holidayDate}
Example of response:
[
{
"date": "2025-06-19",
"name": "Juneteenth National Independence Day",
"localName": "Juneteenth National Independence Day",
"nationwide": true,
"country": {
"name": "United States of America",
"localName": "United States",
"alpha2Code": "US",
"alpha3Code": "USA",
"numericCode": "840"
},
"subdivisions": [],
"types": [
"Public"
]
},
{
"date": "2025-07-04",
"name": "Independence Day",
"localName": "Independence Day",
"nationwide": true,
"country": {
"name": "United States of America",
"localName": "United States",
"alpha2Code": "US",
"alpha3Code": "USA",
"numericCode": "840"
},
"subdivisions": [],
"types": [
"Public"
]
}
]
To be able to use their API you will need to generate API key on their dashboard and subscribe for product with free trial (risk-free 3-day trial, then $110 per year or $12 per month).
Link to their API reference: https://api.finturest.com/docs/#tag/holiday