Contents
Create Booking - Plugixa Car Parking
POST /plugixa-car-parking/v1/bookings
Create a booking as staff: the plugin checks the dates, the opening hours and the free spaces, prices the stay, and stores the booking with its price lines.
The user needs the plugixa_carparking_create capability.
Note. This route applies the same date rules as the booking form. An entry in the past, or sooner than the minimum notice set in the settings, is refused with
too_soon, and one further ahead than the booking window (365 days by default) withtoo_far. To record a stay that has already started, create it and then move its dates with Update Booking, which does not apply those two rules.
Request
POST https://your-site.example/wp-json/plugixa-car-parking/v1/bookings
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
location_id |
integer |
Yes | An existing location. |
space_type_id |
integer |
Yes | The space type booked. At least 1. |
entry_datetime |
string |
Yes | Entry, in the site’s time zone: YYYY-MM-DD, optionally followed by HH:MM or HH:MM:SS (a space or T between). A bare date means midnight. entry is accepted as another name for it. |
exit_datetime |
string |
Yes | Exit, same format, after the entry. exit is accepted as another name for it. |
quantity |
integer |
No | Number of spaces. Defaults to 1; at least 1. |
space_id |
integer |
No | A numbered space to hold. |
billing_type |
string |
No | minute, hour, day, week or month. Defaults to the location’s billing unit. |
coupon |
string |
No | A coupon code. Applied when coupons are switched on in the settings and the code is valid for this booking; otherwise ignored without an error. |
extras PRO |
array |
No | Extras to add, as { "id": 4, "quantity": 1 } objects. Extras the location does not offer are skipped. |
status |
string |
No | One of the booking statuses. Defaults to the default status in the settings (pending unless changed). |
user_id |
integer |
No | The WordPress user the booking belongs to. Omitted, the booking belongs to nobody. |
customer_name |
string |
No | Plain text. |
customer_email |
string |
No | Must be an e-mail address when not empty. |
customer_phone |
string |
No | Plain text. |
license_plate |
string |
No | Plain text, at most 30 characters. |
vehicle |
object |
No | Vehicle details as key-value pairs. Keys are lowercased; values must be plain values. |
billing |
object |
No | Billing details as key-value pairs, cleaned the same way. |
notes |
string |
No | Plain text, line breaks kept. |
meta |
object |
No | Answers to the booking form’s custom fields, keyed by field. |
booking_form_id |
integer |
No | The booking form the answers belong to, used to label them. |
gateway |
string |
No | Stored as the booking’s payment_method. Defaults to offline. |
payment_status and amount_paid cannot be sent: they are worked out from the payments, and a body that contains either is refused. Prices, totals and the currency are worked out by the plugin; values sent for them are ignored, and so are unknown fields.
When the booking is created with the pending status and the settings give pending bookings a hold time, hold_expires_at is set. A booking created with another status has no hold. If booking notifications are switched on, the booking-created messages are sent.
{
"location_id": 3,
"space_type_id": 2,
"entry_datetime": "2026-12-01 08:00",
"exit_datetime": "2026-12-04 08:00",
"status": "confirmed",
"customer_name": "Lucas Bernard",
"customer_email": "lucas@example.com",
"customer_phone": "+33 6 12 34 56 78",
"license_plate": "AB-123-CD"
}
Responses
201 Created. data is the new booking.
{
"success": true,
"data": {
"id": 57,
"booking_ref": "PKG-3F9A1C",
"language_code": null,
"location_id": 3,
"space_type_id": 2,
"space_id": null,
"booking_form_id": null,
"user_id": null,
"status": "confirmed",
"billing_type": "day",
"entry_datetime": "2026-12-01 08:00:00",
"exit_datetime": "2026-12-04 08:00:00",
"quantity": 1,
"hold_expires_at": null,
"license_plate": "AB-123-CD",
"vehicle": null,
"customer_name": "Lucas Bernard",
"customer_email": "lucas@example.com",
"customer_phone": "+33 6 12 34 56 78",
"billing": null,
"currency": "EUR",
"subtotal": 37.5,
"discount_total": 0,
"tax_total": 0,
"deposit_amount": 0,
"total": 37.5,
"amount_paid": 0,
"coupon_id": null,
"payment_method": "offline",
"payment_status": "unpaid",
"notes": null,
"meta": null,
"created_by": 1,
"modified_by": 1,
"created_at": "2026-11-12 09:30:00",
"updated_at": null,
"modified_at": "2026-11-12 09:30:00",
"deleted_at": null,
"items": [
{
"id": 91,
"booking_id": 57,
"type": "parking",
"reference_id": 2,
"label": "1 space × 3 days",
"quantity": 3,
"unit_price": 12.5,
"total": 37.5,
"tax_rate_id": null,
"meta": null
}
],
"custom_fields": [],
"location_name": "Airport North",
"space_type_name": "Standard"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The new booking’s id |
data.booking_ref |
string |
The reference customers see |
data.status |
string |
The booking status |
data.currency |
string |
The location’s currency, else the site’s |
data.subtotal |
number |
Parking, fees and extras before any discount |
data.discount_total |
number |
The coupon discount |
data.tax_total |
number |
Tax added after the discount PRO |
data.deposit_amount |
number |
What is due now when a deposit applies PRO, else 0 |
data.total |
number |
What the booking costs |
data.items |
array |
The price lines. type is fee, parking, extra, discount or tax |
data.custom_fields |
array |
The custom answers as { "key", "label", "value" } objects |
See List Bookings for the other fields.
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_carparking_derived_field |
The body contains payment_status or amount_paid. |
422 |
plugixa_carparking_invalid_choice |
status or billing_type is not one of the allowed values. |
422 |
plugixa_carparking_invalid_date |
A date is not in the accepted format or is not a real date. |
422 |
plugixa_carparking_not_a_number |
quantity, space_type_id or space_id is not a number. |
422 |
plugixa_carparking_negative_number |
One of those numbers is negative. |
422 |
plugixa_carparking_invalid_quantity |
quantity is below 1. |
422 |
plugixa_carparking_invalid_space_type_id |
space_type_id is below 1. |
422 |
plugixa_carparking_invalid_email |
customer_email is not an e-mail address. |
422 |
plugixa_carparking_too_long |
A text field is longer than its column holds. data.max gives the limit. |
422 |
plugixa_carparking_invalid_location |
location_id is not an existing location. |
422 |
missing_fields |
Location, space type, entry or exit is missing. |
422 |
invalid_range |
The exit is not after the entry. |
422 |
too_soon |
The entry is in the past or sooner than the minimum notice. |
422 |
too_far |
The entry is further ahead than the booking window. |
422 |
location_closed |
The location is closed on the entry or exit date. |
422 |
outside_hours |
The entry or exit time is outside the opening hours. |
409 |
no_availability |
No free space for those dates. |
409 |
busy |
Another booking for the same location was being saved at that moment. Try again. |
500 |
create_failed |
The booking could not be stored. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-car-parking/v1/bookings" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"location_id":3,"space_type_id":2,"entry_datetime":"2026-12-01 08:00","exit_datetime":"2026-12-04 08:00","status":"confirmed","customer_name":"Lucas Bernard","customer_email":"lucas@example.com","license_plate":"AB-123-CD"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/bookings');
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([
'location_id' => 3,
'space_type_id' => 2,
'entry_datetime' => '2026-12-01 08:00',
'exit_datetime' => '2026-12-04 08:00',
'status' => 'confirmed',
'customer_name' => 'Lucas Bernard',
'customer_email' => 'lucas@example.com',
'license_plate' => 'AB-123-CD',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-parking/v1/bookings', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({
location_id: 3,
space_type_id: 2,
entry_datetime: '2026-12-01 08:00',
exit_datetime: '2026-12-04 08:00',
status: 'confirmed',
customer_name: 'Lucas Bernard',
customer_email: 'lucas@example.com',
license_plate: 'AB-123-CD',
}),
});
const { data } = await response.json();
Quick Links
Share