- Maintenance types — admin-only CRUD for the catalog of maintenance categories.
- Vehicle maintenance — assign maintenance to vehicles, query status, and mark items as complete.
Maintenance types
Maintenance types form the catalog used when assigning preventive maintenance to a vehicle.All maintenance type endpoints require an admin role.
List maintenance types
GET /api/admin/maintenance-types
Returns all maintenance types ordered alphabetically by name.
Response
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
500 | Internal server error. |
Create maintenance type
POST /api/admin/maintenance-types
Creates a new maintenance type.
Request body
Type name. Must be unique.
Optional description of what this maintenance type covers.
Whether this maintenance type is currently active. Inactive types remain in the catalog but can be filtered out. Defaults to
true.Response
Returns201 Created with the new maintenance type object.
Created maintenance type.
Errors
| Status | Description |
|---|---|
400 | Validation failed — name is missing. |
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
500 | Internal server error. |
Update maintenance type
PUT /api/admin/maintenance-types/:id
Updates a maintenance type’s name or description.
Path parameters
The maintenance type ID.
Request body
Updated type name.
Updated description.
Set to
false to deactivate this maintenance type.Response
Returns200 OK with the updated maintenance type.
Updated maintenance type.
Errors
| Status | Description |
|---|---|
400 | Validation failed. |
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Maintenance type not found. |
500 | Internal server error. |
Delete maintenance type
DELETE /api/admin/maintenance-types/:id
Permanently deletes a maintenance type.
Path parameters
The maintenance type ID.
Response
Returns204 No Content on success with an empty body.
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Maintenance type not found. |
500 | Internal server error. |
Vehicle maintenance
Assign maintenance to vehicle
POST /api/admin/vehicles/:vehicleId/maintenance
Assigns a maintenance record to a vehicle. Supports two modes:
- Preventive — linked to a maintenance type, tracks the last service and schedules the next.
- Mandatory — not linked to a type, blocks inspections until completed.
Requires the
admin role.Path parameters
The vehicle ID.
Request body
true for preventive maintenance, false for mandatory maintenance.ID of the maintenance type. Required when
isPreventive is true.Date the maintenance was last performed (
YYYY-MM-DD). Used when isPreventive is true.Odometer reading at last service. Used when
isPreventive is true. Defaults to 0.Date the maintenance is next due (
YYYY-MM-DD).Odometer reading at which maintenance is next due.
Response
Returns201 Created with the new maintenance record.
Errors
| Status | Description |
|---|---|
400 | Validation failed — required fields missing or invalid. |
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Vehicle not found. |
500 | Internal server error. |
Remove vehicle maintenance record
DELETE /api/admin/vehicle-maintenance/:id
Permanently removes a maintenance record from a vehicle.
Requires the
admin role.Path parameters
The vehicle maintenance record ID.
Response
Returns204 No Content on success with an empty body.
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Maintenance record not found. |
500 | Internal server error. |
Get vehicle maintenance status
GET /api/vehicles/:vehicleId/maintenance/status
Returns the maintenance status for a vehicle. Optionally pass the current mileage to get mileage-based overdue calculations.
Requires a valid JWT. No admin role restriction — technicians and admins may both call this endpoint.
Path parameters
The vehicle ID.
Query parameters
Current odometer reading. When provided, the response includes mileage-based overdue checks for preventive maintenance items.
Response
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
404 | Vehicle not found. |
500 | Internal server error. |
Complete maintenance
POST /api/vehicles/:vehicleId/maintenance/complete
Marks a maintenance item as completed for a vehicle, updating lastPerformedDate and lastPerformedMileage.
Requires a valid JWT and the technician or admin role.
Path parameters
The vehicle ID.
Request body
Date the maintenance was completed (
YYYY-MM-DD ISO 8601 format).Odometer reading at time of completion (non-negative integer).
ID of the specific
VehicleMaintenance record to mark complete. If omitted, isPreventive must be provided so the system can find or create the record.Required when
maintenanceId is not provided. true for preventive, false for mandatory.Maintenance type ID. Used when
isPreventive is true and maintenanceId is not provided.Workshop-suggested next due date (
YYYY-MM-DD). Overrides the stored nextDueDate if provided.Free-text notes about the completion (e.g., parts replaced, observations).
Response
Returns200 OK with the updated maintenance record.
Updated vehicle maintenance record with refreshed
lastPerformedDate, lastPerformedMileage, and updated_at.Errors
| Status | Description |
|---|---|
400 | Validation failed — date or currentMileage missing or invalid. |
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the technician or admin role. |
404 | Vehicle or maintenance record not found. |
500 | Internal server error. |