Work Orders
Work orders track repair and maintenance jobs on a machine. Each work order can carry ordered instructions, a comment thread, and file attachments. All endpoints require a bearer JWT and the Work Orders page.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /api/v1/work-orders | Create a work order |
GET | /api/v1/work-orders | List work orders |
GET | /api/v1/work-orders/{work_order_id} | Get a work order |
PATCH | /api/v1/work-orders/{work_order_id} | Update a work order |
DELETE | /api/v1/work-orders/{work_order_id} | Delete a work order |
GET | /api/v1/work-orders/{work_order_id}/comments | List comments |
POST | /api/v1/work-orders/{work_order_id}/comments | Add a comment |
GET | /api/v1/work-orders/{work_order_id}/instructions | List instructions |
POST | /api/v1/work-orders/{work_order_id}/instructions | Add an instruction |
GET | /api/v1/work-orders/{work_order_id}/instructions/{instruction_id} | Get an instruction |
PATCH | /api/v1/work-orders/{work_order_id}/instructions/{instruction_id} | Update an instruction |
DELETE | /api/v1/work-orders/{work_order_id}/instructions/{instruction_id} | Delete an instruction |
POST | /api/v1/attachments | Upload an attachment |
GET | /api/v1/attachments/work-order/{work_order_id} | List a work order's attachments |
GET | /api/v1/attachments/{attachment_id} | Get attachment metadata |
GET | /api/v1/attachments/{attachment_id}/download | Download an attachment |
POST | /api/v1/attachments/uploads | Start uploading a large file in parts |
GET | /api/v1/attachments/uploads/{upload_id} | Which parts have arrived |
PUT | /api/v1/attachments/uploads/{upload_id}/parts/{part_number} | Send one part |
POST | /api/v1/attachments/uploads/{upload_id}/complete | Attach the file |
DELETE | /api/v1/attachments/uploads/{upload_id} | Cancel an upload |
DELETE | /api/v1/attachments/{attachment_id} | Delete an attachment |
Create a work order
POST /api/v1/work-orders
Requires an operator or administrator role.
| Field | Type | Required | Description |
|---|---|---|---|
machine_id | uuid | Yes | Machine the work order applies to |
alert_id | uuid | No | Alert that prompted the work order |
title | string | Yes | Title (1–255 chars) |
description | string | No | Details |
priority | string | No | One of low, medium, high, critical (default medium) |
assigned_to | uuid | No | Primary assignee |
assignee_ids | array of uuid | No | Additional assignees |
due_date | datetime | No | Due date (ISO 8601 UTC) |
include_playbook | boolean | No | With an alert_id: add the alert's playbook as the first instructions (default true). See Alert playbooks. |
{
"machine_id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Replace spindle bearings",
"description": "Main spindle bearings showing excessive vibration.",
"priority": "high",
"assigned_to": "3f2504e0-4f89-41d3-9a0c-0305e82c3301"
}
Response: 201 Created
{
"id": "ee55...",
"machine_id": "550e8400-e29b-41d4-a716-446655440000",
"alert_id": null,
"title": "Replace spindle bearings",
"description": "Main spindle bearings showing excessive vibration.",
"status": "open",
"priority": "high",
"assigned_to": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"assignee_ids": [],
"due_date": null,
"completed_at": null,
"completion_notes": null,
"created_by": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"created_at": "2026-08-07T10:00:00Z",
"updated_at": "2026-08-07T10:00:00Z",
"external_source": null,
"external_id": null,
"opened_by_rule": false,
"fix_check": null,
"fix_checked_at": null,
"fix_detail": null,
"health_before": null,
"health_after": null
}
| Field | Description |
|---|---|
external_source, external_id | The ERP or maintenance system the work order was handed to (sap, oracle, dynamics, maintainx, maximo) and its record there; null while it was not. See ERP and maintenance systems. |
opened_by_rule | true when an alert rule opened it on a critical alert rather than a person. See Alert rules. |
fix_check, fix_checked_at, fix_detail, health_before, health_after | Whether the repair held, for a work order raised by an alert. See Fix check. |
List work orders
GET /api/v1/work-orders
| Parameter | Type | Description |
|---|---|---|
machine_id | uuid | Filter by machine |
status | string | One of open, in_progress, completed, cancelled |
assigned_to_me | boolean | Only those assigned to the caller, as the primary assignee or among assignee_ids |
unfinished | boolean | Only those open or in_progress |
page | integer | Page number (default 1) |
page_size | integer | Items per page (default 20, max 100) |
Returns an items array with a total count. assigned_to_me=true&unfinished=true is the list the portal keeps on a technician's phone for working offline.
Get, update, and delete
GET /api/v1/work-orders/{work_order_id} returns one work order. PATCH /api/v1/work-orders/{work_order_id} updates it and DELETE /api/v1/work-orders/{work_order_id} removes it (204 No Content). Update and delete require an operator or administrator role.
Updatable fields include title, description, status, priority, assigned_to, assignee_ids, due_date, and completion_notes.
Once a work order has been signed off (see Compliance), it can no longer be changed or deleted: PATCH, DELETE and changes to its instructions return 409.
{
"status": "in_progress"
}
completed_at is stamped when status first becomes completed. A completion sent after the fact (from a phone that was offline) can say when the work was really done:
{
"status": "completed",
"completed_at": "2026-08-07T10:02:00Z"
}
completed_at is read only with status: "completed". A time in the future is taken as now, one before the work order was created as its creation time, and one without a time zone is not trusted: now is used instead. A completion already recorded is never moved.
Fix check
For a work order raised by an alert (opened by a rule or by a person), Haltless checks after completion whether the repair held. The machine's health score is noted when the work order opens (health_before). Once the work order is completed and readings have settled for 24 hours, the alert's own condition decides:
fix_check | Meaning |
|---|---|
null | Not raised by an alert, or not completed yet |
pending | Completed; waiting for readings to settle |
verified | The alert's metric stayed inside its threshold, the alert cleared, and nothing new alerted |
not_verified | The same condition alerted again, the metric went past its threshold in more than 5% of the readings since, or the alert never cleared |
unverifiable | Too few readings within 7 days of completion to tell, or the alert was deleted |
fix_detail says what the verdict rests on:
{
"reason": "held",
"hours": 26,
"metric": "vibration_rms",
"threshold": 7.0,
"readings": 312,
"outside": 0,
"peak": 3.1
}
reason is one of held, rule_quiet (composite rules), past_threshold, recurred, still_open, too_few_readings, or alert_gone. A composite rule's check names the rule instead of a metric and threshold. health_after is the health score when the fix was judged. It is shown for context and is not the verdict: the score counts a month of alerts, the repaired one among them, so it recovers more slowly than the machine does.
Comments
GET /api/v1/work-orders/{work_order_id}/comments lists the comment thread. POST /api/v1/work-orders/{work_order_id}/comments adds a comment (body up to 2,000 characters).
{
"body": "Bearings ordered. Expected delivery next week."
}
Instructions
Instructions are ordered steps attached to a work order. A work order opened from an alert starts with the alert's playbook as its first steps, unless it was created with include_playbook: false.
Add an instruction
POST /api/v1/work-orders/{work_order_id}/instructions
Requires an operator or administrator role.
| Field | Type | Required | Description |
|---|---|---|---|
step_order | integer | Yes | Step position (≥ 1) |
title | string | Yes | Step title (1–255 chars) |
body | string | No | Step detail (up to 5,000 chars) |
attachment_id | uuid | No | Attachment to show with the step |
{
"step_order": 1,
"title": "Lock out and tag out the machine",
"body": "Follow the site LOTO procedure before opening the spindle housing."
}
Response: 201 Created
{
"id": "ff66...",
"work_order_id": "ee55...",
"step_order": 1,
"title": "Lock out and tag out the machine",
"body": "Follow the site LOTO procedure before opening the spindle housing.",
"attachment_id": null,
"created_by": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"created_at": "2026-08-07T10:05:00Z",
"updated_at": "2026-08-07T10:05:00Z"
}
List, get, update, and delete
A work order holds up to 100 steps; adding more returns 400. PATCH takes step_order, title, body and attachment_id.
GET /api/v1/work-orders/{work_order_id}/instructions returns the steps as an items array with a total. GET, PATCH, and DELETE on /api/v1/work-orders/{work_order_id}/instructions/{instruction_id} operate on a single step. Update and delete require an operator or administrator role.
Attachments
Attachments are files linked to a work order (or a maintenance event; see Maintenance).
Upload an attachment
POST /api/v1/attachments
Requires an operator or administrator role. Send the file as multipart/form-data under the file field and provide the target as a query parameter: either work_order_id or maintenance_event_id.
curl -X POST "https://api.haltless.io/api/v1/attachments?work_order_id=ee55..." \
-H "Authorization: Bearer <jwt>" \
-F "file=@inspection-photo.jpg"
Response: 201 Created
{
"id": "aa77...",
"work_order_id": "ee55...",
"maintenance_event_id": null,
"uploaded_by": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"filename": "inspection-photo.jpg",
"content_type": "image/jpeg",
"size_bytes": 245678,
"created_at": "2026-08-07T10:10:00Z",
"updated_at": "2026-08-07T10:10:00Z"
}
A file can be an image (JPEG, PNG, GIF, WebP), a video (MP4, WebM), a PDF, plain text, or a Word or Excel document (.doc, .docx, .xls, .xlsx), up to 50 MB; its contents must match its type. A work order holds up to 50 attachments and a maintenance event up to 20. A request body is at most 10 MB, so send a larger file in parts.
Upload a large file in parts
An upload in parts survives a dropped connection: send what is missing and carry on.
POST /api/v1/attachments/uploadswith the file's name, type and size, and its target:
{
"filename": "gearbox-teardown.mp4",
"content_type": "video/mp4",
"size_bytes": 31457280,
"work_order_id": "ee55..."
}
Give exactly one of work_order_id and maintenance_event_id. The response (201 Created) says how to cut the file:
{
"id": "0f8e...",
"filename": "gearbox-teardown.mp4",
"content_type": "video/mp4",
"size_bytes": 31457280,
"part_size_bytes": 5242880,
"part_count": 6,
"uploaded_parts": [],
"received_bytes": 0,
"expires_at": "2026-08-08T10:10:00Z"
}
PUT /api/v1/attachments/uploads/{upload_id}/parts/{part_number}once for each part, numbered from1, with the part's raw bytes as the body. Every part is exactlypart_size_bytes(5 MiB) except the last, which is the rest. Sending a part again replaces it, and parts can arrive in any order. Each answer (200) is the upload as above, withuploaded_partsandreceived_bytesbrought up to date. If part1does not match the declared type, the upload is discarded (400) and must be started again.POST /api/v1/attachments/uploads/{upload_id}/completeattaches the file and returns the attachment (201 Created), as a one-request upload does. Parts still missing are a409that lists them.
GET /api/v1/attachments/uploads/{upload_id} says which parts have arrived, to resume after an interruption; DELETE cancels the upload (204). An upload lasts 24 hours from when it was started, and only the person who started it can use it; after that, or for anyone else, it is a 404. Uploading needs an operator or administrator role.
List, download, and delete
GET /api/v1/attachments/work-order/{work_order_id} lists a work order's attachments. GET /api/v1/attachments/{attachment_id} returns metadata, and GET /api/v1/attachments/{attachment_id}/download returns the file bytes with a Content-Disposition header. DELETE /api/v1/attachments/{attachment_id} removes an attachment (204 No Content) and requires an operator or administrator role.
Status flow
| Status | Description |
|---|---|
open | Created, not yet started |
in_progress | Work underway |
completed | Work finished |
cancelled | Work order cancelled |