List Vehicles
GET /api/vehicles
Retrieve all vehicles, optionally filtered by collection center. Results are sorted with default vehicles first, then by plate.
Query Parameters
Filter vehicles by collection center ID. If not provided, uses the active center from configuration.
Response
Returns an array of vehicle objects sorted byis_default DESC, plate ASC.
Example Request
Example Response
Create Vehicle
POST /api/vehicles
Create a new vehicle. If isDefault is true, all other vehicles for the same collection center will be set to non-default.
Request Body
Unique vehicle identifier (UUID)
License plate (must be unique across all vehicles)
Vehicle brand/manufacturer
Vehicle model
Vehicle owner name
Set as default vehicle. If true, unsets all other vehicles as default for the same center.
Associated collection center ID (optional)
Response
Returns the created vehicle object withcreated_at timestamp.
The operation runs in a transaction. If
isDefault is true, it will:- BEGIN transaction
- Set all other vehicles to
is_default = falsefor the same center - Insert the new vehicle with
is_default = true - COMMIT transaction
Example Request
Example Response
Update Vehicle
PUT /api/vehicles/:id
Update an existing vehicle. If isDefault is set to true, all other vehicles for the same collection center will be set to non-default.
Path Parameters
Vehicle ID
Request Body
License plate
Vehicle brand
Vehicle model
Vehicle owner name
Set as default vehicle
Associated collection center ID
Response
Returns the updated vehicle object.The update runs in a transaction. If
isDefault is true, it will:- BEGIN transaction
- Set all other vehicles (excluding this one) to
is_default = false - Update this vehicle with the new values
- COMMIT transaction
Example Request
Example Response
Delete Vehicle
DELETE /api/vehicles/:id
Delete a vehicle by its ID.
Path Parameters
Vehicle ID
Response
Returns
true if deletion was successful