JavaScript
The API sends CORS headers, so this works in a browser on any site as well as in Node, Deno, Bun and Workers.
const API = "https://api.financecalendarapi.com";const API_KEY = process.env.FC_API_KEY; // on a server; never put your key in a public page
async function get(path, params = {}) { const res = await fetch(`${API}${path}?${new URLSearchParams(params)}`, { headers: { Authorization: `Bearer ${API_KEY}` }, }); const body = await res.json(); if (!res.ok) throw new Error(`${body.code}: ${body.detail}`); return body;}
// T+2 for a USD trade on the NYSEconst { result } = await get("/v1/business-days/add", { date: "2027-12-23", n: 2, calendars: "USD,XNYS" });console.log(result); // "2027-12-28"
// The next three closures in Tokyoconst next = await get("/v1/holidays/next", { calendars: "XJPX", from: "today", n: 3 });for (const e of next.calendars[0].entries) console.log(e.date, e.name);Every response’s data_release.id (and the x-data-release header) says which release answered. Store it with
anything you cache, and check the changes feed for what changed since.