@zimmerstack/connect 0.5.0 → 0.6.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 -5
- package/README.md +30 -10
- package/dist/cjs/client.d.ts +4 -4
- package/dist/cjs/client.js +4 -4
- package/dist/cjs/generated.d.ts +3 -3
- package/dist/cjs/generated.js +2 -2
- package/dist/cjs/webhooks.d.ts +21 -11
- package/dist/cjs/webhooks.js +13 -6
- package/dist/esm/client.d.ts +4 -4
- package/dist/esm/client.js +4 -4
- package/dist/esm/generated.d.ts +3 -3
- package/dist/esm/generated.js +2 -2
- package/dist/esm/mcp/reference.generated.js +10 -10
- package/dist/esm/webhooks.d.ts +21 -11
- package/dist/esm/webhooks.js +13 -6
- package/package.json +6 -1
package/AGENTS.md
CHANGED
|
@@ -108,7 +108,7 @@ https://docs.zimmerstack.com/llms-full.txt
|
|
|
108
108
|
- `zs.channels.setModifier(channelId, steps)` moves EVERY price sent to that channel from then on.
|
|
109
109
|
Call it only when a person saved that setting on a screen. Never from a loop, a timer, a seed
|
|
110
110
|
script or a test against a live key. A hotel may change modifiers 6 times a day.
|
|
111
|
-
-
|
|
111
|
+
- Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.
|
|
112
112
|
Show that sentence where the person saves (`MODIFIER_TAKES_EFFECT`), and offer
|
|
113
113
|
`zs.rates.resend()` as a separate, deliberate button ("Apply to nights already on sale"): 3 a day
|
|
114
114
|
per hotel, never automatic.
|
|
@@ -118,10 +118,16 @@ https://docs.zimmerstack.com/llms-full.txt
|
|
|
118
118
|
## Website bookings: apply them before you push room counts
|
|
119
119
|
|
|
120
120
|
- When the hotel also sells on its own website through ZimmerStack's booking engine, those bookings
|
|
121
|
-
reach you as the webhooks `direct.booking.created
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
reach you as the webhooks `direct.booking.created`, `direct.booking.modified` and
|
|
122
|
+
`direct.booking.cancelled` (the endpoint receives each only when it lists that type) and by
|
|
123
|
+
`zs.directBookings.all({ since })` (scope `direct-bookings:read`). They are not OTA bookings:
|
|
124
|
+
`isWebsiteBookingEvent(event)` tells them apart, `channel.otaName` is `"Website"` and `finance` is null.
|
|
125
|
+
- `direct.booking.modified` is a no-show and its undo, nothing else yet: the hotel recorded that the guest
|
|
126
|
+
did not arrive, or undid that. It is NOT a cancellation: `status` stays CONFIRMED and the payment is
|
|
127
|
+
untouched, so never refund on it. Read `stayStatus` and each room's `status`: NOSHOW gives the nights
|
|
128
|
+
back (they are on sale again on every channel), UPCOMING again holds them. `changes` names what moved
|
|
129
|
+
(`"stayStatus"`, `"rooms[0].status"`); `previous` is the booking as it read before, `stayStatus`
|
|
130
|
+
included. The sandbox does not simulate one: the endpoint's Test button sends the sample.
|
|
125
131
|
- A website booking takes one room off the count the channels hold, at once. A PMS that pushes absolute
|
|
126
132
|
room counts must apply the booking to its own calendar BEFORE its next `zs.availability.set` or
|
|
127
133
|
`zs.grid.save`, or that push puts the sold room back on sale. Read `zs.directBookings.all` before a
|
package/README.md
CHANGED
|
@@ -6,14 +6,17 @@ back to you.
|
|
|
6
6
|
|
|
7
7
|
- **Free to build.** You get a practice hotel the moment you sign up. Nothing you do there reaches a
|
|
8
8
|
real booking site.
|
|
9
|
-
- **
|
|
10
|
-
the
|
|
9
|
+
- **Public prices.** A fixed price for each live property a month, on one invoice. A partner in India
|
|
10
|
+
pays the price plus GST. A partner outside India pays its own price, with nothing added. You accept
|
|
11
|
+
it in the partner portal. Going live has a one-time onboarding fee of $50, paid once in the portal
|
|
12
|
+
before your live key. No call needed: <https://docs.zimmerstack.com/pricing>
|
|
11
13
|
- **Made for AI coding tools.** The package carries its own rules file and a helper your coding agent
|
|
12
14
|
can ask. See [For AI coding agents](#for-ai-coding-agents).
|
|
13
15
|
|
|
14
16
|
[Docs](https://docs.zimmerstack.com) · [Quickstart](https://docs.zimmerstack.com/quickstart) ·
|
|
15
17
|
[Pricing](https://docs.zimmerstack.com/pricing) · [Partner portal](https://partner.zimmerstack.com/login) ·
|
|
16
18
|
[Starter app](https://github.com/zimmerstack/connect-starter) ·
|
|
19
|
+
[Source](https://github.com/zimmerstack/connect-node) ·
|
|
17
20
|
[Changelog](https://docs.zimmerstack.com/changelog) · <support@zimmerstack.com>
|
|
18
21
|
|
|
19
22
|
## Start in five minutes
|
|
@@ -172,7 +175,7 @@ export async function POST(request: Request) {
|
|
|
172
175
|
const event = await verifyWebhook(await request.text(), request.headers, process.env.ZIMMERSTACK_WEBHOOK_SECRET!);
|
|
173
176
|
// A message can arrive twice. Remember event.id and skip one you have seen.
|
|
174
177
|
if (isOtaBookingEvent(event)) await save(event.data.booking); // a booking site: created, modified, cancelled
|
|
175
|
-
if (isWebsiteBookingEvent(event)) await applyToMyCalendar(event.data.booking); // the hotel's own website
|
|
178
|
+
if (isWebsiteBookingEvent(event)) await applyToMyCalendar(event.data.booking); // the hotel's own website: created, a no-show, cancelled
|
|
176
179
|
return new Response(null, { status: 204 });
|
|
177
180
|
}
|
|
178
181
|
```
|
|
@@ -213,10 +216,11 @@ await zs.channels.setModifier(booking.channelId, [
|
|
|
213
216
|
channelPrice(4500, booking.modifier ?? []); // what Booking.com is sent for 4,500. Show it beside your calendar.
|
|
214
217
|
```
|
|
215
218
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
`zs.rates.resend()`
|
|
219
|
-
|
|
219
|
+
`MODIFIER_TAKES_EFFECT` is the sentence to show where a person saves one: saving makes the channel
|
|
220
|
+
manager send that channel every date again, so prices already on sale move to the new rule within
|
|
221
|
+
minutes. No re-send is needed. `zs.rates.resend()` stays for the rare case where you want our
|
|
222
|
+
record's prices sent again, unchanged; a hotel may ask a few times a day, so never call it
|
|
223
|
+
automatically.
|
|
220
224
|
|
|
221
225
|
One call to `zs.channels.setModifier()` moves every price on that booking site. Call it when a person
|
|
222
226
|
saved the setting. Never from a loop, a timer or a set-up script.
|
|
@@ -288,12 +292,26 @@ Guide: <https://docs.zimmerstack.com/hotels>
|
|
|
288
292
|
Some hotels sell on their own website through ZimmerStack's booking engine and keep your software as
|
|
289
293
|
their PMS. Those bookings reach you in two ways:
|
|
290
294
|
|
|
291
|
-
- the webhooks `direct.booking.created` and `direct.booking.cancelled` (your
|
|
295
|
+
- the webhooks `direct.booking.created`, `direct.booking.modified` and `direct.booking.cancelled` (your
|
|
296
|
+
address receives each one only when it lists that type);
|
|
292
297
|
- `zs.directBookings.list()` and `zs.directBookings.all({ since })`, with the permission
|
|
293
298
|
`direct-bookings:read`.
|
|
294
299
|
|
|
295
300
|
The booking looks like a booking site's booking. `channel.otaName` is `"Website"`, `finance` is null and
|
|
296
|
-
`amounts.paid` is what the guest paid online.
|
|
301
|
+
`amounts.paid` is what the guest paid online.
|
|
302
|
+
|
|
303
|
+
`direct.booking.modified` (from 0.6.0) tells you about a **no-show**: the hotel recorded that the guest did
|
|
304
|
+
not arrive, or undid that. A no-show is not a cancellation. `status` stays `CONFIRMED` and the payment is
|
|
305
|
+
untouched, so refund nothing. Read `stayStatus`:
|
|
306
|
+
|
|
307
|
+
- `NOSHOW`: the nights are on sale again on every booking site. Free the room in your own calendar.
|
|
308
|
+
- `UPCOMING` again: the hotel undid the no-show. Hold the room.
|
|
309
|
+
|
|
310
|
+
`changes` names what moved (`"stayStatus"`, `"rooms[0].status"`) and `previous` is the booking as it read
|
|
311
|
+
before. Nothing else sends this message yet: other dates, one room of several cancelled or a payment taken
|
|
312
|
+
at the desk still send none, so read `zs.directBookings.all({ since })` on a slow schedule too. An address
|
|
313
|
+
that listed the other two types before 21 Nov 2026 keeps receiving exactly those two until its owner ticks
|
|
314
|
+
the third.
|
|
297
315
|
|
|
298
316
|
**Apply a website booking to your own calendar before you next send room counts.** The booking takes
|
|
299
317
|
one room off the count the booking sites hold. If you then send your old count, that room goes back on
|
|
@@ -325,7 +343,8 @@ answers `replay: true` and moves no money. Your own cancel comes back to you as
|
|
|
325
343
|
own cancel button, never from a background job.
|
|
326
344
|
|
|
327
345
|
To try it with a test key, call `zs.sandbox.bookings.create({ …, otaName: "Website" })` and then cancel
|
|
328
|
-
that booking. The nights come back and no money moves.
|
|
346
|
+
that booking. The nights come back and no money moves. A test key cannot pretend a no-show: press Test on
|
|
347
|
+
your address and choose `direct.booking.modified` to receive its sample.
|
|
329
348
|
|
|
330
349
|
Guide: <https://docs.zimmerstack.com/website-bookings>
|
|
331
350
|
|
|
@@ -461,5 +480,6 @@ More words: <https://docs.zimmerstack.com/glossary>
|
|
|
461
480
|
| <https://www.zimmerstack.com/partners/pms-companies#join> | Sign up, free |
|
|
462
481
|
| <https://partner.zimmerstack.com/login> | The partner portal: your practice hotels, keys, webhooks, hotels and bills |
|
|
463
482
|
| <https://github.com/zimmerstack/connect-starter> | A working app to start from, with a Deploy button |
|
|
483
|
+
| <https://github.com/zimmerstack/connect-node> | This package's source, copied at every release |
|
|
464
484
|
| <https://docs.zimmerstack.com/changelog> | What changed, and when |
|
|
465
485
|
| <support@zimmerstack.com> | Questions, from any time zone. Answered within one working day. |
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -330,9 +330,9 @@ export declare class ZimmerStack {
|
|
|
330
330
|
* Replace a channel's modifier with these steps (`[]` removes it). Needs the scope
|
|
331
331
|
* channel-modifiers:write.
|
|
332
332
|
*
|
|
333
|
-
* ONE CALL MOVES EVERY PRICE
|
|
334
|
-
*
|
|
335
|
-
*
|
|
333
|
+
* ONE CALL MOVES EVERY PRICE ON THAT CHANNEL. Call it when a person saved the setting; never from
|
|
334
|
+
* a loop, a timer or a test against a live key. The channel manager then sends that channel every
|
|
335
|
+
* date again, so prices already on sale move within minutes; no `rates.resend` is needed.
|
|
336
336
|
*/
|
|
337
337
|
setModifier: (channelId: string, steps: ModifierStep[], options?: WriteOptions) => Promise<ModifierResult>;
|
|
338
338
|
};
|
|
@@ -362,7 +362,7 @@ export declare class ZimmerStack {
|
|
|
362
362
|
};
|
|
363
363
|
readonly directBookings: {
|
|
364
364
|
/**
|
|
365
|
-
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations included. Scope
|
|
365
|
+
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations and no-shows included. Scope
|
|
366
366
|
* `direct-bookings:read`. Follow `nextCursor`, or use `all`.
|
|
367
367
|
*/
|
|
368
368
|
list: (query?: Op<"GET /direct-bookings">["query"], options?: ReadOptions) => Promise<import("./generated.js").ChannelBookingsList>;
|
package/dist/cjs/client.js
CHANGED
|
@@ -697,9 +697,9 @@ class ZimmerStack {
|
|
|
697
697
|
* Replace a channel's modifier with these steps (`[]` removes it). Needs the scope
|
|
698
698
|
* channel-modifiers:write.
|
|
699
699
|
*
|
|
700
|
-
* ONE CALL MOVES EVERY PRICE
|
|
701
|
-
*
|
|
702
|
-
*
|
|
700
|
+
* ONE CALL MOVES EVERY PRICE ON THAT CHANNEL. Call it when a person saved the setting; never from
|
|
701
|
+
* a loop, a timer or a test against a live key. The channel manager then sends that channel every
|
|
702
|
+
* date again, so prices already on sale move within minutes; no `rates.resend` is needed.
|
|
703
703
|
*/
|
|
704
704
|
setModifier: (channelId, steps, options) => this.request("PUT /channels/{channelId}/modifier", { path: { channelId }, body: { steps }, ...options }),
|
|
705
705
|
};
|
|
@@ -732,7 +732,7 @@ class ZimmerStack {
|
|
|
732
732
|
/* ── bookings guests made on the hotel's own website (our booking engine) ── */
|
|
733
733
|
directBookings = {
|
|
734
734
|
/**
|
|
735
|
-
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations included. Scope
|
|
735
|
+
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations and no-shows included. Scope
|
|
736
736
|
* `direct-bookings:read`. Follow `nextCursor`, or use `all`.
|
|
737
737
|
*/
|
|
738
738
|
list: (query, options) => this.request("GET /direct-bookings", { query, ...options }),
|
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.6.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";
|
|
@@ -33,7 +33,7 @@ export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
|
33
33
|
export declare const SCOPES: readonly ["ari:read", "ari:write", "catalog:write", "channel-modifiers:write", "channel-bookings:read", "direct-bookings:read", "direct-bookings:cancel", "bookings:read", "bookings:write", "bookings:payments", "properties:write"];
|
|
34
34
|
export type Scope = (typeof SCOPES)[number];
|
|
35
35
|
/** When a channel's price modifier takes effect. Show it where a person saves one. */
|
|
36
|
-
export declare const MODIFIER_TAKES_EFFECT = "
|
|
36
|
+
export declare const MODIFIER_TAKES_EFFECT = "Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.";
|
|
37
37
|
export interface Error {
|
|
38
38
|
statuscode: number;
|
|
39
39
|
/** Human-readable, may change; branch on data.code */
|
|
@@ -766,7 +766,7 @@ export interface ModifierResult {
|
|
|
766
766
|
}>;
|
|
767
767
|
/** false when the channel already held exactly these steps: nothing was sent to the channel manager and nothing was counted */
|
|
768
768
|
changed: boolean;
|
|
769
|
-
/** When it takes effect. Always: "
|
|
769
|
+
/** When it takes effect. Always: "Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes." */
|
|
770
770
|
notice: string;
|
|
771
771
|
}
|
|
772
772
|
export interface RatesResendAccepted {
|
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.6.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";
|
|
@@ -114,7 +114,7 @@ exports.SCOPES = [
|
|
|
114
114
|
"properties:write"
|
|
115
115
|
];
|
|
116
116
|
/** When a channel's price modifier takes effect. Show it where a person saves one. */
|
|
117
|
-
exports.MODIFIER_TAKES_EFFECT = "
|
|
117
|
+
exports.MODIFIER_TAKES_EFFECT = "Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.";
|
|
118
118
|
/** idempotent: the server replays the stored answer when the idempotency key repeats, so the client may resend the request after a network failure. */
|
|
119
119
|
exports.OPERATIONS = {
|
|
120
120
|
"GET /properties": { idempotent: false, bodyRequired: false },
|
package/dist/cjs/webhooks.d.ts
CHANGED
|
@@ -6,13 +6,19 @@ import type { ChannelBooking } from "./generated.js";
|
|
|
6
6
|
/** An OTA booking arrived, changed or was cancelled (through the channel manager). */
|
|
7
7
|
export declare const OTA_BOOKING_EVENT_TYPES: readonly ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled"];
|
|
8
8
|
/**
|
|
9
|
-
* A
|
|
10
|
-
*
|
|
11
|
-
* the
|
|
9
|
+
* A booking on the hotel's own website through ZimmerStack's booking engine: the guest booked, the hotel
|
|
10
|
+
* recorded that the guest did not arrive (or undid that), or the booking was cancelled. The same booking
|
|
11
|
+
* object as the OTA events, in a family of its own: an endpoint receives each of these only when it lists
|
|
12
|
+
* that type.
|
|
13
|
+
*
|
|
14
|
+
* `direct.booking.modified` (from 0.6.0; the API sends it since 21 Nov 2026) is a no-show and its undo.
|
|
15
|
+
* The booking is not cancelled: `status` stays CONFIRMED and the payment is untouched. Read
|
|
16
|
+
* `data.booking.stayStatus`: NOSHOW means the nights are on sale again (free the room), UPCOMING again
|
|
17
|
+
* means the no-show was undone (hold the room). Nothing else sends it yet.
|
|
12
18
|
*/
|
|
13
|
-
export declare const WEBSITE_BOOKING_EVENT_TYPES: readonly ["direct.booking.created", "direct.booking.cancelled"];
|
|
19
|
+
export declare const WEBSITE_BOOKING_EVENT_TYPES: readonly ["direct.booking.created", "direct.booking.modified", "direct.booking.cancelled"];
|
|
14
20
|
/** Every event whose `data.booking` is a booking, of either family. */
|
|
15
|
-
export declare const BOOKING_EVENT_TYPES: readonly ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled", "direct.booking.created", "direct.booking.cancelled"];
|
|
21
|
+
export declare const BOOKING_EVENT_TYPES: readonly ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled", "direct.booking.created", "direct.booking.modified", "direct.booking.cancelled"];
|
|
16
22
|
export type OtaBookingEventType = (typeof OTA_BOOKING_EVENT_TYPES)[number];
|
|
17
23
|
export type WebsiteBookingEventType = (typeof WEBSITE_BOOKING_EVENT_TYPES)[number];
|
|
18
24
|
export type BookingEventType = (typeof BOOKING_EVENT_TYPES)[number];
|
|
@@ -24,7 +30,7 @@ export interface WebhookEvent {
|
|
|
24
30
|
id: string;
|
|
25
31
|
/**
|
|
26
32
|
* channel.booking.created · channel.booking.modified · channel.booking.cancelled (an OTA booking) ·
|
|
27
|
-
* direct.booking.created · direct.booking.cancelled (a booking on the hotel's own website) ·
|
|
33
|
+
* direct.booking.created · direct.booking.modified · direct.booking.cancelled (a booking on the hotel's own website) ·
|
|
28
34
|
* channel.sync.* · zimmerstack.ping. Narrow it with `isOtaBookingEvent` and `isWebsiteBookingEvent`.
|
|
29
35
|
*/
|
|
30
36
|
type: string;
|
|
@@ -43,9 +49,9 @@ export interface WebhookEvent {
|
|
|
43
49
|
booking?: ChannelBooking;
|
|
44
50
|
[key: string]: unknown;
|
|
45
51
|
};
|
|
46
|
-
/** Dotted paths that changed, on a modification ("stay.checkOut"). */
|
|
52
|
+
/** Dotted paths that changed, on a modification ("stay.checkOut"; on a website booking's no-show, "stayStatus" and "rooms[0].status"). */
|
|
47
53
|
changes?: string[] | null;
|
|
48
|
-
/** What those fields held before, on a modification. */
|
|
54
|
+
/** What those fields held before, on a modification. A website booking's carries `stayStatus` too. */
|
|
49
55
|
previous?: Record<string, unknown> | null;
|
|
50
56
|
truncated?: boolean;
|
|
51
57
|
}
|
|
@@ -57,7 +63,10 @@ export type BookingEvent = WebhookEvent & {
|
|
|
57
63
|
[key: string]: unknown;
|
|
58
64
|
};
|
|
59
65
|
};
|
|
60
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* A booking a guest made on the hotel's own website. `finance` is always null; `changes` and `previous`
|
|
68
|
+
* are set on `direct.booking.modified` (a no-show, or its undo) and null on the other two.
|
|
69
|
+
*/
|
|
61
70
|
export type WebsiteBookingEvent = BookingEvent & {
|
|
62
71
|
type: WebsiteBookingEventType;
|
|
63
72
|
};
|
|
@@ -66,8 +75,9 @@ export type OtaBookingEvent = BookingEvent & {
|
|
|
66
75
|
type: OtaBookingEventType;
|
|
67
76
|
};
|
|
68
77
|
/**
|
|
69
|
-
* True for `direct.booking.created` and `direct.booking.cancelled`: a booking
|
|
70
|
-
* website. A PMS that pushes room counts must put it in its own calendar before its
|
|
78
|
+
* True for `direct.booking.created`, `direct.booking.modified` and `direct.booking.cancelled`: a booking
|
|
79
|
+
* made on the hotel's own website. A PMS that pushes room counts must put it in its own calendar before its
|
|
80
|
+
* next push, and give the nights back when the booking is cancelled or reads `stayStatus` NOSHOW.
|
|
71
81
|
*/
|
|
72
82
|
export declare function isWebsiteBookingEvent(event: WebhookEvent): event is WebsiteBookingEvent;
|
|
73
83
|
/** True for `channel.booking.created`, `.modified` and `.cancelled`: a booking an OTA sent. */
|
package/dist/cjs/webhooks.js
CHANGED
|
@@ -11,17 +11,24 @@ exports.verifyWebhook = verifyWebhook;
|
|
|
11
11
|
/** An OTA booking arrived, changed or was cancelled (through the channel manager). */
|
|
12
12
|
exports.OTA_BOOKING_EVENT_TYPES = ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled"];
|
|
13
13
|
/**
|
|
14
|
-
* A
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
14
|
+
* A booking on the hotel's own website through ZimmerStack's booking engine: the guest booked, the hotel
|
|
15
|
+
* recorded that the guest did not arrive (or undid that), or the booking was cancelled. The same booking
|
|
16
|
+
* object as the OTA events, in a family of its own: an endpoint receives each of these only when it lists
|
|
17
|
+
* that type.
|
|
18
|
+
*
|
|
19
|
+
* `direct.booking.modified` (from 0.6.0; the API sends it since 21 Nov 2026) is a no-show and its undo.
|
|
20
|
+
* The booking is not cancelled: `status` stays CONFIRMED and the payment is untouched. Read
|
|
21
|
+
* `data.booking.stayStatus`: NOSHOW means the nights are on sale again (free the room), UPCOMING again
|
|
22
|
+
* means the no-show was undone (hold the room). Nothing else sends it yet.
|
|
17
23
|
*/
|
|
18
|
-
exports.WEBSITE_BOOKING_EVENT_TYPES = ["direct.booking.created", "direct.booking.cancelled"];
|
|
24
|
+
exports.WEBSITE_BOOKING_EVENT_TYPES = ["direct.booking.created", "direct.booking.modified", "direct.booking.cancelled"];
|
|
19
25
|
/** Every event whose `data.booking` is a booking, of either family. */
|
|
20
26
|
exports.BOOKING_EVENT_TYPES = [...exports.OTA_BOOKING_EVENT_TYPES, ...exports.WEBSITE_BOOKING_EVENT_TYPES];
|
|
21
27
|
const isType = (list, event) => typeof event?.type === "string" && list.includes(event.type);
|
|
22
28
|
/**
|
|
23
|
-
* True for `direct.booking.created` and `direct.booking.cancelled`: a booking
|
|
24
|
-
* website. A PMS that pushes room counts must put it in its own calendar before its
|
|
29
|
+
* True for `direct.booking.created`, `direct.booking.modified` and `direct.booking.cancelled`: a booking
|
|
30
|
+
* made on the hotel's own website. A PMS that pushes room counts must put it in its own calendar before its
|
|
31
|
+
* next push, and give the nights back when the booking is cancelled or reads `stayStatus` NOSHOW.
|
|
25
32
|
*/
|
|
26
33
|
function isWebsiteBookingEvent(event) {
|
|
27
34
|
return isType(exports.WEBSITE_BOOKING_EVENT_TYPES, event) && Boolean(event.data?.booking);
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -330,9 +330,9 @@ export declare class ZimmerStack {
|
|
|
330
330
|
* Replace a channel's modifier with these steps (`[]` removes it). Needs the scope
|
|
331
331
|
* channel-modifiers:write.
|
|
332
332
|
*
|
|
333
|
-
* ONE CALL MOVES EVERY PRICE
|
|
334
|
-
*
|
|
335
|
-
*
|
|
333
|
+
* ONE CALL MOVES EVERY PRICE ON THAT CHANNEL. Call it when a person saved the setting; never from
|
|
334
|
+
* a loop, a timer or a test against a live key. The channel manager then sends that channel every
|
|
335
|
+
* date again, so prices already on sale move within minutes; no `rates.resend` is needed.
|
|
336
336
|
*/
|
|
337
337
|
setModifier: (channelId: string, steps: ModifierStep[], options?: WriteOptions) => Promise<ModifierResult>;
|
|
338
338
|
};
|
|
@@ -362,7 +362,7 @@ export declare class ZimmerStack {
|
|
|
362
362
|
};
|
|
363
363
|
readonly directBookings: {
|
|
364
364
|
/**
|
|
365
|
-
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations included. Scope
|
|
365
|
+
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations and no-shows included. Scope
|
|
366
366
|
* `direct-bookings:read`. Follow `nextCursor`, or use `all`.
|
|
367
367
|
*/
|
|
368
368
|
list: (query?: Op<"GET /direct-bookings">["query"], options?: ReadOptions) => Promise<import("./generated.js").ChannelBookingsList>;
|
package/dist/esm/client.js
CHANGED
|
@@ -693,9 +693,9 @@ export class ZimmerStack {
|
|
|
693
693
|
* Replace a channel's modifier with these steps (`[]` removes it). Needs the scope
|
|
694
694
|
* channel-modifiers:write.
|
|
695
695
|
*
|
|
696
|
-
* ONE CALL MOVES EVERY PRICE
|
|
697
|
-
*
|
|
698
|
-
*
|
|
696
|
+
* ONE CALL MOVES EVERY PRICE ON THAT CHANNEL. Call it when a person saved the setting; never from
|
|
697
|
+
* a loop, a timer or a test against a live key. The channel manager then sends that channel every
|
|
698
|
+
* date again, so prices already on sale move within minutes; no `rates.resend` is needed.
|
|
699
699
|
*/
|
|
700
700
|
setModifier: (channelId, steps, options) => this.request("PUT /channels/{channelId}/modifier", { path: { channelId }, body: { steps }, ...options }),
|
|
701
701
|
};
|
|
@@ -728,7 +728,7 @@ export class ZimmerStack {
|
|
|
728
728
|
/* ── bookings guests made on the hotel's own website (our booking engine) ── */
|
|
729
729
|
directBookings = {
|
|
730
730
|
/**
|
|
731
|
-
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations included. Scope
|
|
731
|
+
* Website bookings, in the webhook's shape (`direct.booking.*`), cancellations and no-shows included. Scope
|
|
732
732
|
* `direct-bookings:read`. Follow `nextCursor`, or use `all`.
|
|
733
733
|
*/
|
|
734
734
|
list: (query, options) => this.request("GET /direct-bookings", { query, ...options }),
|
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.6.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";
|
|
@@ -33,7 +33,7 @@ export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
|
33
33
|
export declare const SCOPES: readonly ["ari:read", "ari:write", "catalog:write", "channel-modifiers:write", "channel-bookings:read", "direct-bookings:read", "direct-bookings:cancel", "bookings:read", "bookings:write", "bookings:payments", "properties:write"];
|
|
34
34
|
export type Scope = (typeof SCOPES)[number];
|
|
35
35
|
/** When a channel's price modifier takes effect. Show it where a person saves one. */
|
|
36
|
-
export declare const MODIFIER_TAKES_EFFECT = "
|
|
36
|
+
export declare const MODIFIER_TAKES_EFFECT = "Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.";
|
|
37
37
|
export interface Error {
|
|
38
38
|
statuscode: number;
|
|
39
39
|
/** Human-readable, may change; branch on data.code */
|
|
@@ -766,7 +766,7 @@ export interface ModifierResult {
|
|
|
766
766
|
}>;
|
|
767
767
|
/** false when the channel already held exactly these steps: nothing was sent to the channel manager and nothing was counted */
|
|
768
768
|
changed: boolean;
|
|
769
|
-
/** When it takes effect. Always: "
|
|
769
|
+
/** When it takes effect. Always: "Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes." */
|
|
770
770
|
notice: string;
|
|
771
771
|
}
|
|
772
772
|
export interface RatesResendAccepted {
|
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.6.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";
|
|
@@ -111,7 +111,7 @@ export const SCOPES = [
|
|
|
111
111
|
"properties:write"
|
|
112
112
|
];
|
|
113
113
|
/** When a channel's price modifier takes effect. Show it where a person saves one. */
|
|
114
|
-
export const MODIFIER_TAKES_EFFECT = "
|
|
114
|
+
export const MODIFIER_TAKES_EFFECT = "Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.";
|
|
115
115
|
/** idempotent: the server replays the stored answer when the idempotency key repeats, so the client may resend the request after a network failure. */
|
|
116
116
|
export const OPERATIONS = {
|
|
117
117
|
"GET /properties": { idempotent: false, bodyRequired: false },
|
|
@@ -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. 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## Room types and rate plans\n\n- A hotel sells room types (\"Deluxe Room\") through rate plans (\"Bed and breakfast\"). Create or change\n one with `zs.roomTypes.save({ ref, name, roomCount, adults })` and\n `zs.ratePlans.save({ ref, roomTypeRef, name, mealPlan, defaultRate })`. `ref` is the person's own\n id for it: sending the same ref again changes that entity, it never makes a second one. Several in\n one request: `zs.catalog.upsertRoomTypes` and `zs.catalog.upsertRatePlans`. All need the scope\n `catalog:write`.\n- Every later write names ZimmerStack's numeric `id`, not the ref: room counts name a room type's\n id, prices and stay rules name a rate plan's id. `zs.roomTypes.list()` and `zs.ratePlans.list()`\n give them, and so does the answer of each `save`.\n- `zs.roomTypes.delete(idOrRef)` and `zs.ratePlans.delete(idOrRef)` delete for good, and a room\n type takes its rate plans with it. Call them only when a person chose to delete that one entity on\n a screen, after a confirmation that names it. Never from a loop, a sync job, a \"reset\" or a cleanup\n script, and never to repair a mismatch: send the entity again with `save` instead. A hotel may\n delete 60 entities a day.\n- `CATALOG_CONFLICT` or `CHANNEL_MANAGER_ERROR` on a delete means the hotel still uses it: a\n booking site still sells it, an upcoming stay holds one of its rooms, or rooms are still assigned\n to the room type. Nothing was deleted. Show the message and stop; do not try another way round.\n\n## Adding and removing a hotel (a software partner's company key)\n\n- Only a COMPANY key with the scope `properties:write` can do either; a hotel's own key cannot\n (`COMPANY_KEY_REQUIRED`). The person ticks \"Also add and remove hotels\" when making the key in the\n partner portal; only the account's owner or an Admin is offered that tick box. Neither call names a\n hotel with `forProperty`.\n- `zs.properties.create({ name, owner, address, roomTypes })` adds a hotel and answers with its `id`:\n act on it with `zs.forProperty(id)`. The owner gets the sign-in details by email, never the caller.\n It joins the partner's monthly invoice. With a `zsk_test_` key the same call makes a sandbox, which\n is never billed. A partner may add 20 hotels an hour.\n- After adding: the hotel is not on the channel manager yet. The first `zs.roomTypes.save` (or\n `zs.catalog.upsertRoomTypes`) with the same refs puts it there; then the rate plans, then room\n counts and prices.\n- `zs.properties.delete(propertyId, { confirm })` (also `zs.properties.remove`) removes a hotel the\n partner added, FOR GOOD: its booking sites are disconnected, its rate plans and then its room types\n are removed from the channel manager, the hotel is closed and it comes off the invoice from the next\n 1st. `confirm` is the hotel's exact name from `zs.properties.list()`. There is no undo, and a\n removed hotel cannot be added again by API.\n- Call `delete` only when a person chose to remove that one hotel on a screen, after typing or\n confirming its name. Never from a loop, a timer, a sync job, a \"reset\", a cleanup or a test against\n a live key, and never to fix a hotel that looks wrong. A partner may remove\n 10 hotels a day.\n- The answer's `channelManager.state` is `REMOVED`, or `RETRYING` when one step is still finishing:\n that is success, ZimmerStack retries it, do not call again in a loop. `PROPERTY_NOT_REMOVABLE` means\n this key may not remove that hotel (its owner let the partner in, or it uses more than the channel\n manager): show the message and stop.\n- Both calls take longer than the others (a removal disconnects the booking sites one after another),\n so the client waits up to 95 seconds for them whatever `timeoutMs` is. If `delete` ends in\n `TIMEOUT` or `NETWORK_ERROR`, the person may press Remove again: a hotel already gone answers\n `replay: true`, one still being removed answers `PROPERTY_BUSY`. Never retry it in a loop.\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## Website bookings: apply them before you push room counts\n\n- When the hotel also sells on its own website through ZimmerStack's booking engine, those bookings\n reach you as the webhooks `direct.booking.created` and `direct.booking.cancelled` (the endpoint must\n list those two types) and by `zs.directBookings.all({ since })` (scope `direct-bookings:read`). They\n are not OTA bookings: `isWebsiteBookingEvent(event)` tells them apart, `channel.otaName` is `\"Website\"`\n and `finance` is null. There is no modified event.\n- A website booking takes one room off the count the channels hold, at once. A PMS that pushes absolute\n room counts must apply the booking to its own calendar BEFORE its next `zs.availability.set` or\n `zs.grid.save`, or that push puts the sold room back on sale. Read `zs.directBookings.all` before a\n full push. Nothing on our side stops the count from going up.\n- `zs.directBookings.cancel(bookingId, { refund, reason })` cancels a whole website booking that is\n still UPCOMING, and moves the guest's money (scope `direct-bookings:cancel`, granted on its own).\n `refund` is `\"policy\"` (the default: what the booking's own cancellation policy gives back, as if the\n guest cancelled), `\"full\"` (everything paid online: the hotel is at fault, an overbooking) or\n `\"none\"` (the hotel settles the money itself). Call it only from a person's own cancel button, with\n the refund they chose on the screen; never from a loop, a sync job or a test against a live key.\n Show `refund.amount` and `refund.status` from the answer. `BOOKING_NOT_CANCELLABLE` (checked in,\n checked out, a no-show) goes to the hotel's desk; do not retry it. `replay: true` means it was\n already cancelled and no money moved. Your own cancel comes back as `direct.booking.cancelled`\n (\"Cancelled by the hotel\"): match it on the booking id and treat it as already applied.\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- [ ] A PMS that pushes room counts applies every website booking to its own calendar before it pushes.\n- [ ] A website booking is cancelled only from a person's own action, with the refund they chose.\n- [ ] A room type or a rate plan is deleted only from a person's own action, after a confirmation that names it.\n";
|
|
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## Room types and rate plans\n\n- A hotel sells room types (\"Deluxe Room\") through rate plans (\"Bed and breakfast\"). Create or change\n one with `zs.roomTypes.save({ ref, name, roomCount, adults })` and\n `zs.ratePlans.save({ ref, roomTypeRef, name, mealPlan, defaultRate })`. `ref` is the person's own\n id for it: sending the same ref again changes that entity, it never makes a second one. Several in\n one request: `zs.catalog.upsertRoomTypes` and `zs.catalog.upsertRatePlans`. All need the scope\n `catalog:write`.\n- Every later write names ZimmerStack's numeric `id`, not the ref: room counts name a room type's\n id, prices and stay rules name a rate plan's id. `zs.roomTypes.list()` and `zs.ratePlans.list()`\n give them, and so does the answer of each `save`.\n- `zs.roomTypes.delete(idOrRef)` and `zs.ratePlans.delete(idOrRef)` delete for good, and a room\n type takes its rate plans with it. Call them only when a person chose to delete that one entity on\n a screen, after a confirmation that names it. Never from a loop, a sync job, a \"reset\" or a cleanup\n script, and never to repair a mismatch: send the entity again with `save` instead. A hotel may\n delete 60 entities a day.\n- `CATALOG_CONFLICT` or `CHANNEL_MANAGER_ERROR` on a delete means the hotel still uses it: a\n booking site still sells it, an upcoming stay holds one of its rooms, or rooms are still assigned\n to the room type. Nothing was deleted. Show the message and stop; do not try another way round.\n\n## Adding and removing a hotel (a software partner's company key)\n\n- Only a COMPANY key with the scope `properties:write` can do either; a hotel's own key cannot\n (`COMPANY_KEY_REQUIRED`). The person ticks \"Also add and remove hotels\" when making the key in the\n partner portal; only the account's owner or an Admin is offered that tick box. Neither call names a\n hotel with `forProperty`.\n- `zs.properties.create({ name, owner, address, roomTypes })` adds a hotel and answers with its `id`:\n act on it with `zs.forProperty(id)`. The owner gets the sign-in details by email, never the caller.\n It joins the partner's monthly invoice. With a `zsk_test_` key the same call makes a sandbox, which\n is never billed. A partner may add 20 hotels an hour.\n- After adding: the hotel is not on the channel manager yet. The first `zs.roomTypes.save` (or\n `zs.catalog.upsertRoomTypes`) with the same refs puts it there; then the rate plans, then room\n counts and prices.\n- `zs.properties.delete(propertyId, { confirm })` (also `zs.properties.remove`) removes a hotel the\n partner added, FOR GOOD: its booking sites are disconnected, its rate plans and then its room types\n are removed from the channel manager, the hotel is closed and it comes off the invoice from the next\n 1st. `confirm` is the hotel's exact name from `zs.properties.list()`. There is no undo, and a\n removed hotel cannot be added again by API.\n- Call `delete` only when a person chose to remove that one hotel on a screen, after typing or\n confirming its name. Never from a loop, a timer, a sync job, a \"reset\", a cleanup or a test against\n a live key, and never to fix a hotel that looks wrong. A partner may remove\n 10 hotels a day.\n- The answer's `channelManager.state` is `REMOVED`, or `RETRYING` when one step is still finishing:\n that is success, ZimmerStack retries it, do not call again in a loop. `PROPERTY_NOT_REMOVABLE` means\n this key may not remove that hotel (its owner let the partner in, or it uses more than the channel\n manager): show the message and stop.\n- Both calls take longer than the others (a removal disconnects the booking sites one after another),\n so the client waits up to 95 seconds for them whatever `timeoutMs` is. If `delete` ends in\n `TIMEOUT` or `NETWORK_ERROR`, the person may press Remove again: a hotel already gone answers\n `replay: true`, one still being removed answers `PROPERTY_BUSY`. Never retry it in a loop.\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- Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.\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## Website bookings: apply them before you push room counts\n\n- When the hotel also sells on its own website through ZimmerStack's booking engine, those bookings\n reach you as the webhooks `direct.booking.created`, `direct.booking.modified` and\n `direct.booking.cancelled` (the endpoint receives each only when it lists that type) and by\n `zs.directBookings.all({ since })` (scope `direct-bookings:read`). They are not OTA bookings:\n `isWebsiteBookingEvent(event)` tells them apart, `channel.otaName` is `\"Website\"` and `finance` is null.\n- `direct.booking.modified` is a no-show and its undo, nothing else yet: the hotel recorded that the guest\n did not arrive, or undid that. It is NOT a cancellation: `status` stays CONFIRMED and the payment is\n untouched, so never refund on it. Read `stayStatus` and each room's `status`: NOSHOW gives the nights\n back (they are on sale again on every channel), UPCOMING again holds them. `changes` names what moved\n (`\"stayStatus\"`, `\"rooms[0].status\"`); `previous` is the booking as it read before, `stayStatus`\n included. The sandbox does not simulate one: the endpoint's Test button sends the sample.\n- A website booking takes one room off the count the channels hold, at once. A PMS that pushes absolute\n room counts must apply the booking to its own calendar BEFORE its next `zs.availability.set` or\n `zs.grid.save`, or that push puts the sold room back on sale. Read `zs.directBookings.all` before a\n full push. Nothing on our side stops the count from going up.\n- `zs.directBookings.cancel(bookingId, { refund, reason })` cancels a whole website booking that is\n still UPCOMING, and moves the guest's money (scope `direct-bookings:cancel`, granted on its own).\n `refund` is `\"policy\"` (the default: what the booking's own cancellation policy gives back, as if the\n guest cancelled), `\"full\"` (everything paid online: the hotel is at fault, an overbooking) or\n `\"none\"` (the hotel settles the money itself). Call it only from a person's own cancel button, with\n the refund they chose on the screen; never from a loop, a sync job or a test against a live key.\n Show `refund.amount` and `refund.status` from the answer. `BOOKING_NOT_CANCELLABLE` (checked in,\n checked out, a no-show) goes to the hotel's desk; do not retry it. `replay: true` means it was\n already cancelled and no money moved. Your own cancel comes back as `direct.booking.cancelled`\n (\"Cancelled by the hotel\"): match it on the booking id and treat it as already applied.\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- [ ] A PMS that pushes room counts applies every website booking to its own calendar before it pushes.\n- [ ] A website booking is cancelled only from a person's own action, with the refund they chose.\n- [ ] A room type or a rate plan is deleted only from a person's own action, after a confirmation that names it.\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",
|
|
@@ -1571,7 +1571,7 @@ export const REFERENCE = {
|
|
|
1571
1571
|
{
|
|
1572
1572
|
"key": "PUT /channels/{channelId}/modifier",
|
|
1573
1573
|
"summary": "Set one channel's price modifier",
|
|
1574
|
-
"description": "Scope channel-modifiers:write. Replaces the channel's steps with the list sent ([] removes them). Applied to the channel manager while the request runs, read back, then answered: 200 means the channel holds them.
|
|
1574
|
+
"description": "Scope channel-modifiers:write. Replaces the channel's steps with the list sent ([] removes them). Applied to the channel manager while the request runs, read back, then answered: 200 means the channel holds them. The channel manager then sends that channel every date again, so prices already there move within minutes; no re-send is needed. Steps the channel already holds answer changed: false and cost nothing.",
|
|
1575
1575
|
"scope": "channel-modifiers:write",
|
|
1576
1576
|
"call": "zs.channels.setModifier(channelId, steps)",
|
|
1577
1577
|
"also": [],
|
|
@@ -1616,7 +1616,7 @@ export const REFERENCE = {
|
|
|
1616
1616
|
}
|
|
1617
1617
|
],
|
|
1618
1618
|
"changed": true,
|
|
1619
|
-
"notice": "
|
|
1619
|
+
"notice": "Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes."
|
|
1620
1620
|
},
|
|
1621
1621
|
"refusals": [
|
|
1622
1622
|
{
|
|
@@ -1660,7 +1660,7 @@ export const REFERENCE = {
|
|
|
1660
1660
|
{
|
|
1661
1661
|
"key": "POST /rates/resend",
|
|
1662
1662
|
"summary": "Send the property's prices to the channels again",
|
|
1663
|
-
"description": "Scope ari:write. Marks every rate-plan night of the writable horizon to be sent again, unchanged
|
|
1663
|
+
"description": "Scope ari:write. Marks every rate-plan night of the writable horizon to be sent again, unchanged. The nights travel like any write: paced, coalesced, never lost. Not needed after a modifier change (the channel manager re-sends that channel every date itself); it is limited per property per day (data.scope rate-resends-day). No body.",
|
|
1664
1664
|
"scope": "ari:write",
|
|
1665
1665
|
"call": "zs.rates.resend()",
|
|
1666
1666
|
"also": [],
|
|
@@ -2618,7 +2618,7 @@ export const REFERENCE = {
|
|
|
2618
2618
|
"SandboxBookingModify": "export interface SandboxBookingModify {\n /** New arrival, YYYY-MM-DD in the property's timezone; today or later */\n checkIn?: string;\n /** New length of stay, 1–30 */\n nights?: number;\n /** New number of rooms, 1–5 */\n rooms?: number;\n /** New adults per room */\n adults?: number;\n /** The guest renamed, as a channel sometimes does */\n guestName?: string;\n}",
|
|
2619
2619
|
"Channels": "export interface Channels {\n /** When the connection list was last captured; null when never */\n asOf: string | null;\n channels: Array<{\n /** The channel manager's id for this connection */\n channelId: string;\n /** The channel: BookingCom, Expedia, Agoda, Airbnb, GoMMT, … */\n kind: string;\n /** The connection's title in the channel manager */\n title: string | null;\n /** When our record last saw this connection (the nightly settings sweep) */\n seenAt: string;\n /** Unresolved problems the channel manager reported for this connection */\n openIssues: Array<{\n /** sync_error · rate_error · disconnect_channel · inventory_out_of_sync · … */\n event: string;\n raisedAt: string;\n }>;\n /** This channel's price modifier (§2.8): the steps the channel manager applies, in order, to every price it sends this channel. [] = prices go as they are. null = the channel holds a rule set by hand in the channel manager that this API cannot express; PUT /channels/{channelId}/modifier replaces it */\n modifier: Array<{\n /** Raise or lower what this channel is sent */\n action: \"increase\" | \"decrease\";\n /** percent of the price, or a fixed amount in MAJOR units of the property's currency */\n type: \"percent\" | \"fixed\";\n /** How much: 18 with type percent is 18 %; 200 with type fixed is 200.00 in the property's currency. Always positive: choose decrease instead of a minus sign. Two decimals at most */\n value: number;\n }> | null;\n /** A separate adjustment the owner set for this channel in the ZimmerStack Channels app, applied before the modifier. Read-only here; null = none */\n markupPlan: {\n /** markup: this channel sells a copy of each plan priced a fixed step from it · manual: this channel has prices of its own for some nights */\n mode: \"markup\" | \"manual\";\n direction: \"increase\" | \"decrease\";\n /** Percent of the price, when the step is a percentage */\n percent: number | null;\n /** MAJOR units, when the step is a fixed amount */\n amount: number | null;\n } | null;\n }>;\n /** Unresolved problems not tied to one connection (for example the inventory pipe out of sync) */\n propertyIssues: Array<{\n event: string;\n raisedAt: string;\n }>;\n}",
|
|
2620
2620
|
"ModifierWrite": "export interface ModifierWrite {\n /** The whole modifier, in the order it is applied; replaces what the channel holds. At most 5 steps. An empty list removes it: prices go to the channel as they are */\n steps: Array<{\n /** Raise or lower what this channel is sent */\n action: \"increase\" | \"decrease\";\n /** percent of the price, or a fixed amount in MAJOR units of the property's currency */\n type: \"percent\" | \"fixed\";\n /** How much: 18 with type percent is 18 %; 200 with type fixed is 200.00 in the property's currency. Always positive: choose decrease instead of a minus sign. Two decimals at most */\n value: number;\n }>;\n}",
|
|
2621
|
-
"ModifierResult": "export interface ModifierResult {\n channelId: string;\n /** The channel: BookingCom, Expedia, Agoda, Airbnb, GoMMT, … */\n kind: string;\n title: string | null;\n /** What the channel holds now */\n modifier: Array<{\n /** Raise or lower what this channel is sent */\n action: \"increase\" | \"decrease\";\n /** percent of the price, or a fixed amount in MAJOR units of the property's currency */\n type: \"percent\" | \"fixed\";\n /** How much: 18 with type percent is 18 %; 200 with type fixed is 200.00 in the property's currency. Always positive: choose decrease instead of a minus sign. Two decimals at most */\n value: number;\n }>;\n /** false when the channel already held exactly these steps: nothing was sent to the channel manager and nothing was counted */\n changed: boolean;\n /** When it takes effect. Always: \"
|
|
2621
|
+
"ModifierResult": "export interface ModifierResult {\n channelId: string;\n /** The channel: BookingCom, Expedia, Agoda, Airbnb, GoMMT, … */\n kind: string;\n title: string | null;\n /** What the channel holds now */\n modifier: Array<{\n /** Raise or lower what this channel is sent */\n action: \"increase\" | \"decrease\";\n /** percent of the price, or a fixed amount in MAJOR units of the property's currency */\n type: \"percent\" | \"fixed\";\n /** How much: 18 with type percent is 18 %; 200 with type fixed is 200.00 in the property's currency. Always positive: choose decrease instead of a minus sign. Two decimals at most */\n value: number;\n }>;\n /** false when the channel already held exactly these steps: nothing was sent to the channel manager and nothing was counted */\n changed: boolean;\n /** When it takes effect. Always: \"Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.\" */\n notice: string;\n}",
|
|
2622
2622
|
"RatesResendAccepted": "export interface RatesResendAccepted {\n /** Hotel-local calendar date, YYYY-MM-DD */\n from: string;\n /** Hotel-local calendar date, YYYY-MM-DD */\n to: string;\n /** Rate-plan nights marked to be sent again. They travel like any write: watch rates.dirtyCells on GET /sync fall to 0 */\n cells: number;\n /** Nights left out because the channel manager refused their value earlier (rates.parkedCells on GET /sync): send a corrected value for those */\n parkedLeft: number;\n /** GET path that says when it has landed */\n watch: string;\n notice: string;\n}",
|
|
2623
2623
|
"ChannelBookingsQuery": "export interface ChannelBookingsQuery {\n /** Changed (created, modified or cancelled) on or after this instant (ISO 8601); default: the last 7 days */\n since?: string;\n /** Only confirmed (live) or only cancelled bookings; default both */\n status?: \"CONFIRMED\" | \"CANCELLED\";\n /** 1 to 100; default 50 */\n limit?: number;\n /** The previous page's nextCursor: resume exactly after its last item, even when many bookings changed in the same instant. Takes precedence over since */\n cursor?: string;\n}",
|
|
2624
2624
|
"ChannelBookingsList": "export interface ChannelBookingsList {\n /** The instant the list starts at, echoed */\n since: string;\n /** Oldest change first — exactly the booking object the webhooks carry */\n items: Array<{\n id: number;\n reference: string;\n status: \"CONFIRMED\" | \"CANCELLED\";\n stayStatus: string;\n channel: {\n otaName: string;\n otaReservationCode: string;\n source: string;\n sourceGroup: string;\n };\n stay: {\n checkIn: string;\n checkOut: string;\n nights: number;\n dayUse: boolean;\n };\n guest: {\n fullName: string;\n firstName: string | null;\n lastName: string | null;\n phone?: string | null;\n email?: string | null;\n country: string | null;\n language: string | null;\n };\n guestNotes: string | null;\n occupancy: {\n adults: number;\n children: number;\n };\n rooms: Array<{\n roomTypeId: number;\n roomTypeName: string;\n ratePlanId?: number | null;\n mealPlan: \"EP\" | \"CP\" | \"MAP\" | \"AP\";\n adults: number;\n children: number;\n checkIn: string;\n checkOut: string;\n nights: number;\n dayUse: boolean;\n ratePerNight: number;\n amount: number;\n status: string;\n }>;\n amounts: {\n currency: string;\n total: number;\n paid: number;\n balanceDue: number;\n paymentCollect: \"ota\" | \"property\" | \"unknown\";\n };\n finance: {\n otaName: string;\n amountBasis: string;\n currency: string | null;\n grossAmount: number | null;\n commissionAmount: number | null;\n taxAmount: number | null;\n netPayoutAmount: number | null;\n } | null;\n cancellation: {\n at: string;\n reason: string | null;\n } | null;\n createdAt: string;\n updatedAt: string;\n }>;\n /** More rows matched than limit: ask again with cursor = nextCursor */\n more: boolean;\n /** Pass as cursor for the next page; null when there is no more */\n nextCursor: string | null;\n}",
|
|
@@ -2637,11 +2637,11 @@ export const REFERENCE = {
|
|
|
2637
2637
|
"properties": "## properties\nwhat: A software partner's company key adds a hotel and removes a hotel it added, without the partner portal: POST /properties and DELETE /properties/{propertyId}. Scope properties:write, which only a company key can hold; a hotel's own key is 403 COMPANY_KEY_REQUIRED. Neither route reads X-ZS-Property.\nadd: POST /properties makes what the partner portal's \"Add a hotel\" form makes: a channel-manager hotel with its own owner account, its room types (1 to 20, each with one room-only rate plan at its defaultRate), on your invoice at your price. The owner gets their sign-in details by email; you never see them. The answer is the hotel in GET /properties' shape: name its id in X-ZS-Property from then on.\nafterAdding: The new hotel is not on the channel manager yet (channelManager: false). Your first PUT /catalog/room-types puts it there: send the same refs you gave here, or the same names, and they become those room types instead of a second set. Then send your rate plans, and your availability and rates.\nidempotency: POST /properties needs x-idempotency-key (400 IDEMPOTENCY_KEY_INVALID without one): the same key never makes a second hotel, even when the first answer was lost. A test key and a live key never share a key's answer. A 4xx answer is kept under its key for 7 days, like every verdict: once you have changed what it asked for (your billing setup done, a sandbox removed), send the request under a new key. A 429 or a 503 is never kept: send the same request, with the same key, after Retry-After.\nbilling: billing.state says where the new hotel's billing stands. ACTIVE: its billing has started and it is on your next monthly invoice (under the public price list your live hotels are counted on the 1st of each month, so the days before the next 1st are free). WAITING: the hotel is live and its billing has not started; billing.reason says why (SETUP, OVERDUE, UNPAID_LIMIT or REVIEW) and billing.message what to do. Before your first hotel, accept the price list and add your billing details in the partner portal (409 BILLING_SETUP_REQUIRED until then).\nowner: One owner account per email address. An address that already has an account is 409 OWNER_HAS_ACCOUNT: a hotel that exists already joins you when its owner enters your vendor code under Integrations.\nremove: DELETE /properties/{propertyId}?confirm=<the hotel's exact name> removes a hotel for good, in one call: its subscription is cancelled, then its channel connections, its rate plans, its room types and its listing are taken off the channel manager, your keys stop reaching it and nobody signs in to it any more. Its bookings and bills are kept. 200 when nothing is left on the channel manager; 202 when a step there is still pending, which ZimmerStack retries by itself (channelManager.state RETRYING, with the step and what is still connected). Call it again any time: once the hotel is gone the answer is 200 with replay: true and where it stands, and no confirm is needed.\nwhichHotels: Only a hotel you added and pay for, that runs the channel manager alone and is the one property of its owner's account. Anything else is 409 PROPERTY_NOT_REMOVABLE, and data.details.reason says who can do it: OWNER_ALLOWED (its owner let you in: the owner removes your access) · NOT_BILLED_TO_YOU, OTHER_PRODUCTS, SHARES_ACCOUNT (ZimmerStack removes it: write to support). A hotel you cannot reach is 404 PROPERTY_NOT_FOUND.\nrefusals: 400 CONFIRMATION_MISMATCH: confirm is not the hotel's exact name. 503 PROPERTY_BUSY: a hotel of yours is being added or removed right now, one at a time; retry after Retry-After. 503 PROPERTY_BUSY with a Retry-After of an hour on a removal: it has started and could not finish, ZimmerStack has been told and finishes it, and nothing is needed from you; call again later for where it stands. 429 RATE_LIMITED with data.scope vendor-property-removals-day: the most hotels your company may remove in a day (10; a removal that had already started is finished whatever the day's count), partner-new-properties-hour: the most it may add in an hour (20), or partner-new-sandboxes-hour: the most sandboxes a test key may make in an hour (30). 503 PRICE_UNAVAILABLE: the hotel could not be priced just now; retry. 400 VALIDATION whose message says the request is held (data.details.reason): the hotel could not be created from a request already on file, so sending it again, under this key or a new one, will not help; write to ZimmerStack support.\nsandbox: With a test key (zsk_test_) the same two calls make and delete one of your sandboxes (up to 5 at once; 409 SANDBOX_LIMIT beyond, and at most 30 made in any hour; 429 RATE_LIMITED with data.scope partner-new-sandboxes-hour beyond): the body is checked exactly as a live one, the sandbox takes its room types, and nothing is billed or reaches a channel. Its name ends in (sandbox) and is at most 60 characters: confirm a delete with the name the answer returned.\n\n",
|
|
2638
2638
|
"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",
|
|
2639
2639
|
"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. The booking engine's are GET /direct-bookings.\n\n",
|
|
2640
|
-
"website-bookings": "## directBookings\nwhat: A hotel that sells on its own website through the ZimmerStack booking engine takes bookings no OTA sent. They reach a PMS under their own names: the webhooks direct.booking.created and direct.booking.cancelled, and GET /direct-bookings for the pull. The booking object is the one channel.booking.* carries, so one parser serves both families.\ntellApart: channel.source is DIRECT_WEB, channel.sourceGroup is DIRECT and channel.otaName is \"Website\". finance is null (no OTA, no commission); amounts.paymentCollect is \"property\"; amounts.paid is what the guest paid online, amounts.balanceDue what the desk collects.\nsubscribe: An endpoint receives them only when it lists the
|
|
2641
|
-
"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
|
|
2642
|
-
"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. With otaName \"Website\" the booking is one made on the hotel's own website instead, and the events are direct.booking.created and direct.booking.cancelled (x-zimmerstack.directBookings). 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",
|
|
2640
|
+
"website-bookings": "## directBookings\nwhat: A hotel that sells on its own website through the ZimmerStack booking engine takes bookings no OTA sent. They reach a PMS under their own names: the webhooks direct.booking.created, direct.booking.modified and direct.booking.cancelled, and GET /direct-bookings for the pull. The booking object is the one channel.booking.* carries, so one parser serves both families.\ntellApart: channel.source is DIRECT_WEB, channel.sourceGroup is DIRECT and channel.otaName is \"Website\". finance is null (no OTA, no commission); amounts.paymentCollect is \"property\"; amounts.paid is what the guest paid online, amounts.balanceDue what the desk collects.\nsubscribe: An endpoint receives them only when it lists the event types, each ticked on its own. An endpoint registered before a type existed receives none of it until its owner ticks it: direct.booking.modified was added on 21 Nov 2026, so an endpoint that listed created and cancelled before then still receives exactly those two.\napplyFirst: A website booking takes one room off the count the channels hold, at once. A PMS that pushes absolute room counts must apply the booking to its own calendar BEFORE its next PUT /availability, or that push puts the sold room back on sale. Read GET /direct-bookings before a full push to catch anything a webhook has not delivered yet.\nevents: created: a nightly or an hourly booking the guest confirmed. modified: the hotel recorded in ZimmerStack that the guest did not arrive (a no-show), or undid that. The booking is not cancelled, so status stays CONFIRMED and the payment is untouched; stayStatus and each room's status say NOSHOW (the nights are on sale again on every channel: free the room) or, after an undo, UPCOMING again (the nights are taken again: hold the room). changes names what moved (\"stayStatus\", \"rooms[0].status\") and previous carries the booking as it read before, stayStatus included. cancelled: the guest cancelled on the booking page, or the hotel cancelled or deleted the booking in ZimmerStack or through POST /direct-bookings/{bookingId}/cancel; cancellation.reason says which (\"Cancelled by the guest\" or \"Cancelled by the hotel\"). A cancel your own PMS made comes back to you as this event too: match it on the booking id and treat it as already applied.\nafterwards: Anything else the hotel changes on a website booking in ZimmerStack afterwards (other dates, one room of several cancelled, a payment taken at the desk) sends no event yet; modified is a no-show and its undo only, and changes is how a later kind of change will say what it is. GET /direct-bookings lists that booking again, because since is on its last change: read it on a slow schedule too (once an hour is plenty), not only before a push. A modified or a cancelled event can also arrive for a booking whose created your endpoint never received (it ticked the types later): treat an unknown booking id as new and read it with GET /direct-bookings/{bookingId}.\npull: GET /direct-bookings takes the same since, status, limit and cursor as GET /channel-bookings and pages the same way. Scope direct-bookings:read, granted separately from channel-bookings:read. A booking deleted in ZimmerStack stays listed, as CANCELLED.\nnever: OTA bookings (GET /channel-bookings), front-desk bookings and bookings a key created (GET /bookings) are never listed here.\ncancel: POST /direct-bookings/{bookingId}/cancel cancels a whole website booking that is still UPCOMING and says what the guest gets back: refund \"policy\" (the default: what the booking's own cancellation policy gives now, exactly as if the guest cancelled on the booking page), \"full\" (everything paid online) or \"none\" (the hotel settles any money itself). The refund goes back to the guest's online payment, never more than it; the hotel's share of that payment is taken back first. The nights go back on sale on the channels, the guest gets the usual cancellation message, and direct.booking.cancelled says \"Cancelled by the hotel\". Scope direct-bookings:cancel, granted on its own and never by default. A checked-in, checked-out or no-show booking is 409 BOOKING_NOT_CANCELLABLE; an already-cancelled one answers 200 with replay: true and moves no money. Send x-idempotency-key: a retry with the same key gets the first answer back. Budgets: 10 per key per minute, 50 per property per rolling day.\nsandbox: POST /sandbox/bookings with otaName \"Website\" simulates one and sends the real direct.booking.created; its cancel sends direct.booking.cancelled. Its modify is 409 BOOKING_NOT_MODIFIABLE. POST /direct-bookings/{bookingId}/cancel works on a sandbox website booking with a test key: the nights come back and the event says \"Cancelled by the hotel\", and no money moves (refund.status NONE).\n\n",
|
|
2641
|
+
"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: one call moves every price on that channel. A software partner's keys hold it by default; a hotel's own key holds it when the owner ticked it).\ntakesEffect: Saving a modifier makes the channel manager send that channel every date again, so prices already on the channel move to the new rule within minutes.\nresend: Not needed after a modifier: the channel manager re-sends that channel every date itself. POST /rates/resend (scope ari:write) is for the rare case where the channel should get our record's prices and stay rules again, unchanged; re-sending the same price through PUT /rates does nothing, because a value our record already holds is dropped before anything is sent. 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 - Nothing else: the channel manager sends that channel every date again, so prices already there move within minutes\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",
|
|
2642
|
+
"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. With otaName \"Website\" the booking is one made on the hotel's own website instead, and the events are direct.booking.created and direct.booking.cancelled (x-zimmerstack.directBookings); a no-show is not simulated, so direct.booking.modified is tried with the endpoint's Test button, which sends its sample. 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",
|
|
2643
2643
|
"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\" [POST /properties, DELETE /properties/{propertyId}]\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 (400) [POST /properties]\n- IDEMPOTENCY_KEY_REUSED (409): \"This idempotency key was already used with a different request body.\" [POST /properties]\n- IDEMPOTENCY_IN_FLIGHT (409) [POST /properties]\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.\"\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- COMPANY_KEY_REQUIRED (403): \"Hotels are added and removed with your company key. This key belongs to one hotel.\" [POST /properties, DELETE /properties/{propertyId}]\n- BILLING_SETUP_REQUIRED (409): \"Accept the price list and add your billing details on the Billing page of the partner portal first. Then send the request again under a new idempotency key.\" [POST /properties]\n- OWNER_HAS_ACCOUNT (409): \"This owner already has an account you did not create. Ask them to enter your vendor code under Integrations.\" [POST /properties]\n- SANDBOX_LIMIT (409): \"You hold 5 sandboxes, the most one company may have. Remove one first. Then send the request again under a new idempotency key.\" [POST /properties]\n- CONFIRMATION_MISMATCH (400): \"Send confirm= with the hotel's exact name, as GET /properties prints it.\"\n- PROPERTY_NOT_REMOVABLE (409): \"You did not add this hotel: its owner let you in. Ask the owner to remove your access under Integrations.\"\n- PROPERTY_BUSY (503): \"This hotel, or another of yours, is still being added or removed. Retry shortly.\" [POST /properties, DELETE /properties/{propertyId}]\n- PRICE_UNAVAILABLE (503): \"This hotel cannot be priced right now. Retry in a few minutes.\" [POST /properties]\n",
|
|
2644
|
-
"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); direct.booking.created, direct.booking.cancelled (a guest booked
|
|
2645
|
-
"the-package": "@zimmerstack/connect 0.
|
|
2644
|
+
"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); direct.booking.created, direct.booking.modified, direct.booking.cancelled (a guest booked on the hotel's own website through ZimmerStack's booking engine, the hotel recorded that the guest did not arrive or undid that, or the booking was cancelled: topic website-bookings; an endpoint gets each only when it lists that type); 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 })) and GET /direct-bookings (zs.directBookings.all({ since })) recover what an endpoint missed. They are not polling loops.\n- isWebsiteBookingEvent(event) says an event is a website booking (direct.booking.*); isOtaBookingEvent(event) says it is an OTA booking (channel.booking.*). The booking object is the same in both.\n- direct.booking.modified is a no-show or its undo, not a cancellation: status stays CONFIRMED, the payment is untouched, and data.booking.stayStatus says NOSHOW (free the room) or UPCOMING again (hold it). changes and previous are set on it, as on channel.booking.modified.\n",
|
|
2645
|
+
"the-package": "@zimmerstack/connect 0.6.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.directBookings.all({ since }): the same for the bookings guests made on the hotel's own website (scope direct-bookings:read). Read it before a full availability push.\n- zs.roomTypes.list(), zs.roomTypes.save(roomType), zs.roomTypes.delete(idOrRef) and zs.ratePlans.list(), zs.ratePlans.save(ratePlan), zs.ratePlans.delete(idOrRef): a hotel's room types and rate plans one at a time. save creates one, or changes it when that ref was sent before, and answers with its id. delete takes ZimmerStack's id (a number) or your own ref (a string), deletes for good, and a room type takes its rate plans with it. Scope catalog:write.\n- zs.properties.create(hotel) and zs.properties.delete(propertyId, { confirm }) (also zs.properties.remove): a software partner's company key adds a hotel and removes one it added, for good. Scope properties:write, a company key only. confirm is the hotel's exact name. With a test key they make and delete a sandbox.\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- isWebsiteBookingEvent(event), isOtaBookingEvent(event): tell the two booking families apart; BOOKING_EVENT_TYPES lists every type of both.\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"
|
|
2646
2646
|
}
|
|
2647
2647
|
};
|
package/dist/esm/webhooks.d.ts
CHANGED
|
@@ -6,13 +6,19 @@ import type { ChannelBooking } from "./generated.js";
|
|
|
6
6
|
/** An OTA booking arrived, changed or was cancelled (through the channel manager). */
|
|
7
7
|
export declare const OTA_BOOKING_EVENT_TYPES: readonly ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled"];
|
|
8
8
|
/**
|
|
9
|
-
* A
|
|
10
|
-
*
|
|
11
|
-
* the
|
|
9
|
+
* A booking on the hotel's own website through ZimmerStack's booking engine: the guest booked, the hotel
|
|
10
|
+
* recorded that the guest did not arrive (or undid that), or the booking was cancelled. The same booking
|
|
11
|
+
* object as the OTA events, in a family of its own: an endpoint receives each of these only when it lists
|
|
12
|
+
* that type.
|
|
13
|
+
*
|
|
14
|
+
* `direct.booking.modified` (from 0.6.0; the API sends it since 21 Nov 2026) is a no-show and its undo.
|
|
15
|
+
* The booking is not cancelled: `status` stays CONFIRMED and the payment is untouched. Read
|
|
16
|
+
* `data.booking.stayStatus`: NOSHOW means the nights are on sale again (free the room), UPCOMING again
|
|
17
|
+
* means the no-show was undone (hold the room). Nothing else sends it yet.
|
|
12
18
|
*/
|
|
13
|
-
export declare const WEBSITE_BOOKING_EVENT_TYPES: readonly ["direct.booking.created", "direct.booking.cancelled"];
|
|
19
|
+
export declare const WEBSITE_BOOKING_EVENT_TYPES: readonly ["direct.booking.created", "direct.booking.modified", "direct.booking.cancelled"];
|
|
14
20
|
/** Every event whose `data.booking` is a booking, of either family. */
|
|
15
|
-
export declare const BOOKING_EVENT_TYPES: readonly ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled", "direct.booking.created", "direct.booking.cancelled"];
|
|
21
|
+
export declare const BOOKING_EVENT_TYPES: readonly ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled", "direct.booking.created", "direct.booking.modified", "direct.booking.cancelled"];
|
|
16
22
|
export type OtaBookingEventType = (typeof OTA_BOOKING_EVENT_TYPES)[number];
|
|
17
23
|
export type WebsiteBookingEventType = (typeof WEBSITE_BOOKING_EVENT_TYPES)[number];
|
|
18
24
|
export type BookingEventType = (typeof BOOKING_EVENT_TYPES)[number];
|
|
@@ -24,7 +30,7 @@ export interface WebhookEvent {
|
|
|
24
30
|
id: string;
|
|
25
31
|
/**
|
|
26
32
|
* channel.booking.created · channel.booking.modified · channel.booking.cancelled (an OTA booking) ·
|
|
27
|
-
* direct.booking.created · direct.booking.cancelled (a booking on the hotel's own website) ·
|
|
33
|
+
* direct.booking.created · direct.booking.modified · direct.booking.cancelled (a booking on the hotel's own website) ·
|
|
28
34
|
* channel.sync.* · zimmerstack.ping. Narrow it with `isOtaBookingEvent` and `isWebsiteBookingEvent`.
|
|
29
35
|
*/
|
|
30
36
|
type: string;
|
|
@@ -43,9 +49,9 @@ export interface WebhookEvent {
|
|
|
43
49
|
booking?: ChannelBooking;
|
|
44
50
|
[key: string]: unknown;
|
|
45
51
|
};
|
|
46
|
-
/** Dotted paths that changed, on a modification ("stay.checkOut"). */
|
|
52
|
+
/** Dotted paths that changed, on a modification ("stay.checkOut"; on a website booking's no-show, "stayStatus" and "rooms[0].status"). */
|
|
47
53
|
changes?: string[] | null;
|
|
48
|
-
/** What those fields held before, on a modification. */
|
|
54
|
+
/** What those fields held before, on a modification. A website booking's carries `stayStatus` too. */
|
|
49
55
|
previous?: Record<string, unknown> | null;
|
|
50
56
|
truncated?: boolean;
|
|
51
57
|
}
|
|
@@ -57,7 +63,10 @@ export type BookingEvent = WebhookEvent & {
|
|
|
57
63
|
[key: string]: unknown;
|
|
58
64
|
};
|
|
59
65
|
};
|
|
60
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* A booking a guest made on the hotel's own website. `finance` is always null; `changes` and `previous`
|
|
68
|
+
* are set on `direct.booking.modified` (a no-show, or its undo) and null on the other two.
|
|
69
|
+
*/
|
|
61
70
|
export type WebsiteBookingEvent = BookingEvent & {
|
|
62
71
|
type: WebsiteBookingEventType;
|
|
63
72
|
};
|
|
@@ -66,8 +75,9 @@ export type OtaBookingEvent = BookingEvent & {
|
|
|
66
75
|
type: OtaBookingEventType;
|
|
67
76
|
};
|
|
68
77
|
/**
|
|
69
|
-
* True for `direct.booking.created` and `direct.booking.cancelled`: a booking
|
|
70
|
-
* website. A PMS that pushes room counts must put it in its own calendar before its
|
|
78
|
+
* True for `direct.booking.created`, `direct.booking.modified` and `direct.booking.cancelled`: a booking
|
|
79
|
+
* made on the hotel's own website. A PMS that pushes room counts must put it in its own calendar before its
|
|
80
|
+
* next push, and give the nights back when the booking is cancelled or reads `stayStatus` NOSHOW.
|
|
71
81
|
*/
|
|
72
82
|
export declare function isWebsiteBookingEvent(event: WebhookEvent): event is WebsiteBookingEvent;
|
|
73
83
|
/** True for `channel.booking.created`, `.modified` and `.cancelled`: a booking an OTA sent. */
|
package/dist/esm/webhooks.js
CHANGED
|
@@ -5,17 +5,24 @@
|
|
|
5
5
|
/** An OTA booking arrived, changed or was cancelled (through the channel manager). */
|
|
6
6
|
export const OTA_BOOKING_EVENT_TYPES = ["channel.booking.created", "channel.booking.modified", "channel.booking.cancelled"];
|
|
7
7
|
/**
|
|
8
|
-
* A
|
|
9
|
-
*
|
|
10
|
-
* the
|
|
8
|
+
* A booking on the hotel's own website through ZimmerStack's booking engine: the guest booked, the hotel
|
|
9
|
+
* recorded that the guest did not arrive (or undid that), or the booking was cancelled. The same booking
|
|
10
|
+
* object as the OTA events, in a family of its own: an endpoint receives each of these only when it lists
|
|
11
|
+
* that type.
|
|
12
|
+
*
|
|
13
|
+
* `direct.booking.modified` (from 0.6.0; the API sends it since 21 Nov 2026) is a no-show and its undo.
|
|
14
|
+
* The booking is not cancelled: `status` stays CONFIRMED and the payment is untouched. Read
|
|
15
|
+
* `data.booking.stayStatus`: NOSHOW means the nights are on sale again (free the room), UPCOMING again
|
|
16
|
+
* means the no-show was undone (hold the room). Nothing else sends it yet.
|
|
11
17
|
*/
|
|
12
|
-
export const WEBSITE_BOOKING_EVENT_TYPES = ["direct.booking.created", "direct.booking.cancelled"];
|
|
18
|
+
export const WEBSITE_BOOKING_EVENT_TYPES = ["direct.booking.created", "direct.booking.modified", "direct.booking.cancelled"];
|
|
13
19
|
/** Every event whose `data.booking` is a booking, of either family. */
|
|
14
20
|
export const BOOKING_EVENT_TYPES = [...OTA_BOOKING_EVENT_TYPES, ...WEBSITE_BOOKING_EVENT_TYPES];
|
|
15
21
|
const isType = (list, event) => typeof event?.type === "string" && list.includes(event.type);
|
|
16
22
|
/**
|
|
17
|
-
* True for `direct.booking.created` and `direct.booking.cancelled`: a booking
|
|
18
|
-
* website. A PMS that pushes room counts must put it in its own calendar before its
|
|
23
|
+
* True for `direct.booking.created`, `direct.booking.modified` and `direct.booking.cancelled`: a booking
|
|
24
|
+
* made on the hotel's own website. A PMS that pushes room counts must put it in its own calendar before its
|
|
25
|
+
* next push, and give the nights back when the booking is cancelled or reads `stayStatus` NOSHOW.
|
|
19
26
|
*/
|
|
20
27
|
export function isWebsiteBookingEvent(event) {
|
|
21
28
|
return isType(WEBSITE_BOOKING_EVENT_TYPES, event) && Boolean(event.data?.booking);
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zimmerstack/connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Add a channel manager to your hotel software: send rooms and prices to Booking.com, Airbnb, Expedia and other booking sites, and receive their bookings. The official ZimmerStack Connect API client for Node.js, with safe retries and pacing built in and an MCP server for AI coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.zimmerstack.com/sdk",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/zimmerstack/connect-node.git"
|
|
10
|
+
},
|
|
7
11
|
"bugs": {
|
|
12
|
+
"url": "https://github.com/zimmerstack/connect-node/issues",
|
|
8
13
|
"email": "support@zimmerstack.com"
|
|
9
14
|
},
|
|
10
15
|
"keywords": [
|