The Vehicles API is the core of KaroKar’s fleet management layer. It lets privileged users register new vehicles under an organization, then exposes a real-time availability search that respects the full vehicle lifecycle. A vehicle moves through four statuses —Documentation 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.
PENDING, ACTIVE, SUSPENDED, and RETIRED — and can be owned by a vendor or a corporate client, expressed via the ownershipType field. The availability search engine is the most powerful endpoint: it cross-references vehicle status, active bookings, and maintenance windows to return only vehicles that are genuinely free for the requested date range. All three endpoints require a valid bearer token and the appropriate permission from the PermissionGuard.
POST /vehicles
Registers a new vehicle in the fleet under a given organization. Required permission:vehicle.create
Newly registered vehicles are placed in
PENDING status and are not returned by the availability search until they have been activated. Use the vehicle activation flow (via the service layer) to transition a vehicle to ACTIVE.Request body
The UUID of the organization that owns this vehicle. Must reference an existing organization.
How the vehicle is owned. Must be one of the
VehicleOwnershipType enum values.Manufacturer name of the vehicle (e.g.,
"Toyota", "Mahindra").Model name of the vehicle (e.g.,
"Innova Crysta", "XUV700").Four-digit model year. Must be between
1900 and 2100 (inclusive), validated by @Min(1900) and @Max(2100).The vehicle’s registration / license plate number as it appears on the registration certificate.
Response
Returns the newly createdVehicle object.
UUID primary key, auto-generated.
UUID of the owning organization.
VENDOR_OWNED or CORPORATE_OWNED.Manufacturer name.
Model name.
Four-digit model year.
Registration / license plate number.
Current lifecycle status of the vehicle.
Timestamp of record creation, set automatically by the database.
Timestamp of the last update, maintained automatically by the database.
Example
Error cases
| Status | Reason |
|---|---|
401 Unauthorized | Missing or expired Authorization bearer token. |
403 Forbidden | Authenticated principal lacks the vehicle.create permission. |
400 Bad Request | Validation failure — e.g., year is outside the 1900–2100 range, or ownershipType is not a valid enum value. |
GET /vehicles/search
Returns all vehicles belonging to an organization that are genuinely available for booking within the specified date range. Required permission:vehicle.read
The availability engine filters out any vehicle whose status is not
ACTIVE, and additionally excludes vehicles that have an overlapping booking, allocation, or maintenance window for the requested startDate–endDate range. Only vehicles that are free for the entire requested period are returned.Query parameters
Scopes the search to the fleet owned by this organization.
The start of the desired availability window. Must be a valid ISO 8601 date string (e.g.,
2024-07-01).The end of the desired availability window. Must be a valid ISO 8601 date string (e.g.,
2024-07-07). Must be after startDate.Response
Returns an array ofVehicle objects that are available for the full requested date range. An empty array [] means no vehicles are available; it is not an error.
Each element is a full
Vehicle object with the same shape as the POST /vehicles response.Example
Error cases
| Status | Reason |
|---|---|
401 Unauthorized | Missing or expired Authorization bearer token. |
403 Forbidden | Authenticated principal lacks the vehicle.read permission. |
400 Bad Request | Validation failure — e.g., organizationId is not a valid UUID, or startDate / endDate are not valid ISO 8601 date strings. |
GET /vehicles/:id
Retrieves a single vehicle by its UUID. Required permission:vehicle.read
Path parameters
The UUID of the vehicle to retrieve.
Response
Returns the matchingVehicle object, or null if no record exists for the provided ID.
UUID primary key of the vehicle.
UUID of the owning organization.
VENDOR_OWNED or CORPORATE_OWNED.Manufacturer name.
Model name.
Four-digit model year.
Registration / license plate number.
Current lifecycle status:
PENDING, ACTIVE, SUSPENDED, or RETIRED.Timestamp of record creation.
Timestamp of the last update.
Example
Error cases
| Status | Reason |
|---|---|
401 Unauthorized | Missing or expired Authorization bearer token. |
403 Forbidden | Authenticated principal lacks the vehicle.read permission. |