Skip to main content

Downtime Tracking

Record, analyze, and report on machine downtime events.

Create a downtime record

POST /machines/{machine_id}/downtime

Auth: Bearer JWT (admin, operator)

curl -X POST https://api.haltless.io/api/v1/machines/MACHINE_ID/downtime \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"reason": "Unplanned bearing failure",
"category": "unplanned",
"reason_code_id": "REASON_CODE_UUID",
"started_at": "2026-04-04T08:15:00Z"
}'

Categories: planned, unplanned, changeover, maintenance

List downtime records

GET /machines/{machine_id}/downtime

Auth: Bearer JWT (any role)

Update a downtime record

PUT /machines/{machine_id}/downtime/{record_id}

Auth: Bearer JWT (admin, operator)

End a downtime event

POST /machines/{machine_id}/downtime/{record_id}/end

Auth: Bearer JWT (admin, operator)

Sets ended_at to the current time and calculates duration.

Uptime summary

GET /machines/{machine_id}/uptime-summary

Auth: Bearer JWT (any role)

ParameterTypeDescription
startdatetimeStart of analysis period
enddatetimeEnd of analysis period

MTTR / MTBF

GET /machines/{machine_id}/mttr-mtbf

Auth: Bearer JWT (any role)

ParameterTypeDefaultDescription
daysint90Lookback window
{
"mttr_hours": 2.5,
"mtbf_hours": 168.0,
"total_failures": 5,
"total_repairs": 7
}
  • MTTR (Mean Time To Repair): Average repair duration for unplanned and maintenance events
  • MTBF (Mean Time Between Failures): Average uptime between unplanned failure events

Fleet downtime

GET /fleet/downtime

Auth: Bearer JWT (any role)

Paginated list of all downtime records across the fleet.

ParameterTypeDescription
machine_iduuidFilter by machine
sort_bystringSort field
sort_dirstringasc or desc

Fleet MTTR / MTBF

GET /fleet/mttr-mtbf

Auth: Bearer JWT (any role)

Aggregated MTTR and MTBF across the entire fleet.

Reason codes

Reason codes provide a hierarchical taxonomy for categorizing downtime causes.

List reason codes

GET /reason-codes

ParameterTypeDefault
active_onlybooleantrue

Reason code tree

GET /reason-codes/tree

Returns reason codes as a nested tree (parent-child hierarchy).

Create a reason code

POST /reason-codes

Auth: Bearer JWT (admin)

Update a reason code

PUT /reason-codes/{code_id}

Auth: Bearer JWT (admin)