Start from the supported country list
Call holidays-countries once when your settings page loads and store the returned countryCode values with their name. Checking body.country against that stored list in your own form keeps unsupported codes away from requests, where they would be rejected.
Because codes are read case-insensitively, convert them to upper case before you store or compare them, so that a saved us and a picker value US do not turn into two different entries in your data. The same list supplies the labels for a country selector without a second lookup.
Moving a due date with the public holidays API
Before confirming a delivery or payment date:
- Send it to
holidays-is-workdayasbody.date. - When
is_workdayis false, show the user thereasons. - Test the following dates one request at a time until a working day comes back.
is_weekend and is_public_holiday show whether the date falls on the weekend or on a public holiday, which matters when the message to the user should differ between a weekend and a holiday. Keep body.weekend, body.types and body.subdivision identical across these follow-up checks; otherwise the answers for neighbouring dates rest on different rules.
Lead times and monthly working-day totals
For a lead-time estimate or a payroll month, one call to holidays-workday-count replaces a loop of single-date checks:
- Send the first and last day as
body.startandbody.end; both are inclusive, so 2027-03-01 to 2027-03-31 covers all of March. - Read
workdaysfor the total andholidaysfor the holidays that fell inside the period.
A range spans about 10 years at most, so a longer history has to be split into consecutive ranges that neither overlap nor leave gaps. With identical optional inputs on every part, the workdays values of the parts add up to the total for the whole period.
Counting more than one holiday type
body.types takes one value or several separated by commas, read case-insensitively, and with no value only Public counts as a day off. The accepted values are Public, Bank, School, Authorities, Optional and Observance.
When your rules treat both public and bank holidays as days off, send Public,Bank in one request.
Adding up workdays or holiday_days from per-type range counts gives wrong totals, because each count covers the whole range on its own and one date can carry several holiday types. For a combined range total, send all the types in one holidays-workday-count request.
Planning leave around long weekends
To build a leave planner:
- Call
holidays-long-weekendswith the country and year, then split thelongWeekendswindows onneedBridgeDay, which shows whether a window needs a bridge day. - Use
startDate,endDateanddayCountfor the length of each window, andstartWeekdayto label it in a calendar. - When you also want holiday names, call
holidays-holidayswith the same country and year and match the holidaydatevalues that lie between a window'sstartDateandendDate.
Both operations take one year per request, so a planner showing two years sends two pairs of requests.
Showing a holiday countdown
holidays-next-holidays returns the public holidays of about the next 365 days with daysUntil for each, which is the shape a countdown widget needs. Send body.today when the countdown should start from a date other than the current UTC date, for example a user's local date that has already passed midnight while the UTC date has not, or a fixed date in your own test suite. Read asOf to see which reference date was applied: a body.today that cannot be read is ignored, and the response then counts from the current UTC date instead.
Inputs that fall back instead of failing
body.weekend, body.subdivision and body.today accept any string, and a value that cannot be recognised is ignored rather than rejected:
body.weekend: the default weekend appliesbody.subdivision: the nationwide answer applies, so a mistyped GB-SCT produces a nationwide count instead of an errorbody.today: the current UTC date applies
Validate these inputs in your own code before sending them, against your stored ISO-3166-2 codes and the day names you allow, and compare weekend_definition and asOf in the response with what you sent. The strict inputs behave the other way round: a country code outside the supported set or a date that is not in YYYY-MM-DD form is rejected.
About public holidays and business days
A long weekend is a weekend extended by one or more days off immediately before or after it, for example when a holiday falls on the Friday before or the Monday after. A bridge day is a working day that sits between a public holiday and a weekend or another holiday, and it can be taken or granted as a day off to create a longer break. When a public holiday falls on a Saturday or Sunday, some places observe it on a nearby weekday instead, such as the preceding Friday or the following Monday.
[
{
"body": {}
},
{
"body": {
"country": "DE",
"year": 2027
}
},
{
"body": {
"country": "DE",
"year": 2027
}
}
][
{
"body": {
"country": "GB",
"date": "2027-12-27",
"subdivision": "GB-SCT"
}
},
{
"body": {
"country": "GB",
"start": "2027-12-01",
"end": "2027-12-31",
"subdivision": "GB-SCT"
}
}
]Server-side request template
This server-side template shows authentication and request identity using the first operation of this API. Choose the operation for your use case and check its current availability and price on the API page. After a timeout, resend the unchanged request with the same Idempotency-Key.
The gateway request is always POST.
Use a JSON object with the documented path, query, headers and body locations; omit unused locations. input.headers is JSON data for the operation, not browser request headers. Do not put credentials here. Keep body arrays, scalar values and null as documented; omission is different from null.
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/holidays/holidays-countries' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{}}'Integration checklist
- The API key is stored in a server-side secret manager and never sent to a browser.
- Each request carries its own Idempotency-Key, kept until the request has a final answer.
- The integration reads ok and error.code and handles each error code as the error table describes.
- An uncertain POST is inspected using its original identity, never blindly repeated with a new one.
- The operation’s current availability and price have been checked on its API page.
Public holidays and business days overview and prices · Read the API reference · Try it in the playground