Contents
On this page
Create Vehicle Model - Plugixa Car Rental
POST /plugixa-car-rental/v1/vehicle-models
Create a vehicle model.
The user needs the plugixa_car_rental_create capability.
Request
POST https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Must not be blank. |
make |
string |
No | Manufacturer. |
model |
string |
No | Model name. |
category_id |
integer |
No | An existing vehicle category, or 0 for none. |
year |
integer |
No | From 1950 to two years after the current one. 0 or empty for none. |
transmission |
string |
No | automatic (the default) or manual. |
fuel |
string |
No | petrol (the default), diesel, hybrid, electric or lpg. |
seats |
integer |
No | 1 to 99. Defaults to 5. |
doors |
integer |
No | 0 to 9. Defaults to 4. |
bags |
integer |
No | 0 to 20. Defaults to 2. |
air_conditioning |
boolean |
No | Defaults to true. |
mileage_limit |
integer |
No | Distance included per day, 0 to 100000. Defaults to 0, unlimited. |
min_driver_age |
integer |
No | 16 to 99. Defaults to 21. |
deposit |
number |
No | Deposit held at the desk. Rounded to 2 decimals. Defaults to 0. |
image_id |
integer |
No | An image in the media library, or 0 for none. |
description |
string |
No | HTML. Tags not allowed in a post are removed. |
sort_order |
integer |
No | Position in lists, lowest first. Defaults to 0. May be negative. |
status |
string |
No | published (the default) or unpublished. |
A model is priced by its rate plans and booked as one of its cars: create those next.
{
"name": "Peugeot 3008",
"make": "Peugeot",
"model": "3008",
"category_id": 2,
"year": 2025,
"transmission": "automatic",
"fuel": "diesel",
"seats": 5,
"doors": 5,
"bags": 3,
"min_driver_age": 23,
"deposit": 800
}
Responses
201 Created. data is the new vehicle model.
{
"success": true,
"data": {
"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,
"category_name": "SUV",
"image_url": "https://your-site.example/wp-content/uploads/2026/11/peugeot-3008-150x150.webp",
"units_count": 3
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The model’s id. Bookings, rates and cars point at it |
data.name |
string |
The name customers see |
data.category_id |
integer|null |
Its vehicle category, or null |
data.category_name |
string|null |
That category’s name |
data.status |
string |
published or unpublished. Only a published model can be booked |
data.units_count |
integer |
Cars of this model in the fleet, trash excluded |
data.image_url |
string|null |
The image’s thumbnail, or null |
data.year |
integer|null |
Model year |
data.transmission |
string |
automatic or manual |
data.fuel |
string |
petrol, diesel, hybrid, electric or lpg |
data.seats |
integer |
Seats |
data.doors |
integer |
Doors |
data.bags |
integer |
Bags it takes |
data.air_conditioning |
boolean |
Whether it has air conditioning |
data.mileage_limit |
integer |
Distance included per day, 0 for unlimited |
data.min_driver_age |
integer |
Youngest driver allowed |
data.deposit |
number |
Deposit held at the desk, not part of the price |
data.image_id |
integer|null |
Media library image |
data.description |
string|null |
HTML |
data.created_at |
string |
UTC datetime the record was created |
data.modified_at |
string |
UTC datetime of the last change. Send it back on an update to be warned of a conflicting edit |
data.deleted_at |
string|null |
null unless the record is in the trash |
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_car_rental_missing_name |
name is missing or blank. |
422 |
plugixa_car_rental_out_of_range |
A number is outside its range, or year is not a plausible model year. data.field names it. |
422 |
plugixa_car_rental_unknown_reference |
category_id is not a vehicle category, or image_id is not an image. |
422 |
plugixa_car_rental_invalid_choice |
status, transmission or fuel is not one of its values. data.allowed lists them. |
422 |
plugixa_car_rental_not_a_number |
A number field was sent as something else. data.field names it. |
422 |
plugixa_car_rental_negative_number |
A number field that cannot be negative is. data.field names it. |
422 |
plugixa_car_rental_too_long |
A text field is longer than its column. data.field names it and data.max gives the limit. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Peugeot 3008","make":"Peugeot","model":"3008","category_id":2,"year":2025,"transmission":"automatic","fuel":"diesel","seats":5,"doors":5,"bags":3,"min_driver_age":23,"deposit":800}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models');
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([
'name' => 'Peugeot 3008',
'make' => 'Peugeot',
'model' => '3008',
'category_id' => 2,
'year' => 2025,
'transmission' => 'automatic',
'fuel' => 'diesel',
'seats' => 5,
'doors' => 5,
'bags' => 3,
'min_driver_age' => 23,
'deposit' => 800,
]),
]);
$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/vehicle-models', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Peugeot 3008',
make: 'Peugeot',
model: '3008',
category_id: 2,
year: 2025,
transmission: 'automatic',
fuel: 'diesel',
seats: 5,
doors: 5,
bags: 3,
min_driver_age: 23,
deposit: 800,
}),
});
const { data } = await response.json();
Quick Links
Share