Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Kr-Yogsa/ECE-BOT/llms.txt

Use this file to discover all available pages before exploring further.

These three endpoints give operators and admins access to real-time and historical telemetry data collected from each registered machine. All requests require a valid Bearer token with at least the operator role. A machine is considered offline when no telemetry has been received within MACHINE_OFFLINE_AFTER_SECONDS (default: 15 seconds).

GET /api/machine-stats/

Returns the most recent telemetry reading for a single machine, along with its current online/offline status.

Path parameters

machine_id
string
required
The machine identifier. Accepted values include cnc, plc, and melfa. The value is normalized to lowercase before lookup.

Headers

Authorization
string
required
Bearer token for an operator or admin account. Example: Bearer <token>.

Response

machine_id
string
required
Normalized machine identifier.
machine_name
string
required
Human-readable display name for the machine (e.g., "CNC").
has_data
boolean
required
true when at least one telemetry record exists for this machine.
stats
object
Latest telemetry record. null when has_data is false.
status
object
required
Current online/offline status derived from the latest telemetry timestamp.
curl --request GET \
  --url https://your-host/api/machine-stats/cnc \
  --header "Authorization: Bearer <token>"
200
{
  "machine_id": "cnc",
  "machine_name": "CNC",
  "has_data": true,
  "stats": {
    "temperature": 29.4,
    "humidity": 61.0,
    "vibration": 0.0314,
    "recorded_at": "2026-05-05T10:30:00Z"
  },
  "status": {
    "is_online": true,
    "status_text": "Components are on",
    "offline_after_seconds": 15
  }
}
404
{
  "error": "Unknown machine selected."
}

GET /api/machine-stats//dashboard

Returns time-windowed aggregated summaries and a short trend series suitable for rendering charts on the operator dashboard.

Path parameters

machine_id
string
required
The machine identifier (e.g., cnc, plc, melfa).

Headers

Authorization
string
required
Bearer token for an operator or admin account.

Response

machine_id
string
required
Normalized machine identifier.
machine_name
string
required
Human-readable display name.
has_data
boolean
required
true when telemetry records exist.
latest
object
Most recent raw telemetry record (same shape as stats in the single-machine endpoint).
status
object
required
Online/offline status (same shape as the single-machine endpoint).
summaries
object
Time-windowed averages. Each key represents a window (e.g., last 1 minute, last 5 minutes) and contains averaged sensor values for that period.
trend
array
Short ordered series of telemetry records for chart rendering. Each entry has the same shape as a stats record.
curl --request GET \
  --url https://your-host/api/machine-stats/cnc/dashboard \
  --header "Authorization: Bearer <token>"
200
{
  "machine_id": "cnc",
  "machine_name": "CNC",
  "has_data": true,
  "latest": {
    "temperature": 29.4,
    "humidity": 61.0,
    "vibration": 0.0314,
    "recorded_at": "2026-05-05T10:30:00Z"
  },
  "status": {
    "is_online": true,
    "status_text": "Components are on",
    "offline_after_seconds": 15
  },
  "summaries": {
    "1min": { "temperature": 29.2, "humidity": 60.8, "vibration": 0.031 },
    "5min": { "temperature": 28.9, "humidity": 60.5, "vibration": 0.030 }
  },
  "trend": [
    { "temperature": 28.8, "humidity": 60.2, "vibration": 0.029, "recorded_at": "2026-05-05T10:25:00Z" },
    { "temperature": 29.1, "humidity": 60.6, "vibration": 0.031, "recorded_at": "2026-05-05T10:27:00Z" },
    { "temperature": 29.4, "humidity": 61.0, "vibration": 0.031, "recorded_at": "2026-05-05T10:30:00Z" }
  ]
}

GET /api/machine-stats//history

Returns a paginated list of recent telemetry records for a machine. Useful for data exports, auditing, and preparing ML datasets.

Path parameters

machine_id
string
required
The machine identifier (e.g., cnc, plc, melfa).

Query parameters

limit
number
default:"100"
Number of records to return. Accepted range: 11000. Values outside this range are clamped automatically.

Headers

Authorization
string
required
Bearer token for an operator or admin account.

Response

machine_id
string
required
Normalized machine identifier.
machine_name
string
required
Human-readable display name.
count
number
required
Number of records returned in this response.
history
array
required
Ordered list of telemetry records (most recent first). Each entry has the same shape as a stats record.
Passing a non-numeric limit value returns a 400 error with {"error": "limit must be a number."}. Out-of-range numeric values are silently clamped to 11000.
curl --request GET \
  --url "https://your-host/api/machine-stats/cnc/history?limit=50" \
  --header "Authorization: Bearer <token>"
200
{
  "machine_id": "cnc",
  "machine_name": "CNC",
  "count": 50,
  "history": [
    {
      "temperature": 29.4,
      "humidity": 61.0,
      "vibration": 0.0314,
      "recorded_at": "2026-05-05T10:30:00Z"
    }
  ]
}
400
{
  "error": "limit must be a number."
}

Build docs developers (and LLMs) love