# Booking API

This version of the Booking API allows a POS to retrieve a filtered list of bookings from the Booking App and update a booking, this allows POS who do not have native booking functionality to support booking integrations via Tyro Connect. We have also introduced the ability to add new asset types.

* Create a new Booking from the App
* Create walk-in from the POS
* Update an existing Booking
* Retrieve & filter a list of bookings from the POS
* Retrieve a list of changes that have been made to a booking


## Overview of booking scenarios

### New booking from App partner

When a customer makes a booking through a Booking partner the sequence is as follows:

* Tyro Connect receives the booking and notifies the Point of Sale of the booking.
* Depending on the integration the POS is notified either via webhooks or websockets about the booking.
* It is then up to the POS to fetch the booking details using the provided `tcBookingId`.


The sequence diagram below depicts this flow:

p
img
### New walk-in booking

In scenarios where a customer walks in to the restaurant without a booking, the POS will need to inform the Booking partner about the booking. The sequence is as follows:

* Customer walks into the restaurant
* POS user creates a booking on the system which creates the booking on Tyro Connect
* Tyro Connect then pushes this information to the Booking partner through their webhook integration


The sequence diagram below depicts this flow:

p
img
### During the meal

Once the customer has arrived for the booking and started dining. The POS starts sending Tyro Connect all updates about the order:

* Customer is seated at the table, the POS publishes the `SEATED` event to Tyro Connect
* Once the customer starts ordering items the table status is set to `DINING` status on the POS. If integrated with the `Sales API` the POS also sends the order information with their SKUs.
* The table status is set to `CLOSING` when the customer has asked for the bill/check and then to `FINALISED` when the table is available again.
* Tyro Connect then pushes all order updates to the Booking partner through their webhook integration.
* Note that the App can also send a `SEATED` event to Tyro Connect.


The sequence diagram below depicts this flow:

p
img
#### Table statuses

| Status | Description |
|  --- | --- |
| SEATED | The customer is seated at the table |
| DINING | The customer has started ordering their meal |
| CLOSING | The customer has asked for the check/bill |
| FINALISED | The customer has paid the bill and the table is available again |


## Booking status lifecycle

The booking object has a predefined set of statuses it can progress through. The status is reflected by the `bookingStatus` field on the booking. These can be viewed from the diagram below:

p
img
## API reference

| Endpoint | Description |
|  --- | --- |
| [`POST /bookings`](/api-explorer/booking/1.0/other/create-booking-request) | Create a booking (reservation, or POS walk-in) |
| [`GET /bookings`](/api-explorer/booking/1.0/other/list-bookings) | List bookings for a location — POS only |
| [`GET /bookings/{bookingId}`](/api-explorer/booking/1.0/other/get-booking) | Get the details of a booking |
| [`PATCH /bookings/{bookingId}`](/api-explorer/booking/1.0/other/patch-booking) | Update a booking |
| [`GET /bookings/{bookingId}/events`](/api-explorer/booking/1.0/other/get-booking-events) | Get the events associated with a booking — POS only |


Full request and response schemas, including error responses, are in the [API Explorer](/api-explorer/booking/1.0/other/create-booking-request).