The Maintenance API gives fleet managers a first-class way to schedule and track vehicle servicing events. When a maintenance window is created, the platform records it as aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Codefied-CodePix/Karokar-backend/llms.txt
Use this file to discover all available pages before exploring further.
MaintenanceRecord and — critically — registers the vehicle’s unavailability for the entire window, so that the Vehicles availability search will not surface the vehicle to booking workflows during that period. This tight integration between the maintenance and availability subsystems prevents double-allocation: a vehicle cannot be booked while it is in the workshop. Maintenance records progress through three statuses: SCHEDULED (confirmed but not yet started), IN_PROGRESS (servicing is underway), and COMPLETED (work is done and the vehicle can be returned to active service). The single endpoint exposed here requires the vehicle.update permission, reflecting that scheduling maintenance is a mutation of vehicle state.
POST /vehicles/:id/maintenance
Schedules a new maintenance window for the specified vehicle. Required permission:vehicle.update
Path parameters
The UUID of the vehicle to schedule maintenance for. Must reference an existing vehicle.
Request body
The date and time at which the maintenance window begins. Must be a valid ISO 8601 date string (e.g.,
2024-07-15T08:00:00.000Z). Validated with @IsDateString().The date and time at which the maintenance window is expected to end. Must be a valid ISO 8601 date string (e.g.,
2024-07-17T18:00:00.000Z). Must be after startDate. Validated with @IsDateString().A human-readable description of why the vehicle is being taken in for maintenance (e.g.,
"Scheduled 10,000 km service", "Brake pad replacement", "Annual fitness inspection"). Must be a non-empty string.Response
Returns the newly createdMaintenanceRecord object.
UUID primary key of the maintenance record, auto-generated.
UUID of the vehicle this maintenance record belongs to.
Start of the maintenance window, stored as a timezone-aware timestamp (
timestamptz).Expected end of the maintenance window, stored as a timezone-aware timestamp (
timestamptz).The stated reason for the maintenance event.
Current lifecycle status of the maintenance record. Newly created records start at
SCHEDULED.Timestamp of record creation, set automatically by the database.
Timestamp of the last update to this record, maintained automatically by the database.
Availability impact
Calling this endpoint causes the service layer to create aVehicleAvailability record covering the startDate–endDate window. This record is consulted by VehicleService.searchAvailable when answering GET /vehicles/search queries. Any search whose requested window overlaps with an active maintenance window will not include the affected vehicle in its results — regardless of whether the MaintenanceRecord status is SCHEDULED or IN_PROGRESS. The vehicle re-enters the available pool only once the maintenance status transitions to COMPLETED and the corresponding availability block is removed.
Example
Error cases
| Status | Reason |
|---|---|
401 Unauthorized | Missing or expired Authorization bearer token. |
403 Forbidden | Authenticated principal lacks the vehicle.update permission. |
400 Bad Request | Validation failure — e.g., startDate or endDate are not valid ISO 8601 date strings, or reason is missing. |