Skip to main content

Get Anomaly Status

GET 

/api/v1/devices/anomaly-status

Return active anomaly state (stuck / overdue) per device for the caller's workspace.

Read-only aggregation of the two Phase 130 trigger-state tables (DeviceStuckTriggerState and ShiftOverdueTriggerState). For each device in the caller's workspace that has at least one is_stale=True row in either table, the response includes one entry with the union of active anomaly types.

Authorization:

  • Managers/owners: see anomalies for all workspace devices.
  • Field workers: only see anomalies for their own device (intersected via get_devices_for_user).
  • Cross-workspace state rows are never returned (queries are scoped to request.auth.workspace_id derived from the validated JWT/API key).

Response shape:

{
"devices": [
{"id": "<uuid>", "anomalies": ["overdue", "stuck"]},
...
]
}

Anomalies are ordered with "overdue" first (severity ordering per 132-CONTEXT.md DASH-01). Devices with no active anomalies are omitted. Empty workspaces return {"devices": []} (never 404).

Polled every ~15s by the dashboard; no per-request logging by design (would flood CloudWatch). Cache deferred per DASH-01.

Request

Responses

OK