# Append Stay data

### **Overview**

Airship can store full hotel stay booking history for each contact.

Having stay data attached to contacts is useful to measure and target recent or lapsed visitors based on their last visit.

### Storing Stays&#x20;

To store stay history, simply append a `stays` object to your contact as you send it to us.

| Field                       | Notes                                                                                                                                                                                                                |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `booker`                    | <p>True / False, if the contact data being provided is the Booker of the Stay<br><em>Required field</em></p>                                                                                                         |
| `guest`                     | <p>True / False, if the contact data being provided is the Guest of the Stay<br><em>Required field</em></p>                                                                                                          |
| `unit_id`                   | <p>The unit\_id representing the physical location for which this WIFI interaction relates </p><p><em>Required field</em></p>                                                                                        |
| `provider_id`               | <p>Unique ID for the integration partner. If you are a new integrator, please contact our support team to get a new ID setup<br><em>Required field</em></p>                                                          |
| `stay_reference`            | <p>Unique booking reference for the stay. If the stay\_reference has previously been provided by the same provider, we will interoperate this as an update to that Stay<br><em>Required field</em></p>               |
| `enquiry_date`              | <p>Date/time the stay was created, in the format 'yyyy-mm-dd hh:mm:ss'<br><em>Required field</em></p>                                                                                                                |
| `checkin_date`              | <p>Date/time of the stay checkin, in the format 'yyyy-mm-dd hh:mm:ss'<br><em>Required field</em></p>                                                                                                                 |
| `checkout_date`             | <p>Date/time of the stay checkout, in the format 'yyyy-mm-dd hh:mm:ss'<br><em>Required field</em></p>                                                                                                                |
| `room_type_id`              | <p>1 = Basic</p><p>2 = Standard</p><p>3 = Premium<br><br>The classification of the room type booked<br><em>Required field</em></p>                                                                                   |
| `total_guests`              | <p>This is a sum of the total guests booked for the stay (adults + children)<br><em>Required field</em></p>                                                                                                          |
| `total_children`            | This is the total children booked for the stay                                                                                                                                                                       |
| `booking_enquiry_source_id` | <p>1 = Website<br>9 = In house<br>10 = 3rd Party<br><br>You can also retrieve booking source IDs from the <code>/booking/sources</code> endpoint.<br><em>Required field</em></p>                                     |
| `deposit_amount`            | Deposit paid for Stay                                                                                                                                                                                                |
| `room_gross_value`          | Gross room value for stay                                                                                                                                                                                            |
| `room_net_value`            | Net room value for Stay                                                                                                                                                                                              |
| `extras_gross_value`        | Extras gross value for Stay                                                                                                                                                                                          |
| `extras_net_value`          | Extras net value for Stay                                                                                                                                                                                            |
| `booking_status_id`         | <p>1 = Enquiry </p><p>2 = Provisional </p><p>3 = Confirmed </p><p>4 = Checked in </p><p>5 = Cancelled </p><p>6 = No show </p><p>7 = Checked out<br><br>The latest status for the Stay<br><em>Required field</em></p> |
| `room_rate_code`            | Internal Room Rate Code for the booking                                                                                                                                                                              |
| `room_package_code`         | Internal Room Package Code for the booking                                                                                                                                                                           |
| `used_voucher`              | <p>If the booking had a voucher associated<br><br>Boolean, true / false</p>                                                                                                                                          |
| `booking_has_pets`          | <p>If the booking has pets</p><p></p><p>Boolean, true / false</p>                                                                                                                                                    |
| `stay_travel_agent`         | If the booking was an OTA, what is the travel agent provider? (i.e. Booking.com)                                                                                                                                     |

### Example Payload

```json
{
"account_id": 3,
"email": "johnsmith@gmail.com",
//...etc...

    "stays": 
          [
            {
              "booker": true,
              "guest": false,
              "provider_id": 3,
              "stay_reference": "my-unique-ref",
              "unit_id": 13822,
              "enquiry_date": "2021-04-27 20:30:00",
              "check_in_date": "2022-02-01 14:30:00",
              "check_out_date": "2021-02-03 10:30:00",
              "room_type_id": 2,
              "total_guests": 4,
              "total_children": 2,
              "booking_enquiry_source_id": 10,
              "deposit_amount": 250,
              "room_gross_value": 400,
              "room_net_value": 400,
              "extras_gross_value": 210,
              "extras_net_value": 210,
              "booking_status_id": 1,
              "room_rate_code": "DBL",
              "room_package_code": "Package-23a",
              "used_voucher": true,
              "booking_has_pets": false,
              "stay_travel_agent": "booking.com",
              "extras": [
                  {
                      "name": "Pets",
                      "reference": "PT",
                      "start_date": "2023-04-28 20:30:00",
                      "end_date": "2023-04-28 20:30:00",
                      "quantity": 4,
                      "price": 400
                  },
                  {
                      "name": "Breakfast",
                      "reference": "Break",
                      "start_date": "2023-04-28 20:30:00",
                      "end_date": "2023-04-28 20:30:00",
                      "quantity": 1,
                      "price": 1000
                  }
              ]
          }
    ]
}
```

### Extras

Extras can now be added to a Booking to allow us to capture any additional products / purchases / upsells.

| Field       | Notes                                                                                  |
| ----------- | -------------------------------------------------------------------------------------- |
| name        | <p>String description of the extra<br><em>Required</em></p>                            |
| reference   | <p>SKU or product reference number for the extra<br><em>Required</em></p>              |
| start\_date | <p>Extra start date (use stay checkin date if not applicable)<br><em>Required</em></p> |
| end\_date   | <p>Extra end date (use stay check out date if not applicable)<br><em>optional</em></p> |
| price       | <p>value of the extra(s) in pence<br><em>Required</em></p>                             |

### Update bookings&#x20;

To update a booking, you can pass the same object against a contact - and if we identify the `stay_reference` and `provider_id` against an existing stay, that stay will be updated.
