a615b7ebfd
Closes leeworks-agents/api-company#5 (docs-site Astro scaffold) Closes leeworks-agents/api-company#9 (metrics instrumentation standard) Closes leeworks-agents/api-company#10 (Gitea Actions openapi aggregation pipeline) Closes leeworks-agents/api-company#11 (docs-site Flux HelmRelease) Closes leeworks-agents/api-company#12 (SEO blog posts x3) Closes leeworks-agents/api-company#13 (legal docs ToS/Privacy/AUP) Closes leeworks-agents/api-company#14 (DNS documentation) ## Changes ### docs/legal/ - terms-of-service.md — API usage, liability, account termination, governing law - privacy-policy.md — request log retention (90d), no PII sold, data sharing - acceptable-use-policy.md — rate limit abuse, scraping prohibition, resale ban ### docs/metrics-standard.md - Defines api_requests_total, api_response_duration_seconds, api_data_freshness_seconds - Fastify (TypeScript) and FastAPI (Python) reference middleware implementations - Prometheus scrape config and Grafana dashboard guidance ### docs/registry.md - Decision: use Gitea built-in container registry (no new infra) - Image naming convention, auth, Kubernetes imagePullSecrets, ingress config ### docs/dns.md - Required A records for all 6 subdomains - cert-manager ClusterIssuer and Ingress TLS examples - Verification commands and human-operator action items ### docs-site/ - Astro 4 + MDX + sitemap scaffold - Base layout with nav linking all APIs, blog, RapidAPI, status - Landing page with API cards - Per-API Redoc viewer pages (zip-enrichment, holidays, air-quality) - Blog index + 3 SEO blog posts (~1000 words each with JSON-LD) - Dockerfile (multi-stage: node build + nginx serve) - nginx.conf with gzip, caching, health endpoint ### flux/ - gitea-runner/: gitea-act-runner HelmRelease (org-scope, dind) - monitoring/: kube-prometheus-stack + Gatus HelmReleases - Prometheus with pod annotation scraping - Grafana at grafana.leeworks.dev with persistence - Gatus status page at status.leeworks.dev, 90-day retention - docs-site/: Deployment + Service + Ingress via raw chart - api-company-source/: GitRepository + Kustomization reference manifests - kustomization.yaml: root kustomize entry point (build validated) ### .gitea/workflows/build-docs.yaml - Aggregates openapi.yaml from zip-enrichment, holidays, air-quality repos - Builds Astro docs-site - Pushes image to registry.leeworks.dev/leeworks-agents/docs-site - Triggered on push to main, schedule daily 02:00 UTC, workflow_dispatch
162 lines
5.1 KiB
Plaintext
162 lines
5.1 KiB
Plaintext
---
|
|
title: "Public Holidays API: The Free Holiday Calendar API for Any Country"
|
|
description: "Get public holidays for 100+ countries with a single API call. The leeworks.dev Holidays API is perfect for scheduling, calendar apps, and payroll systems."
|
|
date: "2026-05-24"
|
|
author: "leeworks.dev"
|
|
tags: ["holidays", "api", "tutorial"]
|
|
---
|
|
|
|
import Base from '../../layouts/Base.astro';
|
|
|
|
<Base title="Public Holidays API Guide" description="Get public holidays for 100+ countries with a single API call.">
|
|
|
|
<article style="max-width: 800px; margin: 0 auto; padding: 2rem; line-height: 1.75;">
|
|
|
|
<script type="application/ld+json" set:html={JSON.stringify({
|
|
"@context": "https://schema.org",
|
|
"@type": "Article",
|
|
"headline": "Public Holidays API: The Free Holiday Calendar API for Any Country",
|
|
"datePublished": "2026-05-24",
|
|
"author": { "@type": "Organization", "name": "leeworks.dev" },
|
|
"publisher": { "@type": "Organization", "name": "leeworks.dev", "url": "https://docs.leeworks.dev" }
|
|
})} />
|
|
|
|
# Public Holidays API: The Free Holiday Calendar API for Any Country
|
|
|
|
Building a scheduling app, payroll system, or booking platform? You need accurate **public holiday data** for every country you serve. The leeworks.dev **Holidays API** gives you that data in milliseconds.
|
|
|
|
## Why You Need a Holiday Calendar API
|
|
|
|
Manually maintaining a list of public holidays is a losing battle. Holidays change year to year, differ by country and region, and missing one can mean:
|
|
|
|
- **Wrong delivery estimates** on e-commerce sites
|
|
- **Incorrect payroll calculations** (overtime on holidays)
|
|
- **Broken calendar apps** that schedule meetings on national holidays
|
|
- **Failed SLA commitments** that assumed business days
|
|
|
|
A reliable **holiday API** solves this once.
|
|
|
|
## What the leeworks.dev Holidays API Provides
|
|
|
|
- Public holidays for **100+ countries**
|
|
- Data updated from Nager.Date's curated public dataset
|
|
- Filter by **country code** (ISO 3166-1 alpha-2), **year**, and **type**
|
|
- Response includes holiday name (localized), date, and type (`public`, `optional`, `observance`)
|
|
- Sub-100ms response time, SQLite-backed
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Get all US public holidays for 2026
|
|
curl "https://holidays.leeworks.dev/v1/holidays?country=US&year=2026" \
|
|
-H "X-RapidAPI-Key: YOUR_API_KEY"
|
|
```
|
|
|
|
Response:
|
|
```json
|
|
{
|
|
"country": "US",
|
|
"year": 2026,
|
|
"holidays": [
|
|
{
|
|
"date": "2026-01-01",
|
|
"name": "New Year's Day",
|
|
"type": "public"
|
|
},
|
|
{
|
|
"date": "2026-07-04",
|
|
"name": "Independence Day",
|
|
"type": "public"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Common Use Cases
|
|
|
|
### 1. Skip Holidays in Business Day Calculations
|
|
|
|
```python
|
|
from datetime import date, timedelta
|
|
import httpx
|
|
|
|
def next_business_day(start: date, country: str = "US") -> date:
|
|
resp = httpx.get(
|
|
"https://holidays.leeworks.dev/v1/holidays",
|
|
params={"country": country, "year": start.year},
|
|
headers={"X-RapidAPI-Key": "YOUR_KEY"},
|
|
)
|
|
holidays = {h["date"] for h in resp.json()["holidays"]}
|
|
|
|
current = start + timedelta(days=1)
|
|
while current.weekday() >= 5 or current.isoformat() in holidays:
|
|
current += timedelta(days=1)
|
|
return current
|
|
```
|
|
|
|
### 2. Display Holiday Badges in a Calendar
|
|
|
|
```javascript
|
|
async function getHolidayMap(countryCode, year) {
|
|
const res = await fetch(
|
|
`https://holidays.leeworks.dev/v1/holidays?country=${countryCode}&year=${year}`,
|
|
{ headers: { 'X-RapidAPI-Key': process.env.RAPIDAPI_KEY } }
|
|
);
|
|
const { holidays } = await res.json();
|
|
// Return a Map of ISO date string → holiday name
|
|
return new Map(holidays.map(h => [h.date, h.name]));
|
|
}
|
|
|
|
// Usage in a calendar component
|
|
const holidayMap = await getHolidayMap('GB', 2026);
|
|
const isHoliday = holidayMap.has('2026-12-25'); // true: Christmas Day
|
|
```
|
|
|
|
### 3. Check If Today Is a Holiday
|
|
|
|
```typescript
|
|
async function isTodayHoliday(country = 'US'): Promise<string | null> {
|
|
const today = new Date().toISOString().split('T')[0];
|
|
const year = new Date().getFullYear();
|
|
|
|
const res = await fetch(
|
|
`https://holidays.leeworks.dev/v1/is-holiday?country=${country}&date=${today}`,
|
|
{ headers: { 'X-RapidAPI-Key': process.env.RAPIDAPI_KEY! } }
|
|
);
|
|
const data = await res.json();
|
|
return data.isHoliday ? data.name : null;
|
|
}
|
|
```
|
|
|
|
## Supported Countries (Sample)
|
|
|
|
| Code | Country | Code | Country |
|
|
|------|---------|------|---------|
|
|
| US | United States | GB | United Kingdom |
|
|
| CA | Canada | DE | Germany |
|
|
| FR | France | JP | Japan |
|
|
| AU | Australia | BR | Brazil |
|
|
| IN | India | MX | Mexico |
|
|
|
|
...and 90+ more. Use `GET /v1/countries` to see the full list.
|
|
|
|
## Pricing
|
|
|
|
| Plan | Requests/mo | Price |
|
|
|------|------------|-------|
|
|
| Free | 500 | $0 |
|
|
| Basic | 10,000 | $9/mo |
|
|
| Pro | 100,000 | $19/mo |
|
|
| Ultra | 1,000,000 | $49/mo |
|
|
|
|
**[Subscribe on RapidAPI →](https://rapidapi.com/leeworks/api/holidays)**
|
|
|
|
## Conclusion
|
|
|
|
Stop hardcoding holiday lists or scraping Wikipedia. The leeworks.dev **public holidays API** gives you accurate, up-to-date holiday data for every country you need — with a simple REST interface and affordable pricing.
|
|
|
|
**[Get started for free →](https://rapidapi.com/leeworks/api/holidays)**
|
|
|
|
</article>
|
|
</Base>
|