Public holidays
GET /api/public-holidaysPublic holidays for a country and year via Nager.Date (keyless, 100+ countries): date, local name, English name, nationwide flag, and holiday types. Send GET /api/public-holidays with the required fields country and year and pay $0.001 per call over x402 or MPP (there is no free tier). It returns a JSON object with country, year, count and holidays.
Pairs with /api/business-days and /api/country-info. ?country=US&year=2026
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
country | string | yes | ISO 3166-1 alpha-2 country code, e.g. US, DE, JP Also accepted as countryCode, country_code, cc, iso, nation. |
year | integer | yes | calendar year (1975-2099) |
Example request
curl -i "https://agent402.tools/api/public-holidays?country=US&year=2026"
Without payment this returns HTTP 402 Payment Required with the exact price for public-holidays; any x402 v2 or MPP client pays it and retries.
Example response
{
"country": "US",
"year": 2026,
"count": 17,
"holidays": [
{
"date": "2026-01-01",
"localName": "New Year's Day",
"name": "New Year's Day",
"global": true,
"counties": null,
"types": [
"Public",
"Bank"
]
}
]
}
| Field | Type | Always present | In the example |
|---|---|---|---|
country | string | yes | US |
year | number | yes | 2026 |
count | number | yes | 17 |
holidays | array of objects | yes | 1 item in the example |
From an MCP client
catalog.call {
"slug": "public-holidays",
"params": {
"country": "US",
"year": 2026
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for public-holidays; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
countryandyearare required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement is cancelled when the tool fails. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/public-holidays is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/public-holidays?country=US&year=2026");
Part of these workflows
Public holidays is one step in this skill pack, each sold as a single call:
- Locale brief - "Can I reach this counterparty this week?" - country facts, this year's public holidays, working days remaining this week, and what time it is there right now, in one call.
Related tools
Date arithmetic
POST /api/add-timeAdd (or subtract) a duration to a date. duration like "2d", "-3h", "1w 2d", "90m". Returns the resulting UTC ISO timesta…
Age calculator
POST /api/ageCompute a precise age (years, months, days) from a birth date to today (or a given date), plus total days.
Business days
POST /api/business-daysCount business days (Mon–Fri) between two dates, inclusive of the start, exclusive of the end. Optional list of holiday …
Cron next runs
POST /api/cron-nextParse a 5-field cron expression and return the next N run times (UTC).
Date difference
POST /api/date-diffDifference between two dates/times in ms, seconds, minutes, hours, days, and a human summary.
Duration parse/humanize
POST /api/durationParse a duration like "2h30m" / "1d4h" / "90s" to seconds, or humanize a number of seconds.