Extend or Shorten a Reservation

How to extend or shorten a guest's confirmed reservation.

Available Endpoints

MethodEndpoint
PUT/reservations/{id}

Key Parameters

Query ParameterTypeDescriptionRequired
idstringThe reservation ID.✔️
Body ParametersTypeDescriptionRequired
checkInDateLocalizedstringThe check-in date written as"YYYY-MM-DD".✔️
checkOutDateLocalizedstringThe check-out date written as"YYYY-MM-DD".✔️
ignoreCalendarbooleantrue/false. Only include if you wish to override any calendar blocks.
ignoreTermsbooleantrue/false. Only include if you wish to overlook the terms of the listing.

❗️

Override Parameters

You are responsible for any overbooking incurred as a result of the use of the ignoreCalendar and ignoreTerms parameters. These parameters should only be used sparingly with care and caution.

Example

Here is a reservation booked from September 12 - 20, 2023. The guest wishes to extend it another two nights to September 22.

{
    "_id": "64c9213ba097ec00417a9911",
    "integration": {
        "_id": "5b9a25fd3bfa6d01b15a0b14",
        "platform": "manual",
        "limitations": {
            "availableStatuses": [
                "checked_in",
                "checked_out",
                "canceled"
            ]
        }
    },
    "listingId": "62ec6975134d780032b62221",
    "checkInDateLocalized": "2023-09-12",
    "checkOutDateLocalized": "2023-09-20",
    "status": "confirmed",
    "guest": {
        "_id": "64c9213aa097ec00417a9910",
        "fullName": "Ernest Hemingway"
    },
    "accountId": "5b852676354b34003f0a55eb",
    "guestId": "64c9213aa097ec00417a9910",
    "source": "Manual",
    "confirmationCode": "r2Bk86Yj4",
    "listing": {
        "_id": "62ec6975134d780032b62221",
        "nickname": "Test_Listing_Shan"
    }
}

Request

There are no blocks or listing terms preventing the alteration. All we need to do is send the new dates.

curl --request PUT 'https://open-api.guesty.com/v1/reservations/64c9213ba097ec00417a9911' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
  "checkInDateLocalized": "2023-09-12",
  "checkOutDateLocalized": "2023-09-22"
}
'
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");

var raw = JSON.stringify({
  "checkInDateLocalized": "2023-09-12",
  "checkOutDateLocalized": "2023-09-22"
});

var requestOptions = {
  method: 'PUT',
  headers: myHeaders,
  body: raw,
  redirect: 'manual'
};

fetch("https://open-api.guesty.com/v1/reservations/64c9213ba097ec00417a9911", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://open-api.guesty.com/v1/reservations/64c9213ba097ec00417a9911',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS =>'
{
  "checkInDateLocalized": "2023-09-12",
  "checkOutDateLocalized": "2023-09-22"
}
',
  CURLOPT_HTTPHEADER => array(
    'accept: application/json',
    'content-type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

import http.client
import json

conn = http.client.HTTPSConnection("open-api.guesty.com")
payload = json.dumps({
  "checkInDateLocalized": "2023-09-12",
  "checkOutDateLocalized": "2023-09-22"
})
headers = {
  'accept': 'application/json',
  'content-type': 'application/json'
}
conn.request("PUT", "/v1/reservations/64c9213ba097ec00417a9911", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Response

The request is successful, and the response body confirms the new check-out date.

{
    "checkInDateLocalized": "2023-09-12",
    "checkOutDateLocalized": "2023-09-22",
    "_id": "64c9213ba097ec00417a9911",
    "confirmationCode": "r2Bk86Yj4"
}

📘

Past Reservations

To correct the record on past reservations you may have to include the overrideCalendar and /or ignoreTerms parameters to force the change on the closed calendar dates.