Skip to main content
PUT
/
vehiculo
/
{id}
Update Vehicle
curl --request PUT \
  --url https://api.example.com/vehiculo/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "placa": "<string>",
  "idClaseVehiculo": 123,
  "idEstadoVehiculo": 123,
  "idTipoCombustible": 123,
  "idMotoristaPorDefecto": 123,
  "idDepartamentoAsignado": 123,
  "marca": "<string>",
  "modelo": "<string>",
  "anio": 123,
  "color": "<string>",
  "numeroMotor": "<string>",
  "numeroChasis": "<string>",
  "numeroVin": "<string>",
  "capacidadPasajeros": 123,
  "capacidadCombustibleGalones": 123,
  "kilometrajeActual": 123,
  "fechaUltimaRevision": "<string>",
  "fechaProximoMantenimiento": "<string>",
  "fechaTarjetaCirculacion": "<string>",
  "numeroPolizaSeguro": "<string>",
  "fechaVencimientoSeguro": "<string>",
  "observaciones": "<string>"
}
'
{
  "success": false,
  "message": "No se encontró el vehículo con ID 999",
  "timestamp": "2024-03-15T15:20:00Z"
}

Endpoint

method
string
default:"PUT"
PUT
endpoint
string
/vehiculo/

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

id_vehiculo
integer
required
Unique identifier of the vehicle to updateExample: 1

Request Body

All fields are optional. Only include the fields you want to update.
placa
string
Vehicle license plate. Must be unique if changed. Maximum 20 characters.Example: "P503067"
idClaseVehiculo
integer
ID of the vehicle class. Must exist and be active if changed.Example: 1
idEstadoVehiculo
integer
ID of the vehicle state. Must exist and be active if changed.Example: 1
idTipoCombustible
integer
ID of the fuel type. Must exist if provided.Example: 1
idMotoristaPorDefecto
integer
ID of the default driver profile. Must exist if provided.Example: 10
idDepartamentoAsignado
integer
ID of the assigned department. Must exist if provided.Example: 2
marca
string
Vehicle brand. Maximum 100 characters.Example: "TOYOTA"
modelo
string
Vehicle model. Maximum 100 characters.Example: "HILUX"
anio
integer
Year of manufacture.Example: 2020
color
string
Vehicle color. Maximum 50 characters.Example: "BLANCO"
numeroMotor
string
Engine number. Maximum 100 characters.Example: "1GRFE123456"
numeroChasis
string
Chassis number. Maximum 100 characters.Example: "JT123456789012345"
numeroVin
string
VIN number. Maximum 100 characters.Example: "JT123456789012345"
capacidadPasajeros
integer
Passenger capacity.Example: 5
capacidadCombustibleGalones
number
Fuel capacity in gallons.Example: 80.0
kilometrajeActual
integer
Current mileage.Example: 18000
fechaUltimaRevision
string
Last revision date (YYYY-MM-DD format).Example: "2024-03-15"
fechaProximoMantenimiento
string
Next maintenance date (YYYY-MM-DD format).Example: "2024-09-15"
fechaTarjetaCirculacion
string
Circulation card date (YYYY-MM-DD format).Example: "2023-12-01"
numeroPolizaSeguro
string
Insurance policy number. Maximum 100 characters.Example: "POL123456789"
fechaVencimientoSeguro
string
Insurance expiration date (YYYY-MM-DD format).Example: "2025-12-01"
observaciones
string
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

success
boolean
Indicates if the operation was successful
message
string
Success message: “Vehículo actualizado exitosamente”
data
object
The updated vehicle object with all fields and resolved foreign key names
timestamp
string
Response timestamp

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

{
  "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
}

Build docs developers (and LLMs) love