@zimmerstack/connect 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -3
- package/README.md +22 -8
- package/dist/cjs/client.js +57 -7
- package/dist/cjs/generated.d.ts +2 -2
- package/dist/cjs/generated.js +1 -1
- package/dist/esm/client.js +57 -7
- package/dist/esm/generated.d.ts +2 -2
- package/dist/esm/generated.js +1 -1
- package/dist/esm/mcp/reference.generated.js +5 -5
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -12,12 +12,20 @@ https://docs.zimmerstack.com/llms-full.txt
|
|
|
12
12
|
file that is committed, a log line, an error message, a URL, a test fixture or anything a browser
|
|
13
13
|
or a mobile app receives. Never print it. `new ZimmerStack()` reads it by itself.
|
|
14
14
|
- The package refuses to start in a browser or in React Native. Do not work around that: the
|
|
15
|
-
person's own frontend calls their own server, and the server calls ZimmerStack.
|
|
15
|
+
person's own frontend calls their own server, and the server calls ZimmerStack. Never put the key in
|
|
16
|
+
a variable a bundler sends to the browser (`VITE_`, `NEXT_PUBLIC_`, `REACT_APP_`, `EXPO_PUBLIC_`).
|
|
17
|
+
An app with no server gets the smallest one: https://docs.zimmerstack.com/sdk#no-server. A plain
|
|
18
|
+
`fetch` from a browser is refused too ("Failed to fetch"), on purpose.
|
|
16
19
|
- `zsk_test_…` is a sandbox: nothing reaches a channel. Build and test with it. `zsk_live_…` is a real
|
|
17
20
|
hotel. The package refuses to WRITE with a live key under a test runner; never switch that off to
|
|
18
21
|
make a test pass.
|
|
19
22
|
- A software vendor's company key acts on one hotel at a time: `zs.forProperty(propertyId)`
|
|
20
|
-
(`zs.properties.list()` names them)
|
|
23
|
+
(`zs.properties.list()` names them), or `ZIMMERSTACK_PROPERTY_ID` in the environment for an app that
|
|
24
|
+
serves one hotel. A test company key that reaches one sandbox finds it by itself; with several,
|
|
25
|
+
name one; a live key never guesses.
|
|
26
|
+
- No key yet: a software company signs up, free, at https://www.zimmerstack.com/partners/pms-companies#join
|
|
27
|
+
and makes test keys in the partner portal (Developers); a hotel's owner makes one in Admin →
|
|
28
|
+
Developers → API keys.
|
|
21
29
|
|
|
22
30
|
## Let the package pace; never work around it
|
|
23
31
|
|
|
@@ -36,7 +44,7 @@ https://docs.zimmerstack.com/llms-full.txt
|
|
|
36
44
|
|
|
37
45
|
## Money and dates
|
|
38
46
|
|
|
39
|
-
- A price is SENT in major units (4500 =
|
|
47
|
+
- A price is SENT in major units (4500 = 4,500.00 of the hotel's own currency) with that currency, and READ in minor
|
|
40
48
|
units (`rateMinor`). `zs.grid.load` gives major units; `zs.grid.save` takes them.
|
|
41
49
|
- A date is a plain `YYYY-MM-DD` calendar day in the hotel's timezone. Never build one with
|
|
42
50
|
`new Date()` arithmetic in local time; use `eachDate(from, to)`.
|
package/README.md
CHANGED
|
@@ -13,10 +13,17 @@ npm install @zimmerstack/connect
|
|
|
13
13
|
|
|
14
14
|
Node 20 or newer. **Server only**: the key can change a hotel's prices on every channel, so the
|
|
15
15
|
package refuses to start in a browser or a mobile app. Your frontend calls your server; your server
|
|
16
|
-
calls ZimmerStack.
|
|
16
|
+
calls ZimmerStack. Your app has no server (a Vite, Lovable or Bolt page)? The docs show the smallest
|
|
17
|
+
one: <https://docs.zimmerstack.com/sdk#no-server>. Never put the key in a `VITE_` or `NEXT_PUBLIC_`
|
|
18
|
+
variable: those are sent to every visitor's browser.
|
|
17
19
|
|
|
18
20
|
## Start
|
|
19
21
|
|
|
22
|
+
**Get a test key.** A software company: [sign up free](https://www.zimmerstack.com/partners/pms-companies#join)
|
|
23
|
+
(your sandbox is made at sign-up), then the [partner portal](https://partner.zimmerstack.com/login) →
|
|
24
|
+
Developers → Create key. A hotel's own developer: the owner makes one in Admin → Developers → API keys.
|
|
25
|
+
A working app to start from: <https://github.com/zimmerstack/connect-starter>.
|
|
26
|
+
|
|
20
27
|
Put the key in the environment, never in code:
|
|
21
28
|
|
|
22
29
|
```bash
|
|
@@ -35,7 +42,7 @@ const grid = await zs.grid.load("2026-12-01", "2026-12-14");
|
|
|
35
42
|
// Save what a person changed. Nights are folded into ranges; a large save is split for you.
|
|
36
43
|
const accepted = await zs.grid.save({
|
|
37
44
|
rates: [
|
|
38
|
-
{ ratePlanId: 901, date: "2026-12-24", rate: 5200 }, // major units: 5200 =
|
|
45
|
+
{ ratePlanId: 901, date: "2026-12-24", rate: 5200 }, // major units, the hotel's currency: 5200 = 5,200.00
|
|
39
46
|
{ ratePlanId: 901, date: "2026-12-25", rate: 5200 },
|
|
40
47
|
],
|
|
41
48
|
restrictions: [{ ratePlanId: 901, date: "2026-12-31", stopSell: true }], // close a night; never a zero price
|
|
@@ -118,12 +125,19 @@ never from a loop, a timer or a seed script.
|
|
|
118
125
|
|
|
119
126
|
## A software vendor's company key
|
|
120
127
|
|
|
128
|
+
A company key reaches many hotels, so every call names one. A **test** company key reaches your
|
|
129
|
+
sandboxes; while you have one, the client finds it by itself and the Start example works unchanged.
|
|
130
|
+
With several, name one. A live key never guesses.
|
|
131
|
+
|
|
121
132
|
```ts
|
|
122
133
|
const { properties } = await zs.properties.list();
|
|
123
134
|
const hotel = zs.forProperty(properties[0]!.id); // the same client and pace, acting on one hotel
|
|
124
135
|
await hotel.grid.load("2026-12-01", "2026-12-14");
|
|
125
136
|
```
|
|
126
137
|
|
|
138
|
+
An app that serves one hotel can name it once instead: `ZIMMERSTACK_PROPERTY_ID=61` in the
|
|
139
|
+
environment (or `new ZimmerStack({ propertyId: 61 })`).
|
|
140
|
+
|
|
127
141
|
## When the API says no
|
|
128
142
|
|
|
129
143
|
```ts
|
|
@@ -165,7 +179,7 @@ minutes: answer 400 and do not act on the body.
|
|
|
165
179
|
```ts
|
|
166
180
|
new ZimmerStack({
|
|
167
181
|
apiKey, // default: process.env.ZIMMERSTACK_CONNECT_KEY
|
|
168
|
-
propertyId, // company keys: the hotel to act on (or use forProperty)
|
|
182
|
+
propertyId, // company keys: the hotel to act on; default ZIMMERSTACK_PROPERTY_ID (or use forProperty)
|
|
169
183
|
timeoutMs: 30_000, // one attempt
|
|
170
184
|
maxRetries: 3, // of what may pass later
|
|
171
185
|
maxWaitSeconds: 120, // the longest it waits for a budget before giving the refusal back
|
|
@@ -176,17 +190,17 @@ new ZimmerStack({
|
|
|
176
190
|
|
|
177
191
|
## Testing your integration
|
|
178
192
|
|
|
179
|
-
Use a `zsk_test_` key (
|
|
180
|
-
a fake `fetch`. Nothing you do with a test key reaches a channel, and `zs.sandbox.bookings.create`
|
|
193
|
+
Use a `zsk_test_` key (a software company: the partner portal → Developers; a hotel's owner: Admin →
|
|
194
|
+
Developers → API keys), or pass a fake `fetch`. Nothing you do with a test key reaches a channel, and `zs.sandbox.bookings.create`
|
|
181
195
|
sends your webhook endpoint a real delivery.
|
|
182
196
|
|
|
183
197
|
## For AI coding agents
|
|
184
198
|
|
|
185
|
-
The package ships its own rules file.
|
|
186
|
-
package follows it:
|
|
199
|
+
The package ships its own rules file. Add it to the repository's rules so the agent building on this
|
|
200
|
+
package follows it. Append, never copy over: Next.js and other tools write their own `AGENTS.md`.
|
|
187
201
|
|
|
188
202
|
```bash
|
|
189
|
-
|
|
203
|
+
cat node_modules/@zimmerstack/connect/AGENTS.md >> AGENTS.md # or >> CLAUDE.md
|
|
190
204
|
```
|
|
191
205
|
|
|
192
206
|
The whole API reference in one file an agent can read: <https://docs.zimmerstack.com/llms-full.txt>.
|
package/dist/cjs/client.js
CHANGED
|
@@ -66,10 +66,14 @@ class Core {
|
|
|
66
66
|
#writeTail = Promise.resolve();
|
|
67
67
|
#dead;
|
|
68
68
|
catalogs = new Map();
|
|
69
|
+
/** A sandbox company key's one hotel, found once when a call asked for a hotel and none was named. */
|
|
70
|
+
soleSandboxProperty;
|
|
71
|
+
/** The same, once known: sent with every later call that names no hotel, so the refusal is met once. */
|
|
72
|
+
soleSandboxId;
|
|
69
73
|
constructor(options) {
|
|
70
74
|
const g = globalThis;
|
|
71
75
|
if ((typeof g.window !== "undefined" && typeof g.window.document !== "undefined") || g.navigator?.product === "ReactNative") {
|
|
72
|
-
throw new errors_ts_1.ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server.");
|
|
76
|
+
throw new errors_ts_1.ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server (https://docs.zimmerstack.com/sdk#no-server shows the smallest one). If a key was built into this page, anyone can read it now: revoke it and make a new one.");
|
|
73
77
|
}
|
|
74
78
|
const key = options.apiKey ?? env("ZIMMERSTACK_CONNECT_KEY");
|
|
75
79
|
if (!key)
|
|
@@ -274,10 +278,16 @@ class ZimmerStack {
|
|
|
274
278
|
handoff = undefined;
|
|
275
279
|
this.#core = shared ?? new Core(options);
|
|
276
280
|
this.mode = this.#core.mode;
|
|
277
|
-
|
|
281
|
+
// A company key's hotel: the option, else (for a client made from the environment) ZIMMERSTACK_PROPERTY_ID.
|
|
282
|
+
const fromEnv = shared ? undefined : env("ZIMMERSTACK_PROPERTY_ID")?.trim();
|
|
283
|
+
if (fromEnv && !/^[1-9]\d*$/.test(fromEnv)) {
|
|
284
|
+
throw new errors_ts_1.ZimmerStackUsageError("ZIMMERSTACK_PROPERTY_ID must be a property's numeric id (zs.properties.list() names them)");
|
|
285
|
+
}
|
|
286
|
+
const propertyId = options.propertyId ?? (fromEnv ? Number(fromEnv) : undefined);
|
|
287
|
+
if (propertyId !== undefined && (!Number.isInteger(propertyId) || propertyId <= 0)) {
|
|
278
288
|
throw new errors_ts_1.ZimmerStackUsageError("propertyId must be a property's numeric id (zs.properties.list() names them)");
|
|
279
289
|
}
|
|
280
|
-
this.propertyId =
|
|
290
|
+
this.propertyId = propertyId;
|
|
281
291
|
}
|
|
282
292
|
/**
|
|
283
293
|
* A software vendor's company key: the same client, acting on one hotel. Shares this client's pace,
|
|
@@ -327,8 +337,9 @@ class ZimmerStack {
|
|
|
327
337
|
if (value !== undefined && value !== null)
|
|
328
338
|
url.searchParams.set(name, String(value));
|
|
329
339
|
const headers = { authorization: this.#core.authorization(), accept: "application/json", "user-agent": `zimmerstack-connect-node/${generated_ts_1.SDK_VERSION}` };
|
|
330
|
-
|
|
331
|
-
|
|
340
|
+
const hotel = this.propertyId ?? (operation === "GET /properties" ? undefined : this.#core.soleSandboxId);
|
|
341
|
+
if (hotel)
|
|
342
|
+
headers[generated_ts_1.PROPERTY_HEADER] = String(hotel);
|
|
332
343
|
const body = args.body === undefined ? undefined : JSON.stringify(args.body);
|
|
333
344
|
if (body !== undefined)
|
|
334
345
|
headers["content-type"] = "application/json";
|
|
@@ -339,8 +350,47 @@ class ZimmerStack {
|
|
|
339
350
|
}
|
|
340
351
|
headers[generated_ts_1.IDEMPOTENCY_HEADER] = args.idempotencyKey ?? crypto.randomUUID();
|
|
341
352
|
}
|
|
342
|
-
const
|
|
343
|
-
|
|
353
|
+
const wire = { operation, method, url, headers, body, write: method !== "GET", resendable: method === "GET" || meta.idempotent, signal: args.signal };
|
|
354
|
+
try {
|
|
355
|
+
return (await this.#core.send(wire));
|
|
356
|
+
}
|
|
357
|
+
catch (err) {
|
|
358
|
+
// A company key that named no hotel. The API refused before anything ran, so sending again is safe.
|
|
359
|
+
if (!(err instanceof errors_ts_1.ZimmerStackError) || err.code !== "PROPERTY_REQUIRED" || this.propertyId !== undefined)
|
|
360
|
+
throw err;
|
|
361
|
+
const sole = await this.#soleSandboxProperty(args.signal);
|
|
362
|
+
if (sole === undefined) {
|
|
363
|
+
throw new errors_ts_1.ZimmerStackError({
|
|
364
|
+
status: err.status,
|
|
365
|
+
code: err.code,
|
|
366
|
+
message: "This is a company key: say which hotel each call acts on. Use zs.forProperty(id), new ZimmerStack({ propertyId }) or the environment variable ZIMMERSTACK_PROPERTY_ID; zs.properties.list() names the hotels this key reaches.",
|
|
367
|
+
operation,
|
|
368
|
+
details: err.details,
|
|
369
|
+
retryable: false,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
// The same request (same idempotency key) naming the hotel, on its own copy of the headers.
|
|
373
|
+
return (await this.#core.send({ ...wire, headers: { ...headers, [generated_ts_1.PROPERTY_HEADER]: String(sole) } }));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The one hotel a SANDBOX company key reaches (its sandbox), so the first call of a new integration works
|
|
378
|
+
* without naming it. A live key never guesses: a hotel it acts on is always named.
|
|
379
|
+
*/
|
|
380
|
+
#soleSandboxProperty(signal) {
|
|
381
|
+
if (this.mode !== "test")
|
|
382
|
+
return Promise.resolve(undefined);
|
|
383
|
+
this.#core.soleSandboxProperty ??= this.request("GET /properties", { signal })
|
|
384
|
+
.then((list) => {
|
|
385
|
+
const only = list.keyKind === "company" && list.properties.length === 1 && list.properties[0].sandbox ? list.properties[0].id : undefined;
|
|
386
|
+
this.#core.soleSandboxId = only;
|
|
387
|
+
return only;
|
|
388
|
+
})
|
|
389
|
+
.catch(() => {
|
|
390
|
+
this.#core.soleSandboxProperty = undefined; // a failed lookup is asked again next time
|
|
391
|
+
return undefined;
|
|
392
|
+
});
|
|
393
|
+
return this.#core.soleSandboxProperty;
|
|
344
394
|
}
|
|
345
395
|
/* ── which hotel ── */
|
|
346
396
|
properties = {
|
package/dist/cjs/generated.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
|
|
2
|
-
export declare const SDK_VERSION = "0.
|
|
2
|
+
export declare const SDK_VERSION = "0.2.0";
|
|
3
3
|
/** Where the API lives. The key is sent nowhere else. */
|
|
4
4
|
export declare const API_ORIGIN = "https://api.zimmerstack.com";
|
|
5
5
|
export declare const API_PREFIX = "/api/v1/connect-api/v1";
|
|
@@ -166,7 +166,7 @@ export interface RoomTypesUpsert {
|
|
|
166
166
|
ref: string;
|
|
167
167
|
/** Shown to the owner and sent to the channel manager as the title */
|
|
168
168
|
name: string;
|
|
169
|
-
/** Sellable rooms of this type.
|
|
169
|
+
/** Sellable rooms of this type. On a channel-manager-only hotel a later change is written too, to the channel manager first (its count caps what the channels sell); a count below the rooms holding upcoming stays is refused. On a hotel that runs our PMS the count comes from its room list and a different value is not written (the answer's notice says so) */
|
|
170
170
|
roomCount: number;
|
|
171
171
|
/** Most adults one room takes */
|
|
172
172
|
adults: number;
|
package/dist/cjs/generated.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.OPERATIONS = exports.MODIFIER_TAKES_EFFECT = exports.SCOPES = exports.ERROR_CODES = exports.LIMITS = exports.PROPERTY_HEADER = exports.IDEMPOTENCY_HEADER = exports.API_PREFIX = exports.API_ORIGIN = exports.SDK_VERSION = void 0;
|
|
6
6
|
/** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
|
|
7
|
-
exports.SDK_VERSION = "0.
|
|
7
|
+
exports.SDK_VERSION = "0.2.0";
|
|
8
8
|
/** Where the API lives. The key is sent nowhere else. */
|
|
9
9
|
exports.API_ORIGIN = "https://api.zimmerstack.com";
|
|
10
10
|
exports.API_PREFIX = "/api/v1/connect-api/v1";
|
package/dist/esm/client.js
CHANGED
|
@@ -63,10 +63,14 @@ class Core {
|
|
|
63
63
|
#writeTail = Promise.resolve();
|
|
64
64
|
#dead;
|
|
65
65
|
catalogs = new Map();
|
|
66
|
+
/** A sandbox company key's one hotel, found once when a call asked for a hotel and none was named. */
|
|
67
|
+
soleSandboxProperty;
|
|
68
|
+
/** The same, once known: sent with every later call that names no hotel, so the refusal is met once. */
|
|
69
|
+
soleSandboxId;
|
|
66
70
|
constructor(options) {
|
|
67
71
|
const g = globalThis;
|
|
68
72
|
if ((typeof g.window !== "undefined" && typeof g.window.document !== "undefined") || g.navigator?.product === "ReactNative") {
|
|
69
|
-
throw new ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server.");
|
|
73
|
+
throw new ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server (https://docs.zimmerstack.com/sdk#no-server shows the smallest one). If a key was built into this page, anyone can read it now: revoke it and make a new one.");
|
|
70
74
|
}
|
|
71
75
|
const key = options.apiKey ?? env("ZIMMERSTACK_CONNECT_KEY");
|
|
72
76
|
if (!key)
|
|
@@ -271,10 +275,16 @@ export class ZimmerStack {
|
|
|
271
275
|
handoff = undefined;
|
|
272
276
|
this.#core = shared ?? new Core(options);
|
|
273
277
|
this.mode = this.#core.mode;
|
|
274
|
-
|
|
278
|
+
// A company key's hotel: the option, else (for a client made from the environment) ZIMMERSTACK_PROPERTY_ID.
|
|
279
|
+
const fromEnv = shared ? undefined : env("ZIMMERSTACK_PROPERTY_ID")?.trim();
|
|
280
|
+
if (fromEnv && !/^[1-9]\d*$/.test(fromEnv)) {
|
|
281
|
+
throw new ZimmerStackUsageError("ZIMMERSTACK_PROPERTY_ID must be a property's numeric id (zs.properties.list() names them)");
|
|
282
|
+
}
|
|
283
|
+
const propertyId = options.propertyId ?? (fromEnv ? Number(fromEnv) : undefined);
|
|
284
|
+
if (propertyId !== undefined && (!Number.isInteger(propertyId) || propertyId <= 0)) {
|
|
275
285
|
throw new ZimmerStackUsageError("propertyId must be a property's numeric id (zs.properties.list() names them)");
|
|
276
286
|
}
|
|
277
|
-
this.propertyId =
|
|
287
|
+
this.propertyId = propertyId;
|
|
278
288
|
}
|
|
279
289
|
/**
|
|
280
290
|
* A software vendor's company key: the same client, acting on one hotel. Shares this client's pace,
|
|
@@ -324,8 +334,9 @@ export class ZimmerStack {
|
|
|
324
334
|
if (value !== undefined && value !== null)
|
|
325
335
|
url.searchParams.set(name, String(value));
|
|
326
336
|
const headers = { authorization: this.#core.authorization(), accept: "application/json", "user-agent": `zimmerstack-connect-node/${SDK_VERSION}` };
|
|
327
|
-
|
|
328
|
-
|
|
337
|
+
const hotel = this.propertyId ?? (operation === "GET /properties" ? undefined : this.#core.soleSandboxId);
|
|
338
|
+
if (hotel)
|
|
339
|
+
headers[PROPERTY_HEADER] = String(hotel);
|
|
329
340
|
const body = args.body === undefined ? undefined : JSON.stringify(args.body);
|
|
330
341
|
if (body !== undefined)
|
|
331
342
|
headers["content-type"] = "application/json";
|
|
@@ -336,8 +347,47 @@ export class ZimmerStack {
|
|
|
336
347
|
}
|
|
337
348
|
headers[IDEMPOTENCY_HEADER] = args.idempotencyKey ?? crypto.randomUUID();
|
|
338
349
|
}
|
|
339
|
-
const
|
|
340
|
-
|
|
350
|
+
const wire = { operation, method, url, headers, body, write: method !== "GET", resendable: method === "GET" || meta.idempotent, signal: args.signal };
|
|
351
|
+
try {
|
|
352
|
+
return (await this.#core.send(wire));
|
|
353
|
+
}
|
|
354
|
+
catch (err) {
|
|
355
|
+
// A company key that named no hotel. The API refused before anything ran, so sending again is safe.
|
|
356
|
+
if (!(err instanceof ZimmerStackError) || err.code !== "PROPERTY_REQUIRED" || this.propertyId !== undefined)
|
|
357
|
+
throw err;
|
|
358
|
+
const sole = await this.#soleSandboxProperty(args.signal);
|
|
359
|
+
if (sole === undefined) {
|
|
360
|
+
throw new ZimmerStackError({
|
|
361
|
+
status: err.status,
|
|
362
|
+
code: err.code,
|
|
363
|
+
message: "This is a company key: say which hotel each call acts on. Use zs.forProperty(id), new ZimmerStack({ propertyId }) or the environment variable ZIMMERSTACK_PROPERTY_ID; zs.properties.list() names the hotels this key reaches.",
|
|
364
|
+
operation,
|
|
365
|
+
details: err.details,
|
|
366
|
+
retryable: false,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
// The same request (same idempotency key) naming the hotel, on its own copy of the headers.
|
|
370
|
+
return (await this.#core.send({ ...wire, headers: { ...headers, [PROPERTY_HEADER]: String(sole) } }));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* The one hotel a SANDBOX company key reaches (its sandbox), so the first call of a new integration works
|
|
375
|
+
* without naming it. A live key never guesses: a hotel it acts on is always named.
|
|
376
|
+
*/
|
|
377
|
+
#soleSandboxProperty(signal) {
|
|
378
|
+
if (this.mode !== "test")
|
|
379
|
+
return Promise.resolve(undefined);
|
|
380
|
+
this.#core.soleSandboxProperty ??= this.request("GET /properties", { signal })
|
|
381
|
+
.then((list) => {
|
|
382
|
+
const only = list.keyKind === "company" && list.properties.length === 1 && list.properties[0].sandbox ? list.properties[0].id : undefined;
|
|
383
|
+
this.#core.soleSandboxId = only;
|
|
384
|
+
return only;
|
|
385
|
+
})
|
|
386
|
+
.catch(() => {
|
|
387
|
+
this.#core.soleSandboxProperty = undefined; // a failed lookup is asked again next time
|
|
388
|
+
return undefined;
|
|
389
|
+
});
|
|
390
|
+
return this.#core.soleSandboxProperty;
|
|
341
391
|
}
|
|
342
392
|
/* ── which hotel ── */
|
|
343
393
|
properties = {
|
package/dist/esm/generated.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
|
|
2
|
-
export declare const SDK_VERSION = "0.
|
|
2
|
+
export declare const SDK_VERSION = "0.2.0";
|
|
3
3
|
/** Where the API lives. The key is sent nowhere else. */
|
|
4
4
|
export declare const API_ORIGIN = "https://api.zimmerstack.com";
|
|
5
5
|
export declare const API_PREFIX = "/api/v1/connect-api/v1";
|
|
@@ -166,7 +166,7 @@ export interface RoomTypesUpsert {
|
|
|
166
166
|
ref: string;
|
|
167
167
|
/** Shown to the owner and sent to the channel manager as the title */
|
|
168
168
|
name: string;
|
|
169
|
-
/** Sellable rooms of this type.
|
|
169
|
+
/** Sellable rooms of this type. On a channel-manager-only hotel a later change is written too, to the channel manager first (its count caps what the channels sell); a count below the rooms holding upcoming stays is refused. On a hotel that runs our PMS the count comes from its room list and a different value is not written (the answer's notice says so) */
|
|
170
170
|
roomCount: number;
|
|
171
171
|
/** Most adults one room takes */
|
|
172
172
|
adults: number;
|
package/dist/esm/generated.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// GENERATED by scripts/generate.mjs from the Connect API's public contract (ZimmerStack Connect API v1).
|
|
2
2
|
// Do not edit: change the contract, then run `pnpm --dir apps/connect-sdk run generate`.
|
|
3
3
|
/** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
|
|
4
|
-
export const SDK_VERSION = "0.
|
|
4
|
+
export const SDK_VERSION = "0.2.0";
|
|
5
5
|
/** Where the API lives. The key is sent nowhere else. */
|
|
6
6
|
export const API_ORIGIN = "https://api.zimmerstack.com";
|
|
7
7
|
export const API_PREFIX = "/api/v1/connect-api/v1";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Do not edit: change the contract, then run `pnpm --dir apps/connect-sdk run generate`.
|
|
3
3
|
// What the package's MCP server (src/mcp) answers lookups from. It is not part of the client's own exports.
|
|
4
4
|
/** The rules file this package ships (AGENTS.md), for the zimmerstack_rules tool. */
|
|
5
|
-
export const RULES = "# Building on @zimmerstack/connect: rules for coding agents\n\nYou are writing code that calls the ZimmerStack Connect API through its official package. A write\nthrough it changes a real hotel's prices and rooms on every booking site it sells on. The package\nenforces most of the API's rules for you; this file is the rest. Keep it in the repository (as\nAGENTS.md or CLAUDE.md) and follow it. The whole API reference, in one file an agent can read:\nhttps://docs.zimmerstack.com/llms-full.txt\n\n## The key\n\n- It lives in the environment variable `ZIMMERSTACK_CONNECT_KEY` on a server. Never write it into a\n file that is committed, a log line, an error message, a URL, a test fixture or anything a browser\n or a mobile app receives. Never print it. `new ZimmerStack()` reads it by itself.\n- The package refuses to start in a browser or in React Native. Do not work around that: the\n person's own frontend calls their own server, and the server calls ZimmerStack.\n- `zsk_test_…` is a sandbox: nothing reaches a channel. Build and test with it. `zsk_live_…` is a real\n hotel. The package refuses to WRITE with a live key under a test runner; never switch that off to\n make a test pass.\n- A software vendor's company key acts on one hotel at a time: `zs.forProperty(propertyId)`\n (`zs.properties.list()` names them).\n\n## Let the package pace; never work around it\n\n- It reads the `RateLimit` header and slows down before a budget runs out, sends writes one at a\n time, retries only what passes with time (429, 5xx, a network failure) under the same idempotency\n key, and gives up with a `ZimmerStackError` otherwise. Do not wrap its calls in your own retry\n loop, and never resend a 4xx other than 429: it is a verdict on the request. Fix the request.\n- Per minute: 120 requests and 30 writes per key; 300 and 60 for all of a hotel's keys together.\n A hotel also has budgets per hour and per day that count CHANGED cells (at least 10,000 an hour, 30,000\n a day). Hitting one is `error.code === \"RATE_LIMITED\"` with `error.retryAfterSeconds`: tell the\n person when to try again; do not sleep through an hour.\n- One instance per process (`new ZimmerStack()` once, in a module). Two instances do not share a pace.\n- Never write on a timer, in a loop over all nights, or \"to be safe\". Send what a person changed,\n when they changed it: `zs.grid.save(edits)` folds nights into ranges and splits a large save.\n- Do not poll faster than every 15 seconds (`zs.batches.wait` already does it right), and stop.\n\n## Money and dates\n\n- A price is SENT in major units (4500 =
|
|
5
|
+
export const RULES = "# Building on @zimmerstack/connect: rules for coding agents\n\nYou are writing code that calls the ZimmerStack Connect API through its official package. A write\nthrough it changes a real hotel's prices and rooms on every booking site it sells on. The package\nenforces most of the API's rules for you; this file is the rest. Keep it in the repository (as\nAGENTS.md or CLAUDE.md) and follow it. The whole API reference, in one file an agent can read:\nhttps://docs.zimmerstack.com/llms-full.txt\n\n## The key\n\n- It lives in the environment variable `ZIMMERSTACK_CONNECT_KEY` on a server. Never write it into a\n file that is committed, a log line, an error message, a URL, a test fixture or anything a browser\n or a mobile app receives. Never print it. `new ZimmerStack()` reads it by itself.\n- The package refuses to start in a browser or in React Native. Do not work around that: the\n person's own frontend calls their own server, and the server calls ZimmerStack. Never put the key in\n a variable a bundler sends to the browser (`VITE_`, `NEXT_PUBLIC_`, `REACT_APP_`, `EXPO_PUBLIC_`).\n An app with no server gets the smallest one: https://docs.zimmerstack.com/sdk#no-server. A plain\n `fetch` from a browser is refused too (\"Failed to fetch\"), on purpose.\n- `zsk_test_…` is a sandbox: nothing reaches a channel. Build and test with it. `zsk_live_…` is a real\n hotel. The package refuses to WRITE with a live key under a test runner; never switch that off to\n make a test pass.\n- A software vendor's company key acts on one hotel at a time: `zs.forProperty(propertyId)`\n (`zs.properties.list()` names them), or `ZIMMERSTACK_PROPERTY_ID` in the environment for an app that\n serves one hotel. A test company key that reaches one sandbox finds it by itself; with several,\n name one; a live key never guesses.\n- No key yet: a software company signs up, free, at https://www.zimmerstack.com/partners/pms-companies#join\n and makes test keys in the partner portal (Developers); a hotel's owner makes one in Admin →\n Developers → API keys.\n\n## Let the package pace; never work around it\n\n- It reads the `RateLimit` header and slows down before a budget runs out, sends writes one at a\n time, retries only what passes with time (429, 5xx, a network failure) under the same idempotency\n key, and gives up with a `ZimmerStackError` otherwise. Do not wrap its calls in your own retry\n loop, and never resend a 4xx other than 429: it is a verdict on the request. Fix the request.\n- Per minute: 120 requests and 30 writes per key; 300 and 60 for all of a hotel's keys together.\n A hotel also has budgets per hour and per day that count CHANGED cells (at least 10,000 an hour, 30,000\n a day). Hitting one is `error.code === \"RATE_LIMITED\"` with `error.retryAfterSeconds`: tell the\n person when to try again; do not sleep through an hour.\n- One instance per process (`new ZimmerStack()` once, in a module). Two instances do not share a pace.\n- Never write on a timer, in a loop over all nights, or \"to be safe\". Send what a person changed,\n when they changed it: `zs.grid.save(edits)` folds nights into ranges and splits a large save.\n- Do not poll faster than every 15 seconds (`zs.batches.wait` already does it right), and stop.\n\n## Money and dates\n\n- A price is SENT in major units (4500 = 4,500.00 of the hotel's own currency) with that currency, and READ in minor\n units (`rateMinor`). `zs.grid.load` gives major units; `zs.grid.save` takes them.\n- A date is a plain `YYYY-MM-DD` calendar day in the hotel's timezone. Never build one with\n `new Date()` arithmetic in local time; use `eachDate(from, to)`.\n- To close a night send `stopSell: true`. Never a zero price, never zero rooms as a substitute.\n- Writes may reach 365 days ahead. A write is accepted (202) when it is in ZimmerStack's record; it\n reaches the channels in seconds to minutes. `zs.sync.get()` says how far along it is.\n\n## A channel's price modifier\n\n- `zs.channels.setModifier(channelId, steps)` moves EVERY price sent to that channel from then on.\n Call it only when a person saved that setting on a screen. Never from a loop, a timer, a seed\n script or a test against a live key. A hotel may change modifiers 6 times a day.\n- A modifier applies to prices sent to the channel after the change. Prices already on the channel stay as they are until those nights are sent again.\n Show that sentence where the person saves (`MODIFIER_TAKES_EFFECT`), and offer\n `zs.rates.resend()` as a separate, deliberate button (\"Apply to nights already on sale\"): 3 a day\n per hotel, never automatic.\n- Keep the grid on the price before any modifier; show a channel's price beside it with\n `channelPrice(rate, steps)`.\n\n## Errors\n\n```ts\nimport { ZimmerStack, ZimmerStackError } from \"@zimmerstack/connect\";\n\ntry {\n await zs.rates.set(updates);\n} catch (err) {\n if (err instanceof ZimmerStackError) {\n // err.code is stable (RATE_LIMITED, RATE_OUT_OF_BAND, SCOPE_MISSING, …); err.message is for people.\n // Show err.message to the person; branch on err.code; never retry unless err.retryable.\n }\n throw err;\n}\n```\n\n- `SCOPE_MISSING`: the key was not given that permission. Say which one is missing; the hotel's\n owner grants it (Admin → Developers → API keys). Do not look for another route.\n- `API_KEY_INVALID`, `API_KEY_REVOKED`, `API_KEY_EXPIRED`: stop. The client refuses every later call\n by itself; repeated bad calls get the server's address refused.\n- `RATE_OUT_OF_BAND`, `MODIFIER_OUT_OF_BAND`: the value is outside what the hotel allows. It is a\n guard against a typing slip; show the message, never split the change into smaller steps to pass.\n\n## The MCP server\n\nThe package carries an MCP server for you, the agent: `npx -y @zimmerstack/connect mcp`. If it is\nconnected, use it instead of guessing: `zimmerstack_reference` looks up any operation, type, limit\nor error code from the API's own contract, and `zimmerstack_sandbox_read` /\n`zimmerstack_sandbox_write` make one call on the sandbox so you can see real ids and try a body\nbefore you write the code that sends it. It works with a `zsk_test_` key only and refuses a live\none. It is for building; the application you write calls the API through the client, never through\nthese tools.\n\n## Before you call the work done\n\n- [ ] The key is read from the environment, on a server, and appears in no committed file or log.\n- [ ] Every screen that writes sends only what the person changed, once, on their action.\n- [ ] No retry loop, no timer and no polling faster than 15 seconds around a call of this package.\n- [ ] Errors show `err.message` to the person and branch on `err.code`.\n- [ ] Tests run against a `zsk_test_` key or a fake `fetch`; none needs a live key.\n- [ ] Where a modifier is saved, the screen says when it takes effect, and the re-send is its own button.\n";
|
|
6
6
|
export const REFERENCE = {
|
|
7
7
|
"api": "ZimmerStack Connect API v1",
|
|
8
8
|
"base": "https://api.zimmerstack.com/api/v1/connect-api/v1",
|
|
@@ -2036,7 +2036,7 @@ export const REFERENCE = {
|
|
|
2036
2036
|
"Property": "export interface Property {\n id: number;\n name: string;\n /** IANA; every date in this API is a calendar date in this zone */\n timezone: string;\n /** ISO 4217; every rate must be sent in it */\n currency: string;\n inventoryScope: \"PMS_CM\" | \"CM_ONLY\" | \"PMS_CUTOVER\" | \"OWNER_SITE\";\n /** true when this key is a zsk_test_ key on the owner's sandbox: nothing you send reaches a channel, and POST /sandbox/bookings simulates an OTA booking */\n sandbox: boolean;\n /** last writable night = today + horizonDays */\n horizonDays: number;\n ariAuthoritative: boolean;\n /** what THIS key may do: ari:read · ari:write · bookings:read · bookings:write · bookings:payments */\n scopes: Array<string>;\n products: {\n /** the ARI routes need it */\n channelManager: boolean;\n /** the booking routes need it */\n pms: boolean;\n };\n limits: {\n requestsPerMinute: number;\n writesPerMinute: number;\n maxUpdatesPerRequest: number;\n maxCellsPerRequest: number;\n bookingsPerMinute: number;\n /** Changed cells this property may take per clock hour (UTC), all its keys together. A cell that already holds the value sent is not counted */\n cellsPerHour: number;\n /** Changed cells this property may take per rolling 24 hours */\n cellsPerDay: number;\n /** Room types this property may hold */\n maxRoomTypes: number;\n /** Rate plans this property may hold */\n maxRatePlans: number;\n /** A vacation rental: rate plans this property may hold per room type, counted over the whole property. null on a hotel, where maxRatePlans is the rule */\n ratePlansPerRoomType: number | null;\n /** New room types or rate plans one request, and one minute, may create */\n newEntitiesPerMinute: number;\n };\n /** What this property has used of its long budgets (§6.6) */\n usage: {\n /** Changed cells counted against cellsPerHour so far this clock hour */\n cellsThisHour: number;\n /** Changed cells counted against cellsPerDay over the last 24 hours */\n cellsLast24h: number;\n };\n /** Where this integration stands with the channel shield. Reads and bookings are never affected */\n shield: {\n /** CLEAR nothing held against the integration · WATCH noted, nothing refused · PAUSED only writes that close inventory are accepted · SUSPENDED every write refused until ZimmerStack releases it */\n level: \"CLEAR\" | \"WATCH\" | \"PAUSED\" | \"SUSPENDED\";\n /** Why, when the level is not CLEAR */\n reason: string | null;\n /** When a pause ends on its own (ISO instant); null = until released, or not paused */\n until: string | null;\n };\n sync: {\n state: \"IN_SYNC\" | \"PENDING\" | \"OUT_OF_SYNC\" | \"DISABLED\";\n pendingCells: number;\n };\n}",
|
|
2037
2037
|
"Catalog": "export interface Catalog {\n /** ISO 4217; the property's, and the one every rate and booking is sent in */\n currency: string;\n /** Every room type on the property, stable ids, in the order they were created */\n roomTypes: Array<{\n /** The number every availability write and every booking room names as roomTypeId */\n id: number;\n /** Your own id for it, when your system wrote it through PUT /catalog/room-types; null otherwise */\n ref: string | null;\n /** As the owner named it in ZimmerStack */\n name: string;\n /** Most adults one room takes; null = not set */\n maxAdults: number | null;\n /** Most children one room takes; null = not set */\n maxChildren: number | null;\n /** \"room\" unless the owner chose another kind of unit */\n roomKind: string;\n /** IN_SYNC the channel manager has it · PENDING / SENDING on its way · FAILED stopped retrying (the owner's screen offers Retry) · DRIFTED someone changed it inside the channel manager · NOT_LINKED saved here, never added there · DISABLED the property is not connected */\n sync: \"IN_SYNC\" | \"PENDING\" | \"SENDING\" | \"FAILED\" | \"DRIFTED\" | \"NOT_LINKED\" | \"DISABLED\";\n }>;\n /** Every rate plan, each under one room type */\n ratePlans: Array<{\n /** The number rate and restriction writes name as ratePlanId; optional on a booking room */\n id: number;\n /** Your own id for it, when your system wrote it through PUT /catalog/rate-plans; null otherwise */\n ref: string | null;\n /** The room type this plan sells; a booking may only pair the two */\n roomTypeId: number;\n /** As the owner named it */\n name: string;\n /** EP room only · CP breakfast · MAP half board · AP full board; null = not set */\n mealPlan: \"EP\" | \"CP\" | \"MAP\" | \"AP\" | null;\n /** The occupancy this plan is priced for; null = any */\n occupancy: number | null;\n currency: string;\n /** false = a non-refundable plan */\n refundable: boolean;\n /** IN_SYNC the channel manager has it · PENDING / SENDING on its way · FAILED stopped retrying (the owner's screen offers Retry) · DRIFTED someone changed it inside the channel manager · NOT_LINKED saved here, never added there · DISABLED the property is not connected */\n sync: \"IN_SYNC\" | \"PENDING\" | \"SENDING\" | \"FAILED\" | \"DRIFTED\" | \"NOT_LINKED\" | \"DISABLED\";\n }>;\n}",
|
|
2038
2038
|
"Properties": "export interface Properties {\n /** company: a software vendor's key, the hotel named in X-ZS-Property on every request. property: one hotel's own key, no header needed. */\n keyKind: \"company\" | \"property\";\n /** A company key: every property it may act on. A hotel key: its one property. */\n properties: Array<{\n /** The id a company key names in the X-ZS-Property header */\n id: number;\n name: string;\n timezone: string;\n currency: string;\n /** The property publishes to its channels */\n channelManager: boolean;\n /** A sandbox: everything lands locally, nothing reaches a channel */\n sandbox: boolean;\n }>;\n}",
|
|
2039
|
-
"RoomTypesUpsert": "export interface RoomTypesUpsert {\n /** Each ref once per request */\n roomTypes: Array<{\n /** Your own id for this entity: the upsert key, stable across sends (1–64 of A–Z a–z 0–9 . _ : -) */\n ref: string;\n /** Shown to the owner and sent to the channel manager as the title */\n name: string;\n /** Sellable rooms of this type.
|
|
2039
|
+
"RoomTypesUpsert": "export interface RoomTypesUpsert {\n /** Each ref once per request */\n roomTypes: Array<{\n /** Your own id for this entity: the upsert key, stable across sends (1–64 of A–Z a–z 0–9 . _ : -) */\n ref: string;\n /** Shown to the owner and sent to the channel manager as the title */\n name: string;\n /** Sellable rooms of this type. On a channel-manager-only hotel a later change is written too, to the channel manager first (its count caps what the channels sell); a count below the rooms holding upcoming stays is refused. On a hotel that runs our PMS the count comes from its room list and a different value is not written (the answer's notice says so) */\n roomCount: number;\n /** Most adults one room takes */\n adults: number;\n /** Most children one room takes; default 0 */\n children?: number;\n }>;\n}",
|
|
2040
2040
|
"RatePlansUpsert": "export interface RatePlansUpsert {\n /** Each ref once per request */\n ratePlans: Array<{\n /** Your own id for this entity: the upsert key, stable across sends (1–64 of A–Z a–z 0–9 . _ : -) */\n ref: string;\n /** The room type this plan sells (GET /catalog); or name it by roomTypeRef */\n roomTypeId?: number;\n /** The room type by the ref you gave it, in this request or an earlier one */\n roomTypeRef?: string;\n /** Shown to the owner and sent to the channel manager as the title */\n name: string;\n /** EP room only · CP breakfast · MAP half board · AP full board; null = not set */\n mealPlan?: \"EP\" | \"CP\" | \"MAP\" | \"AP\" | null;\n /** The occupancy this plan is priced for; null = the room type's default */\n occupancy?: number | null;\n /** false = a non-refundable plan; default true */\n refundable?: boolean;\n /** The plan's standing price in MAJOR units (e.g. 4500 or \"4500.00\"), like every rate here: what new dates open at, mirrored to the channel manager. Omit to leave it; null = follow the room type's base rate */\n defaultRate?: number | string | null;\n /** Deprecated: the same standing price in MINOR units (paise). Send defaultRate instead; never both */\n defaultRateMinor?: number | null;\n }>;\n}",
|
|
2041
2041
|
"CatalogUpsertResult": "export interface CatalogUpsertResult {\n /** One per entity sent, in the order sent */\n items: Array<{\n ref: string;\n /** The ZimmerStack id: what every availability, rate and booking write names from now on */\n id: number;\n /** created: new here and on the channel manager · updated: fields changed · adopted: an entity the owner had already made with this name is now yours by ref · unchanged: nothing differed */\n action: \"created\" | \"updated\" | \"adopted\" | \"unchanged\";\n /** IN_SYNC the channel manager has it · PENDING / SENDING on its way · FAILED stopped retrying (the owner's screen offers Retry) · DRIFTED someone changed it inside the channel manager · NOT_LINKED saved here, never added there · DISABLED the property is not connected */\n sync: \"IN_SYNC\" | \"PENDING\" | \"SENDING\" | \"FAILED\" | \"DRIFTED\" | \"NOT_LINKED\" | \"DISABLED\";\n /** Saved, but something to know (for example the property is not on the channel manager yet); null when nothing */\n notice: string | null;\n }>;\n /** Where the property stands after this write; a sandbox always says enabled */\n channelManager: {\n /** The property publishes to its channels */\n enabled: boolean;\n /** Why not, when enabled is false (for example: a room type still has no rate plan) */\n reason: string | null;\n };\n}",
|
|
2042
2042
|
"CatalogDeleteResult": "export interface CatalogDeleteResult {\n id: number;\n deleted: true;\n /** The channel manager's copy is gone too (a sandbox has none) */\n channelManagerDeleted: boolean;\n /** For a room type: the plans that went with it */\n deletedRatePlanIds: Array<number>;\n}",
|
|
@@ -2072,13 +2072,13 @@ export const REFERENCE = {
|
|
|
2072
2072
|
"money-and-dates": "## dates\nYYYY-MM-DD, calendar dates in the property's timezone (GET /property); a stay occupies [checkIn, checkOut) — the checkout day is not a night\n\n## money\nrates are SENT in major units with the property's currency and RETURNED in minor units (rateMinor); stored as whole major units\n\n## writes\nabsolute values, last write wins within a request, unchanged cells are dropped before anything is written\n\n## idempotency\nheader: x-idempotency-key\nretentionDays: 7\n\n",
|
|
2073
2073
|
"limits": "## limits\nrequestsPerMinute: 120\nwritesPerMinute: 30\npropertyRequestsPerMinute: 300\npropertyWritesPerMinute: 60\npropertyCellsPerMinute: 20000\nipRequestsPerMinute: 240\nmaxUpdatesPerRequest: 1000\nmaxCellsPerRequest: 5000\nmaxBodyBytes: 1048576\nhorizonDays: 365\nbookingsPerMinute: 20\npropertyBookingsPerMinute: 40\npropertyBookingsPerDay: 500\ncompanyRequestsPerMinute: 1200\nmaxNightsPerBooking: 90\n\n## rateLimits\nwindow: 60 s sliding, shared by every API machine; counters are exact, not per machine\nscopes:\n - scope: ip · perMinute: 240 · counts: every request from one address, checked before the key is read\n - scope: ip-auth · perMinute: 20 · counts: 401 answers to one address; after that the address is refused before any lookup\n - scope: requests · perMinute: 120 · counts: every request on one key\n - scope: writes · perMinute: 30 · counts: PUT requests on one key\n - scope: property · perMinute: 300 · counts: every request on all of a property's keys together (five keys are not five budgets)\n - scope: property-writes · perMinute: 60 · counts: PUT requests on all of a property's keys together\n - scope: cells · perMinute: 20000 · counts: cells a property's writes name after range expansion, charged before anything is read or written\n - scope: bookings · perMinute: 20 · counts: POST /bookings on one key\n - scope: property-bookings · perMinute: 40 · counts: POST /bookings on all of a property's keys together\n - scope: property-bookings-day · perMinute: 500 · counts: POST /bookings per property per ROLLING 24 HOURS (not per minute); the owner can raise it per property\n - scope: company · perMinute: 1200 · counts: every request on one company key, across all its hotels (each hotel keeps its own key and property budgets too)\n - scope: global · perMinute: 3000 · counts: every request on the Connect API, all keys and addresses\nheaders:\n RateLimit-Policy: on every answer, one quoted policy per key scope — \"key\";q=120;w=60, \"key-writes\";q=30;w=60\n RateLimit: on every answer, what is left and when it refills — \"key\";r=117;t=42, \"key-writes\";r=29;t=42\n Retry-After: on every 429, whole seconds to wait; the body's data.scope says which budget refused\nonRefusal: 429 RATE_LIMITED. Wait Retry-After, then resend the same request. Never retry in a tight loop; never retry any other 4xx.\ntooLarge: 413 when the JSON body exceeds 1048576 bytes; split the updates array\npace:\n - Batch: one PUT per resource carrying ranges (dateFrom..dateTo, optional days) — a 365-night calendar for three plans is a handful of updates, not a thousand\n - Send on change, not on a timer: unchanged cells are dropped and cost nothing, but they still spend your request budget\n - Read RateLimit on every answer and slow down when r approaches 0, instead of waiting for a 429\n - Reuse x-idempotency-key on a retry so a timed-out request can never land twice\n - Poll GET /batches/{batchId} and GET /sync no more than every 15 s; the push to the channels is asynchronous and bounded by the channel manager's own budget\nchannelManager:\n whyAsynchronous: Your 202 means the cells are in our record. Pushing them to the channel manager is paced by its budget — ten rate/restriction reads a minute for the whole account and a per-property write budget — so a full calendar takes minutes, never seconds, and is never lost.\n whatWeDo: We coalesce your cells into the fewest channel-manager calls, drop what did not change, pace every call, stop before the channel manager's last token, and back off on its Retry-After — you never have to think about its limits, only about ours.\n\n",
|
|
2074
2074
|
"bookings": "## bookings\nwho: Hotels that run the ZimmerStack PMS and their OWN booking engine: hand us the reservation your website sold and it lands in the PMS exactly as a front-desk booking — guest, folio, inventory, channels.\npricing: You price the stay. Send the nightly rate you charged per room; we store it and never re-quote. currency must equal the property's.\ninventory: Availability is checked inside the booking transaction under the property's inventory lock (a sold-out night is 409 NO_AVAILABILITY, nothing written). The inventory event commits with the booking; the drain pushes the new counts to every connected channel within seconds.\nidempotency: externalReference is YOUR reservation id and is unique per property: the same value again from the same key (or the key it was rotated from), while that booking is live, returns the same booking with HTTP 200 and replay: true. Use it on every retry. A reference another key already used on this property, or one that belongs to a booking you cancelled, is 409 EXTERNAL_REFERENCE_REUSED: after a cancel, the new stay needs a new reference.\npayments: A payment is recorded only when the key holds bookings:payments and never above the stay total. Nothing collected = omit payment; the desk collects at check-in.\nguest: By default the guest hears from YOUR site only; the owner can switch on our confirmation per property (admin → Developers → Settings).\ncancel: POST /bookings/{bookingId}/cancel cancels the whole booking and re-opens its nights on the channels; a booking already checked in is 409 BOOKING_NOT_CANCELLABLE. Date or room changes: cancel and re-create under a NEW externalReference (a modify endpoint is planned).\nscope: A key reads and cancels only the bookings it (or the key it was rotated from) created on its property; another key's, front-desk and OTA bookings are never visible (BOOKING_NOT_FOUND).\n\n",
|
|
2075
|
-
"budgets-and-standing": "## shield\nwhat: On top of the per-minute budgets, every property has budgets over an hour and a day, hard limits on its structure, and a standing ZimmerStack can change. They exist because every changed cell is forwarded by the channel manager to every connected channel: an integration that re-sends, flaps or loops is the hotel's and the channels' problem within a minute. GET /property carries this property's own figures (limits), what it has used (usage) and where it stands (shield).\ncounted: A budget counts CHANGED cells: cells whose value differs from our record. Re-sending a calendar we already hold costs nothing here. So send on change, in ranges.\nbudgets:\n - scope: cells-hour · window: one clock hour (UTC) · floor: 10000 · counts: changed cells, all of a property's keys together. At least this many; a larger property gets two of its own full calendars an hour\n - scope: cells-day · window: rolling 24 hours · floor: 30000 · counts: changed cells, all of a property's keys together. At least this many; a larger property gets six of its own full calendars a day\n - scope: vendor-cells-day · window: rolling 24 hours · floor: 150000 · counts: a software vendor's changed cells across all its hotels (company keys and keys it minted)\n - scope: structure-creates · window: 60 s sliding · floor: 20 · counts: new room types and rate plans per property; also the most one request may create (TOO_MANY_NEW_ENTITIES)\n - scope: structure-creates-day · window: rolling 24 hours · floor: 300 · counts: new room types and rate plans per property\n - scope: structure-edits-day · window: rolling 24 hours · floor: 300 · counts: changed room types and rate plans per property\n - scope: structure-deletes-day · window: rolling 24 hours · floor: 60 · counts: deleted room types and rate plans per property\n - scope: vendor-structure-creates-day · window: rolling 24 hours · floor: 500 · counts: a software vendor's new room types and rate plans across all its hotels\n - scope: vendor-remote-properties-day · window: rolling 24 hours · floor: 10 · counts: hotels a software vendor puts on the channel manager for the first time\n - scope: modifier-changes-day · window: rolling 24 hours · floor: 6 · counts: changes to a channel's price modifier per property (PUT /channels/{channelId}/modifier); steps the channel already holds are not counted\n - scope: rate-resends-day · window: rolling 24 hours · floor: 3 · counts: times a property's prices are sent to the channels again (POST /rates/resend)\ncaps:\n maxRoomTypes: 18\n maxRatePlans: 180\n why: Each cap sits a tenth under what the channel manager includes for that kind of property before it bills extra, so an integration never runs a hotel into overage. GET /property carries this property's own caps.\n byCategory:\n - category: hotel · maxRoomTypes: 18 · maxRatePlans: 180 · ratePlansPerRoomType: null\n - category: vacation rental · maxRoomTypes: 45 · maxRatePlans: 405 · ratePlansPerRoomType: 9\n onRefusal: 409 CATALOG_LIMIT_REACHED (details.limit, details.current, details.requested). Delete what is unused, or ask ZimmerStack support.\nonRefusal: 429 RATE_LIMITED with data.scope naming the budget and Retry-After in whole seconds: to the next clock hour for cells-hour, until enough of the day has aged out for a rolling day. Nothing was written. Wait, then send what still needs to change.\nsafetyLane: A hotel must not oversell because its integration ran out of budget or was paused. A write that only CLOSES inventory (a lower availability count or 0, or stopSell / closedToArrival / closedToDeparture switched on, and nothing else in the request) is still accepted in both cases, against its own hourly allowance (at least 500 cells); its 202 carries lane: true. A write that opens inventory or changes a price waits.\npriceBand:\n what: PUT /rates takes prices in MAJOR units; reads answer in MINOR units. A price below a tenth or above ten times its plan's standing price (the plan's defaultRate, or its room type's base rate) is not taken on trust: the whole request is 422 RATE_OUT_OF_BAND and nothing is written. A plan with no standing price is never judged.\n minPct: 10\n maxPct: 1000\n wayOut: If the price is meant, move the plan's standing price first (PUT /catalog/rate-plans defaultRate): the band moves with it. ZimmerStack support can set a property to warn only (the 202 then carries priceWarnings) or switch its band off; the hotel's owner asks for it.\nstanding:\n levels:\n CLEAR: Nothing held against the integration.\n WATCH: Something notable happened (a budget was used up). Nothing is refused.\n PAUSED: Only writes that close inventory are accepted (the safety lane); anything else is 429 RATE_LIMITED with data.scope shield-pause and a Retry-After that ends with the pause. Set automatically for a while when the channel manager refuses the integration's values or it uses up a budget on two of three days (15 minutes, then 1 hour, 6 hours, a day), or by ZimmerStack support until released.\n SUSPENDED: Every write is 403 WRITES_SUSPENDED until ZimmerStack support releases it.\n frozen: 503 WRITES_FROZEN with Retry-After: ZimmerStack has paused every integration's writes at once. Rare, short, and never your integration alone.\n never: Reads, GET /channel-bookings, webhooks and POST /bookings are never refused by any of this: a guest's reservation and its news always travel.\nrejectedValues: A rate or restriction value the channel manager itself refuses is held, not re-sent: GET /sync counts it (rates.parkedCells), its batch reads failed with the reason, and the property's other cells keep landing. Send a corrected value for those nights.\nsandbox: A sandbox meets the same budgets, limits and band on its own property, so you learn them before going live. It is never frozen and never counts against your company's budgets.\n\n",
|
|
2075
|
+
"budgets-and-standing": "## shield\nwhat: On top of the per-minute budgets, every property has budgets over an hour and a day, hard limits on its structure, and a standing ZimmerStack can change. They exist because every changed cell is forwarded by the channel manager to every connected channel: an integration that re-sends, flaps or loops is the hotel's and the channels' problem within a minute. GET /property carries this property's own figures (limits), what it has used (usage) and where it stands (shield).\ncounted: A budget counts CHANGED cells: cells whose value differs from our record. Re-sending a calendar we already hold costs nothing here. So send on change, in ranges.\ncalendar:\n what: One full calendar of a property is (2 × its rate plans + its room types) × 365 nights: a price and a stay-rule cell for every plan night, an availability cell for every room-type night. The figures in the table are the least any property gets; a larger one gets whole calendars.\n horizonDays: 365\n perHour: 2\n perDay: 6\n vendorPerDayBase: 150000\n vendorPerDayPerHotel: 15000\n perProperty: Every key on a property spends the same budget: a second key, or a company key beside a hotel key, is not a second budget.\nbudgets:\n - scope: cells-hour · window: one clock hour (UTC) · floor: 10000 · counts: changed cells, all of a property's keys together. At least this many; a larger property gets two of its own full calendars an hour\n - scope: cells-day · window: rolling 24 hours · floor: 30000 · counts: changed cells, all of a property's keys together. At least this many; a larger property gets six of its own full calendars a day\n - scope: vendor-cells-day · window: rolling 24 hours · floor: 150000 · counts: a software vendor's changed cells across all its hotels (company keys and keys it minted). At least this many, plus 15,000 for each hotel it serves; a sandbox is never counted here\n - scope: structure-creates · window: 60 s sliding · floor: 20 · counts: new room types and rate plans per property; also the most one request may create (TOO_MANY_NEW_ENTITIES)\n - scope: structure-creates-day · window: rolling 24 hours · floor: 300 · counts: new room types and rate plans per property\n - scope: structure-edits-day · window: rolling 24 hours · floor: 300 · counts: changed room types and rate plans per property\n - scope: structure-deletes-day · window: rolling 24 hours · floor: 60 · counts: deleted room types and rate plans per property\n - scope: vendor-structure-creates-day · window: rolling 24 hours · floor: 500 · counts: a software vendor's new room types and rate plans across all its hotels\n - scope: vendor-remote-properties-day · window: rolling 24 hours · floor: 10 · counts: hotels a software vendor puts on the channel manager for the first time\n - scope: modifier-changes-day · window: rolling 24 hours · floor: 6 · counts: changes to a channel's price modifier per property (PUT /channels/{channelId}/modifier); steps the channel already holds are not counted\n - scope: rate-resends-day · window: rolling 24 hours · floor: 3 · counts: times a property's prices are sent to the channels again (POST /rates/resend)\ncaps:\n maxRoomTypes: 18\n maxRatePlans: 180\n why: Each cap sits a tenth under what the channel manager includes for that kind of property before it bills extra, so an integration never runs a hotel into overage. GET /property carries this property's own caps.\n byCategory:\n - category: hotel · maxRoomTypes: 18 · maxRatePlans: 180 · ratePlansPerRoomType: null\n - category: vacation rental · maxRoomTypes: 45 · maxRatePlans: 405 · ratePlansPerRoomType: 9\n onRefusal: 409 CATALOG_LIMIT_REACHED (details.limit, details.current, details.requested). Delete what is unused, or ask ZimmerStack support.\nonRefusal: 429 RATE_LIMITED with data.scope naming the budget and Retry-After in whole seconds: to the next clock hour for cells-hour, until enough of the day has aged out for a rolling day. Nothing was written. Wait, then send what still needs to change.\nsafetyLane: A hotel must not oversell because its integration ran out of budget or was paused. A write that only CLOSES inventory (a lower availability count or 0, or stopSell / closedToArrival / closedToDeparture switched on, and nothing else in the request) is still accepted in both cases, against its own hourly allowance (at least 500 cells); its 202 carries lane: true. A write that opens inventory or changes a price waits.\npriceBand:\n what: PUT /rates takes prices in MAJOR units; reads answer in MINOR units. A price below a tenth or above ten times its plan's standing price (the plan's defaultRate, or its room type's base rate) is not taken on trust: the whole request is 422 RATE_OUT_OF_BAND and nothing is written. A plan with no standing price is never judged.\n minPct: 10\n maxPct: 1000\n wayOut: If the price is meant, move the plan's standing price first (PUT /catalog/rate-plans defaultRate): the band moves with it. ZimmerStack support can set a property to warn only (the 202 then carries priceWarnings) or switch its band off; the hotel's owner asks for it.\nstanding:\n levels:\n CLEAR: Nothing held against the integration.\n WATCH: Something notable happened (a budget was used up). Nothing is refused.\n PAUSED: Only writes that close inventory are accepted (the safety lane); anything else is 429 RATE_LIMITED with data.scope shield-pause and a Retry-After that ends with the pause. Set automatically for a while when the channel manager refuses the integration's values or it uses up a budget on two of three days (15 minutes, then 1 hour, 6 hours, a day), or by ZimmerStack support until released.\n SUSPENDED: Every write is 403 WRITES_SUSPENDED until ZimmerStack support releases it.\n frozen: 503 WRITES_FROZEN with Retry-After: ZimmerStack has paused every integration's writes at once. Rare, short, and never your integration alone.\n never: Reads, GET /channel-bookings, webhooks and POST /bookings are never refused by any of this: a guest's reservation and its news always travel.\nrejectedValues: A rate or restriction value the channel manager itself refuses is held, not re-sent: GET /sync counts it (rates.parkedCells), its batch reads failed with the reason, and the property's other cells keep landing. Send a corrected value for those nights.\nsandbox: A sandbox meets the same budgets, limits and band on its own property, so you learn them before going live. It is never frozen and never counts against your company's budgets.\n\n",
|
|
2076
2076
|
"room-types-and-rate-plans": "## structure\nwhat: PUT /catalog/room-types and PUT /catalog/rate-plans (scope catalog:write) let the PMS own the hotel's structure: an upsert by ref, your own id. A new entity is created on the channel manager at once; every later change mirrors there with retries and a nightly drift check; the answer names our id, the action and the sync status per entity. GET /catalog carries ref and sync from now on.\nadoption: A room type the owner already made with the same name (and no ref) becomes yours by ref (action: adopted); a plan likewise under the same room type. A plan never moves between room types (409 CATALOG_CONFLICT): delete it and send it again.\nswitchOn: A channel-manager-only hotel with no channel-manager property yet gets one on the first write, and the channel manager is switched on once a room type and a plan are mapped; channelManager.enabled in the answer says where it stands, reason why not.\nidempotent: Twice over: ref is the upsert key here, and the channel-manager create adopts an existing entity with the same title instead of creating it again, so a retry never duplicates on either side. Send x-idempotency-key on retries as on every write.\nnotHere: A room count after creation (it lives on the channel manager), photos, descriptions, amenities, cancellation policies and stay rules: the owner's Rooms & rates screen, or the restrictions routes.\nsandbox: On a sandbox everything lands locally and reads IN_SYNC, through the same code path.\n\n",
|
|
2077
2077
|
"ota-bookings": "## channelBookings\nwhat: GET /channel-bookings lists the OTA bookings the channel manager delivered to the property — the SAME booking object the webhooks carry, so one parser serves both. Scope channel-bookings:read, granted separately from the ARI pair.\nsince: since is on the booking's last change (created, modified or cancelled), default the last 7 days; page with limit (≤100) and repeat with since = the last item's updatedAt while more is true.\nwhy: Recover a missed webhook, or poll instead of receiving: the webhooks remain the push path, this is the pull path over the same shape.\nnever: Front-desk, booking-engine and Connect API bookings are never listed here; they are not channel bookings.\n\n",
|
|
2078
2078
|
"channels-and-modifiers": "## channels\nwhat: GET /channels lists the connections the channel manager holds for the property, from our record (the nightly settings sweep), with every unresolved problem the channel manager reported (rate_error, sync_error, disconnect_channel, the inventory pipe out of sync).\nfreshness: asOf says when the list was captured; a channel connected today appears after the next sweep. Problems are live.\npushed: The same problems are pushed as webhooks: channel.sync.alert when one is raised, channel.sync.recovered when the inventory pipe recovers (docs/webhooks).\n\n## modifiers\nwhat: One price per rate plan per night goes to every channel the plan is mapped to. A channel's modifier is the one thing that differs per channel: up to five ordered steps (raise or lower, by a percentage or a fixed amount in major units) the channel manager applies to every price it sends that channel. GET /channels shows each channel's steps; PUT /channels/{channelId}/modifier replaces them (scope channel-modifiers:write, granted separately: one call moves every price on that channel).\ntakesEffect: A modifier applies to prices sent to the channel after the change. Prices already on the channel stay as they are until those nights are sent again.\nresend: POST /rates/resend (scope ari:write) sends the property's prices and stay rules to the channels again, unchanged, so every night picks the current modifiers up. Re-sending the same price through PUT /rates does nothing: a value our record already holds is dropped before anything is sent. The re-send is the way, and a hotel may ask for it only a few times a day (data.scope rate-resends-day).\nworkflow:\n - GET /channels: find the channel (channelId, kind) and read the steps it holds\n - PUT /channels/{channelId}/modifier with the whole list of steps; [] removes the modifier\n - POST /rates/resend if nights already on the channel should move too, then watch rates.dirtyCells on GET /sync fall to 0\nband:\n maxDecreasePct: 50\n maxIncreasePct: 100\nbandRule: The steps together may not lower a price by more or raise it by more than the band: 422 MODIFIER_OUT_OF_BAND, nothing changed. A fixed amount is judged at the property's lowest and highest standing price.\nshared: A connection that serves more than one property (one Airbnb or Booking.com account for sister hotels) is refused, 409 CHANNEL_SHARED: its modifier would move another hotel's prices. The hotels' owner sets it in ZimmerStack.\ngrid: GET /rates always answers the price before any modifier. What a channel is sent is that price with the channel's steps applied in order.\nmarkupPlan: markupPlan on GET /channels is a separate adjustment the owner may have set in the ZimmerStack Channels app; it applies before the modifier and is read-only here.\nsandbox: A sandbox has three pretend channels (Booking.com, MakeMyTrip, Agoda) so the whole workflow can be tried with a test key; nothing leaves our record.\n\n",
|
|
2079
|
-
"sandbox": "## sandbox\nwhat: The owner creates a sandbox from a real property (admin → Developers → API keys, Channels → Integrations): a copy of its room types and rate plans that no channel ever sees. Keys minted there start with zsk_test_ and work ONLY there; a live key never reaches it.\npushes: Every route behaves as in production. A push lands in our record and stops: GET /sync reports IN_SYNC and GET /batches/{batchId} reports landed within a minute, through the same code path as a live property. GET /property says sandbox: true.\nmodify: POST /sandbox/bookings/{bookingId}/modify sends a modified revision — new dates, length, rooms or guest — and the REAL channel.booking.modified webhook with changes and previous, the old nights back on availability and the new ones off.\nbookings: POST /sandbox/bookings simulates an OTA booking end to end — the booking, the sandbox's availability moved down, the inventory event, and the REAL channel.booking.created webhook to every endpoint registered on the sandbox. POST /sandbox/bookings/{bookingId}/cancel does the same for a cancellation. A live key gets 403 SANDBOX_ONLY.\nlimits: The same budgets as production (one sandbox per owner, at most five keys). Nothing you do there is billed or pushed to a channel.\ngoLive: Ask the owner for a zsk_live_ key on the real property, swap the key, keep the code.\n\n",
|
|
2079
|
+
"sandbox": "## sandbox\nwhat: The owner creates a sandbox from a real property (admin → Developers → API keys, Channels → Integrations): a copy of its room types and rate plans that no channel ever sees. Keys minted there start with zsk_test_ and work ONLY there; a live key never reaches it.\npushes: Every route behaves as in production. A push lands in our record and stops: GET /sync reports IN_SYNC and GET /batches/{batchId} reports landed within a minute, through the same code path as a live property. GET /property says sandbox: true.\nmodify: POST /sandbox/bookings/{bookingId}/modify sends a modified revision — new dates, length, rooms or guest — and the REAL channel.booking.modified webhook with changes and previous, the old nights back on availability and the new ones off.\nbookings: POST /sandbox/bookings simulates an OTA booking end to end — the booking, the sandbox's availability moved down, the inventory event, and the REAL channel.booking.created webhook to every endpoint registered on the sandbox. POST /sandbox/bookings/{bookingId}/cancel does the same for a cancellation. A live key gets 403 SANDBOX_ONLY.\nlimits: The same budgets as production (one sandbox per owner, up to five per software partner, at most five keys on each). Nothing you do there is billed or pushed to a channel.\ngoLive: Ask the owner for a zsk_live_ key on the real property, swap the key, keep the code.\n\n",
|
|
2080
2080
|
"errors": "Every refusal is { statuscode, message, data: { code, … } }. Branch on data.code (the client: err.code): it is stable. message is for a person and may change.\nRetry only 429, 5xx and IDEMPOTENCY_IN_FLIGHT, after Retry-After; every other code is a verdict on the request. The client does this by itself.\n\n- API_KEY_INVALID (401): \"Unauthorized\"\n- API_KEY_REVOKED (401): \"Unauthorized\"\n- API_KEY_EXPIRED (401): \"Unauthorized\"\n- CONNECT_API_NOT_CONFIGURED\n- IP_NOT_ALLOWED (403): \"This API key may not be used from this address. The property owner restricts it to an allowlist.\"\n- SCOPE_MISSING (403): \"This API key does not have the bookings:write scope. The property owner grants scopes when creating or editing a key.\"\n- PROPERTY_UNAVAILABLE (409): \"This property is not available to the API any more. Contact the property owner.\"\n- CHANNEL_MANAGER_DISABLED (409): \"This property's channel manager is switched off, so writes would not reach any channel. Contact the property owner.\"\n- PMS_NOT_AVAILABLE (409): \"This property runs the channel manager only; there is no PMS to put a booking in.\"\n- VALIDATION (400): \"updates[0].available: Expected number, received string\"\n- RANGE_INVALID (400)\n- HORIZON (400): \"updates[0]: 2028-01-01 is beyond the horizon (last writable night is 2027-10-12, today + 365 days)\" [PUT /availability, PUT /rates, PUT /restrictions]\n- TOO_MANY_UPDATES (400) [PUT /availability, PUT /rates, PUT /restrictions]\n- TOO_MANY_CELLS (400): \"a request may name at most 5000 cells (entity × night); split the calendar into several requests\" [PUT /availability, PUT /rates, PUT /restrictions]\n- UNKNOWN_ROOM_TYPE (400) [PUT /catalog/rate-plans, PUT /availability, POST /bookings, POST /sandbox/bookings]\n- UNKNOWN_RATE_PLAN (400): \"rate plan(s) 77 do not belong to this property (see GET /catalog)\" [PUT /rates, PUT /restrictions, POST /bookings]\n- CURRENCY_MISMATCH (400): \"rates must be sent in INR (got EUR)\" [PUT /rates, POST /bookings]\n- RATE_LIMITED (429): \"Too many requests on this API key. Slow down and retry after the Retry-After interval.\"\n- NOTHING_ACCEPTED (422): \"exceptions are switched off for this property — move the base rate instead\" [PUT /availability, PUT /rates, PUT /restrictions]\n- BATCH_NOT_FOUND (404): \"Batch not found.\"\n- IDEMPOTENCY_KEY_INVALID\n- IDEMPOTENCY_KEY_REUSED (409): \"This idempotency key was already used with a different request body.\"\n- IDEMPOTENCY_IN_FLIGHT\n- STAY_INVALID (400): \"checkIn 2026-10-01 is in the past (today at the property is 2026-10-20)\" [POST /bookings, POST /sandbox/bookings, POST /sandbox/bookings/{bookingId}/modify]\n- UNKNOWN_ROOM_TYPE_FOR_PLAN (400) [POST /bookings]\n- OCCUPANCY_EXCEEDED (400): \"rooms[0]: Deluxe takes at most 3 adults (got 4)\" [POST /bookings]\n- NO_AVAILABILITY (409): \"room type 412 has 0 left on 2026-12-21; 1 requested\" [POST /bookings]\n- EXTERNAL_REFERENCE_REUSED (409) [POST /bookings]\n- PAYMENT_NOT_ALLOWED (403): \"This API key may not record payments. The property owner grants the bookings:payments scope.\" [POST /bookings]\n- PAYMENT_EXCEEDS_TOTAL (400): \"payment.amount 30000.00 exceeds the stay total 27000.00\" [POST /bookings]\n- BOOKING_NOT_FOUND (404): \"Booking not found.\"\n- BOOKING_NOT_CANCELLABLE (409): \"Booking already checked in. Ask the hotel to handle it at the desk.\"\n- MODULE_NOT_ENTITLED (402): \"This property's plan does not include the PMS.\"\n- SANDBOX_ONLY (403): \"The sandbox routes answer only to a test key (zsk_test_…) on a sandbox property. This key is a live key.\" [POST /sandbox/bookings, POST /sandbox/bookings/{bookingId}/cancel, POST /sandbox/bookings/{bookingId}/modify]\n- ROOM_TYPE_NOT_FOUND (404): \"That room type doesn't exist.\"\n- RATE_PLAN_NOT_FOUND (404): \"That rate plan doesn't exist.\"\n- CATALOG_CONFLICT (409): \"A room type with this name already exists.\" [PUT /catalog/room-types, PUT /catalog/rate-plans]\n- CATALOG_BUSY (409): \"Another room-type or rate-plan write for this property is still running. Retry in a few seconds.\"\n- CHANNEL_MANAGER_ERROR (502): \"The channel manager refused the delete. Nothing changed here; try again in a moment.\"\n- PROPERTY_REQUIRED (400): \"This is a company key: name the hotel in the X-ZS-Property header, with its id from GET /properties.\"\n- PROPERTY_NOT_FOUND (404): \"No property with this id that this key may act on (see GET /properties).\"\n- ARI_NOT_AUTHORITATIVE (409): \"This property's local rates and availability are not the channels' source of truth yet, so API writes would never be pushed. Contact ZimmerStack support.\"\n- ROUTE_NOT_FOUND (404): \"No GET /api/v1/connect-api/v1/nope in the Connect API; the contract lists every route.\"\n- PAYLOAD_TOO_LARGE (413): \"The request body is larger than the API accepts. Split the updates array across requests.\"\n- AUTH_BACKEND_UNAVAILABLE\n- BOOKING_NOT_MODIFIABLE (409): \"A cancelled booking cannot be modified from the sandbox.\"\n- SANDBOX_NOT_FOUND\n- SANDBOX_INCOMPLETE\n- WRITES_FROZEN (503): \"ZimmerStack has paused every write to the channel manager for now. Nothing was written. Retry after the Retry-After interval; reads and bookings are not affected.\"\n- WRITES_SUSPENDED (403): \"ZimmerStack has suspended writes for this integration: it kept sending after repeated notices. Reads and bookings still work. Contact ZimmerStack support to have it released.\" [PUT /availability, PUT /rates, PUT /restrictions, PUT /channels/{channelId}/modifier, POST /rates/resend]\n- SHIELD_UNAVAILABLE (503): \"The write could not be checked against this property's budgets right now. Nothing was written. Retry after the Retry-After interval.\"\n- CATALOG_LIMIT_REACHED (409): \"This property holds 298 rate plans and may hold 300; this request would add 6. Delete what is unused, or ask ZimmerStack support to raise the limit.\" [PUT /catalog/room-types, PUT /catalog/rate-plans]\n- TOO_MANY_NEW_ENTITIES (400): \"This request would create 34 new room types or rate plans; one request may create at most 20. Entities that already exist do not count. Split the new ones across requests.\" [PUT /catalog/room-types, PUT /catalog/rate-plans]\n- RATE_OUT_OF_BAND (422): \"rate plan 901 on 2026-12-01: 45 INR is below the band around this plan's standing price 4500 INR (lowest accepted 450) (and 29 more cells). Rates are sent in major units (4500, not 450000). If the price is meant, change the plan's standing price first (PUT /catalog/rate-plans defaultRate), or ask ZimmerStack support to lift the band for this property.\" [PUT /availability, PUT /rates, PUT /restrictions]\n- CHANNEL_NOT_FOUND (404): \"No connected channel with this id on this property. GET /channels lists them.\" [PUT /channels/{channelId}/modifier]\n- CHANNEL_SHARED (409): \"This connection serves more than one property, so its modifier would move another hotel's prices too. It is set by the hotels' owner in ZimmerStack, not through this API. Nothing was changed.\" [PUT /channels/{channelId}/modifier]\n- MODIFIER_OUT_OF_BAND (422): \"These steps would change what the channel is sent by +180%; a channel's modifier must stay between 50% lower and 100% higher. Nothing was changed.\"\n",
|
|
2081
2081
|
"webhooks": "ZimmerStack POSTs a signed JSON event to the endpoint the hotel's owner (or a software vendor) registered.\n- Events: channel.booking.created, channel.booking.modified, channel.booking.cancelled (an OTA booking arrived, changed, was cancelled); channel.sync.* (a connection's health); zimmerstack.ping (a test).\n- Envelope: { id, type, apiVersion, occurredAt, mode: \"live\" | \"test\", property: { id, name, currency, timezone }, data: { booking }, changes, previous }.\n- Signature (Standard Webhooks): headers webhook-id, webhook-timestamp, webhook-signature. The signature is \"v1,\" + base64(HMAC-SHA256(secret, id + \".\" + timestamp + \".\" + rawBody)); the secret is whsec_ + base64. During a rotation the header carries two, space-separated.\n- Verify the RAW body before parsing it, compare in constant time, and refuse a timestamp more than five minutes old. With this package: const event = await verifyWebhook(rawBody, headers, secret); it throws ZimmerStackWebhookError otherwise.\n- Deliveries are at-least-once and may arrive out of order: dedupe on event.id, order on occurredAt. Answer 2xx within seconds and do slow work afterwards.\n- GET /channel-bookings (zs.channelBookings.all({ since })) recovers what an endpoint missed. It is not a polling loop.\n",
|
|
2082
|
-
"the-package": "@zimmerstack/connect 0.
|
|
2082
|
+
"the-package": "@zimmerstack/connect 0.2.0: npm install @zimmerstack/connect. Node 20 or newer, on a server only, zero dependencies.\n\nconst zs = new ZimmerStack(); // reads ZIMMERSTACK_CONNECT_KEY; make one per process and reuse it\n\nEvery operation has a method: each operation's lookup names it (\"With the package\"). On top of those:\n- zs.grid.load(from, to): the whole rate grid for a window, ready for a screen. Rows are room types with their rate plans, columns are nights; prices in MAJOR units. Three reads (four the first time; the catalog is kept ten minutes).\n- zs.grid.save(edits): what a person changed, as single nights { availability?, rates?, restrictions? }. Folds nights into ranges, fills in the currency, splits a large save, sends one request per resource in turn. Returns the accepted answers, each with a batchId.\n- zs.batches.wait(batchId): asks every 15 seconds at the fastest, for at most five minutes; returns the last status (\"landed\", \"failed\", or still \"pending\").\n- zs.channelBookings.all({ since }): an async iterator over every OTA booking changed since then, following the cursor.\n- zs.forProperty(propertyId): a software vendor's company key acting on one hotel; shares the pace of the client it came from.\n- zs.request(\"GET /sync\"): any operation by its contract name, typed.\n- Pure helpers: eachDate(from, to), addDays(date, n), toRanges(cells), chunk(updates), buildGrid(parts), channelPrice(rate, steps).\n- verifyWebhook(rawBody, headers, secret): returns the event or throws ZimmerStackWebhookError.\n- MODIFIER_TAKES_EFFECT: the sentence to show where a person saves a channel's modifier. LIMITS, ERROR_CODES, SCOPES: the contract's own.\n\nA refusal is a ZimmerStackError: code (stable; branch on it), message (for a person; show it), status, retryable (false = fix the request, never resend), retryAfterSeconds, scope (which budget), details, operation.\n\nOptions: apiKey, propertyId, timeoutMs (30 s), maxRetries (3), maxWaitSeconds (120), onEvent (every answer, wait and retry, for logs; never the key), fetch (a stand-in for tests), allowLiveWritesInTests.\n\nWhat it keeps by itself, so do not re-implement it or wrap its calls in a retry loop:\n- Server only: it refuses a browser and React Native, sends the key to ZimmerStack only, never follows a redirect with it and never prints it.\n- Reads the RateLimit header and waits before a budget runs out. Writes go one at a time, in order; at most four reads at once.\n- Retries 429, 5xx and a network failure (four attempts, a growing wait, the same idempotency key); throws anything else at once. A wait over two minutes is handed back.\n- A write the server keeps no idempotency record for is not resent when its outcome is unknown.\n- Splits a write at 1,000 updates or 5,000 cells.\n- After API_KEY_INVALID, API_KEY_REVOKED or API_KEY_EXPIRED it stops calling.\n- A zsk_live_ key under a test runner may read but not write.\n"
|
|
2083
2083
|
}
|
|
2084
2084
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zimmerstack/connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Official Node.js client for the ZimmerStack Connect API: rates, availability, stay rules, prices per channel and bookings, with pacing, safe retries and idempotency built in. Ships an MCP server for coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.zimmerstack.com/sdk",
|