Skip to main content

Overview

The Maintenance API provides endpoints for managing preventive and corrective maintenance operations, work orders, routines, schedules, and maintenance notifications. Base Path: /mantenimiento/

Search Work Orders

Search for work orders by various criteria.
GET /mantenimiento/api/search-ordenes/
q
string
Search query for work order details
estado
string
Filter by status: PENDIENTE, EN_PROGRESO, COMPLETADA, CANCELADA
tipo
string
Filter by type: PREVENTIVA, CORRECTIVA
fecha_desde
string
Start date filter (YYYY-MM-DD)
fecha_hasta
string
End date filter (YYYY-MM-DD)

Response

results
array
Array of work order objects
fetch('/mantenimiento/api/search-ordenes/?estado=PENDIENTE&tipo=PREVENTIVA', {
  credentials: 'same-origin'
})
.then(res => res.json())
.then(data => console.log(data.results));

Work Order Details

Get Work Order Details

Retrieve detailed information about a specific work order.
GET /mantenimiento/api/ot/{pk}/detalle/
pk
integer
required
Work order ID

Response

id
integer
Work order ID
codigo
string
Work order code
tipo
string
PREVENTIVA or CORRECTIVA
estado
string
Current status
rutina
object
activos
array
Array of asset objects
procedimientos
array
Array of procedure steps
inicio_programado
string
Scheduled start datetime
fin_programado
string
Scheduled end datetime
inicio_real
string
Actual start datetime
fin_real
string
Actual end datetime
tecnico_asignado
string
Assigned technician name
notas
string
Work order notes
fetch('/mantenimiento/api/ot/1523/detalle/', {
  credentials: 'same-origin'
})
.then(res => res.json())
.then(data => console.log(data));

Update Work Order

Update Work Order Status and Notes

Update the status and notes of a work order.
POST /mantenimiento/api/ot/{pk}/update/
pk
integer
required
Work order ID
estado
string
New status: PENDIENTE, EN_PROGRESO, COMPLETADA, CANCELADA
notas
string
Updated notes
inicio_real
string
Actual start datetime (ISO format)
fin_real
string
Actual end datetime (ISO format)

Response

status
string
“success” or “error”
message
string
Status message
fetch('/mantenimiento/api/ot/1523/update/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-CSRFToken': csrfToken
  },
  credentials: 'same-origin',
  body: JSON.stringify({
    estado: 'COMPLETADA',
    fin_real: new Date().toISOString(),
    notas: 'Inspection completed. All systems normal.'
  })
});

Schedule Management

Update Work Order Date

Change the scheduled date of a work order.
POST /mantenimiento/api/update-ot-date/
ot_id
integer
required
Work order ID
new_date
string
required
New scheduled date (YYYY-MM-DD format)
reason
string
Reason for date change

Bulk Update Work Order Dates

Update multiple work orders at once.
POST /mantenimiento/api/bulk-update-ot-dates/
updates
array
required
Array of update objects

Split Work Order by Asset

Split a work order with multiple assets into separate work orders.
POST /mantenimiento/api/split-ot-asset/
ot_id
integer
required
Work order ID to split

Merge Work Orders

Combine multiple work orders into one.
POST /mantenimiento/api/merge-ots/
ot_ids
array
required
Array of work order IDs to merge
target_date
string
Target date for merged work order

Delete Work Orders

Delete multiple work orders.
POST /mantenimiento/api/delete-ots/
ot_ids
array
required
Array of work order IDs to delete

Notifications

Get Maintenance Notifications

Retrieve maintenance notifications for the current user.
GET /mantenimiento/api/notifications/
limit
integer
default:"20"
Number of notifications to retrieve
unread_only
boolean
default:"false"
Only return unread notifications

Response

notifications
array
Array of notification objects
fetch('/mantenimiento/api/notifications/?unread_only=true', {
  credentials: 'same-origin'
})
.then(res => res.json())
.then(data => console.log(data.notifications));

Mark Notification as Read

Mark a notification as read.
POST /mantenimiento/api/notifications/read/
notification_id
integer
required
Notification ID to mark as read

Routine Management

Get Routine Details

Retrieve details about a maintenance routine.
GET /mantenimiento/rutinas/dashboard/detail/{pk}/
pk
integer
required
Routine ID

Response

id
integer
Routine ID
nombre
string
Routine name
descripcion
string
Routine description
tipo
object
Maintenance type/category
frecuencia
object
Frequency configuration
pasos
array
Array of procedure steps

Save Routine

Create or update a maintenance routine.
POST /mantenimiento/rutinas/dashboard/save/
id
integer
Routine ID (omit for new routine)
nombre
string
required
Routine name
descripcion
string
Routine description
tipo_id
integer
required
Maintenance type ID
frecuencia_id
integer
required
Frequency ID
duracion_estimada
integer
Estimated duration in minutes

Delete Routine

Delete a maintenance routine.
POST /mantenimiento/rutinas/dashboard/delete/{pk}/
pk
integer
required
Routine ID to delete

Save Routine Steps

Update the procedure steps for a routine.
POST /mantenimiento/rutinas/dashboard/rutina/pasos/save/
rutina_id
integer
required
Routine ID
pasos
array
required
Array of step objects

Asset Wizard

Get Assets for Wizard

Retrieve assets filtered by location and category for the routine wizard.
GET /mantenimiento/api/get-assets-wizard/
ubicacion_id
integer
Filter by location ID
categoria_id
integer
Filter by category ID
tipo_id
integer
Filter by maintenance type ID

Individual Order Generation

Generate Individual Work Order

Generate a single work order from a scheduled routine.
POST /mantenimiento/proyeccion-generar/api/
programacion_id
integer
required
Schedule/program ID
fecha
string
required
Date for the work order (YYYY-MM-DD)
activo_ids
array
Array of specific asset IDs to include

Response

status
string
“success” or “error”
ot_id
integer
Generated work order ID
mensaje
string
Status message
fetch('/mantenimiento/proyeccion-generar/api/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-CSRFToken': csrfToken
  },
  credentials: 'same-origin',
  body: JSON.stringify({
    programacion_id: 78,
    fecha: '2024-03-20',
    activo_ids: [123, 124]
  })
});

Mobile Endpoints

The API includes mobile-optimized endpoints:
  • GET /mantenimiento/app/cronograma/ - Mobile maintenance schedule view
  • GET /mantenimiento/app/ot/{pk}/ - Mobile work order detail
  • POST /mantenimiento/app/ot/{pk}/iniciar/ - Start work order from mobile
  • POST /mantenimiento/app/ot/{pk}/finalizar/ - Complete work order from mobile
  • POST /mantenimiento/app/aviso/crear/ - Create maintenance notice from mobile
  • GET /mantenimiento/app/avisos/ - List user’s maintenance notices

Next Steps

Documents API

Document management and AI search

Inventory API

Materials and inventory management

Build docs developers (and LLMs) love