Skip to main content

Get Maintenance Plans

curl -X GET "https://api.example.com/api/mantenimiento/planes?vehiculo_id=123&activo=true" \
  -H "Authorization: Bearer YOUR_TOKEN"

Endpoint

GET /api/mantenimiento/planes

Query Parameters

vehiculo_id
number
Filter plans by vehicle ID
activo
boolean
Filter by active status (true/false)

Response

Returns an array of maintenance plans with their conditions and related data.
id
number
Unique identifier for the maintenance plan
vehiculo_id
number
ID of the vehicle this plan applies to
tipo_mantenimiento_id
number
ID of the maintenance type
nombre
string
Name/description of the maintenance plan
activo
boolean
Whether the plan is currently active
tipo_mantenimiento
object
Related maintenance type information
plan_condicion
array
Array of conditions that trigger this maintenance

Example Response

[
  {
    "id": 1,
    "vehiculo_id": 123,
    "tipo_mantenimiento_id": 1,
    "nombre": "Mantenimiento Preventivo 10K",
    "activo": true,
    "tipo_mantenimiento": {
      "tipo": "Preventivo"
    },
    "plan_condicion": [
      {
        "id": 1,
        "plan_id": 1,
        "tipo_condicion_id": 1,
        "valor": 10000,
        "unidad": "km",
        "tipo_condicion": {
          "nombre": "Kilómetros",
          "codigo": "KM"
        }
      },
      {
        "id": 2,
        "plan_id": 1,
        "tipo_condicion_id": 2,
        "valor": 180,
        "unidad": "dias",
        "tipo_condicion": {
          "nombre": "Días",
          "codigo": "DIAS"
        }
      }
    ]
  }
]

Create Maintenance Plan

curl -X POST https://api.example.com/api/mantenimiento/planes \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "vehiculo_id": 123,
    "tipo_mantenimiento_id": 1,
    "nombre": "Mantenimiento Preventivo 10K",
    "activo": true,
    "condiciones": [
      {
        "tipo_condicion_id": 1,
        "valor": 10000,
        "unidad": "km"
      },
      {
        "tipo_condicion_id": 2,
        "valor": 180,
        "unidad": "dias"
      }
    ]
  }'

Endpoint

POST /api/mantenimiento/planes

Request Body

vehiculo_id
number
required
ID of the vehicle this plan applies to
tipo_mantenimiento_id
number
required
ID of the maintenance type
nombre
string
required
Name/description of the maintenance plan
activo
boolean
default:true
Whether the plan is active
condiciones
array
Array of conditions for this maintenance plan

Response

Returns the created maintenance plan object.
id
number
Unique identifier for the created plan
vehiculo_id
number
Vehicle ID
tipo_mantenimiento_id
number
Maintenance type ID
nombre
string
Plan name
activo
boolean
Active status

Example Response

{
  "id": 45,
  "vehiculo_id": 123,
  "tipo_mantenimiento_id": 1,
  "nombre": "Mantenimiento Preventivo 10K",
  "activo": true
}

Update Maintenance Plan

curl -X PUT https://api.example.com/api/mantenimiento/planes/45 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Mantenimiento Preventivo 15K",
    "activo": true,
    "condiciones": [
      {
        "tipo_condicion_id": 1,
        "valor": 15000,
        "unidad": "km"
      }
    ]
  }'

Endpoint

PUT /api/mantenimiento/planes/:id

URL Parameters

id
number
required
ID of the maintenance plan 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
tipo_mantenimiento_id
number
Update the maintenance type
nombre
string
Update the plan name
activo
boolean
Update active status
condiciones
array
Replace all conditions with new ones. Existing conditions will be deleted and replaced.

Response

Returns the updated maintenance plan object.

Example Response

{
  "id": 45,
  "vehiculo_id": 123,
  "tipo_mantenimiento_id": 1,
  "nombre": "Mantenimiento Preventivo 15K",
  "activo": true
}

Get Maintenance Types

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

Endpoint

GET /api/mantenimiento/tipos

Response

Returns an array of available maintenance types.
id
number
Unique identifier for the maintenance type
tipo
string
Type name (e.g., “Preventivo”, “Correctivo”, “Predictivo”)
descripcion
string
Description of the maintenance type

Example Response

[
  {
    "id": 1,
    "tipo": "Preventivo",
    "descripcion": "Mantenimiento programado regular"
  },
  {
    "id": 2,
    "tipo": "Correctivo",
    "descripcion": "Reparaciones por fallas"
  },
  {
    "id": 3,
    "tipo": "Predictivo",
    "descripcion": "Basado en monitoreo de condiciones"
  }
]

Create Maintenance Type

curl -X POST https://api.example.com/api/mantenimiento/tipos \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tipo": "Emergencia",
    "descripcion": "Mantenimiento de emergencia no programado"
  }'

Endpoint

POST /api/mantenimiento/tipos

Request Body

tipo
string
required
Name of the maintenance type
descripcion
string
Description of the maintenance type

Response

Returns the created maintenance type.

Example Response

{
  "id": 4,
  "tipo": "Emergencia",
  "descripcion": "Mantenimiento de emergencia no programado"
}

Get Condition Types

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

Endpoint

GET /api/mantenimiento/condiciones

Response

Returns an array of condition types that can be used in maintenance plans.
id
number
Unique identifier for the condition type
codigo
string
Condition type code (e.g., “KM”, “DIAS”, “HORAS”)
nombre
string
Human-readable name of the condition type

Example Response

[
  {
    "id": 1,
    "codigo": "KM",
    "nombre": "Kilómetros"
  },
  {
    "id": 2,
    "codigo": "DIAS",
    "nombre": "Días"
  },
  {
    "id": 3,
    "codigo": "HORAS",
    "nombre": "Horas de Motor"
  }
]

Build docs developers (and LLMs) love