@zimmerstack/connect 0.6.0 → 0.9.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 +269 -15
- package/README.md +451 -18
- package/dist/cjs/client.d.ts +503 -13
- package/dist/cjs/client.js +743 -45
- package/dist/cjs/doctor.d.ts +86 -0
- package/dist/cjs/doctor.js +689 -0
- package/dist/cjs/errors.d.ts +6 -2
- package/dist/cjs/errors.js +7 -2
- package/dist/cjs/generated.d.ts +2921 -207
- package/dist/cjs/generated.js +222 -8
- package/dist/cjs/grid.d.ts +6 -1
- package/dist/cjs/grid.js +8 -0
- package/dist/cjs/index.d.ts +14 -5
- package/dist/cjs/index.js +41 -1
- package/dist/cjs/key.d.ts +39 -0
- package/dist/cjs/key.js +85 -0
- package/dist/cjs/money.d.ts +81 -0
- package/dist/cjs/money.js +172 -0
- package/dist/cjs/notices.d.ts +44 -0
- package/dist/cjs/notices.js +64 -0
- package/dist/cjs/shownOnce.d.ts +42 -0
- package/dist/cjs/shownOnce.js +83 -0
- package/dist/cjs/webhooks.d.ts +182 -3
- package/dist/cjs/webhooks.js +75 -1
- package/dist/esm/client.d.ts +503 -13
- package/dist/esm/client.js +741 -45
- package/dist/esm/doctor.d.ts +86 -0
- package/dist/esm/doctor.js +685 -0
- package/dist/esm/errors.d.ts +6 -2
- package/dist/esm/errors.js +7 -2
- package/dist/esm/generated.d.ts +2921 -207
- package/dist/esm/generated.js +221 -7
- package/dist/esm/grid.d.ts +6 -1
- package/dist/esm/grid.js +7 -0
- package/dist/esm/index.d.ts +14 -5
- package/dist/esm/index.js +8 -3
- package/dist/esm/key.d.ts +39 -0
- package/dist/esm/key.js +81 -0
- package/dist/esm/mcp/cli.js +88 -9
- package/dist/esm/mcp/reference.generated.js +4464 -974
- package/dist/esm/mcp/server.d.ts +14 -6
- package/dist/esm/mcp/server.js +451 -25
- package/dist/esm/money.d.ts +81 -0
- package/dist/esm/money.js +161 -0
- package/dist/esm/notices.d.ts +44 -0
- package/dist/esm/notices.js +56 -0
- package/dist/esm/shownOnce.d.ts +42 -0
- package/dist/esm/shownOnce.js +77 -0
- package/dist/esm/webhooks.d.ts +182 -3
- package/dist/esm/webhooks.js +69 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,26 +82,70 @@ calls ZimmerStack.
|
|
|
82
82
|
| Save what a person changed in it | `zs.grid.save(edits)` |
|
|
83
83
|
| Set the rooms left to sell | `zs.availability.set(updates)` |
|
|
84
84
|
| Set prices | `zs.rates.set(updates)` |
|
|
85
|
-
|
|
|
85
|
+
| Stop selling one rate plan on a night, or ask for a minimum stay | `zs.restrictions.set(updates)` |
|
|
86
|
+
| Close a room type on some nights, everywhere, and keep it closed | `zs.availability.close({ roomTypeId, dateFrom, dateTo })` · `zs.availability.reopen(body)` |
|
|
87
|
+
| See what a change would do before I send it | `zs.rates.dryRun(updates)` · `zs.availability.dryRun(updates)` · `zs.restrictions.dryRun(updates)` |
|
|
88
|
+
| Read what a change did not do | `noticesOf(accepted)` |
|
|
89
|
+
| Find out why a night is not selling as I sent it | `zs.explain.night({ roomTypeId, date })` |
|
|
86
90
|
| List a hotel's room types and rate plans | `zs.roomTypes.list()` · `zs.ratePlans.list()` |
|
|
87
91
|
| Create or change a room type or a rate plan | `zs.roomTypes.save(roomType)` · `zs.ratePlans.save(ratePlan)` |
|
|
88
92
|
| Delete a room type or a rate plan | `zs.roomTypes.delete(idOrRef)` · `zs.ratePlans.delete(idOrRef)` |
|
|
89
93
|
| Charge a different price on one booking site | `zs.channels.setModifier(channelId, steps)` |
|
|
90
94
|
| Read the bookings the booking sites sent | `zs.channelBookings.list()`, or a webhook |
|
|
95
|
+
| Read every booking and channel event, in order, from where I stopped | `zs.events.all({ after })` |
|
|
91
96
|
| Read the bookings made on the hotel's own website | `zs.directBookings.list()` |
|
|
92
97
|
| Pretend a booking came in (practice hotel only) | `zs.sandbox.bookings.create(booking)` |
|
|
98
|
+
| Pretend a no-show, or a channel problem (practice hotel only) | `zs.sandbox.bookings.noShow(bookingId)` · `zs.sandbox.syncEvents.create(body)` |
|
|
99
|
+
| Make the practice hotel's booking site refuse a price, or go down | `zs.sandbox.faults.set(body)` · `zs.sandbox.faults.clear()` |
|
|
100
|
+
| Create and manage my webhook addresses from code | `zs.webhookEndpoints.create(body)` and the rest |
|
|
101
|
+
| See how much of each limit is left | `zs.limits.get()` |
|
|
102
|
+
| See which of my calls were refused, and from which address they came | `zs.requests.list({ status: "errors" })` |
|
|
103
|
+
| Find out what is wrong | `npx @zimmerstack/connect doctor` |
|
|
93
104
|
| Check that a change reached the booking sites | `zs.batches.wait(batchId)` · `zs.sync.get()` |
|
|
94
105
|
| Create a booking from your own booking engine | `zs.bookings.create(booking)` |
|
|
95
106
|
| Work with many hotels on one key | `zs.forProperty(propertyId)` |
|
|
96
107
|
| Add a hotel | `zs.properties.create(hotel)` |
|
|
97
108
|
| Remove a hotel I added | `zs.properties.delete(propertyId, { confirm })` |
|
|
109
|
+
| Let a hotel connect a booking site itself | `zs.connectLinks.create({ propertyId, channel })` |
|
|
110
|
+
| Check that a hotel is ready, and make my software its source of truth | `zs.readiness.get()` · `zs.readiness.goLive()` |
|
|
111
|
+
| Make, replace and revoke the keys I made on a hotel | `zs.hotelKeys.create(propertyId, body)` · `zs.hotelKeys.rotate(propertyId, keyId)` · `zs.hotelKeys.revoke(propertyId, keyId, { reason })` |
|
|
112
|
+
| Read my bills and how many hotels I may still add | `zs.billing.get()` · `zs.billing.invoices()` · `zs.billing.nextInvoice()` |
|
|
113
|
+
| Open a support ticket and read the answer | `zs.supportTickets.create(body)` · `zs.supportTickets.get(ticketId)` |
|
|
114
|
+
| See whether something is wrong on ZimmerStack's side | `zs.status.get()` |
|
|
98
115
|
|
|
99
116
|
Every call and every answer is typed, with the meaning of each field shown in your editor.
|
|
100
117
|
|
|
101
|
-
**Money.**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
numbers.
|
|
118
|
+
**Money.** A price goes up and comes back in the same shape: the hotel's own currency, with that
|
|
119
|
+
currency's own decimals. You send a normal number or a decimal string (`4500.50` or `"4500.50"`) and it
|
|
120
|
+
is kept exactly; `zs.rates.get()` returns `rate: "4500.50"` beside `currency` and `decimals`. The
|
|
121
|
+
calendar helpers `zs.grid.load()` and `zs.grid.save()` always use normal numbers.
|
|
122
|
+
|
|
123
|
+
| Currency | Decimals (ISO 4217) | You send | You read `rate` | `rateMinor` |
|
|
124
|
+
|---|---|---|---|---|
|
|
125
|
+
| Rupee, euro, dollar, dirham, rupiah | 2 | `4500.50` | `"4500.50"` | `450050` |
|
|
126
|
+
| Yen, won, dong | 0 | `15000` | `"15000"` | `1500000` |
|
|
127
|
+
| Kuwaiti, Bahraini, Omani, Jordanian, Tunisian, Libyan dinar | 3 | `45.75` | `"46.000"` | `4600` |
|
|
128
|
+
|
|
129
|
+
`rateMinor` is still returned, and is always hundredths of the currency's unit: that is paise or cents
|
|
130
|
+
where a currency has two decimals, and it is not yen (`1500000` is 15,000 yen). Read `rate` and you never
|
|
131
|
+
divide. A price with more decimals than the currency has, a number or a decimal string alike, is
|
|
132
|
+
rounded and named in the answer's `rounded` list, so nothing changes without the answer saying so. A
|
|
133
|
+
three-decimal currency is kept as a whole amount for now.
|
|
134
|
+
|
|
135
|
+
The package has helpers for money, so you never do the arithmetic on floats (from 0.9.0). They take and
|
|
136
|
+
return the same decimal strings, and `decimals` comes from the API's own answer:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import { addAmounts, amountFromHundredths, amountFromMinorUnits, formatAmount, multiplyAmount, toAmount } from "@zimmerstack/connect";
|
|
140
|
+
|
|
141
|
+
const { currency, decimals } = await zs.property.get(); // "INR", 2 · "JPY", 0
|
|
142
|
+
toAmount(4500.5, decimals); // "4500.50": the shape the API reads and writes
|
|
143
|
+
multiplyAmount("4500.50", 3, decimals); // "13501.50": three nights, exact
|
|
144
|
+
addAmounts("0.10", "0.20", decimals); // "0.30", not 0.30000000000000004
|
|
145
|
+
amountFromMinorUnits(450050, decimals); // "4500.50": from a ledger that stores whole paise or cents
|
|
146
|
+
amountFromHundredths(1500000, 0); // "15000": from a rateMinor, in any currency
|
|
147
|
+
formatAmount("4500.50", { currency, decimals, locale: "en-IN" }); // "₹4,500.50", for a person to read
|
|
148
|
+
```
|
|
105
149
|
|
|
106
150
|
**Dates.** A date is a plain calendar day, `YYYY-MM-DD`, on the hotel's own clock.
|
|
107
151
|
|
|
@@ -116,19 +160,100 @@ const accepted = await zs.grid.save({
|
|
|
116
160
|
{ ratePlanId: 901, date: "2026-12-24", rate: 5200 },
|
|
117
161
|
{ ratePlanId: 901, date: "2026-12-25", rate: 5200 },
|
|
118
162
|
],
|
|
119
|
-
restrictions: [{ ratePlanId: 901, date: "2026-12-31", stopSell: true }], //
|
|
163
|
+
restrictions: [{ ratePlanId: 901, date: "2026-12-31", stopSell: true }], // stop selling this rate plan that night. Never send a price of zero.
|
|
120
164
|
});
|
|
121
165
|
|
|
122
166
|
// Accepted means ZimmerStack has saved it and is sending it to the booking sites.
|
|
123
|
-
const batch = await zs.batches.wait(accepted[0]!.batchId); // "landed", or still "pending" after five minutes
|
|
167
|
+
const batch = await zs.batches.wait(accepted[0]!.batchId); // "landed", "failed", or still "pending" after five minutes
|
|
124
168
|
```
|
|
125
169
|
|
|
170
|
+
`stopSell` closes one rate plan on that night. The room type's other rate plans keep selling. To stop
|
|
171
|
+
selling a room type on a night on every booking site, send its room count as 0 with
|
|
172
|
+
`zs.availability.set()` or `grid.save({ availability })`.
|
|
173
|
+
|
|
174
|
+
**Sent is not held: read the answer.** "Accepted" means saved by ZimmerStack, not yet on the booking
|
|
175
|
+
sites. Three things can still happen, and each one is told to you:
|
|
176
|
+
|
|
177
|
+
- A booking site's side refuses a value. The batch then reads `failed` with `parkedCells` and
|
|
178
|
+
`lastError`: the value is held and not sent again. Send a corrected value for those nights.
|
|
179
|
+
- A write names a room type or rate plan that reaches no booking site. The batch lists it under
|
|
180
|
+
`unreachable`.
|
|
181
|
+
- A price is kept differently from how you sent it. The write's answer lists it under `rounded`.
|
|
182
|
+
|
|
183
|
+
And later, someone can change a price on a booking site's side. A check that runs every night finds it,
|
|
184
|
+
sends your value again and tells you: see [Receive bookings](#receive-bookings) for `channel.drift.detected`.
|
|
185
|
+
|
|
126
186
|
Room counts usually reach the booking sites in seconds. A full calendar of prices can take minutes.
|
|
127
187
|
Inside a short-lived function (Vercel, Netlify), show the `batchId` and read `zs.sync.get()` later
|
|
128
188
|
instead of waiting.
|
|
129
189
|
|
|
130
190
|
Guide: <https://docs.zimmerstack.com/rate-grid>
|
|
131
191
|
|
|
192
|
+
## See what a change will do, and read what it did not do
|
|
193
|
+
|
|
194
|
+
"Accepted" means ZimmerStack saved your change. It does not say the change does what you meant. Three
|
|
195
|
+
things do (from 0.9.0).
|
|
196
|
+
|
|
197
|
+
**1. Ask first: a dry run.** The same updates, checked exactly as the real change, and nothing is saved.
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
const [preview] = await zs.restrictions.dryRun([{ ratePlanId: 901, dateFrom: "2026-12-31", dateTo: "2026-12-31", stopSell: true }]);
|
|
201
|
+
preview.verdict; // "would-write", "nothing-to-write", or "would-refuse" with the refusal you would get
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
A dry run answers a `WritePreview`, and `set` answers a `WriteAccepted`: two types, so your code cannot
|
|
205
|
+
mistake one for the other. A dry run counts against the per-minute limits like the change it previews,
|
|
206
|
+
so it is not a way to read the calendar.
|
|
207
|
+
|
|
208
|
+
**2. Read the notices.** Every answer of `set`, and every dry run, can carry notices: one plain sentence
|
|
209
|
+
each, about what the change did **not** do, with what to do about it.
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
import { findNotice, noticesOf } from "@zimmerstack/connect";
|
|
213
|
+
|
|
214
|
+
const accepted = await zs.restrictions.set([{ ratePlanId: 901, dateFrom: "2026-12-31", dateTo: "2026-12-31", stopSell: true }]);
|
|
215
|
+
for (const notice of noticesOf(accepted)) show(notice.level, notice.message, notice.action); // warnings first
|
|
216
|
+
findNotice(accepted, "ROOM_STILL_ON_SALE"); // the room still sells through its other rate plans
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The two that explain most surprises:
|
|
220
|
+
|
|
221
|
+
- **Stop-sell is a switch on one rate plan.** The room keeps selling through its other rate plans, and
|
|
222
|
+
through a rate a booking site makes on its own side (`ROOM_STILL_ON_SALE`).
|
|
223
|
+
- **A room count of 0 is a count, not a switch.** It closes the room everywhere, but a cancellation at a
|
|
224
|
+
booking site puts a room back, and your next count replaces it (`COUNT_ZERO_IS_NOT_STOP_SELL`).
|
|
225
|
+
|
|
226
|
+
A notice is never an error: the change was saved. Decide on `notice.code` (`NOTICES` lists every code),
|
|
227
|
+
and show `message` and `action` to the person who saved.
|
|
228
|
+
|
|
229
|
+
**3. Close a room type everywhere, in one call.** Its count goes to 0 **and** stop-sell is switched on
|
|
230
|
+
for every one of its rate plans, so it is closed and stays closed.
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
const closed = await zs.availability.close({ roomTypeId: 412, dateFrom: "2026-12-30", dateTo: "2027-01-02" });
|
|
234
|
+
closed.notReached; // read this: what the close could not reach, and why
|
|
235
|
+
await zs.availability.reopen({ roomTypeId: 412, dateFrom: "2026-12-30", dateTo: "2027-01-02", available: 3 });
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
`reopen` undoes exactly what `close` did. Pass `available` when your software knows how many rooms are
|
|
239
|
+
free now; without it each night gets back the count it held before. `closeDryRun` and `reopenDryRun`
|
|
240
|
+
show what each would do.
|
|
241
|
+
|
|
242
|
+
**Why is this night not selling as I sent it?** One read tells the night's whole story:
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
const night = await zs.explain.night({ roomTypeId: 412, date: "2026-12-31" });
|
|
246
|
+
night.summary; // plain sentences, most important first: show them to the person who asked
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
It answers what your software last sent, what ZimmerStack holds and who set it, and what the channel
|
|
250
|
+
manager was last seen holding, with any value it refused in its own words. It cannot see a booking
|
|
251
|
+
site's own screen: it reads the channel manager's copy, as last seen. "What your software last sent" is
|
|
252
|
+
there for changes made after this feature shipped.
|
|
253
|
+
|
|
254
|
+
Guides: <https://docs.zimmerstack.com/dry-run> · <https://docs.zimmerstack.com/notices> ·
|
|
255
|
+
<https://docs.zimmerstack.com/close-and-reopen> · <https://docs.zimmerstack.com/explain>
|
|
256
|
+
|
|
132
257
|
## Set up a hotel's rooms: create, change, delete
|
|
133
258
|
|
|
134
259
|
A **room type** is a kind of room the hotel sells, like "Deluxe Room". A **rate plan** is one way to
|
|
@@ -190,9 +315,68 @@ real, signed message:
|
|
|
190
315
|
await zs.sandbox.bookings.create({ roomTypeId: 412, checkIn: "2026-12-05", nights: 2, rooms: 1, adults: 2, guestName: "Asha Verma", otaName: "Booking.com", paidByOta: false });
|
|
191
316
|
```
|
|
192
317
|
|
|
193
|
-
|
|
194
|
-
your server
|
|
195
|
-
|
|
318
|
+
**The webhook is the nudge. The event log is the truth** (from 0.9.0). A webhook can arrive twice, late,
|
|
319
|
+
out of order, or not at all when your server is down for a day. So every event of a hotel also has a
|
|
320
|
+
place in one ordered list: its `sequence`, one higher than the hotel's last event. Save the last
|
|
321
|
+
sequence you applied, and read from there:
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
// Run this when a webhook arrives, on a schedule, and when your server starts.
|
|
325
|
+
for await (const event of zs.events.all({ after: await loadPlace(hotelId) })) {
|
|
326
|
+
await apply(event); // the same shape the webhook carries
|
|
327
|
+
await savePlace(hotelId, event.sequence); // your new place
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Built this way, nothing depends on a webhook having arrived. Events stay in the log for 90 days. If you
|
|
332
|
+
were away for longer, pass `onGap` to hear of it, then read each booking's latest state with
|
|
333
|
+
`zs.channelBookings.all({ since })` and `zs.directBookings.all({ since })`. A booking also carries a
|
|
334
|
+
`version` (1, 2, 3 and so on): a higher version is a later state, whatever order things arrived in.
|
|
335
|
+
|
|
336
|
+
Besides bookings, your address can receive five more kinds of message, each only when it lists the
|
|
337
|
+
type. Narrow them with `isSyncEvent`, `isDriftEvent`, `isConnectEvent`, `isIncidentEvent` and
|
|
338
|
+
`isSupportTicketEvent`:
|
|
339
|
+
|
|
340
|
+
- `channel.sync.alert` and `channel.sync.recovered`: a problem with a booking site began (a refused
|
|
341
|
+
value, a disconnect, prices or room counts that stopped going out) and ended.
|
|
342
|
+
- `channel.drift.detected` and `channel.drift.healed`: the nightly check found a booking site's side
|
|
343
|
+
holding something other than what you sent, sent your value again, and later found them agreeing.
|
|
344
|
+
- `channel.connect.completed` and `channel.connect.expired`: a connect link you made ended. The hotel
|
|
345
|
+
started selling on the booking site, or the link ran out first.
|
|
346
|
+
- `platform.incident.opened`, `.updated` and `.resolved`: ZimmerStack recorded a problem on its own
|
|
347
|
+
side that touches your hotels, and later ended it.
|
|
348
|
+
- `support.ticket.replied` and `support.ticket.closed`: ZimmerStack answered your support ticket.
|
|
349
|
+
|
|
350
|
+
The last two kinds are about your account, not one hotel. They have **no `event.property`** and no
|
|
351
|
+
`sequence`, and they are not in the event log. Check `isIncidentEvent` and `isSupportTicketEvent` before
|
|
352
|
+
any code that reads `event.property`.
|
|
353
|
+
|
|
354
|
+
**A guest's phone and email.** A webhook carries them only while your address has guest contact
|
|
355
|
+
switched on. A read by API returns them until 30 days after checkout; after that they are `null` and
|
|
356
|
+
`guest.contactWithheld` says `"retention"`. Every read that returned contact is logged, and the hotel's
|
|
357
|
+
owner can see the list. Copy what you need when the booking arrives.
|
|
358
|
+
|
|
359
|
+
**Your webhook addresses, from code** (from 0.9.0). A company key with the permission `webhooks:manage`
|
|
360
|
+
(tick **Also manage webhooks** when you make the key) creates and looks after them without the portal:
|
|
361
|
+
|
|
362
|
+
```ts
|
|
363
|
+
const { endpoint, secret } = await zs.webhookEndpoints.create({ url: "https://pms.example/zimmerstack", dataAck: true });
|
|
364
|
+
// `secret` is shown this once. Store it in your server's settings now.
|
|
365
|
+
await zs.webhookEndpoints.test(endpoint.id, { eventType: "channel.booking.created" }); // a signed sample
|
|
366
|
+
await zs.webhookEndpoints.pause(endpoint.id); // before planned downtime: events are held
|
|
367
|
+
await zs.webhookEndpoints.resume(endpoint.id); // they go out, oldest first
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Also there: `update` (the address, the event types, the guest-contact switch), `rotateSecret`,
|
|
371
|
+
`recover(id, since)`, `delete`, and `deliveries.list`, `deliveries.get` and `deliveries.redeliver` for the
|
|
372
|
+
delivery log.
|
|
373
|
+
|
|
374
|
+
Hotels outside India (from 0.7.0): a booking carries `taxes`, the hotel's own tax lines, wherever the
|
|
375
|
+
hotel has confirmed them. When a booking site sends a booking in another currency than the hotel's,
|
|
376
|
+
`amounts.receivedCurrency` names it; the amounts are as the site sent them, never converted. At such a
|
|
377
|
+
hotel `zs.bookings.create` also takes `nightlyRateIncludesTaxes`; `false` is refused with
|
|
378
|
+
`TAXES_NOT_CONFIGURED` where the hotel has confirmed no lines, and `TAXES_INSIDE_RATES` where all its
|
|
379
|
+
taxes sit inside its prices.
|
|
196
380
|
|
|
197
381
|
Guide: <https://docs.zimmerstack.com/webhooks>
|
|
198
382
|
|
|
@@ -242,6 +426,8 @@ await hotel.grid.load("2026-12-01", "2026-12-14");
|
|
|
242
426
|
- A **live** key never guesses. Always name the hotel.
|
|
243
427
|
- An app that serves one hotel can name it once: `ZIMMERSTACK_PROPERTY_ID=61` on the server, or
|
|
244
428
|
`new ZimmerStack({ propertyId: 61 })`.
|
|
429
|
+
- Each hotel has its own queue (from 0.8.0). One hotel that is close to its limit waits by itself; the
|
|
430
|
+
others keep going. What all your hotels share, your company's limit, is kept for all of them together.
|
|
245
431
|
|
|
246
432
|
## Add a hotel, remove a hotel
|
|
247
433
|
|
|
@@ -287,6 +473,91 @@ one that is still being removed answers `PROPERTY_BUSY` (wait, then ask again).
|
|
|
287
473
|
|
|
288
474
|
Guide: <https://docs.zimmerstack.com/hotels>
|
|
289
475
|
|
|
476
|
+
## Connect a booking site, go live, and a hotel's keys
|
|
477
|
+
|
|
478
|
+
A software company's **company key** can do three more things without the partner portal (from 0.9.0).
|
|
479
|
+
Each needs its own permission, ticked when the key is made.
|
|
480
|
+
|
|
481
|
+
**A connect link.** The hotel's own person connects a booking site. Your software never holds the
|
|
482
|
+
booking site's password, and no call takes one.
|
|
483
|
+
|
|
484
|
+
```ts
|
|
485
|
+
import { shownOnce } from "@zimmerstack/connect";
|
|
486
|
+
|
|
487
|
+
const made = await zs.connectLinks.create({ propertyId: 61, channel: "bookingcom" });
|
|
488
|
+
await sendToTheHotel(shownOnce(made), made.hotelStep); // the link, and what the hotel does at the booking site first
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
The hotel opens the link on ZimmerStack's page, signs in to the booking site, confirms each room and
|
|
492
|
+
rate match, and presses Start selling. You then receive `channel.connect.completed`. A link is made
|
|
493
|
+
with a **live** key only: a practice hotel has no booking site to connect. Permission:
|
|
494
|
+
`channels:connect`.
|
|
495
|
+
|
|
496
|
+
**Readiness and go-live.** A hotel you add is yours from the first day. A hotel that let you in with
|
|
497
|
+
your vendor code is not, until it goes live.
|
|
498
|
+
|
|
499
|
+
```ts
|
|
500
|
+
const hotel = zs.forProperty(61);
|
|
501
|
+
const report = await hotel.readiness.get(); // four checks, each with what to do
|
|
502
|
+
await hotel.rates.set(aYearOfPrices, { beforeGoLive: true }); // stored, and waits for go-live
|
|
503
|
+
if ((await hotel.readiness.get()).ready) await hotel.readiness.goLive();
|
|
504
|
+
await hotel.availability.set(aYearOfCounts); // right after going live: your room counts
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
`beforeGoLive: true` says you know the hotel is not live yet. **Prices and stay rules sent this way are
|
|
508
|
+
stored and wait.** The readiness report asks for a price for every rate plan and night of the year
|
|
509
|
+
ahead.
|
|
510
|
+
|
|
511
|
+
**Room counts are different.** Until the hotel is live, a room count may only **lower** what is on sale.
|
|
512
|
+
A lower count goes to the booking sites at once, because a count that waited could sell a room twice. A
|
|
513
|
+
count that **raises** what is on sale is refused (it comes back in the answer's `rejected` list),
|
|
514
|
+
because the hotel's own people may still be running its counts. So send your room counts again right
|
|
515
|
+
after going live.
|
|
516
|
+
|
|
517
|
+
**A hotel's keys.** Make, replace and revoke the keys you made on a hotel you added. Permission:
|
|
518
|
+
`keys:manage`.
|
|
519
|
+
|
|
520
|
+
```ts
|
|
521
|
+
import { shownOnce, withoutShownOnce } from "@zimmerstack/connect";
|
|
522
|
+
|
|
523
|
+
const minted = await zs.hotelKeys.create(61, { name: "Night audit job", scopes: ["ari:read"] });
|
|
524
|
+
await secrets.put("zimmerstack/hotel-61", shownOnce(minted)); // the key is in this answer only
|
|
525
|
+
console.log(withoutShownOnce(minted)); // safe to log: the key is not in it
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**Shown once.** A key, a connect link and a webhook secret are each in one answer and nowhere else.
|
|
529
|
+
`shownOnce(answer)` returns the value. If the answer is a repeat of an earlier request, the value is not
|
|
530
|
+
in it: `shownOnce` then throws an error that names the call that gets you a new one. It never hands you
|
|
531
|
+
an empty value to store by mistake.
|
|
532
|
+
|
|
533
|
+
Guides: <https://docs.zimmerstack.com/connect-links> · <https://docs.zimmerstack.com/go-live> ·
|
|
534
|
+
<https://docs.zimmerstack.com/authentication#hotel-keys>
|
|
535
|
+
|
|
536
|
+
## Your bills, support and status
|
|
537
|
+
|
|
538
|
+
Also for a company key, each with its own permission (from 0.9.0):
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
const bill = await zs.billing.get(); // what is owed, your hotel quota, money paid ahead (billing:read)
|
|
542
|
+
const next = await zs.billing.nextInvoice(); // what the next invoice is made of, hotel by hotel
|
|
543
|
+
|
|
544
|
+
const ticket = await zs.supportTickets.create({ severity: "many_hotels", subject: "Prices are not going out", message: "Since 08:10 UTC …", propertyIds: [61, 62] }); // support:write
|
|
545
|
+
|
|
546
|
+
const { incidents } = await zs.status.get(); // is something wrong on ZimmerStack's side? Any key.
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
- Billing is **read only**: nothing pays or changes anything. `atCost` lists what the channel manager
|
|
550
|
+
charged above the room types and rate plans a hotel includes, passed on at cost. A line marked
|
|
551
|
+
`RECORDED` is not on an invoice yet.
|
|
552
|
+
- A ticket has three levels. `many_hotels` (two or more hotels cannot sell or take bookings) gets a first
|
|
553
|
+
reply within the hour, 9:00 to 21:00 India time, every day; the other two within one working day.
|
|
554
|
+
ZimmerStack attaches what its own records show, so never paste a key or a guest's details.
|
|
555
|
+
- `zs.status.get()` lists the incidents that touch your hotels. During one, keep what your people
|
|
556
|
+
changed and send it when it ends.
|
|
557
|
+
|
|
558
|
+
Guides: <https://docs.zimmerstack.com/billing> · <https://docs.zimmerstack.com/support> ·
|
|
559
|
+
<https://docs.zimmerstack.com/status>
|
|
560
|
+
|
|
290
561
|
## Bookings from the hotel's own website
|
|
291
562
|
|
|
292
563
|
Some hotels sell on their own website through ZimmerStack's booking engine and keep your software as
|
|
@@ -343,8 +614,9 @@ answers `replay: true` and moves no money. Your own cancel comes back to you as
|
|
|
343
614
|
own cancel button, never from a background job.
|
|
344
615
|
|
|
345
616
|
To try it with a test key, call `zs.sandbox.bookings.create({ …, otaName: "Website" })` and then cancel
|
|
346
|
-
that booking. The nights come back and no money moves.
|
|
347
|
-
|
|
617
|
+
that booking. The nights come back and no money moves. To try a no-show, call
|
|
618
|
+
`zs.sandbox.bookings.noShow(bookingId)` on that booking: your address receives the real
|
|
619
|
+
`direct.booking.modified`, and `{ undo: true }` takes it back.
|
|
348
620
|
|
|
349
621
|
Guide: <https://docs.zimmerstack.com/website-bookings>
|
|
350
622
|
|
|
@@ -360,6 +632,8 @@ try {
|
|
|
360
632
|
err.code; // never changes: "RATE_OUT_OF_BAND", "SCOPE_MISSING", "RATE_LIMITED". Decide on this.
|
|
361
633
|
err.message; // a sentence for the person at the screen. Show it.
|
|
362
634
|
err.retryAfterSeconds; // set when you hit a limit: how long to wait
|
|
635
|
+
err.freesAt; // the same as a moment (a Date): when to send it again
|
|
636
|
+
err.scope; // which limit said no: "writes", "cells-hour", "rate-resends-day"
|
|
363
637
|
err.retryable; // false means the request itself is wrong. Fix it. Do not send it again.
|
|
364
638
|
}
|
|
365
639
|
```
|
|
@@ -367,16 +641,78 @@ try {
|
|
|
367
641
|
The package has already waited and tried again where that could help. Do not put its calls in a retry
|
|
368
642
|
loop of your own.
|
|
369
643
|
|
|
644
|
+
A limit that frees within two minutes is waited out for you. A longer one (a limit per hour or per day)
|
|
645
|
+
comes straight back as a `RATE_LIMITED` error that says when it frees, so a person is not left waiting.
|
|
646
|
+
A job that may wait can say so, and the package holds the call and tells you when it lands:
|
|
647
|
+
|
|
648
|
+
```ts
|
|
649
|
+
const zs = new ZimmerStack({ onEvent: (e) => e.type === "wait" && console.log(e.message) });
|
|
650
|
+
await zs.rates.set(updates, { maxWaitSeconds: 3600 }); // "PUT /rates lands in about 25 minutes (waiting for the cells-hour budget)."
|
|
651
|
+
```
|
|
652
|
+
|
|
370
653
|
Every code, what it means and what to do: <https://docs.zimmerstack.com/errors>
|
|
371
654
|
|
|
655
|
+
## When something is wrong: the doctor
|
|
656
|
+
|
|
657
|
+
One command looks at your whole integration and says what to fix (from 0.9.0):
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
npx @zimmerstack/connect doctor
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
It reads the key from `ZIMMERSTACK_CONNECT_KEY` (the environment, or your project's `.env.local` or
|
|
664
|
+
`.env`), and checks, in order:
|
|
665
|
+
|
|
666
|
+
| It checks | What it tells you |
|
|
667
|
+
|---|---|
|
|
668
|
+
| The key | Whether it is the right shape, before anything is sent. A key that was mistyped or cut short is caught by its own checksum. Then whether it answers: revoked, expired, or called from an address that is not on its list. |
|
|
669
|
+
| Is it ZimmerStack | The open incidents on ZimmerStack's side that touch your hotels, with what was last said. |
|
|
670
|
+
| Hotels and permissions | Which hotels the key reaches, and what it may do on each. For a hotel that is not live yet, which readiness checks have not passed and what to do. |
|
|
671
|
+
| Limits | Every limit and how full it is, and whether the integration is paused. |
|
|
672
|
+
| Refused calls | The last day's refused calls, grouped by reason, with what to do about each and the last request id. |
|
|
673
|
+
| Webhook addresses | Whether each one is being answered, and its last failures. If your server answers 401, it says to check how you verify the signature. |
|
|
674
|
+
| Sync and drift | Whether what you sent reached the booking sites, which values were refused, and what the nightly check found changed on a booking site's side. |
|
|
675
|
+
|
|
676
|
+
It only reads, with a test key or a live key, and it never prints the key. It exits with 0 when nothing
|
|
677
|
+
needs attention and 1 when something does, so you can run it after a deploy. `--property <id>` looks at
|
|
678
|
+
one hotel of a company key; `--json` prints the report for a script. The same checks from your own
|
|
679
|
+
code: `diagnose()` and `formatDoctorReport(report)`.
|
|
680
|
+
|
|
681
|
+
Name a night and it explains that night too:
|
|
682
|
+
|
|
683
|
+
```bash
|
|
684
|
+
npx @zimmerstack/connect doctor --room-type 412 --night 2026-12-31
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
## Keys
|
|
688
|
+
|
|
689
|
+
- A key made since 22 Nov 2026 is `zsk_live_` (or `zsk_test_`), 40 letters and digits, then 6
|
|
690
|
+
characters that are a checksum of the rest. `checkKey(value)` tells a real key from a mistyped one
|
|
691
|
+
without sending it anywhere; use it where a person pastes a key. A key made before that day keeps
|
|
692
|
+
working until it is rotated.
|
|
693
|
+
- **Rotate** a key in the screen where it was made (the partner portal, or the hotel owner's Developers
|
|
694
|
+
screen). The new key is shown once and the old one keeps working for 24 hours, so you can swap with
|
|
695
|
+
no downtime. Company keys can be rotated too. A person does this for a hotel's own key and for a
|
|
696
|
+
company key. The keys a software company made on a hotel can also be made, rotated and revoked by
|
|
697
|
+
API (`zs.hotelKeys`, above).
|
|
698
|
+
- **A key found in a public place** (a public repository, for example) is revoked at once and its holder
|
|
699
|
+
is emailed. Calls then answer `API_KEY_REVOKED`: make a new key and keep it in your server's settings,
|
|
700
|
+
never in code.
|
|
701
|
+
- **What a key did** is kept for 7 days: `zs.requests.list()` gives the time, the route, the status, the
|
|
702
|
+
error code, the address and the request id of each call, never a body. An address you do not
|
|
703
|
+
recognise is the first sign of a leaked key.
|
|
704
|
+
|
|
705
|
+
Guide: <https://docs.zimmerstack.com/authentication>
|
|
706
|
+
|
|
372
707
|
## What the package does for you
|
|
373
708
|
|
|
374
709
|
| The rule | What the package does |
|
|
375
710
|
|---|---|
|
|
376
711
|
| The key stays on a server | Refuses to start in a browser or a mobile app. Sends the key to ZimmerStack only. Never prints it. |
|
|
377
|
-
| You may make only so many calls a minute |
|
|
378
|
-
| Changes go out in order | Sends one
|
|
379
|
-
| Try again only when that can help | Tries again after a "slow down" answer, a fault on our side or a network failure. Any other "no" comes straight back to you. |
|
|
712
|
+
| You may make only so many calls a minute | Reads every limit from every answer (the key's, the hotel's, your company's) and slows down before one is reached. |
|
|
713
|
+
| Changes go out in order | Sends one hotel's changes one at a time, in the order you made them. Each hotel has its own queue, so one hotel never holds up another. At most four calls at once. |
|
|
714
|
+
| Try again only when that can help | Tries again after a "slow down" answer, always. Tries again after a fault on our side or a network failure only when sending twice cannot apply the change twice: a read, or a change that carries its own id (next row). Any other "no" comes straight back to you. |
|
|
715
|
+
| A limit per hour or per day | Waits when the wait is under two minutes. Otherwise gives you the "no" at once with when it frees, and stops sending calls that would only be refused again. |
|
|
380
716
|
| A retry must not save twice | Gives each change its own id and reuses it when it tries again, so the same change is never saved twice. A call that cannot be safely repeated, such as a delete, is not sent again when its result is unknown. |
|
|
381
717
|
| A request has a size limit | Splits a save at 1,000 updates or 5,000 night cells. |
|
|
382
718
|
| A refused key is not tried again | After a key is refused, it stops calling. |
|
|
@@ -384,6 +720,91 @@ Every code, what it means and what to do: <https://docs.zimmerstack.com/errors>
|
|
|
384
720
|
|
|
385
721
|
Limits in full: <https://docs.zimmerstack.com/limits>
|
|
386
722
|
|
|
723
|
+
## Limits
|
|
724
|
+
|
|
725
|
+
Every limit the API holds you to, from the one table the server enforces. You do not need to learn it:
|
|
726
|
+
the package reads the limits from every answer and keeps inside them. It is here so you can size a job.
|
|
727
|
+
`zs.limits.get()` (from 0.8.0) answers the same rows for your key, with what is left of each and when it
|
|
728
|
+
refills:
|
|
729
|
+
|
|
730
|
+
```ts
|
|
731
|
+
const { budgets, shield } = await zs.limits.get();
|
|
732
|
+
const today = shield?.budgets.find((b) => b.scope === "cells-day");
|
|
733
|
+
console.log(today?.remaining, "changed cells left today; room again in", today?.resetSeconds, "s");
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
A write is every call that is not a read. An IPv6 /56 counts as one address. A key that has just worked
|
|
737
|
+
from your address is counted against its own limits, not the address's, so many hotels behind one
|
|
738
|
+
office address are not held to the address's limit.
|
|
739
|
+
|
|
740
|
+
<!-- limits-table:begin (generated from connectApiLimitsTable.ts; run `pnpm --dir apps/backend exec tsx ts/scripts/connect-api-limits-doc.ts`) -->
|
|
741
|
+
**Budgets the key guard and the routes measure (429 `RATE_LIMITED`).**
|
|
742
|
+
|
|
743
|
+
| `data.scope` | In `RateLimit` as | Per | Window | Quota | Counts |
|
|
744
|
+
|---|---|---|---|---|---|
|
|
745
|
+
| `api-address` | `api-address` | address, on each API machine | 60 s fixed | 1,200 | every request to any ZimmerStack API route from one address (an IPv6 /56 counts as one address), counted on each API machine: the guard in front of everything, the Connect API included |
|
|
746
|
+
| `ip` | `ip` | address | 60 s sliding | 240 | requests from one address (an IPv6 /56 counts as one address) that carry no key verified from it in the last ten minutes, checked before the key is read. A key that has authenticated from that address is counted against its own budgets, not here |
|
|
747
|
+
| `ip-auth` | `ip-auth` | address | 60 s sliding | 20 | 401 answers, and 403 IP_NOT_ALLOWED, to one address; past it the address's unverified requests are refused before any lookup. A key that authenticated from that address in the last ten minutes keeps working |
|
|
748
|
+
| `key-auth` | `key-auth` | address and key | 60 s sliding | 5 | 401 and 403 IP_NOT_ALLOWED answers to one key (its first twelve characters) from one address; past it that key is refused from that address before any lookup, so one revoked key never uses up its address's budget |
|
|
749
|
+
| `global-unauthenticated` | `global-unauthenticated` | everyone without a verified key | 60 s sliding | 1,200 | requests from every address together that carry no recently verified key and so cost a key lookup: the most a flood of made-up keys can ask of the database |
|
|
750
|
+
| `requests` | `key` | key | 60 s sliding | 120 | every request on one key |
|
|
751
|
+
| `writes` | `key-writes` | key | 60 s sliding | 30 | every request on one key that is not a GET (PUT, POST and DELETE); a dry run (dryRun: true) is a write here |
|
|
752
|
+
| `property` | `property` | property (all its keys) | 60 s sliding | 300 | every request on all of a property's keys together (five keys are not five budgets) |
|
|
753
|
+
| `property-writes` | `property-writes` | property (all its keys) | 60 s sliding | 60 | every request that is not a GET on all of a property's keys together |
|
|
754
|
+
| `cells` | `cells` | property (all its keys) | 60 s sliding | 20,000 | cells a property's writes name after range expansion, charged before anything is read or written. A dry run is charged the same cells as the write it previews; a close or a reopen (POST /availability/close) is charged the room type's count and each of its rate plans for every night |
|
|
755
|
+
| `company` | `company` | company key (all its hotels) | 60 s sliding | 1,200 | every request on one company key, across all its hotels (each hotel keeps its own key and property budgets too) |
|
|
756
|
+
| `global` | `global` | everyone | 60 s sliding | 3,000 | every authenticated request on the Connect API, all keys together; test keys count in a ceiling of their own of the same size, so a sandbox never spends what live hotels use |
|
|
757
|
+
| `bookings` | `bookings` | key | 60 s sliding | 20 | POST /bookings on one key |
|
|
758
|
+
| `property-bookings` | `property-bookings` | property (all its keys) | 60 s sliding | 40 | POST /bookings on all of a property's keys together |
|
|
759
|
+
| `property-bookings-day` | — | property (all its keys) | rolling 24 hours | 500 | POST /bookings per property per ROLLING 24 HOURS (not per minute); the owner can raise it per property |
|
|
760
|
+
| `direct-cancels` | `direct-cancels` | key | 60 s sliding | 10 | POST /direct-bookings/{bookingId}/cancel on one key (a replay is not counted) |
|
|
761
|
+
| `property-direct-cancels-day` | — | property (all its keys) | rolling 24 hours | 50 | POST /direct-bookings/{bookingId}/cancel per property per ROLLING 24 HOURS (not per minute) |
|
|
762
|
+
|
|
763
|
+
**Budgets over an hour and a day (429 `RATE_LIMITED`). "At least" is the least any property gets; `GET /limits` answers your own.**
|
|
764
|
+
|
|
765
|
+
| `data.scope` | In `RateLimit` as | Per | Window | Quota | Counts |
|
|
766
|
+
|---|---|---|---|---|---|
|
|
767
|
+
| `cells-hour` | — | property (all its keys) | one clock hour (UTC) | at least 10,000 | changed cells, all of a property's keys together. At least this many; a larger property gets two of its own full calendars an hour. A dry run changes nothing and is never counted here |
|
|
768
|
+
| `cells-day` | — | property (all its keys) | rolling 24 hours | at least 30,000 | changed cells, all of a property's keys together. At least this many; a larger property gets six of its own full calendars a day. A dry run changes nothing and is never counted here |
|
|
769
|
+
| `vendor-cells-day` | — | software vendor (all its hotels) | rolling 24 hours | at least 150,000 | a software vendor's changed cells across all its hotels (company keys and keys it minted). At least this many, plus 15,000 for each hotel it serves; a sandbox is never counted here |
|
|
770
|
+
| `shield-lane` | — | property (all its keys) | one clock hour (UTC) | at least 500 | cells of writes that only close inventory, accepted while the property is out of budget or paused (the safety lane). At least this many; sixty nights of every room type |
|
|
771
|
+
| `structure-creates` | — | property | 60 s sliding | 20 | new room types and rate plans per property; a row already here that the write puts on the channel manager counts when it gets there, never when the answer's notice says it could not; also the most one request may create (TOO_MANY_NEW_ENTITIES) |
|
|
772
|
+
| `structure-creates-day` | — | property | rolling 24 hours | 300 | new room types and rate plans per property |
|
|
773
|
+
| `structure-edits-day` | — | property | rolling 24 hours | 300 | changed room types and rate plans per property |
|
|
774
|
+
| `structure-deletes-day` | — | property | rolling 24 hours | 60 | deleted room types and rate plans per property |
|
|
775
|
+
| `vendor-structure-creates-day` | — | software vendor (all its hotels) | rolling 24 hours | at least 500 | a software vendor's new room types and rate plans across all its hotels |
|
|
776
|
+
| `vendor-remote-properties-day` | — | software vendor | rolling 24 hours | 10 | hotels a software vendor puts on the channel manager for the first time |
|
|
777
|
+
| `vendor-property-removals-day` | — | software vendor | rolling 24 hours | 10 | hotels a software partner removes (DELETE /properties/{propertyId}, and Remove hotel in the partner portal); a sandbox is never counted |
|
|
778
|
+
| `partner-new-properties-hour` | — | software partner | one hour | 20 | hotels a partner adds, POST /properties and the partner portal's form together; a sandbox is never counted |
|
|
779
|
+
| `partner-new-sandboxes-hour` | — | software partner | rolling hour | 30 | sandboxes a partner makes with a test key (POST /properties), counted when one is made; the partner portal's own sandbox button is not counted |
|
|
780
|
+
| `connect-links-hour` | — | property | rolling hour | 10 | one-time connect links a software partner makes for one hotel (POST /connect-links), every booking site together; a link that was withdrawn or ran out still counts |
|
|
781
|
+
| `partner-connect-links-hour` | — | software partner | rolling hour | 120 | one-time connect links a software partner makes across all its hotels (POST /connect-links) |
|
|
782
|
+
| `modifier-changes-day` | — | property | rolling 24 hours | 6 | changes to a channel's price modifier per property (PUT /channels/{channelId}/modifier); steps the channel already holds are not counted |
|
|
783
|
+
| `rate-resends-day` | — | property | rolling 24 hours | 3 | times a property's prices are sent to the channels again (POST /rates/resend) |
|
|
784
|
+
| `partner-support-tickets-day` | — | software partner | rolling 24 hours | 20 | support tickets a partner opens (POST /support-tickets), both key modes together; a replayed idempotency key is not counted |
|
|
785
|
+
| `partner-support-messages-hour` | — | software partner | rolling hour | 60 | messages a partner adds to its support tickets (POST /support-tickets/{ticketId}/messages) |
|
|
786
|
+
|
|
787
|
+
**Caps: the most one request may carry, and the most of a thing that may exist (a 4xx of their own, never a 429).**
|
|
788
|
+
|
|
789
|
+
| `data.scope` | In `RateLimit` as | Per | Window | Quota | Counts |
|
|
790
|
+
|---|---|---|---|---|---|
|
|
791
|
+
| `maxUpdatesPerRequest` | — | request | one request | 1,000 | entries in one updates array (400 TOO_MANY_UPDATES past it) |
|
|
792
|
+
| `maxCellsPerRequest` | — | request | one request | 5,000 | cells (entity × night) one request may name after range expansion (400 TOO_MANY_CELLS past it) |
|
|
793
|
+
| `maxBodyBytes` | — | request | one request | 1,048,576 | the JSON body; larger is 413 PAYLOAD_TOO_LARGE before a byte is validated |
|
|
794
|
+
| `horizonDays` | — | request | one request | 500 | the last writable night and the last bookable arrival: today + this many, in the property's calendar (400 HORIZON past it) |
|
|
795
|
+
| `maxNightsPerBooking` | — | request | one request | 90 | nights in one POST /bookings |
|
|
796
|
+
| `newEntitiesPerRequest` | — | request | one request | 20 | new room types or rate plans one structure write may create (400 TOO_MANY_NEW_ENTITIES past it) |
|
|
797
|
+
| `maxRoomTypes` | — | property | one request | 18 | live room types on a hotel (a vacation rental has figures of its own, on GET /limits): 409 CATALOG_LIMIT_REACHED past it |
|
|
798
|
+
| `maxRatePlans` | — | property | one request | 180 | live rate plans on a hotel: 409 CATALOG_LIMIT_REACHED past it |
|
|
799
|
+
| `maxActiveKeysPerProperty` | — | property | one request | 5 | active hotel keys on one property (409 KEY_LIMIT past it) |
|
|
800
|
+
| `maxActiveCompanyKeys` | — | software partner | one request | 5 | active company keys of one software partner |
|
|
801
|
+
| `maxSandboxes` | — | software partner | one request | 5 | sandboxes one software partner may hold at once |
|
|
802
|
+
| `maxAllowedCidrs` | — | key | one request | 20 | entries in one key's address allowlist |
|
|
803
|
+
| `idempotencyRetentionDays` | — | key | one request | 7 | how long an x-idempotency-key replays its first answer |
|
|
804
|
+
| `maxSupportMessageChars` | — | request | one request | 5,000 | characters in one support ticket message, the first included (400 VALIDATION past it) |
|
|
805
|
+
| `maxSupportTicketProperties` | — | request | one request | 200 | hotels one support ticket may name in propertyIds; past it send allProperties (400 VALIDATION) |
|
|
806
|
+
<!-- limits-table:end -->
|
|
807
|
+
|
|
387
808
|
## Options
|
|
388
809
|
|
|
389
810
|
```ts
|
|
@@ -392,8 +813,8 @@ new ZimmerStack({
|
|
|
392
813
|
propertyId, // a company key's hotel. Default: ZIMMERSTACK_PROPERTY_ID (or use forProperty)
|
|
393
814
|
timeoutMs: 30_000, // how long one try may take
|
|
394
815
|
maxRetries: 3, // how many more tries, for what may pass later
|
|
395
|
-
maxWaitSeconds: 120, // the longest it
|
|
396
|
-
onEvent: (e) => log(e), // every answer, wait and retry, for your logs. Never carries the key.
|
|
816
|
+
maxWaitSeconds: 120, // the longest it holds a call for a limit before giving you the "no". Any call can pass its own.
|
|
817
|
+
onEvent: (e) => log(e), // every answer, wait and retry, for your logs ("lands in about 25 minutes"). Never carries the key.
|
|
397
818
|
fetch, // a stand-in for tests
|
|
398
819
|
});
|
|
399
820
|
```
|
|
@@ -401,7 +822,11 @@ new ZimmerStack({
|
|
|
401
822
|
## Test your integration
|
|
402
823
|
|
|
403
824
|
Use a `zsk_test_` key, or pass a fake `fetch`. Nothing you do with a test key reaches a booking site,
|
|
404
|
-
and `zs.sandbox.bookings.create()` sends your webhook a real message. A
|
|
825
|
+
and `zs.sandbox.bookings.create()` sends your webhook a real message. A practice hotel can make a real
|
|
826
|
+
message of every type: a booking arriving, changing and cancelled, a cancellation with no booking before
|
|
827
|
+
it (`arrivesCancelled: true`), a website booking and its no-show, and a channel problem with its end
|
|
828
|
+
(`zs.sandbox.syncEvents.create()`). It can also be made to fail: `zs.sandbox.faults.set({ kind: "refuse" })`
|
|
829
|
+
makes its pretend booking site refuse the next price, so you can watch your software handle it. A software company makes test keys
|
|
405
830
|
in the partner portal under Developers. A hotel's owner makes one in Admin → Developers → API keys.
|
|
406
831
|
|
|
407
832
|
Guide: <https://docs.zimmerstack.com/sandbox>
|
|
@@ -435,6 +860,14 @@ up any part of the API, and try a call on your practice hotel before it writes c
|
|
|
435
860
|
| `zimmerstack_reference` | Any call, type, limit or error code, from the API's own contract. |
|
|
436
861
|
| `zimmerstack_sandbox_read` | One read on your practice hotel: real ids and real shapes. |
|
|
437
862
|
| `zimmerstack_sandbox_write` | One change on your practice hotel, to try a request before writing the code that sends it. |
|
|
863
|
+
| `zimmerstack_doctor` | The doctor's checks on your practice hotel's key: what is wrong, and what to do. |
|
|
864
|
+
| `zimmerstack_sandbox_limits` | Every limit of the key and how full it is. |
|
|
865
|
+
| `zimmerstack_sandbox_events` | The practice hotel's ordered event log, from a sequence: the exact body your webhook receives. |
|
|
866
|
+
| `zimmerstack_sandbox_simulate` | One real event of any type on your practice hotel: a booking arriving, changing, cancelled, a no-show, a channel problem and its end. |
|
|
867
|
+
| `zimmerstack_sandbox_dry_run` | What a change would do on your practice hotel, with nothing saved, and its notices. |
|
|
868
|
+
| `zimmerstack_sandbox_explain` | One night's whole story on your practice hotel. |
|
|
869
|
+
| `zimmerstack_sandbox_close` | Close a room type everywhere on your practice hotel, or reopen it. |
|
|
870
|
+
| `zimmerstack_sandbox_fault` | Make the practice hotel's pretend booking site refuse a price, slow down or go down, so your handling can be tried. |
|
|
438
871
|
|
|
439
872
|
```bash
|
|
440
873
|
# Claude Code
|