Contents
On this page

Update Booking - Plugixa Boat Rental

PUT /pbr/v1/bookings/{id}

Change a booking: its customer details, notes, status, or its dates, boat, unit and guests. PATCH does the same.

An API key PRO with Read and write access, or a signed-in user with the plugixa_boatrental_edit capability.

Note. This is a merge, not a replace, for PUT as well as PATCH: only the fields you send are touched. A reschedule is checked against the marina’s hours and its free boats, but not repriced: the booking keeps the total and line items it was made with. The advance-booking limits that refuse a new booking in the past are not applied to a change.

Request

PUT https://your-site.example/wp-json/pbr/v1/bookings/412

Path parameters

Name Type Description
id integer The booking’s id

Request body

Content type: application/json

Field Type Required Description
customer_name string No The customer’s name.
customer_email string No Must be an email address, or empty.
customer_phone string No The customer’s phone.
notes string No Notes, line breaks kept.
status string No One of the site’s booking statuses. Any status but pending also clears the booking’s hold time, so it keeps its boat.
start_datetime string No New departure, YYYY-MM-DD HH:MM (seconds optional) on the marina’s clock.
end_datetime string No New return, in the same form. Must stay after the departure.
boat_id integer No Move the booking to another boat.
unit_id integer|null No One particular unit. 0, null or empty means none in particular.
guests integer No At least 1.
quantity integer No At least 1. Stored as sent.
billing object No Billing details as a flat map of plain values. Replaces the stored map.
meta object No Answers to the booking form’s own fields. Replaces the stored answers: send every answer to keep. Labels already stored are kept.
modified_at string No The booking’s modified_at as you last read it. When sent and the booking has changed since, the change is refused with 409.
force boolean No Save a reschedule into a window where the marina is closed or the boat is full. Overrides those two checks and nothing else. May also be sent in the query string.

The marina, the customer account, the price and the paid state cannot be changed here: location_id, user_id, billing_type and the totals are ignored, and payment_status or amount_paid is refused. start and end are not read on a change: use start_datetime and end_datetime.

Changing start_datetime, end_datetime, quantity, boat_id or unit_id, or adding guests, is checked again with this booking left out of the count. The check is skipped while the booking is in a status that holds no boat, such as cancelled. A status change to confirmed or cancelled, and a change of dates, boat, unit or guests, send the matching booking.confirmed, booking.cancelled or booking.updated webhook.

{
  "start_datetime": "2026-11-21 10:00",
  "end_datetime": "2026-11-21 14:00",
  "notes": "Moved at the customer's request.",
  "modified_at": "2026-11-12 09:45:00"
}

Responses

200 OK. data is the booking as it now stands.

{
  "success": true,
  "data": {
    "id": 412,
    "booking_ref": "BOAT-7F3A91",
    "language_code": null,
    "location_id": 2,
    "boat_id": 5,
    "unit_id": 9,
    "booking_form_id": null,
    "user_id": null,
    "status": "confirmed",
    "billing_type": "hour",
    "start_datetime": "2026-11-21 10:00:00",
    "end_datetime": "2026-11-21 14:00:00",
    "start_utc": "2026-11-21 10:00:00",
    "end_utc": "2026-11-21 14:00:00",
    "buffer_before": 0,
    "buffer_after": 30,
    "block_start_utc": "2026-11-21 10:00:00",
    "block_end_utc": "2026-11-21 14:30:00",
    "quantity": 1,
    "guests": 4,
    "source": "admin",
    "hold_expires_at": null,
    "customer_name": "Ana Silva",
    "customer_email": "ana@example.com",
    "customer_phone": "+351 912 345 678",
    "billing": null,
    "currency": "EUR",
    "subtotal": 380.0,
    "discount_total": 0.0,
    "tax_total": 0.0,
    "deposit_amount": 0.0,
    "total": 380.0,
    "amount_paid": 100.0,
    "payment_method": "offline",
    "payment_status": "deposit_paid",
    "notes": "Moved at the customer's request.",
    "meta": null,
    "created_by": 0,
    "modified_by": 0,
    "created_at": "2026-11-12 09:30:00",
    "updated_at": null,
    "modified_at": "2026-11-12 10:15:00",
    "deleted_at": null,
    "items": [
      {
        "id": 977,
        "booking_id": 412,
        "type": "rental",
        "reference_id": 5,
        "label": "1 boat × 4 hours",
        "quantity": 4.0,
        "unit_price": 95.0,
        "total": 380.0,
        "tax_rate_id": null,
        "meta": null
      }
    ],
    "custom_fields": [],
    "location_name": "Lisbon Marina",
    "boat_name": "Sea Ray 230"
  }
}
Field Type Meaning
data.start_datetime, data.end_datetime string The new window, on the marina’s clock
data.start_utc … data.block_end_utc string Worked out again from the new window
data.total, data.items Unchanged by a reschedule
data.modified_at string UTC datetime of this change: send it back as modified_at next time

Errors

Status Code When
404 plugixa_boatrental_not_found No booking with that id, or the booking is in the trash.
409 plugixa_boatrental_conflict modified_at was sent and the booking has changed since. data.current holds the stored value.
422 plugixa_boatrental_derived_field payment_status or amount_paid was sent.
422 plugixa_boatrental_invalid_choice status is not one of the site’s statuses. data.allowed lists them.
422 plugixa_boatrental_invalid_date A departure or return is not a real date.
422 plugixa_boatrental_not_a_number boat_id, unit_id, guests or quantity is not a number.
422 plugixa_boatrental_invalid_guests guests is below 1. Also plugixa_boatrental_invalid_boat_id and plugixa_boatrental_invalid_quantity.
422 plugixa_boatrental_invalid_email customer_email is not an email address.
422 plugixa_boatrental_too_long A text field is longer than its column holds.
422 invalid_range The return would not be after the departure.
422 location_closed / outside_hours The marina is closed or outside its hours at the new departure or return. force overrides this.
409 no_availability No free boat for the new window. force overrides this.
409 busy The booking or the boat was being changed by another request. Try again.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/pbr/v1/bookings/412" \
  -H "Authorization: Bearer $PBR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"start_datetime":"2026-11-21 10:00","end_datetime":"2026-11-21 14:00","notes":"Moved at the customer'"'"'s request.","modified_at":"2026-11-12 09:45:00"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/pbr/v1/bookings/412');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('PBR_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'start_datetime' => '2026-11-21 10:00',
        'end_datetime'   => '2026-11-21 14:00',
        'notes'          => "Moved at the customer's request.",
        'modified_at'    => '2026-11-12 09:45:00',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/pbr/v1/bookings/412', {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${process.env.PBR_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    start_datetime: '2026-11-21 10:00',
    end_datetime: '2026-11-21 14:00',
    notes: "Moved at the customer's request.",
    modified_at: '2026-11-12 09:45:00',
  }),
});
const { data } = await response.json();

Quick Links

Share