Overview
The Vehicles API provides endpoints for managing vehicle registrations, images, and vehicle types. Drivers can add, update, and delete their vehicles, while admins have full access to all vehicle operations.Authentication
All endpoints require authentication. Include the JWT token in the Authorization header:List Driver Vehicles
Get all vehicles belonging to the authenticated driver with images and vehicle type information.Response
List of driver’s vehicles
Total number of vehicles
Status message
Example Request
Example Response
Add Vehicle with Images
Add a new vehicle with optional image uploads. Supports multipart/form-data.Path Parameters
Driver unique identifier
Request Body (Form Data)
Vehicle name (2-100 characters)
Vehicle model/year (2-50 characters)
Vehicle type identifier
Vehicle images (JPEG, PNG, WebP - max 5 images, 10MB each)
Response
Created vehicle ID
Vehicle name
Vehicle model
Vehicle type ID
Uploaded image URLs
Success message
Example Request
Example Response
Batch Add Vehicles with Images
Add multiple vehicles in a single batch operation with optional images.Path Parameters
Driver unique identifier
Request Body (Form Data)
First vehicle name
First vehicle model
First vehicle type ID
First vehicle images
Second vehicle (same structure as first)
Response
Number of successfully added vehicles
Number of failed vehicle additions
List of successfully added vehicles
List of errors for failed vehicles
Example Request
Get Vehicle by ID
Get detailed information about a specific vehicle.Path Parameters
Vehicle unique identifier
Example Request
Update Vehicle
Update vehicle information and images.Path Parameters
Driver unique identifier
Vehicle unique identifier
Request Body (Form Data)
Updated vehicle name
Updated vehicle model
Updated vehicle type ID
New vehicle images (replaces existing)
Example Request
Delete Vehicle
Delete a vehicle and all associated images. Only allowed if vehicle has no trip history.Path Parameters
Driver unique identifier
Vehicle unique identifier (must start with “v_“)
Response
Success message
Example Request
Example Response
Get Driver Vehicles
Get all vehicles for a specific driver. Useful for admin operations.Path Parameters
Driver unique identifier
Example Request
Get Vehicle Images
Get all images for a specific vehicle.Path Parameters
Vehicle unique identifier
Response
Array of image objects
Example Request
Admin: List All Vehicles
Retrieve all vehicles in the system. Admin only.Response
Same structure as List Driver Vehicles, but includes vehicles from all drivers.Example Request
Vehicle Types
List Vehicle Types
Get all available vehicle types.Query Parameters
Page number
Items per page
Filter by active status
Response
List of vehicle types
Example Request
Example Response
Error Responses
All endpoints may return the following error responses:Error message in Arabic or English
Detailed validation errors
Common Error Codes
400 Bad Request- Invalid request parameters or validation errors401 Unauthorized- Missing or invalid authentication token403 Forbidden- Insufficient permissions or vehicle has trips404 Not Found- Vehicle or vehicle type not found413 Payload Too Large- Image file too large500 Internal Server Error- Server error