Locks that issue their own PIN
Write the door PIN your lock system issued to the booking, remove it when the booking moves to a room the PIN does not open, and what the guest and the property see afterwards.
3 min read
For a lock system on the partner programme that generates the PIN itself. The PIN goes on the booking, where every reader takes it from: the guest webapp, the arrivals report of the property and the self check-in kiosks. The route takes your partner key and is reached only once it is granted on purpose on your connection to that property; the answers come sealed to your key, as the encryption guide explains. One booking is one room: in a group, write each booking with its own id.
- 1Write the PIN
PUT /api/integrations/{pcode}/locks/door-keys/{bookingId}with{ "pin": "0427" }: the PIN as text, digits only, 4 to 8 of them, leading zeros kept. A JSON number is refused, as are all zeros and zeros ending in 1 (0000,0001), which older readers of the booking take for "no key" or "key without PIN":400doorKeyPinInvalid. - 2A key without a PINWhen the booking has a key but no PIN to give the guest (a card, a link), send
{ "state": "keyWithoutPin" }: the guest is sent to reception. - 3Remove the keyWhen the booking moves to a room your PIN does not open, send
{ "state": "none" }, and then write the new PIN the same way. Only bookings still to come or in house can be written: a cancelled booking, a no-show or a block answers409doorKeyBookingNotActive, and a checked-out booking409doorKeyBookingCheckedOut, removing the key included. Nothing reads the key of a stay that is over or cancelled, so there is nothing to clean up: void the PIN in your own system.
http
1PUT /api/integrations/114/locks/door-keys/7892x-api-key: <your partner key>3Content-Type: application/json45{ "pin": "0427" }67→ 200 { "bookingId": 789, "status": "pin", "changed": true }
pin and state per request; anything else is 400 doorKeyRequestInvalid.Safe to send again
Sending the key the booking already has writes nothing and answers
changed: false: retry whenever you did not hear back. Every change goes in the booking history under your partner name, with the status before and after and never the PIN.What the guest and the property see
- •The guest sees the PIN in the keys card of their webapp when the property’s own rules release it — the arrival day, the check-in time or an earlier release the property chose, the online check-in done and nothing blocking left to pay. Hotelgest applies them, so you do not have to time the write: write the PIN as soon as you have it.
- •Hotelgest sends the guest no email with the PIN: if the guest has to receive it by email or SMS, that stays with your system, as it was with the legacy API.
- •Reception sees it in the arrivals report, and a self check-in kiosk hands it to the guest once the booking is checked in. An open guest webapp and the property’s panel refresh on their own when it changes.
From your server, never from a device, app or browser
A PIN opens a guest’s room: the call goes from your server to Hotelgest’s, with the key kept on your server. Do not keep PINs in your logs longer than you need them.
Coming from the legacy API
| Legacy | Now |
|---|---|
/v1/user/getToken with a user and password of the property | Your partner key in x-api-key, the property in the path. |
/v1/reservation/update with rscode and pin_door | PUT …/locks/door-keys/{bookingId} with pin as text. pin_door 1 is state: keyWithoutPin, and 0 is state: none. |