Skip to main content

Service: work orders (E01–E09)

:::warning Routed; scheduling/queues are opt-in Every endpoint on this page is implemented and registered as a route in code (handlers packages/api/src/handlers/service-*.ts, services packages/core/src/services/work-order-service.ts and attachment-service.ts). Per the owner's Q27 decision the routes live in the route-area stack cse-http-be-<stage>-api-service (one work-orders Lambda family, RouteDef.area: 'service' in lib/routes.ts), attached to the shared HttpApi. They are routed (the area stack is created by a default cdk synth; the web team observed these routes answering on dev on 2026-10-28). The attachments bucket cse-http-be-<stage>-service-files is now defined in DataStack, and the work-orders family gets SERVICE_FILES_BUCKET plus S3 access to pending/* and wo/* only. Nothing on this page has been executed against any stage; every JSON body below is an illustrative example, derived from the schema/handler code — none is a captured response. The machine-readable contract is docs/openapi.yaml in cse-http-be. :::

:::caution Lifecycle v2 (ADR 0023) — deployed on dev, backfill not run yet This page describes lifecycle v2, the console's "Work Order Lifecycle v2" request (tickets LC-1 … LC-17), recorded in ADR 0023 in cse-http-be. It is on main and deployed on dev (batches A, B and C, as the web console observed on 2026-11-10). Its data backfill has not run yet. Dev is the only stage (Hard Rule 4).

Two 2026-11-10 follow-up fixes are committed but not deployed yet: Crown-wide reads returned no rows, and operatorOrgId answered 403; and E13 now lists a plant's Installers for Crown staff.

What changes for the console (breaking):

  • Statuses are real enum values now: there are 11 (ACCEPTED, VERIFIED, CLOSED, REJECTED and REOPENED are new).
  • :start needs :accept first.
  • The Installer loses :wait / :resume and gets :request-hold. Holding and resuming are Business actions.
  • The Business must :verify (new) before :close. It can send a completion back with :reject-completion (new).
  • A decline goes to REJECTED, not NEW.
  • COMPLETED is no longer the end. The order closes, and releases its alert, at CLOSED.
  • :reopen works only from CLOSED / CANCELLED and lands in REOPENED, unassigned.
  • Reassigning after acceptance goes back to ASSIGNED, and needs a reason.
  • Hold reasons are renamed. The old input values are accepted for one release.
  • E02 metrics.inProgress counts IN_PROGRESS only. On Hold is onHold.
  • The service-request routes are removed (below).

After the deploy, a human runs the lifecycle v2 backfill once to migrate existing orders. Until it runs, older orders are read in v2 terms (below). :::

Feature 006 (Service / O&M) gives operators a work-order queue per operator org. Source of truth: specs/006-service-om/contracts/http-api.md as amended by ADR 0019 and ADR 0023, the Zod schemas in packages/core/src/schemas.ts (search for WorkOrder), the transition table in packages/core/src/service/work-order-state.ts, and the code cited per section. Types are listed on Types & schemas.

Common rules​

TopicRule
AuthCognito JWT (HttpUserPoolAuthorizer) on every route; none is public
Request headersAuthorization (required); Content-Type: application/json on bodies (else 415); X-Org-Id optional selector — never widens access; X-Correlation-Id optional
Optimistic concurrencyIf-Match: "<version>" on every mutation of an existing order (missing → 428 PRECONDITION_REQUIRED, stale → 409 VERSION_CONFLICT with details.currentVersion). Attachments are unversioned and need no If-Match
IdempotencyIdempotency-Key (1–128 [A-Za-z0-9_-]). R = required (missing → 428, details.header), O = optional. Replays return the same body with Idempotent-Replayed: true; same key with a different body → 422 IDEMPOTENCY_KEY_REUSED; concurrent same key → 409 IDEMPOTENCY_IN_PROGRESS
Response headersX-Request-Id; ETag: "<version>" on single orders; Cache-Control: no-store
Non-disclosureNo access path to the plant/order → 404 NOT_FOUND; visible but level too low → 403 FORBIDDEN
Levelsservice ≥ L @plant = effective service level on the order's plant, evaluated live from DynamoDB; @org = role level in {orgId} plus scope filtering
Paginationlimit 1–50 (default 25), opaque cursor bound to the query; bad/foreign cursor → 400 INVALID_CURSOR. Since 2026-12-01 (F7) E01 reads up to 4 index pages per request to fill a short page, moving on to the next phase (e.g. -cost → orders with no cost), so an empty page with a nextCursor is rare; a page can still be short, so keep paging while nextCursor is present
Unknown query params / unservable sort400 VALIDATION_FAILED with details.allowed
Bodiesstrict (unknown keys → 422); JSON > 256 KB → 413; malformed → 400 MALFORMED_REQUEST
Always possible401 (gateway) / 401 SESSION_REVOKED, 403 ACCOUNT_SUSPENDED, 429 RATE_LIMITED, 503 DEPENDENCY_UNAVAILABLE, 500 INTERNAL

Audience: internal vs customer view​

Every order-bearing response is projected by audience (packages/core/src/service/projection.ts). Omitted fields are absent, not null.

  • INTERNAL (operator and partner staff): the full WorkOrder view — costs, parts, internal notes, warranty claim ref, all attachments and events, viewer.capabilities.
  • CUSTOMER (customer-org members; customers have no service access by default): an explicit allow-list — workOrderId, code, title, status, priority, workType, plant, device, plannedVisitAt, respondedAt, closedAt, completion {resolution, result, completedAt, signature {signerName, signedAt}}, technician {displayName}, operator {orgId, name?}, only CUSTOMER-visibility events (event data limited to from, to, plannedVisitAt, result) and attachments, and viewer. An INTERNAL attachment fetched by a customer answers 404, like an unknown id. For a v2 completion, completion.resolution carries the Installer's workPerformed. The customer never sees diagnosis, completionNotes, the verification, a rejected completion or a hold request.

viewer: {audience, capabilities[]} tells the UI which actions to show (e.g. workOrder.edit, workOrder.assign, workOrder.complete, workOrder.cancel). There is one workOrder.<action> per E06 action that is allowed from the order's current status and that the caller may perform (see who may act):

  • assign, wait, resume, reject-completion, verify, close, cancel and reopen need MANAGE. The order's Installer never gets workOrder.verify, even with MANAGE.
  • accept, decline and request-hold are only for the assigned Installer. request-hold is hidden while a request is pending.
  • schedule, start and complete need EDIT, or come with being the assignee.
  • workOrder.note and attach need EDIT or being the assignee. workOrder.edit (E05) needs EDIT. Neither appears on a CLOSED or CANCELLED order.

A read-only order (plant deleted) has no capabilities.

Responsible Business (WO-6)​

Every order belongs to its plant's operator org (orgId). Responses also carry it as operator: {orgId, name?}; the name is read live and is absent if the org no longer exists. You find operator on:

  • the E04 internal and customer views;
  • E01 and E10 rows;
  • E12 history rows.

Internal views and rows also carry technician.orgName.

SLA (response target)​

packages/core/src/service/sla.ts. Wall-clock hours from createdAt, no working-hours calendar, WAITING never pauses the clock:

PriorityTarget
CRITICAL4 h
HIGH24 h
MEDIUM72 h
LOW240 h

PLAN-sourced orders have no target (sla.state: NO_TARGET). A priority change recomputes responseTargetAt from the original createdAt. sla is derived on read, never stored. Orders where the Installer's work is still pending (NEW, REJECTED, ASSIGNED, ACCEPTED, IN_PROGRESS, WAITING, REOPENED) are NO_TARGET | ON_TARGET | PAST_TARGET. Every other order — COMPLETED and VERIFIED included, although they are still open — is NO_TARGET | MET | MISSED, so it never counts as past target or overdue. An order that never recorded respondedAt is judged on closedAt (default applied, Q24).

In the queue order, COMPLETED and VERIFIED orders sort after every order with a target (queue key sentinel 9999999997).

Status model (ADR 0023 D1)​

StatusConsole labelOpen?Meaning
NEWDraftopenCreated, not assigned
REJECTEDRejectedopenThe Installer declined the assignment; unassigned, awaiting reassignment
ASSIGNEDAssignedopenAwaiting the Installer's answer
ACCEPTEDAcceptedopenThe Installer accepted
IN_PROGRESSIn ProgressopenThe Installer is working
WAITINGOn HoldopenPut on hold by the Business or Crown
COMPLETEDCompletedopenSubmitted for verification
VERIFIEDVerifiedopenThe Business confirmed the work
REOPENEDReopenedopenA closed or cancelled order, waiting to be assigned again
CLOSEDClosedclosedFormally closed by the Business
CANCELLEDCancelledclosedCancelled
  • Open set = every status except CLOSED and CANCELLED. COMPLETED and VERIFIED stay open because the Business still has work to do (owner decision O2, recommended default).
  • closedAt is set at CLOSED or CANCELLED, no longer at :complete. The alert's open guard is released, and workorder.completed.v1 is emitted, at the same moment.
  • The acceptance and businessClosure fields stay as the record of who accepted or closed, and when. The status is the state.
  • SCHEDULED is retired (WO-1). A planned visit is the plannedVisitAt field, and scheduling never changes the status. Stored SCHEDULED values are read as ASSIGNED, and E01 accepts status=SCHEDULED as ASSIGNED.

Orders stored before v2​

Until the backfill rewrites them, older orders are read in v2 terms (foldLegacyLifecycle in schemas.ts):

StoredReturned as
ASSIGNED with acceptanceACCEPTED
COMPLETED with businessClosureCLOSED
hold reason PART / APPROVAL / SITE_ACCESSPARTS_UNAVAILABLE / AWAITING_APPROVAL / SITE_INACCESSIBLE

Status conditions and filters also match the stored value, so actions work on these orders before the backfill. Three things only the backfill fixes:

  • a COMPLETED order the Business never closed still sits in the closed queue, with closedAt;
  • a declined order (NEW + lastDecline) still reads NEW, not REJECTED;
  • older orders have no list entry, so the Crown-wide list and the createdAt sorts miss them, and the E02 counters and E01 q search tokens of older orders are missing or stale.

State machine (ADR 0023 D2)​

TRANSITION_TABLE in packages/core/src/service/work-order-state.ts. Anything not in this table → 409 INVALID_STATE with details: {from, action, allowed}, plus details.reason where one applies (below). The state is checked before the body is validated. A read-only order (plant deleted, readOnlyReason: "PLANT_DELETED") answers 409 INVALID_STATE with details.reason: "PLANT_DELETED" for every mutation.

ActionFromToWho
assignNEW, REJECTED, REOPENEDASSIGNEDMANAGE
assign to another person (reassign)ASSIGNED, ACCEPTED, IN_PROGRESSASSIGNED (the new Installer must accept)MANAGE, reason required
assign to the same personASSIGNED, ACCEPTED, IN_PROGRESSunchangedMANAGE
assign (reassign while on hold)WAITINGWAITING; :resume then returns to ASSIGNEDMANAGE, reason required when the person changes
unassign (technicianSub: null)ASSIGNED, ACCEPTEDNEWMANAGE, reason optional
acceptASSIGNEDACCEPTEDassignee only
declineASSIGNEDREJECTED (unassigned, lastDecline recorded)assignee only
schedule / rescheduleevery open status except COMPLETED, VERIFIEDunchanged (sets plannedVisitAt)EDIT or assignee
startACCEPTEDIN_PROGRESSEDIT or assignee
request-holdASSIGNED, ACCEPTED, IN_PROGRESSunchanged (holdRequest recorded)assignee only
wait (hold)ASSIGNED, ACCEPTED, IN_PROGRESSWAITING (waiting.holdFrom stored)MANAGE
resumeWAITINGwaiting.holdFrom (IN_PROGRESS for a pre-v2 hold)MANAGE
completeIN_PROGRESSCOMPLETEDEDIT or assignee
reject-completionCOMPLETEDIN_PROGRESS (same Installer)MANAGE
verifyCOMPLETEDVERIFIEDMANAGE, never the order's Installer
closeVERIFIEDCLOSEDMANAGE
cancelNEW, REJECTED, ASSIGNED, ACCEPTED, IN_PROGRESS, WAITING, REOPENEDCANCELLEDMANAGE, reason required
reopenCLOSED, CANCELLEDREOPENED (unassigned)MANAGE, reason required

Any status change also ends a pending hold request (holdRequest is removed).

details.reason values on a 409 INVALID_STATE:

ReasonWhen
NOT_ASSIGNED:start on an unassigned order (NEW, REJECTED, REOPENED). :start never assigns the caller
NOT_ACCEPTED:start on an ASSIGNED order: the Installer must :accept first (LC-2)
ALREADY_ACCEPTED:accept on an ACCEPTED order
ON_HOLD:complete on a WAITING order: resume first (owner decision O4, recommended default)
NOT_VERIFIED:close on a COMPLETED order: :verify first (LC-5)
ALREADY_CLOSED:close on a CLOSED order
HOLD_ALREADY_REQUESTED:request-hold while a request is pending
CLOSEDE05 patch, E08 note or E09 attachment write on a CLOSED or CANCELLED order. Only :reopen works there
PLANT_DELETEDany mutation of a read-only order

403 FORBIDDEN with details.reason: "SELF_VERIFY" answers :verify when the caller is the order's Installer (technician.sub) or the person who submitted the completion (completion.completedBy.sub), whatever their level (LC-3).

Hold (ADR 0023 D2, D3)​

Only the Business or Crown (MANAGE) put an order on hold and resume it. The Installer asks with :request-hold.

  • :wait stores waiting {reason, note?, since, holdFrom, heldBy}. holdFrom is the status the hold started from. :resume restores it and writes RESUMED with the reason, heldSince and heldBy.
  • :request-hold {reason, note?} records holdRequest {requestedAt, requestedBy, reason, note?} and notifies the Business. The status does not change. Like every E06 action it needs If-Match and bumps the version, so the console can show "hold requested". A second request while one is pending → 409 INVALID_STATE reason: HOLD_ALREADY_REQUESTED. The request ends at the next status change (for example :wait) or reassignment.
  • An order on hold cannot be completed (409 reason: ON_HOLD).

Hold reasons (WaitingReason): CUSTOMER_UNAVAILABLE, PARTS_UNAVAILABLE, INSTALLER_UNAVAILABLE, AWAITING_APPROVAL, SITE_INACCESSIBLE, INVESTIGATION_REQUIRED, OTHER. For one release the old input values are accepted and mapped: PART → PARTS_UNAVAILABLE, APPROVAL → AWAITING_APPROVAL, SITE_ACCESS → SITE_INACCESSIBLE. Responses always carry the new values.

Completion, verification and closure (ADR 0023 D2, D4)​

  1. The Installer completes (:complete, from IN_PROGRESS). The order becomes COMPLETED, still open. The full submission is kept in the COMPLETED event.
  2. The Business verifies (:verify) → VERIFIED, recording verification {result: VERIFIED, verifiedAt, verifiedBy, notes?}. Or it sends the completion back (:reject-completion) → IN_PROGRESS, same Installer: the current completion moves into the COMPLETION_REJECTED event, and lastCompletionRejection {rejectedAt, rejectedBy, reason, instructions?} tells the Installer what to fix. The next :complete starts clean.
  3. The Business closes (:close, from VERIFIED) → CLOSED, recording businessClosure {closedAt, closedBy, note?} and closedAt. The linked alert is released here.

awaitingClosure: true on views and internal rows marks VERIFIED orders that are not closed yet.

Reopen (:reopen, from CLOSED or CANCELLED) lands in REOPENED with the technician, acceptance and assignment cleared. The previous completion, verification, closure, cancellation and actual cost move into the REOPENED event, and reopenCount goes up by one. From REOPENED the Business :assigns again (the same Installer is fine) or :cancels (owner decision O3, recommended default). If the order has an alert, reopening takes the alert's open guard again (409 ALREADY_EXISTS if another open order holds it).

Who may act (ADR 0023)​

  • The responsible Business is anyone with service ≥ MANAGE on the plant: the Business role, or a platform member intervening. Platform interventions are written to the org's access log as PLATFORM_ACCESS, and every event they write carries data.platformIntervention: true. The Business:

    • assigns, reassigns, unassigns and bulk-assigns;
    • puts orders on hold and resumes them;
    • verifies or rejects completions, and closes;
    • cancels and reopens;
    • writes instructions and actualCost (E03 / E05).

    Only it may send technicianSub / teamId on E03.

  • The assigned Installer (technician.sub is the caller) may:

    • accept or decline;
    • request a hold;
    • schedule, start and complete;
    • add notes (E08) and attachments (E09).

    This works at any visible service level, so the seeded Installer role (service: VIEW) can work its own orders. The Installer never assigns, never holds or resumes, never verifies their own work, and cannot use E05 at service: VIEW.

  • Others with service ≥ EDIT keep the EDIT actions (schedule, start, complete, E05, notes, attachments) on orders they can see. Under the visibility rule below, that means only their own orders unless they are MANAGE.

  • Crown staff. The Administrator system role equals Super Admin for work orders: both hold service: FULL with scope ALL. A per-Business limit (ADR 0014 R-3a) lowers the roles of the Business's own members only. It does not cap a Crown Administrator (owner decision O1, decided 2026-11-10: no cap).

Installers see only their own orders (WO-4). This applies to a caller who reaches the plant through an operator-org membership at service below MANAGE, with no platform membership:

RouteWhat that caller gets
E04, E05, E06, E08, E09404 for an order that is not assigned to them
E01Only their own orders (technicianSub=me is forced). Asking for someone else or quick=unassigned returns an empty page
E02Counts over their own orders
E10Their own orders, with counts over this page

Partner-org and customer-portal callers keep their existing share-based visibility.

Crown-wide reads (ADR 0023 D9)​

E01, E02 and E12 called with the caller's own PLATFORM org as {orgId} and no operatorOrgId cover every Business (LC-11). This applies to an ACTIVE PLATFORM member with scope ALL and service ≥ VIEW there (Super Admin, Administrator and Viewer by default; isCrownWideRead in packages/core/src/service/assignee-scope.ts). operatorOrgId stays available to read one Business.

  • Rows are read from a per-order list entry (WO#<w>/LISTALL), because every index slot on the order itself is taken. One shard today.
  • Every row is listed, whatever the Business's state (suspended, missing from the Businesses list) and whether the caller is also a member of that Business. Passing the Crown-wide check above is the access decision, so E01 lists every order the E02 Crown-wide counters count. Each Business read is noted in that Business's access log (PLATFORM_ACCESS). Fixed 2026-11-12, not deployed yet: earlier builds re-checked each Business through the platform fallback and dropped the rows it refused. On dev, E02 counted 4 open orders while E01 listed 1: 3 of the 4 belong to a Business the check refused. The 2026-11-10 build first dropped every row, and operatorOrgId from the PLATFORM org answered 403.
  • plantId narrows to that plant's orders, read from the plant's own partition, whatever its Business. One Business with operatorOrgId still goes through the platform fallback and can answer 403.
  • q is checked page by page: there is no search index across Businesses, so pages may be short or empty while nextCursor is present.
  • E02 returns counter-backed metrics, facets and tabs.openOrders only: no byTechnician, plans or history tab. plantId or technicianSub there needs operatorOrgId (422 VALIDATION_FAILED).
  • E12 computes its tiles over at most the tiles read budget (truncated: true beyond).

Creating an order on behalf of a Business needs nothing new: E03 takes the Business from the plant, and a platform member with MANAGE acts through the audited platform fallback.

E01 — GET /v1/orgs/{orgId}/work-orders​

Work-order table. AuthZ: service ≥ VIEW @org (operator org) or a share-based caller. Paginated.

ParamTypeRules
orgId (path)ULIDcaller is an ACTIVE member, or platform. Crown staff read one Business by passing that Business's orgId, or by calling with their PLATFORM org and operatorOrgId (WO-8; audited PLATFORM_ACCESS). Their PLATFORM org without operatorOrgId lists every Business (Crown-wide reads)
operatorOrgIdULIDWO-8: accepted only when {orgId} is the PLATFORM org the caller belongs to; lists that Business instead. From any other org → 422 VALIDATION_FAILED (field operatorOrgId). Also on E02 and E12
quickopen (default) | overdue | unassigned | progress | completed | closure | allopen = the open set (COMPLETED and VERIFIED included); progress = IN_PROGRESS + WAITING; completed = COMPLETED, VERIFIED or CLOSED; closure = VERIFIED (awaiting Business closure)
statusrepeatable WorkOrderStatus (all 11)intersected with quick; SCHEDULED is accepted as ASSIGNED
awaitingClosuretrue | falsekept for one release: true = only VERIFIED orders not yet closed (same as status=VERIFIED); false = excludes them
awaitingAcceptanceSinceISO-8601 UTCLC-16: ASSIGNED orders assigned at or before this instant (not yet answered). No automatic reassignment
createdFrom, createdToISO-8601 UTCLC-13: inclusive bounds on createdAt; createdTo before createdFrom → 400 (field createdTo)
plannedFrom, plannedToISO-8601 UTCLC-13: inclusive bounds on plannedVisitAt; orders with no planned visit are excluded; plannedTo before plannedFrom → 400 (field plannedTo)
priority, workType, sourcerepeatable enums
issueCategoryrepeatable IssueCategoryADR 0023 D6: orders with any of these reported issues; orders without one are excluded. Internal rows carry issueCategory
technicianSubrepeatable sub, unassigned or me
plantIdULIDmust be visible (else 404)
planIdULID
overduetruesame as quick=overdue
q2–64 charswith the default sort: the search index; with any other sort: that sort's order, words matched page by page (2026-11-25)
sortqueue (default) | dueAt | -createdAt | createdAt | planned | priority | status | plant | technician | device | cost (each also with -)see below; unservable → 400 VALIDATION_FAILED + details.allowed
limit, cursor

The date and awaitingAcceptanceSince filters are checked on each page read, so a page may come back short with a nextCursor, as with the other filters.

Search. q matches the order code (and its numeric tail), title words, plant name and code, customer name, device serial, technician name and alert id/code. Since ADR 0023 D10 the search tokens are written on the request path, right after each order write (see counters and search), so search works without the stream-router. Orders written before that only appear after the backfill with --counters.

Sort (ADR 0023 D11).

  • queue (default): open orders by SLA, then priority, then age; closed orders newest closed first.
  • -createdAt / createdAt: newest / oldest created first, with or without plantId, per Business or Crown-wide, also with q. Share-based callers get both on one plant and on their merged plants (2026-11-25).
  • dueAt / -dueAt (2026-11-25): on open orders dueAt is the queue order (response target first). On closed or mixed sets (quick=completed|closure|all), with plantId, and -dueAt everywhere, orders sort by responseTargetAt, with orders that have no target last in both directions. Before 2026-11-25 dueAt was refused on closed sets.
  • Column sorts (2026-11-24, ADR 0030 in cse-http-be/docs/adr/, console item 4.12). planned (planned visit; orders without one last), priority (CRITICAL first), status (lifecycle order NEW → ASSIGNED → ACCEPTED → IN_PROGRESS → WAITING → COMPLETED → VERIFIED → CLOSED → CANCELLED), plant (plant name), technician (technician name; unassigned last). A leading - reverses (so -planned puts unplanned first). Ties: oldest created first. Every filter still applies, checked page by page, so a page can be short with a nextCursor. Served from one small sort entry per order and column, written after each order change (no table scan, no new index). Orders written before the change appear only after npm run backfill:wo-console-indexes.
  • More column sorts (2026-11-25, console request W1–W6, ADR 0030 addendum). device (device label, else serial; orders without a device last ascending) and cost (the row's costDisplay amount: actual cost, else estimate; currencies are not converted or compared; orders without a cost last in both directions). Every column sort now also works with q (words matched page by page; pages may be short) and on the Crown-wide list (every Business, without operatorOrgId). Share-based callers (a partner or customer seeing the orders through plant shares) can use queue, createdAt / -createdAt (one plant or their merged plants) and dueAt (with one technicianSub) only; any other sort → 400 + details.allowed. Re-run backfill:wo-console-indexes once after deploying this: existing sort entries lack the Crown-wide copy and the new columns, so those sorts miss older orders until it runs. Run on dev 2026-11-25 (4 orders, 32 entries, 0 failures).

Invalid combinations are rejected with 400 VALIDATION_FAILED (Zod issue on the named field): overdue=true with any quick other than open or overdue (field overdue); the reversed date ranges above. Before ADR 0023, sort=-createdAt required plantId; it no longer does.

Known default (Q28): on the plantId path and the shared-plant merge path, sort=queue is accepted but rows are served newest-first (no index carries the queue key per plant). Don't render a "queue order" label there.

Response 200: { items: WorkOrderRow[], nextCursor?, access? }. access is on the first page only (no cursor, 2026-11-25): member (the org's own list, scoped or not), shared (plant shares; limited sorts, see above) or crownWide (every Business). Use it to disable the sorts a shared caller cannot use. Rows carry operator, and internal rows also awaitingClosure, acceptedAt? and businessClosedAt?. For an Installer-tier caller the list holds only their own orders (see who may act).

StatusCodeWhen
200—ok (empty → items: [])
400VALIDATION_FAILED / INVALID_CURSOR / ORG_CONTEXT_REQUIREDbad params / cursor
403FORBIDDENnot a member / service NONE
404NOT_FOUNDplantId not visible
422VALIDATION_FAILEDoperatorOrgId from a non-PLATFORM org
422SCOPE_TOO_BROADshare-based caller: tag/region share, no plant shares, or > 10 shared plants (see details below)

422 SCOPE_TOO_BROAD details (E01 and E02, B-2). Only share-based callers (partner/customer orgs) get it. Body:

// illustrative example, derived from shareScopeTooBroad() in packages/core/src/services/work-order-service.ts
{ "error": { "code": "SCOPE_TOO_BROAD", "message": "Filter by plant or technician to list these work orders",
"details": { "reason": "TOO_MANY_PLANTS", "maxPlants": 10, "narrowBy": ["plantId", "technicianSub"] }, "requestId": "<id>" } }
reasonWhen
NON_PLANT_SHAREone of the caller's active shares is a tag/region share (its plants cannot be listed)
NO_PLANT_SHARESa customer org with no plant shares
TOO_MANY_PLANTSmore shared plants than maxPlants — 10 on E01, 50 on E02

The message says summarise instead of list on E02. Narrow with plantId or technicianSub and retry.

E02 — GET /v1/orgs/{orgId}/work-orders/summary​

Metric strip, drawer facets, group-by-technician and tab counts. AuthZ service ≥ VIEW @org, or a share-based caller.

ParamTypeRules
includerepeatable, max 4: metrics (default), facets, byTechnician, tabs
plantIdULIDoptional; parsed as on E01
technicianSubrepeatable (max 20) sub, unassigned or meoptional; parsed as on E01
operatorOrgIdULIDWO-8: from the PLATFORM org only — summarise this Business. Omitted from the PLATFORM org → every Business (Crown-wide reads)
// illustrative example, derived from the schema/handler code (counter-backed, whole Business)
{ "metrics": { "pastTarget": 6, "criticalOpen": 3, "unassigned": 9, "inProgress": 11, "completedLast30d": 71,
"awaitingClosure": 4, "open": 61, "total": 348,
"draft": 7, "rejected": 2, "awaitingAcceptance": 8, "accepted": 6, "onHold": 3,
"awaitingVerification": 5, "verified": 4, "reopened": 1, "closed": 270, "cancelled": 17 },
"facets": { "status": { "NEW": 7, "ASSIGNED": 8, "COMPLETED": 5 }, "priority": { "CRITICAL": 3 } },
"byTechnician": [{ "sub": "<sub>", "displayName": "Hina R.", "open": 5, "pastTarget": 1 }],
"tabs": { "openOrders": 61, "plans": 5, "historyLast90d": 142 },
"approximate": true, "truncated": false, "asOf": "2026-11-10T09:20:00.000Z" }

facets count open orders only (owner decision 2026-12-01, report F3). Every facet (status, priority, workType, source, technician) and byTechnician count the open set (every status except CLOSED and CANCELLED), not the rows of the list the console is showing. With quick=all the facets therefore sum to the open orders, and a CLOSED order is in no facet. Label these counts "open" in the console (for example "Open by status"). Crown-wide (the PLATFORM org, no operatorOrgId) facets.technician holds only UNASSIGNED and byTechnician is not returned. A status count that disagrees with the list (for example ACCEPTED: 1 for an order that is already CLOSED, seen on dev 2026-12-01) is counter drift from the v1 → v2 lifecycle change; a human rebuilds the counters with npm run backfill:wo-lifecycle-v2 -- --counters over every org (dry-run first).

Metrics (ADR 0023 D10, LC-12).

MetricCounts
draftNEW
rejectedREJECTED
awaitingAcceptanceASSIGNED
acceptedACCEPTED
inProgressIN_PROGRESS only. Breaking: before v2 it also counted WAITING
onHoldWAITING
awaitingVerificationCOMPLETED
verifiedVERIFIED
awaitingClosureVERIFIED (kept for one release; same as verified)
reopenedREOPENED
closed, cancelledCLOSED, CANCELLED — counter-backed summaries only (a whole Business, or every Business)
open, totalthe open set (COMPLETED and VERIFIED included); every order
pastTargetopen orders past their response target (never COMPLETED / VERIFIED)
criticalOpen, unassignedopen orders with priority CRITICAL; open orders with no technician
completedLast30dorders closed (CLOSED) in the last 30 days

The metrics are scoped to the caller: an Installer gets their own orders, a Business gets its org counters, and Crown gets every Business's counters (or one Business's with operatorOrgId). The per-status counts come from COUNT#WOSTATUS#<status> counters that, since ADR 0023 D10, are written on the request path (see below).

Unfiltered ALL callers get counter-based counts (approximate: true). Any filter (plantId or technicianSub), and every scoped or share-based caller, gets counts over the visible open set with approximate: false: facets, completedLast30d, closed and cancelled are omitted there. The read is capped at 2,000 rows read / 40 pages / 2,000 visible, then truncated: true. Share-based callers with up to 50 shared plants are counted (E01 still merges only up to 10). An Installer-tier caller is always counted over their own assigned orders, through the computed path. A SCHEDULED counter left by old orders is added to ASSIGNED.

Status: 200, 400 VALIDATION_FAILED, 403 FORBIDDEN, 404 NOT_FOUND (plantId not visible), 422 VALIDATION_FAILED (Crown-wide with plantId or technicianSub but no operatorOrgId), 422 SCOPE_TOO_BROAD (details as on E01, maxPlants: 50).

E03 — POST /v1/work-orders​

Create. AuthZ service ≥ EDIT @plant; sending technicianSub, teamId or instructions needs service ≥ MANAGE (403 FORBIDDEN otherwise — WO-3, ADR 0023 D6). End users never create orders: they phone their Business, which creates the order in the console. Idempotency R.

FieldTypeReqRules
plantIdULIDyesvisible; lifecycle ACTIVE
(currency)——Cost fields are in the Business currency: read currency / localisation.currency from GET /v1/orgs/{orgId} (N-38). That route needs settings ≥ VIEW, so a creator without it cannot read the currency — open owner question (2026-10-29)
titlestring 3–160yes**optional when alert.title is given
sourceSERVICE | PLANT | DEVICE | ALERTnodefault SERVICE; ALERT needs alert; DEVICE needs deviceSerial; PLAN (plan worker) and SERVICE_REQUEST (only on orders created from a now-retired service request) are rejected
deviceSerialstring 1–64noADR 0012: a serial bound to the plant (binding), as typed or normalised; else 422 VALIDATION_FAILED (details.reason = DEVICE_NOT_ON_PLANT, details.field = deviceSerial). The order stores a device snapshot {serial, label?, model?}
deviceIdstring ≤ 64noDeprecated alias of deviceSerial (it always carried the serial). Sending both → 422
alert{alertId, code?, title?, severity?, deviceKey?}noformat only — see alert link
descriptionstring ≤ 4000noa default sentence is stored when omitted
priorityWorkOrderPrioritynodefault MEDIUM / alert-derived
workTypeWorkTypenodefault CORRECTIVE_REPAIR. This is the job type (repair, inspection …), not the reported issue
customerOrgIdULIDnoADR 0023 D6: must be the plant's customer (422 VALIDATION_FAILED, details {field: customerOrgId, reason: CUSTOMER_PLANT_MISMATCH}) and a customer of the Business (reason: CUSTOMER_NOT_LINKED). Omitted → taken from the plant, as before
instructionsstring 1–4000noADR 0023 D6: instructions for the Installer; MANAGE only
preferredDateYYYY-MM-DDnoADR 0023 D6: the customer's preferred visit day (a real calendar date). Separate from plannedVisitAt, which stays an ISO-8601 UTC instant
issueCategoryIssueCategorynoADR 0023 D6 (LC-9): the issue the customer reported. Unknown value → 400/422 validation error
technicianSubstring | nullnoa sub needs MANAGE and must be an eligible Installer of the operator org; the order starts ASSIGNED. Omitted on a Business (MANAGE) create → the plant's assigned Installer (R-5) when eligible (WO-5); otherwise, or below MANAGE, unassigned. null → always unassigned (NEW, shown as Draft)
teamIdULIDnocaller needs MANAGE; team of the operator org
plannedVisitAtISO UTCnonow − 7 d … now + 366 d; never changes the status
costEstimateMoneynoorg currency
internalNotesstring ≤ 4000no
warrantyClaimRefstring ≤ 40no

:::caution Provisional issueCategory values issueCategory (LC-9) is built with a provisional list (owner decision O5), which product has not confirmed yet: NO_GENERATION, LOW_GENERATION, INVERTER_FAULT, BATTERY_ISSUE, COMMUNICATION_LOSS, PANEL_DAMAGE, WIRING_ELECTRICAL, GRID_OR_METER, CLEANING_REQUEST, OTHER. The list may change before the console relies on it. :::

Response 201 + Location: /v1/work-orders/{id} + ETag, body WorkOrder. An assigned create also sets assignedBy and assignedAt. Attachments are added afterwards via E09.

StatusCodeWhen
201—created (replay: same body + Idempotent-Replayed)
403FORBIDDENservice < EDIT; or technicianSub / teamId / instructions sent below MANAGE
404NOT_FOUNDplant not visible
409INVALID_STATEplant archived/deleting (details.lifecycle), or details.reason: "PLANT_NOT_ORG_MANAGED" — the plant has no operator org + customer org (e.g. a legacy consumer plant)
409ALREADY_EXISTSthe alert already has an open order (details.workOrderId)
409IDEMPOTENCY_IN_PROGRESSconcurrent same key
422VALIDATION_FAILEDfield errors; device not on plant; ineligible assignee (see below); CUSTOMER_PLANT_MISMATCH / CUSTOMER_NOT_LINKED; currency mismatch
422IDEMPOTENCY_KEY_REUSEDsame key, different body
428PRECONDITION_REQUIREDmissing Idempotency-Key

Ineligible assignee (E03, :assign, bulk). The response is 422 VALIDATION_FAILED, message "assignee is not an eligible Installer for this plant", with details:

{ "field": "technicianSub", "reason": "INELIGIBLE_ASSIGNEE", "cause": "<cause>" }

cause is one of:

causeMeaning
NOT_MEMBERnot a member of the plant's operator org (partner technicians fall here)
MEMBERSHIP_INACTIVEthe membership is not ACTIVE
SERVICE_LEVELthe scope does not cover the plant, or the role is neither service ≥ EDIT nor an Installer role
PROFILE_INACTIVEthe person has a roster profile marked inactive

Before 2026-11-04 the message was "assignee lacks service access" and these values were in details.reason.

Codes are WO-YYYY-NNNN, allocated per operator org; they resolve via GET /v1/lookup.

E04 — GET /v1/work-orders/{workOrderId}​

Drawer. AuthZ service ≥ VIEW @plant; an Installer-tier caller gets 404 for an order not assigned to them. 200 WorkOrder (first 50 timeline events, all non-deleted attachments' metadata) + ETag. 403, 404.

Fields of the internal view beyond the stored basics:

FieldMeaning
operatorthe responsible Business
awaitingClosureVERIFIED and not yet closed by the Business
assignedBy?, assignedAt?who made the current assignment, and when (assignedAt is new in v2; cleared by unassign, decline and reopen)
acceptance?when and by whom the Installer accepted
lastDecline?the last decline and its reason
holdRequest?the Installer's pending hold request {requestedAt, requestedBy, reason, note?}
waiting?{reason, note?, since, holdFrom?, heldBy?} while on hold
completion?the current submission: {diagnosis, workPerformed, completionNotes?, resolution, result, hoursOnSite?, downtimeMinutes?, completedAt, completedBy, signature?}. Pre-v2 completions carry only resolution
lastCompletionRejection?the last :reject-completion {rejectedAt, rejectedBy, reason, instructions?}; cleared by :verify, reassignment or reopen
verification?{result: VERIFIED, verifiedAt, verifiedBy, notes?}
businessClosure?when and by whom the Business closed it
instructions?, preferredDate?, issueCategory?ADR 0023 D6
completions[]every :complete submission found on the loaded timeline page, newest first, at most 20. Each entry is {submittedAt, submittedBy, submission, actualCost?, outcome, rejection?, verifiedAt?}; outcome is PENDING, REJECTED, VERIFIED or SUPERSEDED
assignments[]assignment periods found on the loaded timeline page, newest first, at most 20: {technician, assignedAt, assignedBy, reason?, endedAt?, endedBy?, outcome?}; outcome is REASSIGNED, UNASSIGNED, DECLINED or REOPENED
serviceRequestId?the (retired) service request an older order came from
technician.orgNamethe assignee's org name

completions[] and assignments[] are derived from the same first 50 timeline events the drawer loads. History older than that page is not included; page through E08 for it. A suspended assignee shows assigneeStatus: "SUSPENDED"; a deleted plant shows readOnlyReason: "PLANT_DELETED". Open orders past target carry a synthetic PAST_TARGET timeline item (eventId: "sla-past-target", synthetic: true, internal only).

// illustrative example, derived from the schema/handler code (trimmed)
{ "workOrderId": "01JB7Y3R8Q2V6K1M9N4P5S7T0W", "code": "WO-2026-0499", "version": 7,
"plant": { "name": "Regal Textiles Rooftop", "code": "PL-0231" },
"source": "ALERT",
"alert": { "alertId": "8f0c-…", "code": "CRN-GRD-002", "severity": "CRITICAL", "clientSupplied": true, "linkedAt": "2026-11-08T09:12:00.000Z" },
"title": "Grid over-voltage trip", "priority": "CRITICAL", "workType": "CORRECTIVE_REPAIR",
"status": "COMPLETED", "technician": { "sub": "<sub>", "displayName": "Hina R.", "orgId": "01J…", "orgName": "Crown Solar Lahore" },
"operator": { "orgId": "01J…", "name": "Crown Solar Lahore" }, "awaitingClosure": false,
"assignedBy": { "kind": "USER", "sub": "<sub>", "displayName": "Bilal A.", "orgId": "01J…", "role": "Business" },
"assignedAt": "2026-11-08T09:20:00.000Z",
"acceptance": { "acceptedAt": "2026-11-08T09:30:00.000Z", "acceptedBy": { "kind": "USER", "sub": "<sub>", "displayName": "Hina R." } },
"instructions": "Call the site manager before arriving.", "preferredDate": "2026-11-09",
"completion": { "diagnosis": "Loose AC terminal on phase L2.", "workPerformed": "Re-terminated and torqued L2.",
"resolution": "Re-terminated and torqued L2.", "result": "RESOLVED",
"completedAt": "2026-11-09T12:05:00.000Z", "completedBy": { "kind": "USER", "sub": "<sub>", "displayName": "Hina R." } },
"completions": [{ "submittedAt": "2026-11-09T12:05:00.000Z", "submittedBy": { "kind": "USER", "sub": "<sub>", "displayName": "Hina R." },
"submission": { "…": "as completion" }, "outcome": "PENDING" }],
"assignments": [{ "technician": { "sub": "<sub>", "displayName": "Hina R.", "orgId": "01J…" }, "assignedAt": "2026-11-08T09:20:00.000Z",
"assignedBy": { "kind": "USER", "sub": "<sub>", "displayName": "Bilal A." } }],
"responseTargetAt": "2026-11-08T13:12:00.000Z", "sla": { "state": "MET", "pastTarget": false },
"viewer": { "audience": "INTERNAL", "capabilities": ["workOrder.edit", "workOrder.note", "workOrder.attach", "workOrder.reject-completion", "workOrder.verify"] } }

E05 — PATCH /v1/work-orders/{workOrderId}​

AuthZ service ≥ EDIT @plant; If-Match required. Body: ≥ 1 of title, description, priority, workType, deviceSerial (null = whole plant; deprecated alias deviceId, not both), costEstimate, internalNotes, warrantyClaimRef, parts[] (≤ 50), actions[] (≤ 50; new entries get an actionId, existing ones are immutable except removal), checklist[] (≤ 30, {itemId?, text, done}), preferredDate (YYYY-MM-DD), issueCategory (null clears), and two fields that need service ≥ MANAGE (403 otherwise):

  • instructions (1–4000): instructions for the Installer;
  • actualCost (Money, org currency): the Business enters or corrects the cost until the order is closed. Since v2 :complete no longer requires it.

null clears an optional field. status, technicianSub, plantId, source, alert, code, version are rejected as unknown keys (422). Over-cap arrays → 422 LIMIT_EXCEEDED (details {limit, field}).

E05 works on every open order, COMPLETED and VERIFIED included. A CLOSED or CANCELLED order → 409 INVALID_STATE with details.reason: "CLOSED" (reopen it first). The Installer cannot change title, description, customer or plant: at service: VIEW they have no E05 at all.

200 WorkOrder · 403 · 404 · 409 VERSION_CONFLICT · 409 INVALID_STATE (CLOSED, or read-only) · 422 · 428. Appends one FIELDS_CHANGED event {fields, previous?, next?}: previous / next hold the before and after values of the scalar fields among fields (title, description, priority, workType, deviceId, costEstimate, actualCost, warrantyClaimRef, instructions, preferredDate, issueCategory, responseTargetAt); an absent value is null. List fields (parts, actions, checklist) are only named.

E06 — POST /v1/work-orders/{workOrderId}:{action}​

All need If-Match; Idempotency O. Response 200 WorkOrder. Every body is strict (unknown keys → 422). Transitions are in the state machine.

ActionBodyWhoNotes
:assign{technicianSub: string | null, teamId?: ULID | null, reason?: 1–1000}MANAGEnull unassigns (from ASSIGNED / ACCEPTED only). The assignee must be eligible. reason is required when the order already has a different assignee (422 VALIDATION_FAILED, details.field: reason), optional otherwise; it is stored in the REASSIGNED / UNASSIGNED event. A new assignee clears acceptance, holdRequest and lastCompletionRejection and sets assignedBy / assignedAt
:accept{} or no bodyassignee onlyASSIGNED → ACCEPTED; records acceptance; ACCEPTED event (internal)
:decline{reason 1–1000}assignee onlyASSIGNED → REJECTED, unassigned; records lastDecline; DECLINED event (internal — the reason is for the Business)
:schedule{plannedVisitAt}EDIT or assigneesets the date only (now − 7 d … now + 366 d); SCHEDULED / RESCHEDULED event (customer-visible)
:start{onSiteAt?}EDIT or assigneeACCEPTED only (NOT_ACCEPTED from ASSIGNED, NOT_ASSIGNED when unassigned). onSiteAt defaults to now, not in the future, not before createdAt; the first start sets respondedAt
:request-hold{reason: WaitingReason, note?: 1–1000}assignee onlystatus unchanged; records holdRequest; HOLD_REQUESTED event (internal); notifies the Business. HOLD_ALREADY_REQUESTED while one is pending
:wait{reason: WaitingReason, note? ≤ 1000, warrantyClaimRef? ≤ 40}MANAGEfrom ASSIGNED, ACCEPTED, IN_PROGRESS; stores waiting.holdFrom and heldBy; WAITING event (shown as On Hold)
:resume{}MANAGEback to waiting.holdFrom; RESUMED event with the hold's reason, start and heldBy
:complete{diagnosis 1–4000, workPerformed 1–4000, completionNotes?: 1–4000, result, actualCost?, hoursOnSite? 0–999.9, downtimeMinutes? 0–525600, signature?: {attachmentId, signerName ≤ 120}}EDIT or assigneeIN_PROGRESS only (ON_HOLD from WAITING). diagnosis and workPerformed are required: one 422 lists every missing one (below). resolution is accepted as an alias of workPerformed for one release. actualCost is optional and must be in the org currency. signature must be a READY SIGNATURE attachment on this order
:reject-completion{reason 1–1000, instructions?: 1–4000}MANAGECOMPLETED → IN_PROGRESS; moves completion into the COMPLETION_REJECTED event (internal); sets lastCompletionRejection; notifies the Installer
:verify{notes?: 1–1000} or no bodyMANAGE, never the InstallerCOMPLETED → VERIFIED; records verification; VERIFIED event (customer-visible). notes is also appended as an internal NOTE event. The Installer → 403 reason: SELF_VERIFY
:close{remarks?: 1–1000} or no bodyMANAGEVERIFIED → CLOSED (NOT_VERIFIED from COMPLETED); records businessClosure (remarks is stored as its note) and closedAt; releases the alert; CLOSED event (customer-visible). note is accepted as an alias of remarks for one release
:cancel{reason: DUPLICATE|WITHDRAWN|NOT_A_FAULT|OTHER, note? ≤ 1000, duplicateOfWorkOrderId?}MANAGEnot from COMPLETED / VERIFIED; duplicate-of must be a visible order of the same org (not itself); sets closedAt; releases the alert
:reopen{reason 1–1000}MANAGECLOSED / CANCELLED → REOPENED, unassigned; see reopen

:complete with missing fields.

// illustrative example, derived from planTransition() in packages/core/src/service/work-order-state.ts
{ "error": { "code": "VALIDATION_FAILED", "message": "Validation failed",
"details": { "fields": ["diagnosis", "workPerformed"],
"issues": [{ "path": "diagnosis", "message": "diagnosis is required" },
{ "path": "workPerformed", "message": "workPerformed is required" }] },
"requestId": "<id>" } }
StatusCodeWhen
403FORBIDDENnot the Business for a MANAGE action; not the assignee for :accept / :decline / :request-hold; below EDIT and not the assignee otherwise; details.reason: SELF_VERIFY on :verify by the Installer
404NOT_FOUNDnot visible (incl. an Installer-tier caller on someone else's order); unknown action
409INVALID_STATEnot allowed from the current status (details {from, action, allowed}, plus reason NOT_ASSIGNED / NOT_ACCEPTED / ALREADY_ACCEPTED / ON_HOLD / NOT_VERIFIED / ALREADY_CLOSED / HOLD_ALREADY_REQUESTED) or read-only (PLANT_DELETED) — checked before body validation
409VERSION_CONFLICTstale If-Match
409ALREADY_EXISTSreopen while another open order holds the alert
422VALIDATION_FAILEDfield errors; reassign without reason (details.field: reason); :complete missing diagnosis / workPerformed (details.fields); ineligible assignee (details.reason: INELIGIBLE_ASSIGNEE); bad dates; decline / reopen / reject-completion reason; currency mismatch
428PRECONDITION_REQUIREDno If-Match

Close and cancel emit workorder.completed.v1 (outcome COMPLETED / CANCELLED) and reopen emits workorder.linked.v1 when an alert is linked.

Automatic cancel on detach (RBAC v2, 2026-11-14): when a Business detaches an End User, each of its open, writable orders on the plants that move back is cancelled by the system through this same transition — reason: WITHDRAWN, note starting END_USER_DETACHED, actor { kind: SYSTEM } — with the usual event, alert release and workorder.completed.v1. Finished orders are untouched. :complete no longer emits anything.

Activity history (WO-9, ADR 0023 D8)​

Every create, assign, reassign, unassign, accept, decline, schedule, start, hold request, hold, resume, complete, completion rejection, verify, close, cancel and reopen writes timeline events in the same transaction as the change. No route edits or deletes an event.

  • Each event carries actor {kind, sub, displayName, orgId?, role?, viaPlatform?} and at. role (new) is the name of the role the actor held in the acting org at the time; it is absent on older events.
  • viaPlatform: true (2026-11-12) marks an actor who is Crown staff acting through platform access. A reader with no Crown membership gets that actor as {kind, displayName: "Crown Support", viaPlatform: true} — no sub, orgId or role. Applies to events, notes and attachments written since then; older ones are shown as stored (Role boundaries).
  • Assignment events, SCHEDULED / RESCHEDULED and FIELDS_CHANGED carry data.previous and data.next. REASSIGNED and UNASSIGNED carry reason when one was given.
  • COMPLETED carries the full submission in data.completion (and data.actualCost when sent). COMPLETION_REJECTED carries the rejected submission, reason and instructions. REOPENED carries the closing facts it cleared.
  • New kinds: VERIFIED, COMPLETION_REJECTED, HOLD_REQUESTED.
VisibilityEvents
Customer-visibleevents that change the status (including VERIFIED); SCHEDULED / RESCHEDULED; CLOSED
InternalREASSIGNED without a status change, ACCEPTED, DECLINED, COMPLETION_REJECTED, HOLD_REQUESTED, field/attachment/checklist changes, and notes unless posted as CUSTOMER

Customers only see from, to, plannedVisitAt and result of an event's data. An event written by a platform member acting in a Business they do not belong to carries data.platformIntervention: true.

Notifications (WO-10, ADR 0023 D8)​

These go to the in-app inbox (notifications). "The Business" means the user who made the current assignment (assignedBy) and the order's creator. Nobody is notified about their own action.

KindWhenRecipient
WORK_ORDER_ASSIGNEDassigned or reassignedthe new assignee
WORK_ORDER_UNASSIGNEDreassigned or unassignedthe previous assignee
WORK_ORDER_ACCEPTED, WORK_ORDER_DECLINEDaccept, declinethe Business
WORK_ORDER_STARTEDACCEPTED → IN_PROGRESSthe Business
WORK_ORDER_PROGRESSthe assignee adds a note (E08)the Business; at most one per order per recipient per hour
WORK_ORDER_HOLD_REQUESTED:request-holdthe Business
WORK_ORDER_COMPLETED:completethe Business
WORK_ORDER_COMPLETION_REJECTED:reject-completionthe Installer
WORK_ORDER_VERIFIED:verifythe Business
WORK_ORDER_ON_HOLD, WORK_ORDER_RESUMED:wait, :resumethe Installer and the Business
WORK_ORDER_CLOSED, WORK_ORDER_CANCELLED:close, :cancelthe Installer and the Business
WORK_ORDER_STATUSany other status changethe creator, unless one of the items above already reached them

There is no _REASSIGNED kind: a reassignment sends WORK_ORDER_UNASSIGNED to the previous Installer and WORK_ORDER_ASSIGNED to the new one. Crown staff monitor through the activity history and the Crown-wide list, not their inbox: fanning every Business's events out to every platform member would cost one write per event per member.

These items are written on the request path right after the change (best-effort, since 2026-11-05), so they arrive even though no stage deploys the stream-router yet (KI-43). The ids are deterministic, so when the stream-router does run, its copy of the same change is a no-op. WORK_ORDER_PROGRESS ids embed the hour, so later notes in the same hour create nothing.

Counters and search on the request path (ADR 0023 D10)​

The E02 counters (per Business, and Crown-wide under ORG#ALL), the COUNT#WOSTATUS#<status> per-status counters and the E01 q search tokens used to be written only by the stream-router, which no stage deploys (KI-43). Since v2 they are applied right after each order write (create, action, E05, and orders a maintenance plan creates), by the same projector code (packages/core/src/service/wo-projection-bridge.ts), with one dedup id per order version. Plan-created orders were not counted before 2026-11-12 (fixed, not deployed yet), so counters can be low after a plan run; the backfill with --counters corrects them. This is best-effort: a failure is logged and never fails the request. If the stream-router is deployed later, its copy is a no-op. Counters of orders written before v2 are rebuilt by the backfill with --counters.

E07 — Bulk: POST /v1/work-orders:bulk-assign · :bulk-reschedule · :bulk-cancel · :bulk-create​

The URL the client calls is exactly as shown. API Gateway cannot register a : in a route key (CR-2), so these are served by the shared POST /v1/{collection} route (PlantsCollectionAction), which splits work-orders:<verb> out of the path; any other collection or verb is 404.

AuthZ service ≥ MANAGE @plant for every affected plant, checked before any write. Idempotency R.

VerbBody
bulk-assign{workOrderIds: ULID[1..50], technicianSub, teamId?, reason?: 1–1000}. reason follows :assign: an item that already has another assignee fails with 422 without it
bulk-reschedule{workOrderIds, plannedVisitAt}
bulk-cancel{workOrderIds, reason, note?}
bulk-create{items: [{plantId, deviceSerial?, alert, title?, priority?, workType?}] (1..50), technicianSub?} (deviceId = deprecated alias)

200 { results: [{id|index, ok: true, workOrder} | {id|index, ok: false, error: {code, message, details?}}] } even when some items fail. 403 FORBIDDEN with details.deniedPlantIds (≤ 20) means nothing was applied. 422 LIMIT_EXCEEDED (> 50) / VALIDATION_FAILED (incl. duplicate ids). Per-item codes: NOT_FOUND, INVALID_STATE, VERSION_CONFLICT, VALIDATION_FAILED, ALREADY_EXISTS.

E08 — Timeline: POST / GET /v1/work-orders/{workOrderId}/events​

  • POST (progress note): service ≥ EDIT @plant or the assigned Installer at any level, Idempotency R, 300 notes/hour/user (429 RATE_LIMITED). Body:

    FieldRules
    text1–2000, required
    visibilityINTERNAL (default) | CUSTOMER
    kindADR 0023 D5: GENERAL (default, the pre-v2 note), FINDING, DIAGNOSIS, WORK_PERFORMED, MATERIAL, ISSUE, INSTRUCTION_REQUEST
    materialonly with kind: MATERIAL (422 otherwise): {name 1–200, quantity? > 0 (≤ 100000), serialNumber? 1–64, replacedSerialNumber? 1–64}

    201 with the NOTE event. A typed note stores {kind, material?} in the event's data; a GENERAL note keeps the pre-v2 shape. A note by the assigned Installer sends WORK_ORDER_PROGRESS to the Business (at most once per order and recipient per hour). 409 INVALID_STATE on a CLOSED or CANCELLED order (details.reason: CLOSED) or a read-only one; 422 LIMIT_EXCEEDED (> 1,000 events).

    // illustrative example request body, derived from AddWorkOrderNoteInput in packages/core/src/schemas.ts
    { "text": "Replaced the AC surge protector.", "kind": "MATERIAL",
    "material": { "name": "AC SPD Type 2", "quantity": 1, "serialNumber": "SPD-2291", "replacedSerialNumber": "SPD-0457" } }
  • GET: service ≥ VIEW @plant; limit (default 15 on the first page, 10 with a cursor), cursor; chronological ascending; customer audience sees CUSTOMER events only. {items: WorkOrderEvent[], nextCursor?}.

E09 — Attachments​

Bytes never pass through the API. Flow:

  1. POST /v1/work-orders/{id}/attachments — service ≥ EDIT or the assigned Installer, Idempotency R, 120 presigns/hour/user. Body {kind: PHOTO|DOCUMENT|SIGNATURE, contentType: image/jpeg|image/png|application/pdf, sizeBytes ≤ 20 MiB, label? ≤ 120, visibility?}. A SIGNATURE must be image/png and ≤ 1 MiB. 201 with a PENDING attachment and a presigned PUT (≤ 15 min).
  2. Client PUTs the bytes to upload.url with exactly the returned headers.
  3. POST …/attachments/{attachmentId}:confirm — EDIT or the assignee, Idempotency O. Server HEADs the object, copies it to its final key and flips it READY (+ ATTACHMENT_ADDED event). 409 INVALID_STATE (OBJECT_MISSING, or not PENDING); 422 VALIDATION_FAILED (SIZE_MISMATCH / TYPE_MISMATCH — the object is deleted, start again).
  4. GET …/attachments/{attachmentId} — VIEW; {attachment, download: {url, expiresAt}} (≤ 5 min). 404 for PENDING/DELETED and, for the customer audience, INTERNAL attachments.
  5. DELETE …/attachments/{attachmentId} — EDIT or the assignee, no If-Match; 204. 409 INVALID_STATE (SIGNATURE_OF_COMPLETED_ORDER) for the signature of an order that has a completion, or for a read-only order. Soft delete; ATTACHMENT_REMOVED event.
// illustrative example, derived from the schema/handler code; URL is a placeholder
{ "attachment": { "attachmentId": "01J…", "status": "PENDING", "kind": "PHOTO", "contentType": "image/jpeg", "sizeBytes": 812334 },
"upload": { "method": "PUT", "url": "https://<presigned-url>", "headers": { "Content-Type": "image/jpeg", "Content-Length": "812334" }, "expiresAt": "…" } }

Limits: 30 attachments per order (422 LIMIT_EXCEEDED); type/size errors 422 VALIDATION_FAILED. Create, confirm and delete answer 409 INVALID_STATE on a CLOSED or CANCELLED order (details.reason: CLOSED, ADR 0023) and on read-only orders. Unconfirmed uploads expire from the bucket's pending/ prefix after 1 day. Without the bucket configured (SERVICE_FILES_BUCKET unset) every E09 call answers 503 DEPENDENCY_UNAVAILABLE before any write.

Service requests (retired)​

ADR 0023 D12 (LC-17) removed the service-request routes that ADR 0019 (WO-7) added on 2026-11-04. End users no longer submit anything: they phone their Business, which creates the order with E03. Removed from the API stack:

  • POST /v1/plants/{plantId}/service-requests
  • GET /v1/orgs/{orgId}/service-requests
  • GET /v1/me/service-requests
  • GET /v1/service-requests/{requestId}, :accept, :decline
  • POST /v1/service-requests/{requestId}/attachments and …/attachments/{attachmentId} (:confirm, GET)

SERVICE_REQUEST_SUBMITTED and SERVICE_REQUEST_DECIDED inbox items are no longer produced; older ones stay readable until their 90-day expiry. Nothing is deleted: existing SR#… items stay in the table, and orders created from a request keep source: SERVICE_REQUEST and serviceRequestId. The handler and core service remain in the code tree, unreachable. Until the next deploy, dev still serves these routes.

Web console additions​

See Web console additions (N-37 … N-51) for the newer, not-yet-deployed fields and routes on this area.