Start Free Trial

Webhooks and events

Instead of polling, register a URL and Best Guest calls it when a reservation changes. The same events are kept as a feed you can read, so a missed webhook is never lost.

Register a receiver

Register a webhook

The secret is shown once. The URL must be https on port 443.

curl -X POST https://api.bestguest.app/v1/createWebhook \
  -H "Authorization: $BESTGUEST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://example.com/hooks/best-guest",
  "events": [
    "reservation.updated",
    "guest.form_completed",
    "reservation.submitted"
  ]
}'

Answer: HTTP 200, and data.status = "active".

  • The URL must be https on port 443 and resolve only to public addresses. Redirects are not followed.
  • events and accommodationIds are optional filters; leave them out for everything. Up to 5 receivers per workspace.
  • The secret is returned once. updateWebhook with rotateSecret makes a new one; the old one keeps working for 24 hours, so you can switch over without dropping events.
  • A receiver belongs to one vendor in one workspace: you see, change and delete only your own, in each workspace you are connected to, and up to 5 in each workspace. Another vendor's receivers in the same workspace are invisible to you.
  • Delivery stops at once if the key that registered the receiver is revoked, and a receiver that fails for 3 days in a row is disabled (updateWebhook with enabled: true turns it back on).

Send a test event

Queues a webhook.test event to that receiver to check the route and the signature.

curl -X POST https://api.bestguest.app/v1/testWebhook \
  -H "Authorization: $BESTGUEST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "webhookId": 1234
}'

Answer: HTTP 200, and data.queued = true.

Events

TypeWhen
reservation.createdA reservation appeared in your workspace (also one the host made).
reservation.updatedDates, number of guests, property, listings or any guest's form changed. data.changed names the fields.
reservation.cancelledThe reservation was deleted.
guest.form_completedA guest's form became complete (data.dataId).
reservation.closed / reservation.reopenedThe reservation was closed (submitted, or queued to be) / opened again.
reservation.submittedThe report to the police portal was accepted. Czech reservations only: a closed reservation elsewhere gets closed and never submitted.
reservation.submission_failedThe report failed for good. A retry in progress is not an event.
localfee.requested, localfee.paid, localfee.payment_revertedThe local fee payment request, the payment, an undone payment.
webhook.testSent by testWebhook.

More types may be added; ignore the ones you do not know. reservation.ready_to_close is planned and not sent yet.

What a delivery looks like

POST https://your.server/best-guest
Content-Type: application/json
X-BestGuest-Event: guest.form_completed
X-BestGuest-Event-Id: evt_1042
X-BestGuest-Delivery-Id: del_88
X-BestGuest-Signature: t=1767225600,v1=5257a869...

{
  "id": "evt_1042", "type": "guest.form_completed", "apiVersion": "v1",
  "occurredAt": "2027-01-05T14:03:00Z", "workspaceId": 117,
  "data": { "reservationId": 9310, "externalId": "your-booking-id", "accommodationId": 4821,
            "status": "NOT_COMPLETED", "filledForms": 1, "personsCount": 2,
            "submissionStatus": null, "dataId": 1674 }
}

The body is thin on purpose: ids, counters and status words, never a name, a document number, a contact or a link. Read the current state with getReservation.

Verify the signature

v1 = HMAC-SHA256(secret, t + "." + rawBody), hex. Compute it over the raw body, compare in constant time, and refuse a t more than 5 minutes away. During a rotation the header carries two v1= values: accept either.

// PHP
[$t, $sigs] = parse($_SERVER['HTTP_X_BESTGUEST_SIGNATURE']);   // t=..., v1=..., v1=...
$expected = hash_hmac('sha256', $t . '.' . $rawBody, $secret);
$ok = abs(time() - $t) <= 300 && in_array($expected, $sigs, true); // use hash_equals per value

// Node.js
const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
const ok = Math.abs(Date.now() / 1000 - t) <= 300 && sigs.some(s => crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected)));

# Python
expected = hmac.new(secret.encode(), f"{t}.{raw_body}".encode(), hashlib.sha256).hexdigest()
ok = abs(time.time() - int(t)) <= 300 and any(hmac.compare_digest(s, expected) for s in sigs)

Delivery guarantees

  • At least once, in no guaranteed order. Deduplicate on the event id.
  • Answer any 2xx within 10 seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2, 6, 12 and 24 hours (8 attempts in all).
  • Changes are noticed about once a minute. A state that flips and flips back within that minute is not reported.
  • Events are kept 30 days.

Catch up: the event feed and replay

Read the event feed

The pull-based way to catch up. Pass the returned nextCursor as `after` next time.

curl -X GET https://api.bestguest.app/v1/getEvents?after=0&limit=50 \
  -H "Authorization: $BESTGUEST_API_KEY"

Answer: HTTP 200, and data.hasMore = false.

Start with after=0 and pass the returned nextCursor next time. Events are kept 30 days: a cursor older than the oldest trimmed event is answered with 410 CURSOR_EXPIRED, and you start again without a cursor and resynchronise with getReservations. Reading the feed also makes Best Guest watch your workspace (for a week) even with no receiver. replayWebhookEvents with fromEventId, since or eventIds sends stored events to one receiver again (at most 1000 per call).

feedEnabled in the answer is false while Best Guest has event detection switched off: the feed is then empty. It ships switched off and is switched on when you go live.

Chekin-compatible webhooks

With the Chekin-compatible API you subscribe per event (POST /api/v3/webhooks/ with target, event, optional signature_secret and housing_id). The body is Chekin's: {"hook": {"id", "event", "target"}, "data": {"reservation_id", "reservation_url"}} (Guest.created: reservation_id, guest_id, guest_origin), signed as x-payload-signature: the HMAC-SHA256 (hex) of the raw body with your secret. Retries, the 3-day rule and the 5-receiver limit are the same as above (Chekin gives up after three tries; Best Guest does not).

Chekin eventSent when
Reservation.updatedAny change, cancellation, closing, reopening or local fee event.
Guest.createdA guest completed their form.
PoliceRegistration.created, .scheduledA Czech reservation was closed and queued for the police.
PoliceRegistration.complete, .errorThe police report was accepted / failed for good.
PoliceRegistration.updated, .deleted, .progress, StatRegistration.*Accepted so a client that subscribes to every event does not fail; never sent.

Subscribe to an event

One event per subscription. The body of a delivery is {hook, data}; the signature is HMAC-SHA256 (hex) of the raw body in x-payload-signature.

curl -X POST https://api.bestguest.app/api/v3/webhooks/ \
  -H "Authorization: JWT $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "target": "https://example.com/hooks/chekin",
  "event": "Reservation.updated",
  "signature_secret": "my-secret"
}'

Answer: HTTP 201, and event = "Reservation.updated".