Skip to content

Tools

Node package(ready-made code for Node.js)

The Node is ready-made code for this API. You install it once on your . Then one short line of code sends one , and the package keeps the API's rules for you.

The idea, with one example

Without the package, you write every request by hand: the address, the key, the headers, the waiting, and the tries after a failure. With the package, you write one line.

read the hotel with the package
import { ZimmerStack } from "@zimmerstack/connect";

const zs = new ZimmerStack();              // reads your key from ZIMMERSTACK_CONNECT_KEY
const property = await zs.property.get();  // one request: GET /property
console.log(property.name);                // The Lantern House

The package also knows every field of every request and every answer. It takes them from the API's own contract. So your editor shows the right names as you type, and marks a wrong name before you run the code.

And it keeps the rules that keep a hotel's prices safe: how fast to send, when to try again, how never to save twice, and where the key may live. The table below lists them.

Install

Open a in your project's folder and run this. downloads the package.

terminal
npm install @zimmerstack/connect
Runs on
20 or newer, on a server. It refuses to start in a browser or in a mobile app. Your website calls your server, and your server calls ZimmerStack.
Depends on
Nothing. It is one package, and it installs no other package.
Module format
ES modules and CommonJS, the two ways Node.js loads code. Each has its own types. It loads the same way in Next.js, in Express, in a plain script and in Jest.
The key
The package reads it from the ZIMMERSTACK_CONNECT_KEY. You never type the key into code that you commit.
.env
# .env  (git-ignored; the key never leaves your server)
ZIMMERSTACK_CONNECT_KEY=zsk_test_...

# .env.example  (committed: the name, never a value)
ZIMMERSTACK_CONNECT_KEY=

The file .env holds the key on your computer, and git must ignore it. The file .env.example is committed. It holds the name only, never a value.

Start from a working app

There is a small Next.js app built on this package. It shows four things: the next 14 nights of rooms and prices, a price change, pretend bookings, and the signed .

it with your . Then change it as you like.

Your app has no server?

A page made with Vite, Lovable, Bolt or plain HTML runs in the visitor's browser. Everything in that page runs there too.

Your key can change a hotel's prices on every OTA. So the key must never reach a browser. If it does, one of two things stops you. Both are on purpose.

With the package
The package stops. The page is blank. The browser's console shows ZimmerStackUsageError: … runs on a server only.
With a plain fetch
A plain fetch to the API from a browser fails with Failed to fetch.

The fix is one small file on a server. It holds the key, and your page calls it. Pick the tab for your host.

app/api/hotel/route.ts
// app/api/hotel/route.ts: your page fetches /api/hotel; only this file sees the key.
import { ZimmerStack } from "@zimmerstack/connect";

const zs = new ZimmerStack(); // reads ZIMMERSTACK_CONNECT_KEY on the server

export async function GET() {
  const property = await zs.property.get();
  return Response.json({ name: property.name, currency: property.currency });
}
your page
// In the browser: call YOUR route. No key, no package.
const hotel = await fetch("/api/hotel").then((r) => r.json());

The first calls

Start with a key (zsk_test_). With it, nothing you send reaches an OTA.

A software company
Make the key in the partner portal, under Developers. Not a partner yet? Sign up free.
A developer of one hotel
Ask the hotel's owner for it. The owner makes it in Admin → Developers → API keys.

The first script does four things. It reads the hotel. It loads 14 nights of the grid. It changes one price. Then it waits until the price has landed.

scripts/first-calls.ts
import { ZimmerStackError, addDays } from "@zimmerstack/connect";

import { zs } from "@/lib/zimmerstack";

/** The first calls to make with a new key: which hotel is this, what does it sell, and one price changed. */
export async function firstCalls(): Promise<void> {
  // Which hotel, in which timezone and currency, and what this key may do.
  const property = await zs().property.get();
  console.log(`${property.name}: ${property.currency}, ${property.timezone}, scopes ${property.scopes.join(", ")}`);

  // The grid for the next fortnight: rows are room types with their rate plans, columns are nights.
  const today = new Intl.DateTimeFormat("en-CA", { timeZone: property.timezone }).format(new Date()); // YYYY-MM-DD in the hotel's zone
  const grid = await zs().grid.load(today, addDays(today, 13));
  const plan = grid.rows[0]?.plans[0];
  if (!plan) return console.log("This property has no rate plan yet.");
  console.log(`${plan.ratePlan.name} tonight: ${plan.rate[today] ?? "no price set"}`);

  try {
    // Change one price (major units: 5200 = 5,200.00). Accepted means it is in ZimmerStack's record.
    const [accepted] = await zs().grid.save({ rates: [{ ratePlanId: plan.ratePlan.id, date: addDays(today, 7), rate: 5200 }] });
    if (!accepted) return;
    // On its way to the channels: "landed", or still "pending" after five minutes.
    const batch = await zs().batches.wait(accepted.batchId);
    console.log(`${accepted.acceptedCells} night changed, ${batch.status}`);
  } catch (err) {
    if (!(err instanceof ZimmerStackError)) throw err;
    console.log(`Refused (${err.code}): ${err.message}`); // err.code is stable; err.message is for a person
  }
}

What the package does for you

The API has rules that keep a hotel's prices safe. The package keeps them, so you do not write that code. Two words come up in the table. A is how many requests you may send in a given time. An is a code that stops one change from being saved twice.

  • The API's ruleThe key stays on a server
    What the package doesThe package refuses to start in a browser or in React Native. It sends the key to ZimmerStack only. It never follows a redirect with the key. It never prints the key: not in an error, and not when the client is logged.
  • The API's ruleLimits for each minute
    What the package doesEvery answer carries RateLimit headers. They say what is left of each limit: the key's, the hotel's and your company's. The package reads them and waits before a limit runs out. So you do not get a 429, the answer for too many requests.
  • The API's ruleChanges never go out all at once
    What the package doesThe package sends one hotel's changes one at a time, in the order you made them. With a company key, each hotel has its own queue and its own pace. So one hotel's limit never holds up another hotel. At most four requests run at the same time.
  • The API's ruleTry again only when waiting can help
    What the package doesAfter a 429, the package waits the Retry-After time and sends again: four tries in all. After a 5xx (a problem on our side) or a network failure, it sends again only when that is safe. Safe means a read, or a change that carries an idempotency key. Any other refusal is given to you at once and is never sent again.
  • The API's ruleLimits for each hour and each day
    What the package doesA wait of up to two minutes is waited out. A longer wait is given back to you at once, as an error you may retry, with retryAfterSeconds and freesAt. Requests that would only be refused again are not sent. A request that may wait passes maxWaitSeconds. The package then holds it, and tells onEvent when it lands. The call zs.limits.get() answers every limit and what is left of it.
  • The API's ruleA retry must not save twice
    What the package doesThe package gives every change an idempotency key. It uses the same key again on its own retries. For some requests the server keeps no such record. Such a request is not sent again when its result is unknown.
  • The API's ruleA request has a size
    What the package doesThe package splits a change at 1,000 items or 5,000 cells. It also joins single nights into ranges (grid.save).
  • The API's ruleA refused key is not tried again
    What the package doesAfter API_KEY_INVALID, API_KEY_REVOKED or API_KEY_EXPIRED the package stops calling. So a loop never gets your address locked out.
  • The API's ruleA test must not touch a real hotel
    What the package doesThe package refuses to change anything with a zsk_live_ key while a test runner is running: NODE_ENV=test, Vitest, Jest or node --test.

One thing the package cannot decide for you: when to send. Send what a person changed, when they saved it. Never on a timer. Never when a page loads. Never "to be safe". Rate limits has every limit and what counts for it.

In a Next.js app

The example app has three route handlers on top of that one client. A route handler is a file that answers one address of your own server.

  • grid: the rate grid, a calendar of rooms and prices.
  • channels: a price modifier on one OTA.
  • webhook: bookings that arrive by webhook, from the OTAs and from the hotel's own website.

These files are compiled and run against the built package every time it changes. So they are code that works, not a sketch.

app/api/grid/route.ts · the rate grid
import type { GridEdits } from "@zimmerstack/connect";

import { refusal, zs } from "@/lib/zimmerstack";

// Your own sign-in decides who may call these routes: check it first, in both handlers.

/** GET /api/grid?from=2026-12-01&to=2026-12-14: rows are room types with their rate plans, columns are nights. */
export async function GET(request: Request): Promise<Response> {
  const { searchParams } = new URL(request.url);
  const from = searchParams.get("from");
  const to = searchParams.get("to");
  if (!from || !to) return Response.json({ error: "from and to are required (YYYY-MM-DD)" }, { status: 400 });
  try {
    return Response.json(await zs().grid.load(from, to));
  } catch (err) {
    return refusal(err);
  }
}

/** PUT /api/grid with what the person changed: single nights, only the ones that changed. */
export async function PUT(request: Request): Promise<Response> {
  const edits = (await request.json()) as GridEdits;
  try {
    // Nights are folded into ranges and sent one request per resource. Each answer carries a batchId:
    // the values are in ZimmerStack's record and on their way to the channels.
    const accepted = await zs().grid.save(edits);
    return Response.json({ accepted });
  } catch (err) {
    return refusal(err);
  }
}

The screens that use these routes are yours to build. Build a rate grid explains what each cell means and how a save travels. Set a price modifier on an OTA explains a and when it takes effect.

Room types and rate plans: create, change, delete

A is a kind of room the hotel sells. A is one way to sell it.

  • save creates one. If you sent that before, save changes it.
  • delete takes your own ref or our id. A delete cannot be undone.
  • Both need the catalog:write.
scripts/pms-sync.ts · one at a time, and a delete
// Create a room type, or change it when you sent this ref before. The answer carries our id for it.
const room = await zs().roomTypes.save({ ref: "rt-penthouse", name: "Penthouse", roomCount: 1, adults: 3, children: 1 });

// A rate plan that sells it. defaultRate is its standing price, in major units: 12000 = 12,000.00.
const plan = await zs().ratePlans.save({ ref: "rp-ph-ro", roomTypeRef: "rt-penthouse", name: "Room only", mealPlan: "EP", defaultRate: 12000 });
console.log(room.id, room.action, plan.id, plan.action);

// Delete by your own ref (a string) or by our id (a number). There is no undo, so call it only when a
// person chose to delete. A plan a channel still sells is refused; a room type takes its plans with it.
const gone = await zs().ratePlans.delete("rp-bb");
console.log(gone.id, gone.deleted);

A delete is refused while an OTA still sells that room type or rate plan. Delete a room type and Delete a rate plan say what a delete does, and when it is refused.

Everything it covers

Each row is one job, with the call that does it. In the calls, zs is your client. A note like "from 0.9.0" is the first version of the package that has the call.

  • You want toRead the hotel, and what your key may do
    Callzs.property.get() · zs.properties.list() · zs.forProperty(id)
  • You want toSee every limit and what is left of it (from 0.8.0)
    Callzs.limits.get()
  • You want toFind out what is wrong (from 0.9.0)
    Callnpx @zimmerstack/connect doctor · diagnose() · formatDoctorReport(report)
  • You want toSee what your key did, and which requests were refused (from 0.9.0)
    Callzs.requests.list({ status: "errors" }) · zs.requests.all(query)
  • You want toCheck a pasted key before it is sent anywhere (from 0.9.0)
    CallcheckKey(value)
  • You want toAdd a hotel, or remove one you added (from 0.5.0)
    Callzs.properties.create(hotel) · zs.properties.delete(propertyId, { confirm })
  • You want toLet a hotel connect an OTA (from 0.9.0)
    Callzs.connectLinks.create(body) · .list(query) · .get(linkId) · .revoke(linkId) · isConnectEvent(event)
  • You want toCheck readiness and go live (from 0.9.0)
    Callzs.readiness.get() · zs.readiness.goLive() · { beforeGoLive: true } on a call
  • You want toManage the keys you made on a hotel (from 0.9.0)
    Callzs.hotelKeys.list(propertyId) · .create(propertyId, body) · .rotate(propertyId, keyId) · .revoke(propertyId, keyId, { reason })
  • You want toKeep a value that is shown once (from 0.9.0)
    CallshownOnce(answer) · withoutShownOnce(answer)
  • You want toRead your bills and your hotel quota (from 0.9.0)
    Callzs.billing.get() · zs.billing.invoices() · zs.billing.nextInvoice()
  • You want toOpen a support ticket and follow it (from 0.9.0)
    Callzs.supportTickets.create(body) · .get(ticketId) · .reply(ticketId, message) · .close(ticketId) · .all(query) · isSupportTicketEvent(event)
  • You want toSee if something is wrong on our side (from 0.9.0)
    Callzs.status.get() · isIncidentEvent(event)
  • You want toList, create or change a room type or a rate plan (from 0.5.0)
    Callzs.roomTypes.list() · zs.roomTypes.save(roomType) · zs.ratePlans.list() · zs.ratePlans.save(ratePlan)
  • You want toDelete a room type or a rate plan (by your ref from 0.5.0)
    Callzs.roomTypes.delete(idOrRef) · zs.ratePlans.delete(idOrRef)
  • You want toSend many room types or rate plans at once
    Callzs.catalog.get() · zs.catalog.upsertRoomTypes(body) · zs.catalog.upsertRatePlans(body)
  • You want toDraw and save a grid
    Callzs.grid.load(from, to) · zs.grid.save(edits)
  • You want toRead or set availability, rates or restrictions
    Callzs.availability / zs.rates / zs.restrictions .get({ from, to }) · .set(updates)
  • You want toSee what a change would do, with nothing saved (from 0.9.0)
    Callzs.availability / zs.rates / zs.restrictions .dryRun(updates) · isWritePreview(answer)
  • You want toRead what a change did not do (from 0.9.0)
    CallnoticesOf(accepted) · warningsOf(accepted) · findNotice(accepted, code) · NOTICES
  • You want toClose a room type, and reopen it (from 0.9.0)
    Callzs.availability.close(body) · .reopen(body) · .closeDryRun(body) · .reopenDryRun(body)
  • You want toExplain one night (from 0.9.0)
    Callzs.explain.night({ roomTypeId, date })
  • You want toSee a change reach the OTAs
    Callzs.batches.wait(batchId) · zs.batches.get(batchId) · zs.sync.get()
  • You want toSet a price modifier on one OTA
    Callzs.channels.list() · zs.channels.setModifier(channelId, steps) · zs.rates.resend() · channelPrice(rate, steps)
  • You want toSend your own bookings to ZimmerStack
    Callzs.bookings.create() · .get() · .list() · .cancel()
  • You want toReceive OTA bookings
    CallverifyWebhook(rawBody, headers, secret) · zs.channelBookings.all({ since })
  • You want toRead every booking and channel event in order, from where you stopped (from 0.9.0)
    Callzs.events.all({ after }) · zs.events.list({ after }) · isSyncEvent(event) · isDriftEvent(event)
  • You want toManage your webhook endpoints from code (from 0.9.0)
    Callzs.webhookEndpoints.create(body) · .list() · .update(id, body) · .pause(id) · .resume(id) · .rotateSecret(id) · .test(id, body) · .recover(id, since) · .deliveries.list(id)
  • You want toDo money maths with no rounding mistakes (from 0.9.0)
    CalltoAmount(value, decimals) · addAmounts · multiplyAmount · amountFromMinorUnits · amountFromHundredths · formatAmount
  • You want toReceive the hotel's own website bookings (from 0.3.0; a no-show, direct.booking.modified, from 0.6.0)
    CallisWebsiteBookingEvent(event) · isOtaBookingEvent(event) · zs.directBookings.all({ since }) · .list() · .get()
  • You want toCancel a website booking, with its refund (from 0.4.0)
    Callzs.directBookings.cancel(bookingId, { refund, reason })
  • You want toMake a test booking from an OTA or the website, a no-show, or an OTA problem
    Callzs.sandbox.bookings.create() · .modify() · .cancel() · .noShow() · zs.sandbox.syncEvents.create()
  • You want toMake the sandbox's pretend channel fail (from 0.9.0)
    Callzs.sandbox.faults.set(body) · .get() · .clear()
  • You want toAnything else in the contract
    Callzs.request("GET /sync")

A software company's company key

A works for many hotels. So every call must name one hotel. In a plain request, that is the header.

  • A test company key works for your sandboxes. While you have one sandbox, the package finds it by itself. So the first calls above work with no change.
  • With several sandboxes, name one.
  • A live key never guesses. Always name the hotel.
  • An app that serves one hotel can name it once: ZIMMERSTACK_PROPERTY_ID=61 in the environment, or new ZimmerStack({ propertyId: 61 }).
one client, many hotels
const { properties } = await zs().properties.list();   // the hotels this key may act on

for (const property of properties) {
  const hotel = zs().forProperty(property.id);         // the same client and pace, acting on one hotel
  const sync = await hotel.sync.get();
  console.log(property.name, sync.rates.dirtyCells);
}

Publishing your app

  • Put ZIMMERSTACK_CONNECT_KEY (and ZIMMERSTACK_WEBHOOK_SECRET) in your host's environment settings, marked secret. Never put them in the .
  • A key can have an . Put your server's outgoing addresses in it. Keys and scopes says how.
  • Some hosts have no fixed address: Vercel, Netlify, Replit and most platforms. On such a host, leave the allowlist empty while you build. Before you go live, do one of two things. Set the allowlist to your server's fixed outgoing addresses. Or send your calls through a fixed-egress proxy, and set the allowlist to the proxy's address. A fixed-egress proxy is a service that sends your requests out from one address that never changes.
  • On a serverless host, a request handler must answer within seconds. Never call zs.batches.wait() inside one. Show the id, and read zs.sync.get() later.
  • A serverless function keeps nothing between two calls. With no database yet, read bookings back with zs.channelBookings.list(). Do not keep what the webhook sent in memory.
  • On Next.js 16 with cacheComponents (the default for a new app), a page that reads the API calls await connection() inside a <Suspense> boundary. Do not use export const dynamic.

When the API says no

When the API refuses a request, the package throws an error. The error has four parts.

a refusal
import { ZimmerStackError } from "@zimmerstack/connect";

try {
  await zs().rates.set(updates);
} catch (err) {
  if (!(err instanceof ZimmerStackError)) throw err;
  err.code;               // stable: RATE_OUT_OF_BAND, SCOPE_MISSING, RATE_LIMITED, …  branch on this
  err.message;            // a sentence for the person in front of the screen: show it
  err.retryAfterSeconds;  // when a budget refused: when to try again
  err.retryable;          // false = a verdict on the request. Fix it; never send it again.
}
err.code
A short code that never changes, like RATE_OUT_OF_BAND, SCOPE_MISSING or RATE_LIMITED. Let your code decide by this.
err.message
A sentence for the person at the screen. Show it.
err.retryAfterSeconds
Set when a limit refused the request. It says how many seconds to wait.
err.retryable
false means the request itself is wrong. Fix it, and never send it again as it is.

The package has already waited and tried again where that could help. Do not put its calls inside a retry loop of your own. Every code is on Errors.

For your coding agent

A is an AI program that writes code for you. The package carries a rules file for it, named . It says four things: where the key lives, what the package already handles, when a change is allowed, and a checklist for the end. It is made from the same contract as this site.

terminal
# The package ships its own rules file. APPEND it where your agent reads rules
# (Next.js and other tools write their own AGENTS.md: never copy over it):
cat node_modules/@zimmerstack/connect/AGENTS.md >> AGENTS.md

# Claude Code reads CLAUDE.md; one line imports it:
printf '\n@AGENTS.md\n' >> CLAUDE.md

Build with an AI agent has more: the rules for the API itself, and the whole reference in one file.

An MCP server, so the agent can look things up

The package also carries an . Connect it to your coding agent. Then the agent can do three things:

  • read the rules;
  • look up any part of the API in the contract;
  • try a call on your sandbox, before it writes the code that makes the call.
  • Toolzimmerstack_rules
    What the agent getsThe rules for building on the API: the key, pacing, money and dates, and a checklist for the end.
  • Toolzimmerstack_reference
    What the agent getsAny request, type, limit or error code, with its sample and the package's call for it.
  • Toolzimmerstack_sandbox_read
    What the agent getsOne read on your sandbox: real ids and real shapes.
  • Toolzimmerstack_sandbox_write
    What the agent getsOne change on your sandbox, to try a body before writing the code that sends it.
  • Toolzimmerstack_doctor
    What the agent getsThe doctor's checks on your sandbox key: what is wrong, and what to do about it.
  • Toolzimmerstack_sandbox_limits
    What the agent getsEvery limit of the key and how full it is: the size a real job must fit in.
  • Toolzimmerstack_sandbox_events
    What the agent getsThe sandbox's event log, in order, from a sequence number: the exact body your server gets.
  • Toolzimmerstack_sandbox_simulate
    What the agent getsOne real event of any type on your sandbox: a booking arriving, changing, cancelled, a no-show, an OTA problem and its end.
  • Toolzimmerstack_sandbox_dry_run
    What the agent getsWhat a change would do on your sandbox, with nothing saved, and its notices.
  • Toolzimmerstack_sandbox_explain
    What the agent getsOne night of one room type on your sandbox, explained.
  • Toolzimmerstack_sandbox_close
    What the agent getsClose a room type everywhere on your sandbox, or reopen it.
  • Toolzimmerstack_sandbox_fault
    What the agent getsMake your sandbox's pretend channel refuse a price, slow down or go down, to try the code that handles it.
terminal
# Claude Code
claude mcp add zimmerstack -- npx -y @zimmerstack/connect mcp

Not on Node?

The API is plain HTTPS and . Any language can call it.

Words on this page

Package
Ready-made code you install and use, so you write less yourself.
Node.js
A free program that runs JavaScript code outside a browser, for example on a server.
npm
The public store of packages for Node.js, and the command that installs them.
Terminal
A window where you type commands for your computer. Also called the command line.
Server
A computer that runs your software all the time and can be reached over the internet.
Request
One message your software sends to the API.
Environment variable
A named value kept in your server's settings, outside your code. It is a safe place for a key.
Sandbox
Your test hotel. It works like a real hotel, but no OTA can see it and it costs nothing.
Test key
A key that starts with zsk_test_. It works only on a sandbox, so it can never change a real hotel.
Company key
The key of a software company. One key works for all the hotels of that company.
X-ZS-Property
The header that tells ZimmerStack which hotel a request is for. Its value is the property id.
OTA
Online travel agency: a website that sells hotel rooms, like Booking.com, MakeMyTrip or Agoda. Learn more
Webhook
A message ZimmerStack sends to your server when something happens, like a new booking.
Deploy
To put a new version of your software on your server.
Serverless
A kind of hosting that runs your code only when a request comes, like Vercel or Netlify.
Repository
The folder that holds your project's code and its history. Many teams keep it on GitHub.
Revoke
To switch a key or a link off for good.
Allowlist
A list of internet addresses a key may be used from. From any other address the key is refused.
Rate limit
How many requests you may send in a minute, an hour or a day.
Idempotency key
A code you choose and send with an update. If the same update is sent twice by mistake, it is done only once.
Batch
One update you sent. It gets an id (batchId), so you can ask later if it reached the OTAs.
Room type
A kind of room the hotel sells, like Deluxe Room or Family Suite. A hotel can have 12 rooms of one room type.
Rate plan
One way to sell a room type, with its own price. For example Room only, or With breakfast.
Ref
Your own name or id for a room type or a rate plan. You choose it, and ZimmerStack remembers it.
Scope
One permission of a key. For example ari:write lets the key update availability, rates and restrictions.
Channel modifier
A rule on one OTA. It raises or lowers every price that goes to that OTA, like 10% higher. You still send one price.
Coding agent
An AI program that writes code for you when you tell it what to build, like Claude Code, Cursor or Codex. Learn more
AGENTS.md
A text file of rules in your project. A coding agent reads it before it writes code.
MCP server
A small helper program that a coding agent connects to. It gives the agent extra tools. Learn more
JSON
A simple text format for data, made of names and values inside { }.

Routes, samples, limits and codes on this page come from the API's public contract, read live, Fri, 04 Dec 2026 23:28:35 UTC.