View Categories

Bookings, Availability & Serials Endpoints

5 min read

These endpoints live under https://your-store.com/wp-json/wc-sibooking/v1/ and need a WooCommerce REST API key with Read/Write permissions, as described in the REST API overview. A booking is a reservation of one or more units of a product for a date range. Creating one reserves the units, deleting it frees them, and the send/return endpoints record the units leaving and coming back, which is what the Rentals → Send and Return screens do.

Bookings #

Method and pathWhat it does
GET /bookingsList bookings. Filters: product_id, order_id, state (upcoming, out, overdue, returned), after (ending after this date), before (starting before this date), search, is_booked, page, per_page.
POST /bookingsReserve units. Required: product_id, start, end. Optional: quantity (default 1), order_id, notes, apply_buffer (default true: the product’s turnover buffers are added around the dates), force (default false).
GET /bookings/{id}One booking.
PUT /bookings/{id}Change start, end, quantity, notes, order_id or is_booked. Availability is re-checked for the new dates, ignoring this booking’s own units.
DELETE /bookings/{id}Remove the booking and free its units.
POST /bookings/{id}/sendCheck units out to the customer: quantity and, on a serial-tracked product, the serials (array of codes) going out.
POST /bookings/{id}/returnTake units back: quantity and the serials returned.
GET /bookings/{id}/serialsThe serials currently out on this booking.
GET /bookings/{id}/historyEvery send and return recorded for the booking, with who did it and when.

The booking object #

{
  "id": 8123,
  "product_id": 123,
  "product_name": "Canon EOS R6 body",
  "order_id": 4571,
  "quantity": 1,
  "start": "2026-10-03 00:00:00",
  "end": "2026-10-05 23:59:00",
  "start_with_buffer": "2026-10-02 00:00:00",
  "end_with_buffer": "2026-10-06 23:59:00",
  "quantity_sent": 1,
  "quantity_returned": 0,
  "is_booked": true,
  "notes": "",
  "state": "out"
}
  • start/end are the customer’s rental dates; start_with_buffer/end_with_buffer include the turnover time before and after, and those are the dates that block the calendar.
  • state is derived the same way as the Rentals → Bookings screen: upcoming until something is sent, out while units are with the customer, overdue when the end date has passed with units still out, returned once everything is back.
  • is_booked is false for a reservation that no longer holds units: the plugin clears it when the order is cancelled, refunded, failed or trashed, and sets it again if the order comes back to a live status.
  • order_id is 0 for a reservation created directly through the API (a block-out, a phone booking, a maintenance hold).

Creating a reservation #

curl -u "ck_your_key:cs_your_secret" -X POST \
  -H "Content-Type: application/json" \
  -d '{"product_id": 123, "start": "2026-10-03", "end": "2026-10-05", "quantity": 2, "notes": "Phone booking, J. Smith"}' \
  https://your-store.com/wp-json/wc-sibooking/v1/bookings

The response is the new booking with HTTP status 201. If fewer than two units are free for those dates (buffers included) the request is refused with status 409 and a message saying how many are available; pass "force": true to reserve anyway, for example to record an overbooking you intend to resolve by hand. For a time-based rental send the times as well: "start": "2026-10-03 09:00", "end": "2026-10-03 17:00".

Sending and returning #

POST /wp-json/wc-sibooking/v1/bookings/8123/send
{ "quantity": 1, "serials": ["CAM-0007"] }

POST /wp-json/wc-sibooking/v1/bookings/8123/return
{ "quantity": 1, "serials": ["CAM-0007"] }

Both return the updated booking. On a product with serial tracking the serial codes are required and must belong to the product; a code that is already out (or, on return, not out on this booking) is a 409. On a quantity-only product leave serials out. Sending more than the booking’s remaining quantity is refused.

Availability #

Method and pathWhat it does
GET /availabilityHow many units of a product are free for a date range. Required: product_id, start, end. Optional: quantity (default 1) to get a yes/no answer for that many, exclude_order_id to ignore an order’s own reservations (when re-quoting an existing order), apply_buffer (default true).
GET /availability/calendarThe reservation intervals for a product (start/end optional to narrow the window): every interval with its booked quantity, and the list of days on which every unit is booked. This is the data behind the greyed-out days on the product calendar.
GET /wp-json/wc-sibooking/v1/availability/calendar?product_id=123&start=2026-10-01&end=2026-10-31

{
  "product_id": 123,
  "max_quantity": 3,
  "inventory": [
    { "quantity": 1, "start": "2026-10-02 00:00:00", "end": "2026-10-06 23:59:00" },
    { "quantity": 3, "start": "2026-10-10 00:00:00", "end": "2026-10-12 23:59:00" }
  ],
  "fully_booked_days": [
    { "date": "2026-10-10", "quantity": 3 },
    { "date": "2026-10-11", "quantity": 3 },
    { "date": "2026-10-12", "quantity": 3 }
  ]
}

max_quantity is the product’s stock (or its serial count). A rental may run through days on which the product is partly booked, but not through a fully booked day, and it cannot start or end on a store closed day; the add-to-cart endpoints enforce both, so a booking widget built on this data should too.

Serials #

Method and pathWhat it does
GET /serialsList serials. Filters: product_id, status, search (code or comments), page, per_page.
POST /serialsAdd a serial. Required: product_id, code. Optional: status (default Available), cost, acquired (Y-m-d), comments.
GET /serials/{id}One serial.
PUT /serials/{id}Change any of the fields above, including moving it to another product.
DELETE /serials/{id}Delete a serial. One that is out with a customer cannot be deleted.
{
  "id": 41,
  "product_id": 123,
  "code": "CAM-0007",
  "status": "Available",
  "cost": "2499.00",
  "acquired": "2025-03-14",
  "comments": "Second body, firmware 1.8",
  "order_id": null
}

Codes are unique per product; a duplicate is a 409. status must be one of the statuses the store uses (Available, Not Available and Damaged by default, extendable with the sibooking_serial_status filter). order_id is the order the serial is currently out on, or null. Adding or removing serials changes the product’s max_quantity when it uses serial tracking, so it is the API way to grow or shrink a serial-tracked fleet.