Create Vehicle
Add a new vehicle to the fleet.
WARNING
Requires vehicles.create permission.
Endpoint
INFO
POST /api/v1/dashboard/vehicles
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
Authorization | Bearer {token} | Yes |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
agency_id | integer | Yes | Agency ID |
plate_number | string | Yes | License plate number |
vin | string | No | Vehicle Identification Number |
brand | string | Yes | Vehicle brand |
model | string | Yes | Vehicle model |
year | integer | Yes | Manufacturing year |
color | string | Yes | Vehicle color |
category | string | Yes | Category: sedan, suv, van, compact, luxury |
seats | integer | Yes | Number of seats |
fuel_type | string | Yes | Fuel: petrol, diesel, electric, hybrid |
transmission | string | Yes | Transmission: automatic, manual |
hourly_rate | decimal | Yes | Hourly rental rate |
daily_rate | decimal | Yes | Daily rental rate |
invers_device_id | string | No | INVERS telematics device ID |
features | array | No | List of features |
images | array | No | Array of image files |
Example Request
bash
curl -X POST https://api.daakey.com/api/v1/dashboard/vehicles \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"agency_id": 1,
"plate_number": "NEW-456",
"vin": "1HGBH41JXMN109186",
"brand": "Tesla",
"model": "Model 3",
"year": 2024,
"color": "Red",
"category": "sedan",
"seats": 5,
"fuel_type": "electric",
"transmission": "automatic",
"hourly_rate": 25.00,
"daily_rate": 150.00,
"features": ["Autopilot", "Premium Sound", "Glass Roof"]
}'Response
Success (201)
json
{
"success": true,
"message": "Vehicle created successfully",
"data": {
"id": 10,
"plate_number": "NEW-456",
"vin": "1HGBH41JXMN109186",
"brand": "Tesla",
"model": "Model 3",
"year": 2024,
"color": "Red",
"category": "sedan",
"seats": 5,
"fuel_type": "electric",
"transmission": "automatic",
"agency": {
"id": 1,
"name": "Downtown Branch"
},
"pricing": {
"hourly_rate": 25.00,
"daily_rate": 150.00,
"currency": "USD"
},
"features": ["Autopilot", "Premium Sound", "Glass Roof"],
"status": "available",
"images": [],
"created_at": "2024-01-20T00:00:00Z"
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Error (422)
json
{
"success": false,
"message": "Validation failed",
"errors": {
"plate_number": ["The plate number has already been taken."],
"category": ["The selected category is invalid."]
},
"data": null,
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Notes
- Plate number must be unique across all agencies
- INVERS device ID enables remote vehicle control
- Images can be uploaded separately after vehicle creation
- Vehicle is set to
availablestatus by default