Skip to main content
POST
/
vehiculo
Create Vehicle
curl --request POST \
  --url https://api.example.com/vehiculo \
  --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": "Ya existe un vehículo con la placa P503067",
  "timestamp": "2024-01-15T10:30:00Z"
}

Endpoint

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

Description

Creates a new vehicle record with complete data. This endpoint requires all vehicle information to be provided in the request body.

Request Body

placa
string
required
Vehicle license plate (unique). Automatically converted to uppercase and spaces removed.Example: "P503067"
idClaseVehiculo
integer
required
ID of the vehicle class. Must exist and be active in the catalog.Example: 1
idEstadoVehiculo
integer
required
ID of the vehicle state. Must exist and be active in the catalog.Example: 1
idTipoCombustible
integer
ID of the fuel type. Optional. Must exist if provided.Example: 1
idMotoristaPorDefecto
integer
ID of the default driver profile. Optional. Must exist if provided.Example: 10
idDepartamentoAsignado
integer
ID of the assigned department. Optional. 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: 15000
fechaUltimaRevision
string
Last revision date (YYYY-MM-DD format).Example: "2024-01-15"
fechaProximoMantenimiento
string
Next maintenance date (YYYY-MM-DD format).Example: "2024-07-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: "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

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

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

Build docs developers (and LLMs) love