Skip to main content

Get Maintenance Events

curl -X GET "https://api.example.com/api/mantenimiento/eventos?vehiculo_id=123&fecha_inicio=2026-01-01&fecha_fin=2026-03-31" \
  -H "Authorization: Bearer YOUR_TOKEN"

Endpoint

GET /api/mantenimiento/eventos

Query Parameters

vehiculo_id
number
Filter events by vehicle ID
fecha_inicio
string
Filter events starting from this date (ISO 8601 format: YYYY-MM-DD)
fecha_fin
string
Filter events up to this date (ISO 8601 format: YYYY-MM-DD)

Response

Returns an array of maintenance events ordered by date (most recent first).
id
number
Unique identifier for the maintenance event
vehiculo_id
number
ID of the vehicle that received maintenance
plan_id
number
ID of the related maintenance plan (if applicable)
fecha
string
Date of the maintenance event (ISO 8601 format)
km_evento
number
Odometer reading at the time of maintenance (in kilometers)
hr_evento
number
Engine hours at the time of maintenance
descripcion
string
Description of the maintenance performed
observaciones
string
Additional observations or notes
taller_id
number
ID of the workshop where maintenance was performed
costo
number
default:0
Cost of the maintenance service
plan_mantenimiento
object
Related maintenance plan information
talleres
object
Workshop information
vehiculo
object
Vehicle information

Example Response

[
  {
    "id": 234,
    "vehiculo_id": 123,
    "plan_id": 45,
    "fecha": "2026-03-04",
    "km_evento": 15000,
    "hr_evento": 500,
    "descripcion": "Cambio de aceite y filtros",
    "observaciones": "Se encontró desgaste en pastillas de freno",
    "taller_id": 5,
    "costo": 150000,
    "plan_mantenimiento": {
      "id": 45,
      "nombre": "Mantenimiento Preventivo 15K"
    },
    "talleres": {
      "id": 5,
      "nombre": "Taller Central"
    },
    "vehiculo": {
      "id": 123,
      "areas_placas": {
        "placa": "ABC123"
      }
    }
  }
]

Create Maintenance Event

curl -X POST https://api.example.com/api/mantenimiento/eventos \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "vehiculo_id": 123,
    "plan_id": 45,
    "fecha": "2026-03-04",
    "km_evento": 15000,
    "hr_evento": 500,
    "descripcion": "Cambio de aceite y filtros",
    "observaciones": "Se encontró desgaste en pastillas de freno",
    "taller_id": 5,
    "costo": 150000
  }'

Endpoint

POST /api/mantenimiento/eventos

Request Body

vehiculo_id
number
required
ID of the vehicle receiving maintenance
fecha
string
required
Date of the maintenance event (ISO 8601 format: YYYY-MM-DD)
plan_id
number
ID of the related maintenance plan (if this event is part of a scheduled plan)
km_evento
number
Odometer reading at the time of maintenance (in kilometers)
hr_evento
number
Engine hours at the time of maintenance
descripcion
string
Description of the maintenance work performed
observaciones
string
Additional observations, notes, or findings
taller_id
number
ID of the workshop where maintenance was performed
costo
number
default:0
Total cost of the maintenance service

Response

Returns the created maintenance event with related data.
id
number
Unique identifier for the created event
vehiculo_id
number
Vehicle ID
plan_id
number
Plan ID
fecha
string
Event date
km_evento
number
Odometer reading
hr_evento
number
Engine hours
descripcion
string
Description
observaciones
string
Observations
taller_id
number
Workshop ID
costo
number
Cost
plan_mantenimiento
object
Related plan information
talleres
object
Workshop information

Example Response

{
  "id": 234,
  "vehiculo_id": 123,
  "plan_id": 45,
  "fecha": "2026-03-04",
  "km_evento": 15000,
  "hr_evento": 500,
  "descripcion": "Cambio de aceite y filtros",
  "observaciones": "Se encontró desgaste en pastillas de freno",
  "taller_id": 5,
  "costo": 150000,
  "plan_mantenimiento": {
    "id": 45,
    "nombre": "Mantenimiento Preventivo 15K"
  },
  "talleres": {
    "id": 5,
    "nombre": "Taller Central"
  }
}

Update Maintenance Event

curl -X PUT https://api.example.com/api/mantenimiento/eventos/234 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "costo": 175000,
    "observaciones": "Se reemplazaron pastillas de freno además del mantenimiento programado"
  }'

Endpoint

PUT /api/mantenimiento/eventos/:id

URL Parameters

id
number
required
ID of the maintenance event to update

Request Body

All fields from the create endpoint are supported. Only include fields you want to update.
vehiculo_id
number
Update the vehicle ID
plan_id
number
Update the plan ID
fecha
string
Update the event date
km_evento
number
Update the odometer reading
hr_evento
number
Update the engine hours
descripcion
string
Update the description
observaciones
string
Update the observations
taller_id
number
Update the workshop ID
costo
number
Update the cost

Response

Returns the updated maintenance event with related data.

Example Response

{
  "id": 234,
  "vehiculo_id": 123,
  "plan_id": 45,
  "fecha": "2026-03-04",
  "km_evento": 15000,
  "hr_evento": 500,
  "descripcion": "Cambio de aceite y filtros",
  "observaciones": "Se reemplazaron pastillas de freno además del mantenimiento programado",
  "taller_id": 5,
  "costo": 175000,
  "plan_mantenimiento": {
    "id": 45,
    "nombre": "Mantenimiento Preventivo 15K"
  },
  "talleres": {
    "id": 5,
    "nombre": "Taller Central"
  }
}

Delete Maintenance Event

curl -X DELETE https://api.example.com/api/mantenimiento/eventos/234 \
  -H "Authorization: Bearer YOUR_TOKEN"

Endpoint

DELETE /api/mantenimiento/eventos/:id

URL Parameters

id
number
required
ID of the maintenance event to delete

Response

Returns HTTP 204 No Content on successful deletion.

Get Workshops/Talleres

curl -X GET https://api.example.com/api/mantenimiento/talleres \
  -H "Authorization: Bearer YOUR_TOKEN"

Endpoint

GET /api/mantenimiento/talleres

Response

Returns an array of available workshops/talleres.
id
number
Unique identifier for the workshop
nombre_taller
string
Name of the workshop

Example Response

[
  {
    "id": 5,
    "nombre_taller": "Taller Central"
  },
  {
    "id": 6,
    "nombre_taller": "Taller Norte"
  },
  {
    "id": 7,
    "nombre_taller": "Servicio Autorizado Toyota"
  }
]

Build docs developers (and LLMs) love