Endpoint
Description
Updates an existing vehicle record. All fields in the request body are optional - only send the fields you want to update. The vehicle must exist and be active.
Path Parameters
Unique identifier of the vehicle to update Example : 1
Request Body
All fields are optional. Only include the fields you want to update.
Vehicle license plate. Must be unique if changed. Maximum 20 characters. Example : "P503067"
ID of the vehicle class. Must exist and be active if changed. Example : 1
ID of the vehicle state. Must exist and be active if changed. Example : 1
ID of the fuel type. Must exist if provided. Example : 1
ID of the default driver profile. Must exist if provided. Example : 10
ID of the assigned department. Must exist if provided. Example : 2
Vehicle brand. Maximum 100 characters. Example : "TOYOTA"
Vehicle model. Maximum 100 characters. Example : "HILUX"
Year of manufacture. Example : 2020
Vehicle color. Maximum 50 characters. Example : "BLANCO"
Engine number. Maximum 100 characters. Example : "1GRFE123456"
Chassis number. Maximum 100 characters. Example : "JT123456789012345"
VIN number. Maximum 100 characters. Example : "JT123456789012345"
Passenger capacity. Example : 5
capacidadCombustibleGalones
Fuel capacity in gallons. Example : 80.0
Current mileage. Example : 18000
Last revision date (YYYY-MM-DD format). Example : "2024-03-15"
fechaProximoMantenimiento
Next maintenance date (YYYY-MM-DD format). Example : "2024-09-15"
Circulation card date (YYYY-MM-DD format). Example : "2023-12-01"
Insurance policy number. Maximum 100 characters. Example : "POL123456789"
Insurance expiration date (YYYY-MM-DD format). Example : "2025-12-01"
Additional observations. Example : "Mantenimiento realizado en marzo 2024"
Validations
Important Validations
Vehicle must exist and be active
If changing placa , it must be unique (not used by another active vehicle)
Any FK that is changed must exist and be active
placa is automatically converted to uppercase without spaces
Response
Indicates if the operation was successful
Success message: “Vehículo actualizado exitosamente”
The updated vehicle object with all fields and resolved foreign key names Show Vehicle Object Properties
Unique vehicle identifier
Vehicle license plate (updated)
Current mileage (updated)
Last update timestamp (will reflect this update)
Example Request
PUT /vehiculo/ 1
{
"kilometrajeActual" : 18000 ,
"fechaUltimaRevision" : "2024-03-15" ,
"fechaProximoMantenimiento" : "2024-09-15" ,
"observaciones" : "Mantenimiento realizado en marzo 2024"
}
Example Response
{
"success" : true ,
"message" : "Vehículo actualizado exitosamente" ,
"data" : {
"Id" : 1 ,
"Placa" : "P503067" ,
"Marca" : "TOYOTA" ,
"Modelo" : "HILUX" ,
"Anio" : 2020 ,
"Color" : "BLANCO" ,
"NumeroMotor" : "1GRFE123456" ,
"NumeroChasis" : "JT123456789012345" ,
"NumeroVin" : "JT123456789012345" ,
"CapacidadPasajeros" : 5 ,
"CapacidadCombustibleGalones" : 80.0 ,
"KilometrajeActual" : 18000 ,
"FechaUltimaRevision" : "2024-03-15" ,
"FechaProximoMantenimiento" : "2024-09-15" ,
"FechaTarjetaCirculacion" : "2023-12-01" ,
"NumeroPolizaSeguro" : "POL123456789" ,
"FechaVencimientoSeguro" : "2025-12-01" ,
"Observaciones" : "Mantenimiento realizado en marzo 2024" ,
"Eliminado" : false ,
"FechaHoraCreacion" : "2024-01-15T10:30:00Z" ,
"FechaHoraActualizacion" : "2024-03-15T15:20:00Z" ,
"IdClaseVehiculo" : 1 ,
"NombreClaseVehiculo" : "Pick-up" ,
"IdEstadoVehiculo" : 1 ,
"NombreEstadoVehiculo" : "Activo" ,
"IdTipoCombustible" : 1 ,
"NombreTipoCombustible" : "Diesel" ,
"IdMotoristaPorDefecto" : 10 ,
"NombreMotoristaPorDefecto" : "Juan Pérez" ,
"IdDepartamentoAsignado" : 2 ,
"NombreDepartamentoAsignado" : "Logística"
},
"timestamp" : "2024-03-15T15:20:00Z"
}
Common Use Cases
Update Mileage Regularly update vehicle mileage after trips
Maintenance Records Update maintenance dates and observations
Change Status Update vehicle state (active, maintenance, inactive)
Reassign Department Change the assigned department for a vehicle
Error Responses
404 Not Found - Vehicle Not Found
409 Conflict - Duplicate Plate
400 Bad Request - Invalid FK
500 Internal Server Error
{
"success" : false ,
"message" : "No se encontró el vehículo con ID 999" ,
"timestamp" : "2024-03-15T15:20:00Z"
}
Partial Update Support
This endpoint supports partial updates. You can send only the fields you want to change, and all other fields will remain unchanged. For example, to only update the mileage: {
"kilometrajeActual" : 18000
}