Node.js · REST API · Updated
Build a chronological city calendar from live event data. The downloadable Node.js example fetches every page and writes a standalone HTML calendar with local times, venue names and source links. It needs no frontend framework.
Open the VenuNite calendar demo. On December 3, 2026, we ran the generator against the REST API for Gilbert House Children’s Museum in Salem, Oregon. The published calendar is the HTML from that run.
The API returned 2026-12-31T18:00:00.000Z. The calendar shows 10 a.m. Pacific and links to the museum’s Noon Year’s Eve listing, where families can check admission and early entry.
Save this as salem.mjs beside the downloadable example and run node salem.mjs with your REST key. For a future event, change the dates and source.
import { writeFile } from "node:fs/promises";
import { calendarHtml, fetchEvents } from "./venunite-events.mjs";
const query = new URLSearchParams({
city: "Salem", state: "OR", source: "scraper:gilbert_house_childrens_museum_salem",
starts_after: "2026-12-31T00:00:00-08:00",
starts_before: "2026-12-31T23:59:59.999-08:00",
exclude_sold_out: "true", limit: "5",
});
const events = await fetchEvents(query, process.env.VENUNITE_API_KEY);
const html = calendarHtml(events, "VenuNite demo · Gilbert House calendar for December 31, 2026", new Date().toISOString());
await writeFile("salem.html", html);Always pair a city with its two-letter state code. City matching selects the venue’s stored city; it is not a metro-wide search. Use the radius guide for a surrounding area.
curl --fail-with-body \
-H "Authorization: Bearer $VENUNITE_API_KEY" \
'https://venunite.com/v1/events?city=Denver&state=CO&limit=25'Leave dates out for the default upcoming window, bounded by your account’s lookahead. For a calendar month, calculate its boundaries in the city’s timezone and send ISO timestamps with offsets as starts_after and starts_before. Check the reference’s window limits before requesting a longer period.
Download the script below and set VENUNITE_API_KEY in your environment, then run:
node venunite-events.mjs calendar Denver CO
# For a multi-word city:
node venunite-events.mjs calendar "St. Petersburg" FLOpen city-calendar.html in your browser. Each successful run replaces that file. The script follows hasMore and nextCursor, keeps its original filters, and upserts in memory by event ID. It writes the file only after every page succeeds, using a temporary file and rename.
Its 100-page safety ceiling fails explicitly. A quota refusal, malformed response or network failure leaves the previous calendar intact. Pages can change while you traverse them: completing pagination does not turn the feed into a frozen export.
Format startDate and endDate with venue.timezone, not the server’s timezone. The script uses Intl.DateTimeFormat; when the venue’s timezone is unavailable, it labels the timestamp as UTC. In-progress events remain eligible until they end.
const label = new Intl.DateTimeFormat("en-US", {
timeZone: event.venue.timezone,
dateStyle: "full",
timeStyle: "short",
}).format(new Date(event.startDate));The generated HTML escapes event text, permits only HTTP(S) source links, shows sold-out and postponed flags, and uses no third-party images. It links website when supplied, with eventUrl as a fallback. Readers can confirm details at the source.
For an ongoing product, run retrieval on your server and store imported rows under event.id. Keep your users’ own events separate. Stage a complete traversal, then publish the replacement for that exact city, filters and window; never remove rows because they were missing from page one or from a failed run.
A row missing from a later successful traversal is absent from that feed window, not necessarily cancelled. It may have ended, moved outside the filters or temporarily lost serving eligibility. Do not display “cancelled” based on absence alone. updatedAt is a returned field, not an incremental-sync query parameter.
Choose a refresh cadence within your plan and agreed storage terms. The example does not schedule jobs or grant data rights. Repeated fetches consume delivered rows again. Your API plan’s terms apply; an image URL or source link does not grant image rights, feed resale rights or model-training rights.
Use Node.js 22 or newer. Create a key and keep it in the server’s VENUNITE_API_KEY environment variable. Never put it in browser JavaScript, a public repository or the generated calendar.
Eligible verified accounts get a separate REST trial: 7 days or 1,000 delivered rows total, whichever comes first. Ongoing REST access requires a paid plan. Free MCP access is separate. Repeated results consume rows again.
Download venunite-events.mjs. The file has no package dependencies; inspect its source before running it.
Prefer Postman? Open the VenuNite Postman collection for city, nearby and pagination requests. Fork it into your workspace and set api_key in a local, unshared Postman environment. Use the Postman desktop app or Desktop Agent; no credentials are included in the collection.
Try your key in the API explorer or review plans and limits.