{
    "openapi": "3.1.0",
    "info": {
        "title": "Ruang IoT REST API",
        "version": "1.0.0",
        "description": "API to read projects, devices, latest values and history; to send values from non-MQTT devices; and to send commands. All times are in WIB (ISO 8601, +07:00). Authenticate with a workspace API key (account menu → API & Webhooks).",
        "contact": {
            "name": "Ruang IoT",
            "url": "https://ruangiot.id/docs/api"
        }
    },
    "servers": [
        {
            "url": "https://ruangiot.id/api/v1"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        },
        {
            "apiKeyHeader": []
        }
    ],
    "tags": [
        {
            "name": "Project",
            "description": "Projects in the API key's workspace."
        },
        {
            "name": "Device",
            "description": "Devices, variables, latest values and history."
        },
        {
            "name": "Data",
            "description": "Send values over HTTP for non-MQTT devices."
        },
        {
            "name": "Command",
            "description": "Send a command to a Command variable."
        }
    ],
    "paths": {
        "/projects": {
            "get": {
                "operationId": "listProjects",
                "tags": [
                    "Project"
                ],
                "summary": "Workspace projects",
                "description": "Projects in the API key's workspace, paginated.\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "List of projects.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data",
                                        "meta"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Project"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/PageMeta"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    }
                ]
            }
        },
        "/projects/{project}": {
            "get": {
                "operationId": "getProject",
                "tags": [
                    "Project"
                ],
                "summary": "Project details",
                "description": "One project owned by the API key's workspace.\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "Project.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Project"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "project",
                        "in": "path",
                        "required": true,
                        "description": "Project ID (AUTH_TOKEN in the device program).",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{1,64}$"
                        }
                    }
                ]
            }
        },
        "/projects/{project}/devices": {
            "get": {
                "operationId": "listProjectDevices",
                "tags": [
                    "Project"
                ],
                "summary": "Devices in a project",
                "description": "Every device of the project with its status (Online, Inactive, Offline, Never connected).\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "List of devices.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/DeviceSummary"
                                            }
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "project",
                        "in": "path",
                        "required": true,
                        "description": "Project ID (AUTH_TOKEN in the device program).",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{1,64}$"
                        }
                    }
                ]
            }
        },
        "/projects/{project}/alerts": {
            "get": {
                "operationId": "listProjectAlerts",
                "tags": [
                    "Project"
                ],
                "summary": "Project alarms",
                "description": "The project's Alarms & Automation events. Default: open alarms (Active and Acknowledged).\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "List of alarm events.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AlertEvent"
                                            }
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "422": {
                        "$ref": "#/components/responses/E422"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "project",
                        "in": "path",
                        "required": true,
                        "description": "Project ID (AUTH_TOKEN in the device program).",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{1,64}$"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "all"
                            ],
                            "default": "open"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    }
                ]
            }
        },
        "/devices/{device}": {
            "get": {
                "operationId": "getDevice",
                "tags": [
                    "Device"
                ],
                "summary": "Device details",
                "description": "Device with its variables.\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "Device.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/DeviceDetail"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "device",
                        "in": "path",
                        "required": true,
                        "description": "Device ID.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                    }
                ]
            }
        },
        "/devices/{device}/variables": {
            "get": {
                "operationId": "listDeviceVariables",
                "tags": [
                    "Device"
                ],
                "summary": "Device variables",
                "description": "Device Data & Topics: Sensor (telemetry), Command (command) and Status.\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "List of variables.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Variable"
                                            }
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "device",
                        "in": "path",
                        "required": true,
                        "description": "Device ID.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                    }
                ]
            }
        },
        "/devices/{device}/latest": {
            "get": {
                "operationId": "getDeviceLatest",
                "tags": [
                    "Device"
                ],
                "summary": "Latest device values",
                "description": "Latest value of every variable (the same source as the Overview and Devices pages).\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "Latest values.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data",
                                        "meta"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/LatestValue"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/LatestMeta"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "device",
                        "in": "path",
                        "required": true,
                        "description": "Device ID.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                    }
                ]
            }
        },
        "/devices/{device}/history": {
            "get": {
                "operationId": "getDeviceHistory",
                "tags": [
                    "Device"
                ],
                "summary": "Device value history",
                "description": "Value history within a time range. interval=raw returns the original points (at most limit); minute/hour/day/month return the average, minimum, maximum, sum and count per WIB time bucket (computed in the database). Valid-quality data only.\n\nRequired API key scope: `read`.",
                "x-ruangiot-scope": "read",
                "responses": {
                    "200": {
                        "description": "History series per variable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data",
                                        "meta"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/HistorySeries"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/HistoryMeta"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "422": {
                        "$ref": "#/components/responses/E422"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "device",
                        "in": "path",
                        "required": true,
                        "description": "Device ID.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                    },
                    {
                        "name": "variable",
                        "in": "query",
                        "description": "Variable keys, comma separated. Default: every numeric and ON/OFF variable.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "description": "Start of the range (ISO 8601). Default: 24 hours before \"to\". No time zone = WIB.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "description": "End of the range (ISO 8601). Default: now.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "interval",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "raw",
                                "minute",
                                "hour",
                                "day",
                                "month"
                            ],
                            "default": "raw"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "For interval=raw.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 5000,
                            "default": 1000
                        }
                    }
                ]
            }
        },
        "/devices/{device}/data": {
            "post": {
                "operationId": "sendDeviceData",
                "tags": [
                    "Data"
                ],
                "summary": "Send values",
                "description": "Stores Sensor/Status values over HTTP. It uses the same path as MQTT messages: history, the device's Online status, Alarms & Automation, Digital Twin and the data.received webhook. Command variables are rejected.\n\nRequired API key scope: `write`.",
                "x-ruangiot-scope": "write",
                "responses": {
                    "202": {
                        "description": "Values accepted.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/IngestResult"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "415": {
                        "$ref": "#/components/responses/E415"
                    },
                    "422": {
                        "$ref": "#/components/responses/E422"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    }
                },
                "parameters": [
                    {
                        "name": "device",
                        "in": "path",
                        "required": true,
                        "description": "Device ID.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/IngestRequest"
                            },
                            "example": {
                                "values": {
                                    "suhu": 27.5,
                                    "kelembapan": 61
                                },
                                "timestamp": "2026-11-21T08:00:00+07:00"
                            }
                        }
                    }
                }
            }
        },
        "/devices/{device}/commands": {
            "post": {
                "operationId": "sendDeviceCommand",
                "tags": [
                    "Command"
                ],
                "summary": "Send command",
                "description": "Sends a command to a Command variable through the same path as the dashboard and Alarms & Automation. Requires the API key creator's control permission (edit access to the project; school-loaned devices only while the control permission is active).\n\nRequired API key scope: `control`.",
                "x-ruangiot-scope": "control",
                "responses": {
                    "202": {
                        "description": "Command sent.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/CommandResult"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/E401"
                    },
                    "403": {
                        "$ref": "#/components/responses/E403"
                    },
                    "404": {
                        "$ref": "#/components/responses/E404"
                    },
                    "415": {
                        "$ref": "#/components/responses/E415"
                    },
                    "422": {
                        "$ref": "#/components/responses/E422"
                    },
                    "429": {
                        "$ref": "#/components/responses/E429"
                    },
                    "503": {
                        "$ref": "#/components/responses/E503"
                    }
                },
                "parameters": [
                    {
                        "name": "device",
                        "in": "path",
                        "required": true,
                        "description": "Device ID.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CommandRequest"
                            },
                            "example": {
                                "variable": "lampu",
                                "value": true
                            }
                        }
                    }
                }
            }
        }
    },
    "webhooks": {
        "alert.triggered": {
            "post": {
                "operationId": "webhookAlertTriggered",
                "summary": "Alarm triggered",
                "description": "Headers: X-RuangIoT-Event (type), X-RuangIoT-Event-Id (event ID), X-RuangIoT-Delivery (delivery ID), X-RuangIoT-Timestamp (Unix seconds), X-RuangIoT-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>. Reject timestamps older than 5 minutes. Answer 2xx within 6 seconds; anything else is retried (10 s, 1 min, 5 min, 30 min).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookAlertTriggered"
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Accepted."
                    }
                }
            }
        },
        "alert.recovered": {
            "post": {
                "operationId": "webhookAlertRecovered",
                "summary": "Alarm recovered",
                "description": "Headers: X-RuangIoT-Event (type), X-RuangIoT-Event-Id (event ID), X-RuangIoT-Delivery (delivery ID), X-RuangIoT-Timestamp (Unix seconds), X-RuangIoT-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>. Reject timestamps older than 5 minutes. Answer 2xx within 6 seconds; anything else is retried (10 s, 1 min, 5 min, 30 min).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookAlertRecovered"
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Accepted."
                    }
                }
            }
        },
        "device.online": {
            "post": {
                "operationId": "webhookDeviceOnline",
                "summary": "Device came online",
                "description": "Headers: X-RuangIoT-Event (type), X-RuangIoT-Event-Id (event ID), X-RuangIoT-Delivery (delivery ID), X-RuangIoT-Timestamp (Unix seconds), X-RuangIoT-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>. Reject timestamps older than 5 minutes. Answer 2xx within 6 seconds; anything else is retried (10 s, 1 min, 5 min, 30 min).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookDeviceOnline"
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Accepted."
                    }
                }
            }
        },
        "device.inactive": {
            "post": {
                "operationId": "webhookDeviceInactive",
                "summary": "Device became inactive",
                "description": "Headers: X-RuangIoT-Event (type), X-RuangIoT-Event-Id (event ID), X-RuangIoT-Delivery (delivery ID), X-RuangIoT-Timestamp (Unix seconds), X-RuangIoT-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>. Reject timestamps older than 5 minutes. Answer 2xx within 6 seconds; anything else is retried (10 s, 1 min, 5 min, 30 min).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookDeviceInactive"
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Accepted."
                    }
                }
            }
        },
        "data.received": {
            "post": {
                "operationId": "webhookDataReceived",
                "summary": "New data received (at most 1 per device every 10 s)",
                "description": "Headers: X-RuangIoT-Event (type), X-RuangIoT-Event-Id (event ID), X-RuangIoT-Delivery (delivery ID), X-RuangIoT-Timestamp (Unix seconds), X-RuangIoT-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>. Reject timestamps older than 5 minutes. Answer 2xx within 6 seconds; anything else is retried (10 s, 1 min, 5 min, 30 min).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookDataReceived"
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Accepted."
                    }
                }
            }
        },
        "ping": {
            "post": {
                "operationId": "webhookPing",
                "summary": "Test from the API & Webhooks page",
                "description": "Headers: X-RuangIoT-Event (type), X-RuangIoT-Event-Id (event ID), X-RuangIoT-Delivery (delivery ID), X-RuangIoT-Timestamp (Unix seconds), X-RuangIoT-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>. Reject timestamps older than 5 minutes. Answer 2xx within 6 seconds; anything else is retried (10 s, 1 min, 5 min, 30 min).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookPing"
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Accepted."
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "rk_…",
                "description": "Authorization: Bearer rk_… (workspace API key, shown once when created)."
            },
            "apiKeyHeader": {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-Key",
                "description": "Alternative for clients that cannot set the Authorization header."
            }
        },
        "responses": {
            "E400": {
                "description": "Bad request (e.g. the API key in the URL).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "E401": {
                "description": "The API key is missing, unknown, revoked or expired, or its creator no longer manages the workspace.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "E403": {
                "description": "The API key lacks the required scope, or device control is not allowed.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "E404": {
                "description": "Not found, or not owned by the API key's workspace.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "E415": {
                "description": "The request body must be JSON.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "E422": {
                "description": "Invalid request data (per-field details in error.details).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "E429": {
                "description": "Rate limit exceeded (per API key, per device, or failed key attempts per IP). See the Retry-After header.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "E503": {
                "description": "The MQTT broker could not be reached.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "required": [
                            "status",
                            "code",
                            "message"
                        ],
                        "properties": {
                            "status": {
                                "type": "integer"
                            },
                            "code": {
                                "type": "string",
                                "description": "Machine-readable code, e.g. invalid_key, key_revoked, key_expired, insufficient_scope, project_not_found, device_not_found, validation_failed, rate_limited, control_not_allowed."
                            },
                            "message": {
                                "type": "string"
                            },
                            "details": {
                                "type": "object"
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "additionalProperties": false
            },
            "PageMeta": {
                "type": "object",
                "required": [
                    "page",
                    "per_page",
                    "total"
                ],
                "properties": {
                    "page": {
                        "type": "integer"
                    },
                    "per_page": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    }
                },
                "additionalProperties": false
            },
            "Project": {
                "type": "object",
                "required": [
                    "id",
                    "name",
                    "description",
                    "category",
                    "public",
                    "devices_count",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "Project ID = AUTH_TOKEN."
                    },
                    "name": {
                        "type": "string"
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "category": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "public": {
                        "type": "boolean"
                    },
                    "devices_count": {
                        "type": "integer"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "additionalProperties": false
            },
            "DeviceSummary": {
                "type": "object",
                "required": [
                    "id",
                    "project_id",
                    "name",
                    "type",
                    "location",
                    "status",
                    "status_label",
                    "last_seen_at",
                    "variables_count"
                ],
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "project_id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "type": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "location": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "online",
                            "inactive",
                            "offline",
                            "never_connected"
                        ],
                        "description": "online ≤ heartbeat threshold; inactive = Inactive (≤ 24 hours without data); offline > 24 hours; never_connected = no data yet."
                    },
                    "status_label": {
                        "type": "string"
                    },
                    "last_seen_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "variables_count": {
                        "type": "integer"
                    }
                },
                "additionalProperties": false
            },
            "Variable": {
                "type": "object",
                "required": [
                    "key",
                    "name",
                    "direction",
                    "data_type",
                    "unit",
                    "topic",
                    "minimum",
                    "maximum"
                ],
                "properties": {
                    "key": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "direction": {
                        "type": "string",
                        "enum": [
                            "telemetry",
                            "command",
                            "status"
                        ],
                        "description": "telemetry = Sensor, command = Command, status = Status."
                    },
                    "data_type": {
                        "type": "string",
                        "enum": [
                            "integer",
                            "float",
                            "boolean",
                            "string",
                            "json"
                        ]
                    },
                    "unit": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "topic": {
                        "type": "string"
                    },
                    "minimum": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "maximum": {
                        "type": [
                            "number",
                            "null"
                        ]
                    }
                },
                "additionalProperties": false
            },
            "DeviceDetail": {
                "type": "object",
                "required": [
                    "id",
                    "project_id",
                    "name",
                    "type",
                    "location",
                    "status",
                    "status_label",
                    "last_seen_at",
                    "variables"
                ],
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "project_id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "type": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "location": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "online",
                            "inactive",
                            "offline",
                            "never_connected"
                        ],
                        "description": "online ≤ heartbeat threshold; inactive = Inactive (≤ 24 hours without data); offline > 24 hours; never_connected = no data yet."
                    },
                    "status_label": {
                        "type": "string"
                    },
                    "last_seen_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "variables": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Variable"
                        }
                    }
                },
                "additionalProperties": false
            },
            "LatestValue": {
                "type": "object",
                "required": [
                    "key",
                    "name",
                    "direction",
                    "unit",
                    "value",
                    "display",
                    "received_at",
                    "quality"
                ],
                "properties": {
                    "key": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "direction": {
                        "type": "string",
                        "enum": [
                            "telemetry",
                            "command",
                            "status"
                        ]
                    },
                    "unit": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "value": {
                        "description": "Typed value: number, true/false (ON/OFF), text or JSON object; null when there is no data yet."
                    },
                    "display": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "received_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "quality": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "additionalProperties": false
            },
            "LatestMeta": {
                "type": "object",
                "required": [
                    "device_id",
                    "status"
                ],
                "properties": {
                    "device_id": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "online",
                            "inactive",
                            "offline",
                            "never_connected"
                        ]
                    }
                },
                "additionalProperties": false
            },
            "RawPoint": {
                "type": "object",
                "required": [
                    "t",
                    "value"
                ],
                "properties": {
                    "t": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "value": {
                        "description": "Typed value."
                    }
                },
                "additionalProperties": false
            },
            "AggregatePoint": {
                "type": "object",
                "required": [
                    "t",
                    "avg",
                    "min",
                    "max",
                    "sum",
                    "count"
                ],
                "properties": {
                    "t": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Start of the time bucket (WIB)."
                    },
                    "avg": {
                        "type": "number"
                    },
                    "min": {
                        "type": "number"
                    },
                    "max": {
                        "type": "number"
                    },
                    "sum": {
                        "type": "number"
                    },
                    "count": {
                        "type": "integer"
                    }
                },
                "additionalProperties": false
            },
            "HistorySeries": {
                "type": "object",
                "required": [
                    "key",
                    "name",
                    "data_type",
                    "unit",
                    "points"
                ],
                "properties": {
                    "key": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "data_type": {
                        "type": "string"
                    },
                    "unit": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "points": {
                        "type": "array",
                        "items": {
                            "oneOf": [
                                {
                                    "$ref": "#/components/schemas/RawPoint"
                                },
                                {
                                    "$ref": "#/components/schemas/AggregatePoint"
                                }
                            ]
                        }
                    }
                },
                "additionalProperties": false
            },
            "HistoryMeta": {
                "type": "object",
                "required": [
                    "device_id",
                    "from",
                    "to",
                    "timezone",
                    "interval"
                ],
                "properties": {
                    "device_id": {
                        "type": "string"
                    },
                    "from": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "to": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "timezone": {
                        "type": "string"
                    },
                    "interval": {
                        "type": "string",
                        "enum": [
                            "raw",
                            "minute",
                            "hour",
                            "day",
                            "month"
                        ]
                    },
                    "limit": {
                        "type": "integer"
                    },
                    "truncated": {
                        "type": "boolean",
                        "description": "true when there are more points than limit; continue with from = next_from."
                    },
                    "next_from": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "additionalProperties": false
            },
            "IngestRequest": {
                "type": "object",
                "description": "Either {\"values\": {...}, \"timestamp\": ...} or plain variable: value pairs.",
                "properties": {
                    "values": {
                        "type": "object",
                        "additionalProperties": {
                            "type": [
                                "number",
                                "integer",
                                "boolean",
                                "string",
                                "object",
                                "array"
                            ]
                        }
                    },
                    "timestamp": {
                        "type": [
                            "string",
                            "integer"
                        ],
                        "description": "Optional. ISO 8601 (no time zone = WIB) or Unix seconds; at most 7 days in the past and 5 minutes in the future."
                    }
                }
            },
            "IngestResult": {
                "type": "object",
                "required": [
                    "device_id",
                    "accepted",
                    "rejected",
                    "stored",
                    "unchanged",
                    "received_at"
                ],
                "properties": {
                    "device_id": {
                        "type": "string"
                    },
                    "accepted": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "rejected": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "description": "Rejected variables with the reason."
                    },
                    "stored": {
                        "type": "integer",
                        "description": "New history rows (the variable's history policy still applies)."
                    },
                    "unchanged": {
                        "type": "integer"
                    },
                    "received_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "additionalProperties": false
            },
            "CommandRequest": {
                "type": "object",
                "required": [
                    "variable",
                    "value"
                ],
                "properties": {
                    "variable": {
                        "type": "string"
                    },
                    "value": {
                        "type": [
                            "boolean",
                            "number",
                            "integer",
                            "string",
                            "object",
                            "array"
                        ],
                        "description": "ON/OFF: true/false or 1/0; numbers; text ≤ 1,000 characters; JSON."
                    }
                },
                "additionalProperties": false
            },
            "CommandResult": {
                "type": "object",
                "required": [
                    "device_id",
                    "variable",
                    "value",
                    "topic",
                    "broker",
                    "virtual_lab",
                    "sent_at"
                ],
                "properties": {
                    "device_id": {
                        "type": "string"
                    },
                    "variable": {
                        "type": "string"
                    },
                    "value": {
                        "type": "string",
                        "description": "The value published to the command topic (as text, the same as the dashboard)."
                    },
                    "topic": {
                        "type": "string"
                    },
                    "broker": {
                        "type": "boolean"
                    },
                    "virtual_lab": {
                        "type": "boolean"
                    },
                    "sent_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "additionalProperties": false
            },
            "AlertEvent": {
                "type": "object",
                "required": [
                    "id",
                    "rule",
                    "status",
                    "severity",
                    "trigger_type",
                    "device_id",
                    "variable",
                    "unit",
                    "trigger_value",
                    "started_at",
                    "acknowledged_at",
                    "resolved_at",
                    "repeat_count"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "rule": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "acknowledged",
                            "resolved",
                            "info"
                        ]
                    },
                    "severity": {
                        "type": "string"
                    },
                    "trigger_type": {
                        "type": "string"
                    },
                    "device_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "variable": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "unit": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "trigger_value": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "started_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "acknowledged_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "resolved_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "repeat_count": {
                        "type": "integer"
                    }
                },
                "additionalProperties": false
            },
            "WebhookAlertTriggered": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "created_at",
                    "test",
                    "workspace",
                    "project",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Event ID — the same for every retry; use it to ignore duplicates."
                    },
                    "type": {
                        "type": "string",
                        "const": "alert.triggered"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "workspace": {
                        "type": "object",
                        "required": [
                            "id"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            }
                        },
                        "additionalProperties": false
                    },
                    "project": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            }
                        ]
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "rule",
                            "event",
                            "device",
                            "variable",
                            "message"
                        ],
                        "properties": {
                            "rule": {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            },
                            "event": {
                                "type": "object",
                                "required": [
                                    "id",
                                    "status",
                                    "severity",
                                    "trigger_type",
                                    "trigger_value",
                                    "resolve_value",
                                    "started_at",
                                    "resolved_at"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "status": {
                                        "type": "string"
                                    },
                                    "severity": {
                                        "type": "string"
                                    },
                                    "trigger_type": {
                                        "type": "string"
                                    },
                                    "trigger_value": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "resolve_value": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "started_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    },
                                    "resolved_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    }
                                },
                                "additionalProperties": false
                            },
                            "device": {
                                "oneOf": [
                                    {
                                        "type": "null"
                                    },
                                    {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "name"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "string"
                                            },
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                ]
                            },
                            "variable": {
                                "oneOf": [
                                    {
                                        "type": "null"
                                    },
                                    {
                                        "type": "object",
                                        "required": [
                                            "key",
                                            "name",
                                            "unit"
                                        ],
                                        "properties": {
                                            "key": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "unit": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                ]
                            },
                            "message": {
                                "type": "string"
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "additionalProperties": false
            },
            "WebhookAlertRecovered": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "created_at",
                    "test",
                    "workspace",
                    "project",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Event ID — the same for every retry; use it to ignore duplicates."
                    },
                    "type": {
                        "type": "string",
                        "const": "alert.recovered"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "workspace": {
                        "type": "object",
                        "required": [
                            "id"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            }
                        },
                        "additionalProperties": false
                    },
                    "project": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            }
                        ]
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "rule",
                            "event",
                            "device",
                            "variable",
                            "message"
                        ],
                        "properties": {
                            "rule": {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            },
                            "event": {
                                "type": "object",
                                "required": [
                                    "id",
                                    "status",
                                    "severity",
                                    "trigger_type",
                                    "trigger_value",
                                    "resolve_value",
                                    "started_at",
                                    "resolved_at"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "status": {
                                        "type": "string"
                                    },
                                    "severity": {
                                        "type": "string"
                                    },
                                    "trigger_type": {
                                        "type": "string"
                                    },
                                    "trigger_value": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "resolve_value": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "started_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    },
                                    "resolved_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    }
                                },
                                "additionalProperties": false
                            },
                            "device": {
                                "oneOf": [
                                    {
                                        "type": "null"
                                    },
                                    {
                                        "type": "object",
                                        "required": [
                                            "id",
                                            "name"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "string"
                                            },
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                ]
                            },
                            "variable": {
                                "oneOf": [
                                    {
                                        "type": "null"
                                    },
                                    {
                                        "type": "object",
                                        "required": [
                                            "key",
                                            "name",
                                            "unit"
                                        ],
                                        "properties": {
                                            "key": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "unit": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                ]
                            },
                            "message": {
                                "type": "string"
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "additionalProperties": false
            },
            "WebhookDeviceOnline": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "created_at",
                    "test",
                    "workspace",
                    "project",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Event ID — the same for every retry; use it to ignore duplicates."
                    },
                    "type": {
                        "type": "string",
                        "const": "device.online"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "workspace": {
                        "type": "object",
                        "required": [
                            "id"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            }
                        },
                        "additionalProperties": false
                    },
                    "project": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            }
                        ]
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "device",
                            "status",
                            "previous_status",
                            "last_seen_at"
                        ],
                        "properties": {
                            "device": {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            },
                            "status": {
                                "type": "string",
                                "enum": [
                                    "online",
                                    "inactive"
                                ]
                            },
                            "previous_status": {
                                "type": "string",
                                "enum": [
                                    "online",
                                    "inactive"
                                ]
                            },
                            "last_seen_at": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "additionalProperties": false
            },
            "WebhookDeviceInactive": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "created_at",
                    "test",
                    "workspace",
                    "project",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Event ID — the same for every retry; use it to ignore duplicates."
                    },
                    "type": {
                        "type": "string",
                        "const": "device.inactive"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "workspace": {
                        "type": "object",
                        "required": [
                            "id"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            }
                        },
                        "additionalProperties": false
                    },
                    "project": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            }
                        ]
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "device",
                            "status",
                            "previous_status",
                            "last_seen_at"
                        ],
                        "properties": {
                            "device": {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            },
                            "status": {
                                "type": "string",
                                "enum": [
                                    "online",
                                    "inactive"
                                ]
                            },
                            "previous_status": {
                                "type": "string",
                                "enum": [
                                    "online",
                                    "inactive"
                                ]
                            },
                            "last_seen_at": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "additionalProperties": false
            },
            "WebhookDataReceived": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "created_at",
                    "test",
                    "workspace",
                    "project",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Event ID — the same for every retry; use it to ignore duplicates."
                    },
                    "type": {
                        "type": "string",
                        "const": "data.received"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "workspace": {
                        "type": "object",
                        "required": [
                            "id"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            }
                        },
                        "additionalProperties": false
                    },
                    "project": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            }
                        ]
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "device",
                            "values",
                            "source"
                        ],
                        "properties": {
                            "device": {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            },
                            "values": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "required": [
                                        "key",
                                        "value",
                                        "unit",
                                        "received_at"
                                    ],
                                    "properties": {
                                        "key": {
                                            "type": "string"
                                        },
                                        "value": {
                                            "description": "Typed value."
                                        },
                                        "unit": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "received_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            },
                            "source": {
                                "type": "string",
                                "enum": [
                                    "mqtt",
                                    "http_api",
                                    "mixed"
                                ],
                                "description": "mqtt, http_api, or mixed (both within one window)."
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "additionalProperties": false
            },
            "WebhookPing": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "created_at",
                    "test",
                    "workspace",
                    "project",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Event ID — the same for every retry; use it to ignore duplicates."
                    },
                    "type": {
                        "type": "string",
                        "const": "ping"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "test": {
                        "type": "boolean"
                    },
                    "workspace": {
                        "type": "object",
                        "required": [
                            "id"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            }
                        },
                        "additionalProperties": false
                    },
                    "project": {
                        "oneOf": [
                            {
                                "type": "null"
                            },
                            {
                                "type": "object",
                                "required": [
                                    "id",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false
                            }
                        ]
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "message"
                        ],
                        "properties": {
                            "message": {
                                "type": "string"
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "additionalProperties": false
            }
        }
    }
}