Contents
On this page

Search Availability - Plugixa Car Rental

POST /plugixa-car-rental/v1/bookings/search

For a rental window, list every published model: how many of its cars are free and what the rental would cost.

A read: the user needs the plugixa_car_rental_view capability. It is a POST only because the question is a JSON body; it writes nothing.

Staff searches skip the shortest notice and furthest horizon of the booking rules, as staff bookings do.

Request

POST https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/search

Request body

Content type: application/json

Field Type Required Description
pickup_location_id integer Yes A published location that allows pickups.
return_location_id integer No A published location that allows returns. Omitted or 0: the pickup location.
pickup_at string Yes Local time at the pickup location: YYYY-MM-DD HH:MM, with optional seconds, a space or a T between. No time-zone offset, and a bare date is refused.
return_at string Yes Local time at the return location, in the same form. After pickup_at.
extras object[] No Extras to add, as {"id": 3, "quantity": 1}. Only published extras count, and a quantity above the extra’s max_quantity is cut to it. Needs the Extras app.
coupon string No A coupon code. Needs the Coupons app.
driver_age integer No The driver’s age, 16 to 99, for the young and senior driver surcharges and each model’s minimum age. Needs Pro with the Driver age app.
delivery_address string No Deliver the car to this address. Needs Pro with the Delivery and collection app.
collection_address string No Collect the car from this address at the end. Needs Pro with the Delivery and collection app.
currency string No Price in another of your currencies, by its code. Needs Pro with the Multi-currency app. Unknown codes are ignored.
{
  "pickup_location_id": 1,
  "pickup_at": "2026-12-01 10:00",
  "return_at": "2026-12-04 10:00",
  "extras": [
    {
      "id": 3,
      "quantity": 1
    }
  ]
}

Responses

200 OK. data holds the window and one entry per model.

{
  "success": true,
  "data": {
    "window": {
      "pickup_location_id": 1,
      "return_location_id": 1,
      "pickup_at": "2026-12-01T10:00:00+01:00",
      "return_at": "2026-12-04T10:00:00+01:00",
      "days": 3,
      "one_way": false,
      "after_hours": []
    },
    "vehicles": [
      {
        "model": {
          "id": 4,
          "category_id": 2,
          "name": "Peugeot 3008",
          "make": "Peugeot",
          "model": "3008",
          "year": 2025,
          "transmission": "automatic",
          "fuel": "diesel",
          "seats": 5,
          "doors": 5,
          "bags": 3,
          "air_conditioning": true,
          "mileage_limit": 300,
          "min_driver_age": 23,
          "deposit": 800.0,
          "image_id": 51,
          "description": "<p>A roomy SUV with a large boot.</p>",
          "sort_order": 10,
          "status": "published",
          "created_by": 1,
          "modified_by": 1,
          "created_at": "2026-11-12 09:30:00",
          "modified_at": "2026-11-12 09:30:00",
          "deleted_at": null
        },
        "available": 2,
        "quote": {
          "vehicle_model_id": 4,
          "rate_plan_id": 5,
          "days": 3,
          "daily_rate": 65.0,
          "currency": "EUR",
          "line_items": [
            {
              "type": "rental",
              "reference_id": 5,
              "label": "Peugeot 3008, 3 days",
              "quantity": 3.0,
              "unit_price": 65.0,
              "total": 195.0
            },
            {
              "type": "extra",
              "reference_id": 3,
              "label": "Child seat",
              "quantity": 1.0,
              "unit_price": 24.0,
              "total": 24.0
            }
          ],
          "subtotal": 219.0,
          "discount_total": 0,
          "tax_total": 0.0,
          "total": 219.0,
          "deposit": 800.0,
          "exchange_rate": 1.0,
          "window": {
            "pickup_location_id": 1,
            "return_location_id": 1,
            "pickup_at": "2026-12-01T10:00:00+01:00",
            "return_at": "2026-12-04T10:00:00+01:00",
            "days": 3,
            "one_way": false,
            "after_hours": []
          },
          "refusal": "",
          "refusal_field": "",
          "refusal_scope": "car"
        },
        "reason": null
      },
      {
        "model": {
          "id": 2,
          "category_id": 1,
          "name": "Renault Clio",
          "make": "Renault",
          "model": "Clio",
          "year": 2024,
          "transmission": "manual",
          "fuel": "petrol",
          "seats": 5,
          "doors": 5,
          "bags": 2,
          "air_conditioning": true,
          "mileage_limit": 250,
          "min_driver_age": 21,
          "deposit": 500.0,
          "image_id": null,
          "description": "",
          "sort_order": 20,
          "status": "published",
          "created_by": 1,
          "modified_by": 1,
          "created_at": "2026-11-12 09:30:00",
          "modified_at": "2026-11-12 09:30:00",
          "deleted_at": null
        },
        "available": 4,
        "quote": null,
        "reason": "plugixa_car_rental_not_priced"
      }
    ]
  }
}
Field Type Meaning
data.window object The rental window as understood, with days and after_hours
data.vehicles[].model object The model’s stored fields, as on Get Vehicle Model without the three added names
data.vehicles[].available integer Cars of the model free for the window
data.vehicles[].quote object|null The price, in the shape of Quote Booking, or null when it cannot be priced
data.vehicles[].reason string|null Why it cannot be booked: the error code that stopped pricing (such as plugixa_car_rental_not_priced), sold_out when no car is free, else null

A model that is priced but refused for this request (a driver too young for it, for example) keeps its quote, with the reason in quote.refusal.

Errors

Status Code When
422 plugixa_car_rental_unknown_location A location is missing, unpublished or in the trash. data.field names it.
422 plugixa_car_rental_location_not_allowed The pickup location takes no pickups, or the return location takes no returns.
422 plugixa_car_rental_invalid_datetime pickup_at or return_at is missing, a bare date, not a date, or a time skipped by a clock change at that location.
422 plugixa_car_rental_return_before_pickup return_at is not after pickup_at.
422 plugixa_car_rental_location_closed The location is closed on that day.
422 plugixa_car_rental_outside_hours The time is outside the location’s opening hours and it charges no after-hours fee.
422 plugixa_car_rental_too_short The rental is shorter than the shortest rental in the booking rules.
422 plugixa_car_rental_too_long The rental is longer than the longest rental in the booking rules. data.field is return_at.
422 plugixa_car_rental_refused A module refused the whole request rather than one car, for example a delivery address out of range. data.field names the field.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/search" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"pickup_location_id":1,"pickup_at":"2026-12-01 10:00","return_at":"2026-12-04 10:00","extras":[{"id":3,"quantity":1}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/search');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'pickup_location_id' => 1,
        'pickup_at'          => '2026-12-01 10:00',
        'return_at'          => '2026-12-04 10:00',
        'extras'             => [
            [
                'id'       => 3,
                'quantity' => 1,
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/search', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    pickup_location_id: 1,
    pickup_at: '2026-12-01 10:00',
    return_at: '2026-12-04 10:00',
    extras: [{ id: 3, quantity: 1 }],
  }),
});
const { data } = await response.json();

Quick Links

Share