Rela AIRela AI Docs
API Reference

Maintenance API

Plan CRUD endpoints, execute, preview, test notification, pause/resume, counters, history, compliance, and optimization.

Plan Endpoints

MethodEndpointDescription
GET/api/v1/maintenance/plansList plans
POST/api/v1/maintenance/plansCreate plan
GET/api/v1/maintenance/plans/{plan_id}Get plan
PUT/api/v1/maintenance/plans/{plan_id}Update plan
DELETE/api/v1/maintenance/plans/{plan_id}Delete plan

Execution and Preview

MethodEndpointDescription
POST/api/v1/maintenance/plans/{plan_id}/executeExecute plan manually
GET/api/v1/maintenance/plans/{plan_id}/previewPreview task to be generated
POST/api/v1/maintenance/plans/{plan_id}/test-notificationSend test notification

Execute Plan

Forces immediate plan execution, generating the task without waiting for the scheduler:

POST /api/v1/maintenance/plans/{plan_id}/execute

Response 200:

{
  "task_id": "task_abc123",
  "task_code": "MAN-042",
  "next_due_at": "2026-04-24T10:00:00Z"
}

Task Preview

Shows what the generated task would look like without executing the plan:

GET /api/v1/maintenance/plans/{plan_id}/preview

Pause and Resume

MethodEndpointDescription
POST/api/v1/maintenance/plans/{plan_id}/pausePause plan
POST/api/v1/maintenance/plans/{plan_id}/resumeResume plan
Pausing a plan preserves the next_due_at date. On resume, it recalculates if the date has passed.

Counters

For plans with counter-based triggers:

MethodEndpointDescription
POST/api/v1/maintenance/plans/{plan_id}/counterUpdate counter
GET/api/v1/maintenance/plans/{plan_id}/counter/historyCounter history
POST /api/v1/maintenance/plans/{plan_id}/counter
{
  "value": 523,
  "source": "gateway_001"
}

If the value reaches the threshold, the plan executes automatically.

Execution History

GET /api/v1/maintenance/plans/{plan_id}/history?skip=0&limit=20

Each entry includes:

FieldDescription
execution_idUnique execution ID
task_idGenerated task
triggercalendar or counter
executed_atExecution timestamp
executed_bysystem or user_id

Compliance

GET /api/v1/maintenance/compliance?start_date=2026-01-01&end_date=2026-03-31

Returns preventive maintenance compliance metrics:

MetricDescription
compliance_rate% of plans executed on time
overdue_countOverdue plans in the period
on_time_countPlans executed within the deadline
average_delay_hoursAverage delay on late executions

Optimization

POST /api/v1/maintenance/plans/{plan_id}/optimize

The AI engine analyzes the plan's history and suggests adjustments:

  • Optimal frequency based on failure patterns
  • Workload redistribution among technicians
  • Multi-asset route consolidation
  • Counter threshold adjustments

Suggestions are presented as a draft for the user to approve before applying.

On this page