JavaScript how-to
Is the market open? A JavaScript API
One fetch returns whether an exchange is open now, why not (holiday, weekend, before the open or after the close), and the next open and close times in UTC. Works in Node 18+, Deno, Bun and the browser (CORS is open). No key, no package.
Right now
// Node 18+ or any browser: no key, no package
async function marketStatus(mic = "XNYS") {
const res = await fetch(`https://settledate.dev/v1/markets/${mic}/status`);
if (!res.ok) throw new Error((await res.json()).error.message);
return res.json();
}
const s = await marketStatus("XNYS");
if (s.is_open) {
console.log(`NYSE is open (${s.session.session_type}), closes ${s.next_close}`);
} else {
console.log(`NYSE is closed, opens ${s.next_open}`);
}
Real output (run Friday Nov 6 2026, 3:41 pm New York time):
NYSE is open (regular), closes 2026-11-06T21:00:00Z
At any moment
Pass at (ISO 8601) to ask about another instant, for example to schedule a job:
// Ask about any instant: Thanksgiving 2026, 10:00 in New York
const at = "2026-11-26T15:00:00Z";
const s = await (await fetch(`https://settledate.dev/v1/markets/XNYS/status?at=${at}`)).json();
console.log(s.status, "-", s.holiday, "- next open", s.next_open);
Real output:
closed - Thanksgiving - next open 2026-11-27T14:30:00Z
Response fields
status:open,closedorbreak(lunch, e.g. Tokyo);is_openas a boolean.reasonandholidaywhen closed;session.session_typeisearly_closeon half days while the session is open or before it opens.next_open,next_close: UTC instants;local_date,local_time,timezonefor display.
Other markets: XNAS, XLON, XETR, XTKS keyless; 29 exchanges on paid plans. See a live version of this on Is the stock market open today?
That ran without a key. Keyless access covers NYSE, Nasdaq, London, Xetra, Tokyo, the Fed, TARGET2, UK payments and every country calendar, 60 calls an hour per IP. For scripts, notebooks and schedules, a free key gives 5,000 calls a month (no card). Paid plans add the other 24 exchanges.
Questions
Is there a free API to check if the stock market is open?
Yes. GET https://settledate.dev/v1/markets/XNYS/status returns open, closed or break with the next open and close, no key needed (60 calls an hour per IP).
Does it handle holidays and half days?
Yes. Closed responses name the holiday, and early-close days such as the day after Thanksgiving report the 13:00 close.
Can I call it from the browser?
Yes. The API sends Access-Control-Allow-Origin: *, so fetch works from any page.
Related: Is the stock market open today? · NYSE holidays 2026 · API docs