Endpoint
Description
Creates a new vehicle record with complete data. This endpoint requires all vehicle information to be provided in the request body.
Request Body
Vehicle license plate (unique). Automatically converted to uppercase and spaces removed.Example: "P503067"
ID of the vehicle class. Must exist and be active in the catalog.Example: 1
ID of the vehicle state. Must exist and be active in the catalog.Example: 1
ID of the fuel type. Optional. Must exist if provided.Example: 1
ID of the default driver profile. Optional. Must exist if provided.Example: 10
ID of the assigned department. Optional. 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: 15000
Last revision date (YYYY-MM-DD format).Example: "2024-01-15"
fechaProximoMantenimiento
Next maintenance date (YYYY-MM-DD format).Example: "2024-07-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: "Vehículo en excelente estado"
Validations
Important Validations
- placa: Required, unique, converted to uppercase without spaces
- idClaseVehiculo: Required, must exist and be active
- idEstadoVehiculo: Required, must exist and be active
- Optional FKs: If provided (idTipoCombustible, idMotoristaPorDefecto, idDepartamentoAsignado), they must exist
If a vehicle with the same plate was previously deleted, the system will reactivate that record instead of creating a new one.
Response
Indicates if the operation was successful
Success message: “Vehículo creado exitosamente”
The created vehicle object with all fields and resolved foreign key namesShow Vehicle Object Properties
Unique vehicle identifier
Vehicle class name (resolved)
Vehicle state name (resolved)
Example Request
{
"placa": "P503067",
"idClaseVehiculo": 1,
"idEstadoVehiculo": 1,
"idTipoCombustible": 1,
"idMotoristaPorDefecto": 10,
"idDepartamentoAsignado": 2,
"marca": "TOYOTA",
"modelo": "HILUX",
"anio": 2020,
"color": "BLANCO",
"numeroMotor": "1GRFE123456",
"numeroChasis": "JT123456789012345",
"numeroVin": "JT123456789012345",
"capacidadPasajeros": 5,
"capacidadCombustibleGalones": 80.0,
"kilometrajeActual": 15000,
"fechaUltimaRevision": "2024-01-15",
"fechaProximoMantenimiento": "2024-07-15",
"fechaTarjetaCirculacion": "2023-12-01",
"numeroPolizaSeguro": "POL123456789",
"fechaVencimientoSeguro": "2025-12-01",
"observaciones": "Vehículo en excelente estado"
}
Example Response
{
"success": true,
"message": "Vehículo creado 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": 15000,
"FechaUltimaRevision": "2024-01-15",
"FechaProximoMantenimiento": "2024-07-15",
"FechaTarjetaCirculacion": "2023-12-01",
"NumeroPolizaSeguro": "POL123456789",
"FechaVencimientoSeguro": "2025-12-01",
"Observaciones": "Vehículo en excelente estado",
"IdClaseVehiculo": 1,
"NombreClaseVehiculo": "Pick-up",
"IdEstadoVehiculo": 1,
"NombreEstadoVehiculo": "Activo",
"IdTipoCombustible": 1,
"NombreTipoCombustible": "Diesel",
"IdMotoristaPorDefecto": 10,
"NombreMotoristaPorDefecto": "Juan Pérez",
"IdDepartamentoAsignado": 2,
"NombreDepartamentoAsignado": "Logística",
"Eliminado": false,
"FechaHoraCreacion": "2024-01-15T10:30:00Z",
"FechaHoraActualizacion": null
},
"timestamp": "2024-01-15T10:30:00Z"
}
Error Responses
{
"success": false,
"message": "Ya existe un vehículo con la placa P503067",
"timestamp": "2024-01-15T10:30:00Z"
}