Skip to main content

Charts and Dashboards

The dashboard's chart widgets read their data from these endpoints, and you can too: several machines' metrics over one period, reduced to a few hundred points per series. Every endpoint is authenticated with a Bearer JWT (see Authentication), and covers only the machines you may see.

Endpoints​

MethodPathDescription
POST/api/v1/charts/seriesUp to six series over one period, one point per interval
GET/api/v1/charts/metricsThe metrics each machine reports, with the raw tags they arrive as
GET/api/v1/settings/dashboard-presetsEach role's default dashboard
PUT/api/v1/settings/dashboard-presetsSave a role's default dashboard (admin)

Chart series​

POST /api/v1/charts/series

{
"series": [
{ "machine_id": "MACHINE_UUID_1", "metric": "pressure" },
{ "machine_id": "MACHINE_UUID_2", "metric": "pressure" }
],
"range_hours": 168,
"aggregation": "max"
}
FieldTypeDescription
seriesobject[]1–6 pairs of machine_id and metric, none twice
range_hoursintThe period: 1, 6, 24, 168 (7 days), 720 (30 days) or 2160 (90 days). Default 24
aggregationstringHow each interval's readings become one point: avg (default), min or max

The interval is chosen for the period so that a series has at most about 240 points: 1 minute for an hour, 5 minutes for 6 hours, 15 minutes for a day, 1 hour for a week, 3 hours for 30 days and 12 hours for 90 days. Intervals line up with the machine page's charts. The period never reaches back past your data-retention window.

{
"start": "2026-11-07T12:00:00Z",
"end": "2026-11-14T12:00:00Z",
"bucket_seconds": 3600,
"aggregation": "max",
"series": [
{
"machine_id": "MACHINE_UUID_1",
"machine_name": "Press 4",
"metric": "pressure",
"unit": "bar",
"points": [
{ "t": "2026-11-07T12:00:00Z", "v": 4.61 },
{ "t": "2026-11-07T13:00:00Z", "v": 4.58 }
]
}
]
}

Series come back in the order asked for. t is the start of each interval. An interval with no readings has no point, and a metric with no readings in the period has an empty points list. A machine that is not yours, or that you may not see, answers 404 for the whole request.

What can be charted​

GET /api/v1/charts/metrics?machine_id=MACHINE_UUID_1&machine_id=MACHINE_UUID_2

Lists, for each machine, the metrics it reports and the raw tags they arrive as (when those differ from the metric's name), so a chart can be built by tag as well as by metric. machine_id can be repeated, up to 200 times. Without it, every machine you may see is listed.

[
{ "machine_id": "MACHINE_UUID_1", "metric": "pressure", "unit": "bar", "tags": ["PLC.DB1.P_LINE"] },
{ "machine_id": "MACHINE_UUID_1", "metric": "temperature", "unit": "°C", "tags": [] }
]

Dashboard presets​

Each role can have a default dashboard, which a person starts from until they arrange their own. A layout is a list of widgets; a chart widget carries its definition, and an item added from the dashboard's catalogue (a KPI tile, a list of work orders, a note) carries its settings.

GET /api/v1/settings/dashboard-presets (any role) returns them by role:

{
"presets": {
"operator": {
"widgets": [
{ "id": "stat-cards", "labelKey": "dashboard.widgetStatCards", "visible": true, "size": "full" },
{
"id": "chart-5f0c…",
"labelKey": "dashboard.widgetChart",
"visible": true,
"size": "full",
"chart": {
"title": "Line 2 pressures",
"kind": "line",
"range_hours": 24,
"aggregation": "avg",
"series": [{ "machine_id": "MACHINE_UUID_1", "metric": "pressure" }]
}
},
{
"id": "item:9a1e…",
"labelKey": "dashboard.widgetItem",
"visible": true,
"size": "half",
"item": { "kind": "work-orders", "title": "", "config": { "scope": "mine", "rows": 5 } }
}
],
"statMetrics": [{ "metricId": "critical_count" }]
}
}
}

PUT /api/v1/settings/dashboard-presets (admin) saves one role's:

{ "role": "operator", "widgets": [ … ], "statMetrics": [ … ] }

role is admin, operator or viewer; size is full or half. A chart widget's chart is checked as POST /api/v1/charts/series checks it, plus a title (up to 80 characters) and a kind: line, or area for a single series. A chart that could not be drawn is refused with 422.

A chart in a role's default covers the machines it names; someone who may not see one of them sees the chart say so instead of the data.

A catalogue item's item is its kind (a lowercase name such as kpi, work-orders or note, up to 40 characters), the title the person gave it (up to 80 characters; empty, it is named after what it shows), and its config: plain values or a list of names, at most 4 KB in all. The portal decides what each kind and setting means, and takes a setting it does not recognise as the kind's default. An item whose data is on a page someone may not open is not shown to them. Anything outside these bounds is refused with 422.