# Thinger.io Docs > Documentation of Thinger.io, the IoT platform to connect devices, store and visualize their data, build dashboards and automate projects, in the Cloud or on your own server. Every page below is plain markdown; llms-full.txt has all of them in one file. --- Source: https://docs.thinger.io/get-started.md # What is Thinger.io > Thinger.io is an IoT platform to connect devices, store and show their data, and automate what happens with it. Thinger.io is a platform to connect devices to the Internet and build on top of them: read sensors, control actuators, store time series, show dashboards and trigger integrations. You use it from a web console, a REST API, a command-line tool or an AI agent. ![Devices connect to Thinger.io over IOTMP (Arduino, ESP-IDF, Zephyr, Linux), MQTT or HTTP (LoRaWAN, Sigfox, services), and people and tools reach it from the console and mobile app, the REST API and thinger CLI, and AI agents through the MCP; your account runs on the free Cloud server iot.thinger.io or on a private instance, and on top of it you build Data Buckets, dashboards, alarms, endpoints, products, projects and plugins](https://docs.thinger.io/diagrams/platform-overview.svg) *Thinger.io at a glance* ## Who it is for - Makers and developers who want a board online in minutes. - Companies that build connected products and need fleets, white-label consoles and their own instance. - Integrators who connect existing equipment over MQTT, HTTP or LPWAN networks. ## How devices connect - **IOTMP**: the protocol of the Thinger.io device libraries for Arduino, ESP-IDF, Zephyr and Linux. The device keeps one secure connection open, so the platform can read and call its device resources at any time. - **MQTT**: for devices and gateways that already publish to a broker. - **HTTP**: for devices and services that send data from time to time, including LoRaWAN and Sigfox network servers. See [Connect a device](https://docs.thinger.io/devices.md) to choose. ## What you can do with the data - Store it in [Data Buckets](https://docs.thinger.io/platform/data-buckets.md) and show it on [dashboards](https://docs.thinger.io/platform/dashboards.md). - React to it with [alarms](https://docs.thinger.io/platform/alarms.md) and [endpoints](https://docs.thinger.io/platform/endpoints.md) that call other services. - Manage fleets with [products](https://docs.thinger.io/platform/products.md), and share resources with [projects](https://docs.thinger.io/platform/projects.md). - Extend the instance with [plugins](https://docs.thinger.io/plugins.md). - Automate everything through the [REST API](https://docs.thinger.io/reference/rest-api.md), the [CLI](https://docs.thinger.io/reference/cli.md) or an [AI agent](https://docs.thinger.io/ai.md). To work with your account from Claude, VS Code or Cursor, see [Connect an AI agent](https://docs.thinger.io/ai/connect.md). ## Where it runs Start with a free Cloud account at `console.thinger.io`, whose server is `iot.thinger.io`. Companies use a private instance with their own domain. See [Deployment](https://docs.thinger.io/administration/deployment.md) and [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Open source The client side is open source under the MIT license: the [Arduino library](https://github.com/thinger-io/Arduino-Library), the `thinger` [CLI](https://github.com/thinger-io/thinger-cli), the [Dashboard SDK](https://github.com/thinger-io/dashboard-sdk) and the [plugins](https://github.com/thinger-io/plugins). Browse every repository at [github.com/thinger-io](https://github.com/thinger-io). The server is not open source. ## Get help | Channel | Use it for | |---|---| | [Community forum](https://community.thinger.io) | Questions, projects and answers from other users and the Thinger.io team. Search it first: most problems are already solved there. | | [Discord](https://discord.com/invite/xAc24hdWZE) | Chat with other users and the developers of Thinger.io. | | [GitHub](https://github.com/thinger-io) | Bugs and feature requests for the libraries, the CLI and the plugins, as issues of each repository. | | [Technical support](https://thinger.io/services/technical-support) | Professional support for companies and private instances. | | [info@thinger.io](mailto:info@thinger.io) | Sales, partnerships and ideas for the roadmap. | ## Learn more - [Quick start](https://docs.thinger.io/get-started/quick-start.md): Create a free Thinger.io account, connect an ESP32 and read its first value from the console in about 15 minutes. - [Core concepts](https://docs.thinger.io/get-started/concepts.md): How devices, device resources, properties, Data Buckets, dashboards, endpoints, products, projects and access tokens fit together in Thinger.io. - [Connect an AI agent](https://docs.thinger.io/ai/connect.md): Install the thinger CLI, sign in, and connect Claude Code, Claude Desktop or any other MCP client to your Thinger.io account. - [Connect a device](https://docs.thinger.io/devices.md): Choose how to connect your hardware to Thinger.io - device libraries over IOTMP, MQTT, HTTP or a LoRaWAN or Sigfox network. - [CLI](https://docs.thinger.io/reference/cli.md): Every command and option of the thinger CLI, plus how to install it, sign in, use profiles, script it with JSON output and run its MCP server. --- Source: https://docs.thinger.io/get-started/quick-start.md # Quick start > Create a free Thinger.io account, connect an ESP32 and read its first value from the console in about 15 minutes. In this tutorial you create a Thinger.io account, connect an ESP32 board and read a value from it in the console. It takes about 15 minutes. ## What you need - An ESP32 development board and a USB data cable. - A 2.4 GHz Wi-Fi network with Internet access. - The [Arduino IDE](https://www.arduino.cc/en/software) installed on your computer. This tutorial uses the free Cloud account, so your server is `iot.thinger.io`. On a private instance, use your own domain wherever this page says `YOUR_SERVER`, and open your own console instead of `console.thinger.io`. ## Create your account **Step 1: Sign up** Open [console.thinger.io/signup](https://console.thinger.io/signup), fill in **Username**, **Email** and **Password**, accept the terms and click **Sign Up**. Your username is `YOUR_USER` in the rest of this tutorial. **Step 2: Sign in to the console** Confirm your email if the console asks you to, and sign in. The console opens on **Statistics**. ## Create the device **Step 1: Open the Add Device form** In the main menu, go to **Devices** and click **Create a Device**. **Step 2: Fill in the form** - **Device Type**: **IOTMP Device (Thinger.io protocol)**. - **Device Id**: a name for your board, such as `esp32_test`. This is `YOUR_DEVICE`. - **Device Credentials**: click **Random**. Copy the device credentials before you continue: this is `YOUR_TOKEN` in the sketch. Click **Add Device**. ![Add Device form with the IOTMP device type, a device ID and credentials](https://docs.thinger.io/screenshots/quick-start-add-device.webp) *Add an IOTMP device* ## Program the board **Step 1: Install the ESP32 package** In the Arduino IDE, open **Tools > Board > Boards Manager**, search for **esp32** and install **esp32** by Espressif Systems. **Step 2: Install the Thinger.io library** Open **Sketch > Include Library > Manage Libraries**, search for **thinger.io** and click **Install**. **Step 3: Paste the sketch** Create a new sketch and paste this code. Replace `YOUR_USER`, `YOUR_DEVICE` and `YOUR_TOKEN` with your username, the device ID and the device credentials, and set your Wi-Fi network name and password. ```cpp #define THINGER_SERIAL_DEBUG #include #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define WIFI_SSID "wifi-network" #define WIFI_PASSWORD "wifi-password" #define LED_PIN 2 // change it to the LED pin of your board ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { Serial.begin(115200); pinMode(LED_PIN, OUTPUT); thing.add_wifi(WIFI_SSID, WIFI_PASSWORD); // input resource: turn the LED on and off thing["led"] << digitalPin(LED_PIN); // output resource: milliseconds since the board started thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` **Step 4: Upload it** Connect the board, choose it in **Tools > Board** (for most boards, **ESP32 Dev Module**) and its port in **Tools > Port**, and click **Upload**. Then open **Tools > Serial Monitor** at 115200 baud. After a few seconds, it shows `[THINGER] Authenticated`. ## See your device in the console **Step 1: Check the connection** Go to **Devices**. Your device has a green status dot. Click it to open its **Status** page: **Device State** shows **Online**. ![Device Status with Device State Online, transmitted and received data and the connection time](https://docs.thinger.io/screenshots/quick-start-device-online.webp) *Device State Online* **Step 2: Read a value** On the device page, go to **API**. Expand `millis` and click **Run**: the output shows the milliseconds since the board started. Expand `led`, switch it on and click **Run**: the LED of the board turns on. ![Device API of a device with the led resource as an on/off switch, switched on, and the millis resource with its output after Run](https://docs.thinger.io/screenshots/quick-start-device-api.webp) *The led and millis resources after Run* ## Result Your ESP32 is online in **Devices**, and you can read its `millis` device resource and control its LED from the console. If the serial monitor does not show `Authenticated`, check the Wi-Fi network and the three credentials, and see [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md). ## Next steps - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. - [Core concepts](https://docs.thinger.io/get-started/concepts.md): How devices, device resources, properties, Data Buckets, dashboards, endpoints, products, projects and access tokens fit together in Thinger.io. - [Console tour](https://docs.thinger.io/get-started/console.md): Find your way around the Thinger.io console - the main menu, the Statistics page and where each feature lives. Then store the readings of your device in a [Data Bucket](https://docs.thinger.io/platform/data-buckets.md) and show them on a [dashboard](https://docs.thinger.io/platform/dashboards.md). --- Source: https://docs.thinger.io/get-started/concepts.md # Core concepts > How devices, device resources, properties, Data Buckets, dashboards, endpoints, products, projects and access tokens fit together in Thinger.io. Thinger.io connects your devices to the data, dashboards and integrations you build on top of them. This page explains the main pieces and how they relate; each one has its own page in [Platform](https://docs.thinger.io/platform/devices.md). ![A device exposes device resources and properties; its data goes to Data Buckets, dashboards and endpoints; products, projects, assets and access tokens organize devices and give access to them](https://docs.thinger.io/diagrams/core-concepts.svg) *The main pieces of Thinger.io* ## Devices A **device** is anything connected to your account that sends or receives data: a microcontroller, a Linux computer, an MQTT or HTTP client, or a virtual device. Each device has a unique **device ID** in your account and authenticates with its **device credentials**. Its **device type** says how it connects: IOTMP, MQTT, HTTP, Virtual or Subdevice. An IOTMP device exposes **device resources**: functions the platform can call. An **input resource** receives data from the platform, such as a command to switch a relay. An **output resource** sends data to it, such as a sensor reading. A device resource can be both. You call device resources from the console, the API, dashboards, other devices and AI agents. **Properties** are named JSON values stored on the device in the platform: its configuration, its calibration, its last known state. They persist when the device is offline, and the device can read and write them. ## Data A **Data Bucket** stores device data as a time series. It is filled by the device itself, by reading a device resource at an interval, or from MQTT and HTTP messages. You query and export it, and dashboards chart it. ## From device to dashboard A reading can reach a dashboard in two ways. A widget can read a device resource live, while the device is online. Or the reading is stored first in a Data Bucket, and the widget charts its history; the bucket keeps the data when the device goes offline. ![A device resource such as temperature reaches a dashboard in two ways: live, when the widget reads the device resource while the device is online, or stored, when a Data Bucket fills with readings at an interval, written by the device or from MQTT and HTTP messages, and a chart shows its history; buttons and sliders of the dashboard call input resources of the device](https://docs.thinger.io/diagrams/device-to-dashboard-flow.svg) *From device to dashboard* ## Visualization and integrations A **dashboard** is a screen of widgets (charts, gauges, maps, buttons) that shows and controls device data, in real time or from Data Buckets. An **endpoint** is an outgoing integration: an HTTP request, an email, a Telegram message. Devices and rules call endpoints to notify or to send data to other services. ## Organization and access - A **product** is a template for a fleet of devices that share properties, buckets, flows, API resources and dashboards. With **Auto Provision**, devices are created when they first connect. - A **project** groups resources to share them with other users, with members and roles. - An **asset** type or group classifies devices and other resources. - An **access token** grants a limited set of permissions to the REST API, for scripts, apps, the CLI and AI agents. - A **plugin** is a packaged application that runs on your instance and extends it, installed from **Plugins > Marketplace**. ## How it fits together | Piece | What it does | Learn more | |---|---|---| | Device | Connects hardware and exposes device resources. | [Devices](https://docs.thinger.io/platform/devices.md) | | Property | Keeps configuration and state on the platform. | [Properties](https://docs.thinger.io/platform/properties.md) | | Data Bucket | Stores time series data. | [Data Buckets](https://docs.thinger.io/platform/data-buckets.md) | | Dashboard | Shows and controls device data. | [Dashboards](https://docs.thinger.io/platform/dashboards.md) | | Endpoint | Calls other services. | [Endpoints](https://docs.thinger.io/platform/endpoints.md) | | Product | Manages a fleet of devices with one definition. | [Products](https://docs.thinger.io/platform/products.md) | | Project | Shares resources with other users. | [Projects](https://docs.thinger.io/platform/projects.md) | | Asset | Classifies devices by type and group. | [Assets](https://docs.thinger.io/platform/assets.md) | | Access token | Gives scoped access to the API. | [Access Tokens](https://docs.thinger.io/platform/access-tokens.md) | | Plugin | Extends the instance with an application. | [Plugins](https://docs.thinger.io/plugins.md) | ## Learn more - [Quick start](https://docs.thinger.io/get-started/quick-start.md): Create a free Thinger.io account, connect an ESP32 and read its first value from the console in about 15 minutes. - [Console tour](https://docs.thinger.io/get-started/console.md): Find your way around the Thinger.io console - the main menu, the Statistics page and where each feature lives. - [Connect a device](https://docs.thinger.io/devices.md): Choose how to connect your hardware to Thinger.io - device libraries over IOTMP, MQTT, HTTP or a LoRaWAN or Sigfox network. --- Source: https://docs.thinger.io/get-started/console.md # Console tour > Find your way around the Thinger.io console - the main menu, the Statistics page and where each feature lives. The console is the web interface of your Thinger.io instance. On the free Cloud account it is at `console.thinger.io`; on a private instance, at your own domain. The main menu on the left gives access to every feature, in the order below. ![The console with the main menu on the left and the Statistics page open](https://docs.thinger.io/screenshots/console-main-menu.webp) *Main menu and the Statistics page* ## Statistics **Statistics** is the page the console opens after you sign in. It summarizes your account: - **Account Stats**: how many devices, dashboards, Data Buckets and endpoints you use, against what your plan allows, and the number of **Connected Devices**. - **Connected Devices Locations**: a map with the last known position of your connected devices. - **Daily Data Transmission**: connections, data sent and data received by your devices in the last 30 days. When you work inside a project, this entry shows the name of the project instead, and opens its dashboard. ## Main menu | Menu | What you find there | Learn more | |---|---|---| | **Statistics** | The summary of your account. | This page | | **Devices** | Your devices: add them, see their state, call their device resources, edit properties, open their remote tools. | [Devices](https://docs.thinger.io/platform/devices.md) | | **Dashboards** | Screens of widgets that show and control device data. | [Dashboards](https://docs.thinger.io/platform/dashboards.md) | | **Data Buckets** | Time series storage for device data. | [Data Buckets](https://docs.thinger.io/platform/data-buckets.md) | | **Endpoints** | Integrations with other services: HTTP, email, Telegram. | [Endpoints](https://docs.thinger.io/platform/endpoints.md) | | **Alarms** | Rules that watch data and notify when a condition is met. A badge shows the active alarms. | [Alarms](https://docs.thinger.io/platform/alarms.md) | | **Access Tokens** | Tokens with scoped permissions for the API, scripts and agents. | [Access Tokens](https://docs.thinger.io/platform/access-tokens.md) | | **Assets** | **Overview**, **Types** and **Groups** to classify devices and other resources. | [Assets](https://docs.thinger.io/platform/assets.md) | | **File Storages** | File repositories on the instance. | [File Storages](https://docs.thinger.io/platform/file-storages.md) | | **Products** | Templates for fleets of devices. | [Products](https://docs.thinger.io/platform/products.md) | | **Projects** | Sets of resources shared with other users. | [Projects](https://docs.thinger.io/platform/projects.md) | | **Plugins** | The **Marketplace** and **My Plugins**. | [Plugins](https://docs.thinger.io/plugins.md) | | **Toolbox** | **Syncs** and **Claims**. | [Toolbox](https://docs.thinger.io/platform/toolbox.md) | | **Plugins** (second group) | One entry per installed plugin, to open its interface. | [Management](https://docs.thinger.io/plugins/management.md) | | **Administration** | **User Accounts**, **Cluster Hosts**, **Domains**, **Brands**, **OAuth2 Clients**, **Identity Providers**, **Proxies** and **Billing**. Only for administrators of the instance. | [User Accounts](https://docs.thinger.io/administration/user-accounts.md) | | **Account** | **Profile** and **Security** of your user. | [Account](https://docs.thinger.io/platform/account.md) | | **Support** | Links to the documentation, the community, the helpdesk, the device libraries on GitHub and support by email. | — | Some entries depend on your role and your plan: project members do not see **Plugins** or **Administration**, and the free Cloud account does not include plugins (see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md)). ## Inside a device Open a device in **Devices** to see its own menu: **Status** (connection state, IP address, data transmitted), **API** (call its device resources), **Properties**, **Tokens**, **Terminal**, **Explorer**, **Geofences** and **Settings**, among others. The entries depend on the device type: the remote tools, for example, are only for IOTMP devices. ![Status page of a connected device, with the device tabs and the device menu open](https://docs.thinger.io/screenshots/console-device-status.webp) *Status page of a device and its menu* ## Learn more - [Quick start](https://docs.thinger.io/get-started/quick-start.md): Create a free Thinger.io account, connect an ESP32 and read its first value from the console in about 15 minutes. - [Core concepts](https://docs.thinger.io/get-started/concepts.md): How devices, device resources, properties, Data Buckets, dashboards, endpoints, products, projects and access tokens fit together in Thinger.io. - [Mobile app](https://docs.thinger.io/get-started/mobile-app.md): Use the Thinger.io console from the iOS and Android app, with your free Cloud account or your own instance. --- Source: https://docs.thinger.io/get-started/mobile-app.md # Mobile app > Use the Thinger.io console from the iOS and Android app, with your free Cloud account or your own instance. The Thinger.io mobile app brings the console to your phone: the same devices, dashboards, Data Buckets and settings as on the web, in a native app for iOS and Android. It works with the free Cloud account and with private instances. ![A phone with the Thinger.io app open on Statistics, showing the counts of devices, dashboards, Data Buckets and endpoints, next to a ClimaStick board connected to a USB cable](https://docs.thinger.io/images/get-started/mobile-app-climastick.webp) *The app with a connected ClimaStick* ## When to use it - To check your devices and dashboards away from your computer. - To control a device from a dashboard on your phone. - To give the users of a private instance an app instead of a web address. ## Install the app [![Download on the App Store](https://docs.thinger.io/images/get-started/app-store-badge.svg)](https://apps.apple.com/us/app/thinger-io/id6503300549) [![Get it on Google Play](https://docs.thinger.io/images/get-started/google-play-badge.svg)](https://play.google.com/store/apps/details?id=io.thinger.mobile.app) - iOS: [Thinger.io on the App Store](https://apps.apple.com/us/app/thinger-io/id6503300549). - Android: [Thinger.io on Google Play](https://play.google.com/store/apps/details?id=io.thinger.mobile.app). ## Sign in to the free Cloud account Open the app and sign in with your username and password. The app connects to the free Cloud account (`iot.thinger.io`) by default. ## Sign in to a private instance **Step 1: Open the host settings** On the sign-in screen, tap **Settings**. The **Configure your Host** screen opens. **Step 2: Set your server** Type your server in **Hostname** (`YOUR_SERVER`, without `https://`), keep **Secure Connection** on and tap **Update**. **Step 3: Sign in** Tap **Back to application** and sign in with your user on that instance. ## What the app includes The app is the console: the main menu, **Statistics**, **Devices**, **Dashboards**, **Data Buckets** and the rest of the sections work as described in the [Console tour](https://docs.thinger.io/get-started/console.md). These parts are web only: - The interfaces of installed plugins (the second **Plugins** group of the menu). - The upgrade options of the free Cloud account. ## White-label app Companies can give their users the app with their own brand instead of the Thinger.io one: their colors, their logo and icons, and the features their users need. The white-label app is arranged with Thinger.io; [contact sales](https://thinger.io/contact) to discuss it. To brand the web console of a private instance, see [White-label the console](https://docs.thinger.io/guides/white-label.md). ## Limits - One server at a time: to switch between the free Cloud account and a private instance, change the host in **Settings**. ## Related pages - [Console tour](https://docs.thinger.io/get-started/console.md): Find your way around the Thinger.io console - the main menu, the Statistics page and where each feature lives. - [Quick start](https://docs.thinger.io/get-started/quick-start.md): Create a free Thinger.io account, connect an ESP32 and read its first value from the console in about 15 minutes. --- Source: https://docs.thinger.io/devices.md # Connect a device > Choose how to connect your hardware to Thinger.io - device libraries over IOTMP, MQTT, HTTP or a LoRaWAN or Sigfox network. Thinger.io connects any device that can reach the Internet, directly or through a network server. How you connect it decides what the platform can do with it: a device that keeps an IOTMP connection open can receive commands at any time, while a device that only sends messages is read, not called. ## Ways to connect ![Devices with the Thinger.io libraries keep an IOTMP connection open both ways. MQTT clients publish and subscribe on the built-in broker. HTTP clients send requests and get data back only in the response. LoRaWAN and Sigfox sensors reach Thinger.io through their network server, which forwards each message over HTTP to a plugin or a device callback.](https://docs.thinger.io/diagrams/ways-to-connect.svg) *How each kind of device reaches Thinger.io* | Way | Device type | Best for | Direction | Page | |---|---|---|---|---| | Arduino library | IOTMP | ESP32, ESP8266, Arduino boards and modules | Both: device resources the platform can call, data the device sends | [Arduino](https://docs.thinger.io/devices/arduino.md) | | ESP-IDF component | IOTMP | ESP32 firmware without Arduino | Both | [ESP-IDF](https://docs.thinger.io/devices/esp-idf.md) | | Zephyr module | IOTMP | Boards running Zephyr RTOS | Both | [Zephyr](https://docs.thinger.io/devices/zephyr.md) | | Linux client | IOTMP | Linux computers and gateways | Both, plus remote shell and files | [Linux](https://docs.thinger.io/devices/linux.md) | | MQTT | MQTT | Devices and gateways that already speak MQTT | Both, through topics | [MQTT](https://docs.thinger.io/devices/mqtt.md) | | HTTP | HTTP | Devices that post data from time to time, scripts, other clouds | Device to platform | [HTTP](https://docs.thinger.io/devices/http.md) | | LoRaWAN | HTTP | Low-power sensors on a LoRaWAN network server | Mostly device to platform | [LoRaWAN](https://docs.thinger.io/devices/lorawan.md) | | Sigfox | HTTP | Sigfox sensors | Mostly device to platform | [Sigfox](https://docs.thinger.io/devices/sigfox.md) | IOTMP is the protocol of the Thinger.io device libraries: a single encrypted connection, open in both directions, with low overhead. Use it when you write the firmware. Use MQTT or HTTP when the device or its firmware already exists. See [IOTMP](https://docs.thinger.io/reference/iotmp.md) for the protocol. ## Without hardware - A [virtual device](https://docs.thinger.io/devices/virtual-devices.md) is implemented on the platform, for tests or to combine data. - A [subdevice](https://docs.thinger.io/devices/subdevices.md) reaches the platform through another device, such as a gateway. ## Once the device is connected - [Remote tools](https://docs.thinger.io/devices/remote-tools.md): terminal, file explorer and log console of IOTMP devices. - [OTA updates](https://docs.thinger.io/devices/ota.md): send new firmware over the Internet. - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): connect fleets with products and auto provisioning. - [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md): what to check when a device does not connect. ## Start here - [Quick start](https://docs.thinger.io/get-started/quick-start.md): Create a free Thinger.io account, connect an ESP32 and read its first value from the console in about 15 minutes. - [Arduino](https://docs.thinger.io/devices/arduino.md): Connect an Arduino-compatible board to Thinger.io with the Arduino library, from the Arduino IDE or PlatformIO, and update it over the Internet. - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): The boards and network modules the Thinger.io Arduino library supports, with the class, the example sketch and the OTA support of each. --- Source: https://docs.thinger.io/devices/arduino.md # Arduino > Connect an Arduino-compatible board to Thinger.io with the Arduino library, from the Arduino IDE or PlatformIO, and update it over the Internet. This guide connects a board to Thinger.io with the Thinger.io Arduino library: you create the device, install the library, upload a sketch and check that the device is online. The steps use an ESP32; for other boards, change the include and the class as shown in [Supported boards](https://docs.thinger.io/devices/arduino/boards.md). ![The board runs a sketch with the thing object and its device resources. It opens a TLS connection to port 25202 of the Thinger.io server and authenticates with the username, the device ID and the device credentials. The console, the REST API, the thinger CLI and an AI agent read and call the device resources through the server.](https://docs.thinger.io/diagrams/arduino-sketch-to-console.svg) *From the sketch to the console* ## Before you start - A Thinger.io account. Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - A [supported board](https://docs.thinger.io/devices/arduino/boards.md) and its USB cable. - The [Arduino IDE](https://www.arduino.cc/en/software), or Visual Studio Code with the [PlatformIO](https://platformio.org/install/ide?install=vscode) extension. ## Steps **Step 1: Create the device** ### Console Go to **Devices** and click **Add Device** (**Create a Device** if you have no devices yet). Fill in the form: - **Device Type**: **IOTMP Device (Thinger.io protocol)**. - **Device Id**: `YOUR_DEVICE`. Letters, numbers, `_` and `-`. - **Device Credentials**: click **Random**, or type your own (6 characters or more). Copy them: you need them in the sketch. Click **Add Device**. ![Add Device form with the IOTMP device type, a device ID and credentials](https://docs.thinger.io/screenshots/arduino-add-device.webp) *Add an IOTMP device* ### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"device": "YOUR_DEVICE", "type": "Generic", "credentials": "change-me-123"}' ``` `YOUR_TOKEN` is an access token. Set `credentials` to the device credentials you choose (6 characters or more). `Generic` is the IOTMP device type. ### CLI ```bash thinger device create YOUR_DEVICE -t Generic ``` Without `-c`, the CLI generates random credentials and prints them. See the [CLI reference](https://docs.thinger.io/reference/cli.md). ### AI **Prompt for an AI agent:** > Create an IOTMP device called YOUR_DEVICE in my Thinger.io account and show me its credentials. **Step 2: Install the library** ### Arduino IDE 1. Install the package of your board. Some packages need an extra URL first: open **File > Preferences** (**Arduino IDE > Settings** on macOS) and add it to **Additional boards manager URLs**. Then open **Tools > Board > Boards Manager**, search for the package and click **Install**. | Boards | Boards manager URL | Package | |---|---|---| | ESP32 | None: the package is in the default list. | **esp32** by Espressif Systems | | ESP8266 | `https://arduino.esp8266.com/stable/package_esp8266com_index.json` | **esp8266** by ESP8266 Community | | Arduino boards | None. | The package named on the [family page](https://docs.thinger.io/devices/arduino/boards.md) of your board. | 2. Open **Sketch > Include Library > Manage Libraries**, search for **thinger.io** and click **Install**. ![Arduino IDE 2 with the Library Manager open, the search box set to Thinger.io and the thinger.io library by Alvaro Luis Bustamante installed](https://docs.thinger.io/images/devices/arduino/arduino-ide-library-manager.webp) *The thinger.io library in the Library Manager* The library examples are in **File > Examples > thinger.io**, one per board (see [Start from a library example](#start-from-a-library-example)). **Install from a ZIP file.** If you cannot use the Library Manager, for example in an IDE based on the Arduino IDE such as Energia, download the ZIP of the latest release from the [Releases page of the library](https://github.com/thinger-io/Arduino-Library/releases). Then open **Sketch > Include Library > Add .ZIP Library** and choose the file. ![Sketch menu of the Arduino IDE with the Include Library option, which holds Add .ZIP Library](https://docs.thinger.io/images/devices/arduino/arduino-ide-add-zip-library.webp) *Sketch > Include Library holds Add .ZIP Library* ### PlatformIO 1. Install [Visual Studio Code](https://code.visualstudio.com/download). Open the Extensions view (`Ctrl+Shift+X`, or `Cmd+Shift+X` on macOS), search for **PlatformIO IDE** and click **Install**. ![Visual Studio Code Extensions view with platformio in the search box and the PlatformIO IDE extension page open](https://docs.thinger.io/images/devices/arduino/vscode-platformio-extension.webp) *The PlatformIO IDE extension* 2. Open **PIO Home** (the PlatformIO icon in the activity bar, then **Home**) and click **New Project**. ![PIO Home with the Quick Access buttons New Project, Import Arduino Project, Open Project and Project Examples](https://docs.thinger.io/images/devices/arduino/platformio-home-new-project.webp) *New Project in PIO Home* 3. In the **Project Wizard**, type a **Name**, choose your **Board** (**Espressif ESP32 Dev Module** for a generic ESP32) and the **Arduino** framework, and click **Finish**. PlatformIO downloads the tools of the board the first time. ![PlatformIO Project Wizard with the name Thinger.io Example, the board Espressif ESP32 Dev Module and the Arduino framework](https://docs.thinger.io/images/devices/arduino/platformio-project-wizard.webp) *The Project Wizard* 4. Add the library to `platformio.ini`, in the root of the project. Each `[env:…]` section is a board you build for: **platformio.ini** ```ini [env:esp32dev] platform = espressif32 board = esp32dev framework = arduino lib_deps = thinger-io/thinger.io monitor_speed = 115200 ``` PlatformIO downloads the library on the next build. The sketch goes in `src/main.cpp`: ```text my-project/ ├── include/ header files, such as arduino_secrets.h ├── lib/ private libraries ├── src/ │ └── main.cpp the sketch ├── test/ └── platformio.ini boards, libraries and build options ``` What each version of the library changes is in the [Arduino library changelog](https://docs.thinger.io/reference/arduino-library/changelog.md). **Step 3: Write the sketch** Replace the placeholders with your username, the device ID and the device credentials, and set your Wi-Fi network. The three values come from the device you created: ![On the left, the device in Thinger.io: the account username, the Device Id and the Device Credentials of the Add Device form. On the right, the three constants of the sketch: USERNAME takes the username, DEVICE_ID the Device Id and DEVICE_CREDENTIAL the Device Credentials.](https://docs.thinger.io/diagrams/device-credentials-mapping.svg) *From the console to the sketch* **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG // #define THINGER_SERVER "YOUR_SERVER" // only on a private instance #include #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define WIFI_SSID "wifi-network" #define WIFI_PASSWORD "wifi-password" #define LED_PIN 2 // change it to the LED pin of your board ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { Serial.begin(115200); pinMode(LED_PIN, OUTPUT); thing.add_wifi(WIFI_SSID, WIFI_PASSWORD); // input resource: turn the LED on and off thing["led"] << digitalPin(LED_PIN); // output resource: milliseconds since the board started thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` - `DEVICE_CREDENTIAL` holds the device credentials, not an access token. - On the free Cloud account, leave the `THINGER_SERVER` line commented: the library connects to the free Cloud server by default. On a private instance, uncomment it and set your domain. - `THINGER_SERIAL_DEBUG` prints the connection steps to the serial monitor. Keep it while you test. **Step 4: Upload the sketch** Select your board and port, upload the sketch and open the serial monitor at 115200 baud. When the device connects, the monitor shows `[THINGER] Authenticated`. **Step 5: Check that the device is online** ### Console Go to **Devices**. The device shows a green status dot (**Device Connected**). Open it: the **Status** page shows **Device State** as **Online**, with its IP address and the data transmitted. ![Device Status with Device State Online, transmitted and received data and the connection time](https://docs.thinger.io/screenshots/arduino-device-online.webp) *Status of a connected device* ### API **API call:** `GET /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-readstatus)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" ``` The response includes the connection state of the device. ### CLI ```bash thinger device get YOUR_DEVICE ``` ### AI **Prompt for an AI agent:** > Is my device YOUR_DEVICE connected to Thinger.io? Tell me since when and its IP address. **Step 6: Read a device resource** ### Console Open the device and go to **API**. Expand the `millis` device resource and click **Run**: the output shows the value from the board. Expand `led` to turn the LED on and off. ![Device API of a device with the led resource as an on/off switch, switched on, and the millis resource with its output after Run](https://docs.thinger.io/screenshots/arduino-device-api.webp) *The led and millis resources after Run* ### API **API call:** `GET /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessoutputresources)) ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/millis" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger device resource call YOUR_DEVICE millis ``` ### AI **Prompt for an AI agent:** > Read the millis resource of my device YOUR_DEVICE. ## Result The device appears as connected in **Devices**, and its device resources answer from the console, the API, the CLI and your agent. Continue with the [Coding guide](https://docs.thinger.io/devices/arduino/coding.md) to send data to a Data Bucket and react to commands. ## Start from a library example The library has a complete sketch for each board in **File > Examples > thinger.io** of the Arduino IDE. The same sketches are on the [family page](https://docs.thinger.io/devices/arduino/boards.md) of each board, to copy into a PlatformIO project. ![Arduino IDE File > Examples menu with thinger.io open: the Arduino, EnergiaCC3200, ESP32, ESP8266, LinkItOne and Sonoff folders, and the list of Arduino examples](https://docs.thinger.io/images/devices/arduino/arduino-ide-thinger-examples.webp) *The thinger.io examples in the Arduino IDE* The examples keep the credentials in a second file, `arduino_secrets.h`, that the Arduino IDE shows as a tab next to the sketch. Fill it in before you upload: **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define SSID "wifi-network" #define SSID_PASSWORD "wifi-password" ``` - `DEVICE_CREDENTIAL` holds the device credentials, not an access token. - Cellular boards replace `SSID` and `SSID_PASSWORD` with `PIN_NUMBER`, `GPRS_APN`, `GPRS_LOGIN` and `GPRS_PASSWORD`; Ethernet boards have no network settings. The three versions are in [Credentials file](https://docs.thinger.io/devices/arduino/boards.md#credentials-file). - In PlatformIO, put `arduino_secrets.h` in `include/` and keep `#include "arduino_secrets.h"` in `src/main.cpp`. - If you share the sketch, keep `arduino_secrets.h` out of version control. ## Update the firmware over the Internet The [Thinger.io extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=thinger-io.thinger-io) builds a PlatformIO project and sends the firmware to a device, or to every device of a product, over its Thinger.io connection. The device must run a sketch with OTA support: add the OTA include and object of your board (see [Supported boards](https://docs.thinger.io/devices/arduino/boards.md)). ![Sequence between Visual Studio Code, the Thinger.io server and the device: the extension builds the firmware and asks for confirmation, reads the OTA options of the device through the server, skips it if it already runs the same version, sends the firmware in blocks, and the device checks it, restarts with the new firmware and connects again. With a product as the target, the steps repeat for each device.](https://docs.thinger.io/diagrams/ota-update-flow.svg) *A firmware update from Visual Studio Code* **main.cpp** ```cpp #include #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerESP32OTA ota(thing); void setup() { thing.add_wifi("wifi-network", "wifi-password"); } void loop() { thing.handle(); } ``` The extension needs the PlatformIO extension, and it becomes active when you open a PlatformIO project. Set it up in the VS Code settings: | Setting | Default | Description | |---|---|---| | `thinger-io.host` | `iot.thinger.io` | Server of your account: the free Cloud server by default, or `YOUR_SERVER`. | | `thinger-io.port` | `443` | Server port. | | `thinger-io.ssl` | `true` | Use a TLS connection. | | `thinger-io.secure` | `true` | Verify the TLS certificate. | | `thinger-io.token` | (empty) | Access token of your account. If it is empty, the extension asks for one. | The access token needs these permissions: `ListDevices`, `ListProducts`, `AccessDeviceResources` and `ReadDeviceStatistics`. See [Access Tokens](https://docs.thinger.io/platform/access-tokens.md). **Step 1: Choose the target** Click the rocket in the status bar, or run **Thinger.io: Switch Target Destination** from the command palette. Choose **Device** and the device, or **Product** to update every device of a product. **Step 2: Upload the firmware** Click the upload button in the status bar, or run **Thinger.io: Upload Firmware**. If the project has several environments, pick one. The extension builds the firmware, asks you to confirm and uploads it. The device restarts with the new firmware. To skip devices that already run the same firmware, define `THINGER_OTA_VERSION` in the build. If the upload is slow, set **Application > Proxy > Proxy Support** to `fallback` in the VS Code settings. **Thinger.io: Clear Target Destination** removes the target. More on firmware updates in [OTA updates](https://docs.thinger.io/devices/ota.md). ## Troubleshooting Keep `#define THINGER_SERIAL_DEBUG` as the first line and open the serial monitor at 115200 baud: the library prints each step of the connection. | Symptom | Cause | Fix | |---|---|---| | Stops at `[NETWORK] Connecting to network` | Wrong Wi-Fi name or password, or the network is out of reach. | Check `WIFI_SSID` and `WIFI_PASSWORD`. Most ESP32 boards only join 2.4 GHz networks. | | `[_SOCKET] Error while connecting!` | The server cannot be reached. | On a private instance, check `THINGER_SERVER`. Check that the network allows outgoing connections. | | `[THINGER] Auth Failed! Check username, device id, or device credentials.` | The credentials do not match the device. | Check `USERNAME`, `DEVICE_ID` and `DEVICE_CREDENTIAL` against the device in **Devices**. | | No output at all | The sketch blocks before `thing.handle()`. | Remove long `delay()` calls and loops from `setup()` and `loop()`. | More cases in [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md). ## Next steps - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): The boards and network modules the Thinger.io Arduino library supports, with the class, the example sketch and the OTA support of each. - [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md): Let users set the Wi-Fi network and the Thinger.io credentials of an ESP32 or ESP8266 from a phone, without changing the firmware. --- Source: https://docs.thinger.io/devices/arduino/boards.md # Supported boards > The boards and network modules the Thinger.io Arduino library supports, with the class, the example sketch and the OTA support of each. The Thinger.io Arduino library (`thinger.io` in the library managers) supports these boards and network modules. Include the header of your board and create the `thing` object with its class; the rest of the sketch is the same for every board (see the [Coding guide](https://docs.thinger.io/devices/arduino/coding.md)). Each board has a complete sketch on its family page, and the same sketch in **File > Examples > thinger.io** of the Arduino IDE. - [ESP32](https://docs.thinger.io/devices/arduino/boards/esp32.md): Connect an ESP32, ESP32-S2, S3, C3, C5, C6 or P4 to Thinger.io over Wi-Fi or Ethernet, with OTA updates and the connection in its own FreeRTOS task. - [ESP8266](https://docs.thinger.io/devices/arduino/boards/esp8266.md): Connect an ESP8266 to Thinger.io over Wi-Fi, with OTA updates, ESP-Touch setup from a phone or as the Wi-Fi modem of another Arduino. - [Arduino Wi-Fi boards](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md): Connect the Arduino MKR, Nano, UNO and Yún Wi-Fi boards, the WiFi shield and the CC3000 module to Thinger.io, with one sketch per board. - [Portenta H7, Opta and GIGA R1 WiFi](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md): Connect an Arduino Portenta H7, Opta or GIGA R1 WiFi to Thinger.io on the Zephyr core, or on the Mbed OS core with Ethernet and OTA updates. - [Ethernet boards](https://docs.thinger.io/devices/arduino/boards/ethernet.md): Connect an Arduino with an Ethernet shield or an ENC28J60 module to Thinger.io, with DHCP or a fixed address. - [Cellular boards](https://docs.thinger.io/devices/arduino/boards/cellular.md): Connect the Arduino MKR GSM 1400, the MKR NB 1500 and Arduinos with a GSM modem to Thinger.io over the cellular network. - [Other boards](https://docs.thinger.io/devices/arduino/boards/other.md): Connect the Raspberry Pi Pico W and Pico 2 W, the Texas Instruments CC3200 LaunchPad and the SeeedStudio LinkIt ONE to Thinger.io over Wi-Fi or GPRS. ## Boards and classes The **Example** column is the name of the sketch in **File > Examples > thinger.io**. ### Espressif | Board | Network | Include | Class | Example | OTA | |---|---|---|---|---|---| | [ESP32, ESP32-S2, S3, C3, C5, C6](https://docs.thinger.io/devices/arduino/boards/esp32.md#esp32-over-wi-fi) | Wi-Fi | `ThingerESP32.h` | `ThingerESP32` | `ESP32`, `ESP32OTA`, `ESP32RTOS` | Yes, `ThingerESP32OTA` | | [ESP32, ESP32-P4](https://docs.thinger.io/devices/arduino/boards/esp32.md#esp32-over-ethernet) | Ethernet | `ThingerESP32Eth.h` | `ThingerESP32Eth` | `ESP32Eth` | Yes, `ThingerESP32OTA` | | [ESP32](https://docs.thinger.io/devices/arduino/webconfig.md) | Wi-Fi set up from a phone | `ThingerESP32WebConfig.h` | `ThingerESP32WebConfig` | `ESP32WebConfig` | — | | [ESP8266](https://docs.thinger.io/devices/arduino/boards/esp8266.md#esp8266-over-wi-fi) | Wi-Fi | `ThingerESP8266.h` | `ThingerESP8266` | `ESP8266`, `ESP8266OTA` | Yes, `ThingerESP8266OTA` | | [ESP8266](https://docs.thinger.io/devices/arduino/webconfig.md) | Wi-Fi set up from a phone | `ThingerESP8266WebConfig.h` | `ThingerESP8266WebConfig` | `ESP8266WebConfig` | — | | [ESP8266](https://docs.thinger.io/devices/arduino/boards/esp8266.md#esp8266-set-up-with-esp-touch) | Wi-Fi set up with ESP-Touch | `ThingerSmartConfig.h` | `ThingerSmartConfig` | `ESP8266SmartConfig` | — | | [Arduino with an ESP8266 as Wi-Fi modem](https://docs.thinger.io/devices/arduino/boards/esp8266.md#esp8266-as-the-wi-fi-modem-of-an-arduino) (AT commands) | Wi-Fi | `ThingerESP8266AT.h` | `ThingerESP8266AT` | `ESP8266AT` | — | ### Arduino | Board | Network | Include | Class | Example | OTA | |---|---|---|---|---|---| | [Arduino Nano RP2040 Connect](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#nano-rp2040-connect) | Wi-Fi | `ThingerMbed.h` | `ThingerMbed` | `ArduinoNanoRP2040` | Yes, `ThingerMbedOTA` | | [Arduino Nano 33 IoT](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#nano-33-iot) | Wi-Fi | `ThingerWiFiNINA.h` | `ThingerWiFiNINA` | `ArduinoNano33IOT` | Yes, `ThingerWiFiNINAOTA` | | [Arduino MKR WiFi 1010](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#mkr-wifi-1010) | Wi-Fi | `ThingerWiFiNINA.h` | `ThingerWiFiNINA` | `ArduinoMKR1010` | Yes, `ThingerWiFiNINAOTA` | | [Arduino UNO WiFi Rev2](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#uno-wifi-rev2) | Wi-Fi | `ThingerWiFiNINA.h` | `ThingerWiFiNINA` | — | — | | [Arduino Portenta H7, GIGA R1 WiFi](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#portenta-h7-and-giga-r1-wifi-on-the-zephyr-core) (Zephyr core) | Wi-Fi | `ThingerZephyr.h` | `ThingerZephyr` | `ArduinoZephyr` | — | | [Arduino Opta WiFi](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#opta-wifi-on-the-zephyr-core) (Zephyr core) | Wi-Fi | `ThingerZephyr.h` | `ThingerZephyr` | `ArduinoOptaZephyr` | — | | [Arduino Portenta H7](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#portenta-h7-over-wi-fi) (Mbed OS core) | Wi-Fi | `ThingerMbed.h` | `ThingerMbed` | `ArduinoPortentaH7` | Yes, `ThingerPortentaOTA` | | [Arduino Portenta H7](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#portenta-h7-over-ethernet) (Mbed OS core) | Ethernet | `ThingerMbedEth.h` | `ThingerMbedEth` | `ArduinoPortentaH7Ethernet` | Yes, `ThingerPortentaOTA` | | [Arduino Opta](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#opta-wifi-over-wi-fi) (Mbed OS core) | Wi-Fi | `ThingerMbed.h` | `ThingerMbed` | `ArduinoOptaWiFi` | Yes, `ThingerPortentaOTA` | | [Arduino Opta](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#opta-over-ethernet) (Mbed OS core) | Ethernet | `ThingerMbedEth.h` | `ThingerMbedEth` | `ArduinoOptaEthernet` | Yes, `ThingerPortentaOTA` | | [Arduino MKR NB 1500](https://docs.thinger.io/devices/arduino/boards/cellular.md#mkr-nb-1500) | NB-IoT / LTE-M | `ThingerMKRNB.h` | `ThingerMKRNB` | `ArduinoMKRNB1500` | Yes, `ThingerMKRNBOTA` | | [Arduino MKR GSM 1400](https://docs.thinger.io/devices/arduino/boards/cellular.md#mkr-gsm-1400) | GSM / GPRS | `ThingerMKRGSM.h` | `ThingerMKRGSM` | `ArduinoGSM1400` | — | | [Arduino MKR1000](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#mkr1000) | Wi-Fi | `ThingerWifi101.h` | `ThingerWifi101` | `ArduinoMKR1000` | — | | [Arduino UNO R4 WiFi](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#uno-r4-wifi) | Wi-Fi | `ThingerR4WiFi.h` | `ThingerR4WiFi` | `ArduinoR4Wifi` | Yes, `ThingerR4OTA` | | [Arduino UNO Q](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#uno-q) | Wi-Fi, through its Linux side | `ThingerUnoQ.h` | `ThingerUnoQ` | `ArduinoUnoQ` | — | | [Arduino Yún](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#arduino-yun) | Wi-Fi or Ethernet | `ThingerYun.h` | `ThingerYun` | `ArduinoYun` | — | | [Arduino with Ethernet shield](https://docs.thinger.io/devices/arduino/boards/ethernet.md#arduino-with-ethernet-shield) | Ethernet | `ThingerEthernet.h` | `ThingerEthernet` | `ArduinoEthernet` | — | | [Arduino with ENC28J60 module](https://docs.thinger.io/devices/arduino/boards/ethernet.md#arduino-with-enc28j60) | Ethernet | `ThingerENC28J60.h` | `ThingerENC28J60` | `ArduinoENC28J60` | — | | [Arduino with WiFi shield](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#arduino-with-wifi-shield) | Wi-Fi | `ThingerWifi.h` | `ThingerWifi` | `ArduinoWifi` | — | | [Arduino with Adafruit CC3000](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#arduino-with-adafruit-cc3000) | Wi-Fi | `ThingerCC3000.h` | `ThingerCC3000` | `ArduinoCC3000` | — | | [Arduino with a GSM modem](https://docs.thinger.io/devices/arduino/boards/cellular.md#arduino-with-a-gsm-modem) (SIM800, SIM900, A6, A7, M590) | GPRS | `ThingerTinyGSM.h` | `ThingerTinyGSM` | `ArduinoTinyGSM` | — | ### Other boards | Board | Network | Include | Class | Example | OTA | |---|---|---|---|---|---| | [Raspberry Pi Pico W and Pico 2 W](https://docs.thinger.io/devices/arduino/boards/other.md#raspberry-pi-pico-w-and-pico-2-w) | Wi-Fi | `ThingerPicoW.h` | `ThingerPicoW` | `PicoW` | Yes, `ThingerPicoOTA` | | [Thinger.io NB-IoT Core](https://docs.thinger.io/hardware/thinger32-nb-iot.md) | NB-IoT | `ThingerNBCore.h` | `ThingerNBCore` | `NBCore` | Yes, `ThingerESP32OTA` | | [Texas Instruments CC3200](https://docs.thinger.io/devices/arduino/boards/other.md#ti-cc3200-launchpad) (Energia IDE) | Wi-Fi | `ThingerWifi.h` | `ThingerWifi` | `EnergiaCC3200` | — | | [SeeedStudio LinkIt ONE](https://docs.thinger.io/devices/arduino/boards/other.md#linkit-one-over-wi-fi) | Wi-Fi | `ThingerLinkItOneWifi.h` | `ThingerLinkItOneWifi` | `LinkItOneWifi` | — | | [SeeedStudio LinkIt ONE](https://docs.thinger.io/devices/arduino/boards/other.md#linkit-one-over-gprs) | GPRS | `ThingerLinkItOneGPRS.h` | `ThingerLinkItOneGPRS` | `LinkItOneGPRS` | — | A board with OTA support can receive firmware updates over the Internet from the [Visual Studio Code extension](https://docs.thinger.io/devices/arduino.md#update-the-firmware-over-the-internet). Add the OTA include and create the OTA object after `thing`: ```cpp #include #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerESP32OTA ota(thing); ``` ## Credentials file The example sketches keep the credentials out of the code, in a file called `arduino_secrets.h` in the sketch folder (the Arduino IDE shows it as a second tab). The sketch includes it with `#include "arduino_secrets.h"`. Replace the placeholders with your username, the device ID and the device credentials, and add the settings of your network: **Wi-Fi boards** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define SSID "wifi-network" #define SSID_PASSWORD "wifi-password" ``` **Cellular boards** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define PIN_NUMBER "1234" #define GPRS_APN "internet.example" #define GPRS_LOGIN "" #define GPRS_PASSWORD "" ``` **Ethernet boards** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" ``` - `DEVICE_CREDENTIAL` holds the device credentials, not an access token. - Keep `arduino_secrets.h` out of version control if you share the sketch. - You can also write the values in the sketch itself, as the [Arduino](https://docs.thinger.io/devices/arduino.md) guide does. ## Server and TLS The library connects to the free Cloud server by default. On a private instance, define your domain before the first include, where `YOUR_SERVER` is your own domain: ```cpp #define THINGER_SERVER "YOUR_SERVER" ``` Most boards connect over TLS, to port 25202, and validate the server certificate. These connect without TLS, to port 25200: the Ethernet shield, the ENC28J60 module, the WiFi shield, the CC3000 module, the ESP8266 as Wi-Fi modem, the CC3200 and the LinkIt ONE. All the options are in [Compile options](https://docs.thinger.io/reference/arduino-library.md#compile-options). The ESP32, the ESP8266, the Raspberry Pi Pico W and Pico 2 W, the Arduino UNO R4 WiFi, the Arduino UNO Q and the boards of the Arduino Zephyr core (`ThingerZephyr`) validate the server with a root certificate built into the library: the one of the free Cloud servers, or the one of Let's Encrypt when you set `THINGER_SERVER`. If the certificate of your instance comes from another authority, such as your own, define its root certificate in PEM format with `THINGER_ROOT_CA`, before the include. It replaces the default certificates: ```cpp #define THINGER_SERVER "YOUR_SERVER" #define THINGER_ROOT_CA R"(-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----)" #include ``` Paste the whole certificate between the `R"(` and `)"` marks, with its `BEGIN` and `END` lines. `thing.set_root_ca()` can also set it from the sketch, in `setup()` or while the device runs; it takes effect on the next connection. `#define THINGER_INSECURE_SSL` skips the certificate check, for a private instance with a self-signed certificate, on the ESP32, the ESP8266, the Raspberry Pi Pico W and Pico 2 W and the boards of the Zephyr core. The Wi-Fi module of the UNO R4 WiFi always checks the certificate: with this option it uses its own root certificates instead of the one of the library. ## See also - [Arduino](https://docs.thinger.io/devices/arduino.md): install the library and connect a board. - [Arduino library reference](https://docs.thinger.io/reference/arduino-library.md): every class and function. - [Thinger.io hardware](https://docs.thinger.io/hardware.md): boards made by Thinger.io. --- Source: https://docs.thinger.io/devices/arduino/boards/esp32.md # ESP32 > Connect an ESP32, ESP32-S2, S3, C3, C5, C6 or P4 to Thinger.io over Wi-Fi or Ethernet, with OTA updates and the connection in its own FreeRTOS task. The ESP32 is a microcontroller from Espressif with Wi-Fi and Bluetooth. It is found on many development boards, some with Ethernet, LoRa, audio or a display. The Thinger.io Arduino library connects it over Wi-Fi with `ThingerESP32` and over Ethernet with `ThingerESP32Eth`, always with TLS. ![ESP32 development board with an ESP32-WROOM module, a micro USB connector and two rows of pins](https://docs.thinger.io/images/devices/boards/esp32-devkit.webp) *ESP32 development board (ESP32-WROOM)* ## Supported chips The same sketches work on every chip of the family. In the Arduino IDE, select the board of your chip in **Tools > Board > esp32**. | Chip | Network | Class | OTA | |---|---|---|---| | ESP32 | Wi-Fi or Ethernet | `ThingerESP32`, `ThingerESP32Eth` | Yes, `ThingerESP32OTA` | | ESP32-S2 | Wi-Fi | `ThingerESP32` | Yes, `ThingerESP32OTA` | | ESP32-S3 | Wi-Fi | `ThingerESP32` | Yes, `ThingerESP32OTA` | | ESP32-C3 | Wi-Fi | `ThingerESP32` | Yes, `ThingerESP32OTA` | | ESP32-C5 | Wi-Fi, 2.4 and 5 GHz | `ThingerESP32` | Yes, `ThingerESP32OTA` | | ESP32-C6 | Wi-Fi | `ThingerESP32` | Yes, `ThingerESP32OTA` | | ESP32-P4 | Ethernet | `ThingerESP32Eth` | Yes, `ThingerESP32OTA` | Boards built on these chips use the same classes, such as the Arduino Nano ESP32 (ESP32-S3) and the Seeed Studio XIAO ESP32 boards. The ESP32-P4 has no Wi-Fi of its own: connect it over Ethernet, as in [ESP32 over Ethernet](#esp32-over-ethernet). ## Set up the board **Step 1: Install the board package** In the Arduino IDE, open **Tools > Board > Boards Manager**, search for `esp32` and install **esp32** by Espressif Systems. In PlatformIO, use `platform = espressif32`. **Step 2: Install the library** Install **thinger.io** from the Library Manager. See [Arduino](https://docs.thinger.io/devices/arduino.md) for PlatformIO. **Step 3: Create the credentials file** The sketches read the credentials from `arduino_secrets.h`, in the sketch folder: **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define SSID "wifi-network" #define SSID_PASSWORD "wifi-password" ``` `DEVICE_CREDENTIAL` holds the device credentials. The Ethernet sketch does not use `SSID` and `SSID_PASSWORD`. Each example is in **File > Examples > thinger.io > ESP32**. ## ESP32 over Wi-Fi Example `ESP32`. The board joins the Wi-Fi network set with `add_wifi()` and exposes an input resource for GPIO 16 and an output resource with the milliseconds since it started. **ESP32.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); pinMode(16, OUTPUT); thing.add_wifi(SSID, SSID_PASSWORD); // add more networks calling add_wifi again: it connects to the strongest one // thing.add_wifi("other-network", "other-password"); // WPA2-Enterprise networks (PEAP), such as eduroam. Pass the CA certificate of the // authentication server (provided by your organization) as the last parameter to validate it // thing.add_wifi_enterprise("eduroam", "user@example.com", "password", "anonymous@example.com", EDUROAM_CA); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["GPIO_16"] << digitalPin(16); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Without `add_wifi()`, the board joins the last network stored in its flash. With several calls to `add_wifi()`, it joins the strongest of those networks, and `add_wifi_enterprise()` adds a WPA2-Enterprise network such as eduroam (version 3 of the **esp32** board package). See [Connect to several Wi-Fi networks](https://docs.thinger.io/devices/arduino/coding.md#connect-to-several-wi-fi-networks) and [Connect to a WPA2-Enterprise network](https://docs.thinger.io/devices/arduino/coding.md#connect-to-a-wpa2-enterprise-network). ## ESP32 with OTA updates Example `ESP32OTA`. The same sketch with the OTA object, so you can send new firmware from the [Visual Studio Code extension](https://docs.thinger.io/devices/ota.md). Upload it once over USB; the next updates go over the Internet. **ESP32OTA.ino** ```cpp #define THINGER_SERIAL_DEBUG // compatibility fields of this firmware: the VS Code extension asks for confirmation before updating // a device with different values (i.e., a firmware for another PCB version) // #define THINGER_OTA_CHECK(FIELD) FIELD("PCB_MODEL", "MY_BOARD") FIELD("PCB_VERSION", "V1") // roll back to the previous firmware if a new one cannot connect to Thinger.io in 5 minutes, or reboots before // #define THINGER_OTA_ROLLBACK #include #include #include "arduino_secrets.h" ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); // receives firmware updates from the Thinger.io extension for Visual Studio Code ThingerESP32OTA ota(thing); void setup() { // open serial for debugging Serial.begin(115200); pinMode(16, OUTPUT); thing.add_wifi(SSID, SSID_PASSWORD); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["GPIO_16"] << digitalPin(16); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Uncomment `THINGER_OTA_CHECK` to declare the hardware the firmware is built for, as in [Check the hardware compatibility](https://docs.thinger.io/devices/ota.md#check-the-hardware-compatibility), and `THINGER_OTA_ROLLBACK` to go back to the previous firmware when a new one does not connect, as in [Roll back a failed update](https://docs.thinger.io/devices/ota.md#roll-back-a-failed-update-esp32). ## ESP32 with the connection in its own task Example `ESP32RTOS`. `#define THINGER_FREE_RTOS` before the include adds `thing.start()`, which runs the connection in its own FreeRTOS task. `loop()` stays free for your code, with no `thing.handle()`. **ESP32RTOS.ino** ```cpp #define THINGER_SERIAL_DEBUG #define THINGER_FREE_RTOS #include #include "arduino_secrets.h" ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); pinMode(16, OUTPUT); thing.add_wifi(SSID, SSID_PASSWORD); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["GPIO_16"] << digitalPin(16); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); // start the connection in its own task thing.start(); } void loop() { // your code here: no thing.handle() needed // wrap variables shared with device resources in thing.lock() and thing.unlock() } ``` `thing.start(core, stack_size)` takes the CPU core and the stack size of the task (by default, the core that runs `loop()` and 8192 bytes). `thing.stop()` ends the task and `thing.is_running()` tells whether it runs. Wrap any variable that `loop()` and a device resource both use in `thing.lock()` and `thing.unlock()`, and also the calls to the platform from `loop()`, such as `thing.write_bucket()`. `thing.get_state()` and `thing.get_error()` can be read from any task or core without them. ## ESP32 over Ethernet Example `ESP32Eth`. For ESP32 and ESP32-P4 boards with an Ethernet port. The example is set up for a LAN8720 PHY; for other boards, change the PHY settings below. The board gets its address over DHCP and exposes an output resource with its network data. **ESP32Eth.ino** ```cpp // Ethernet PHY of your board: these values are for a LAN8720 (RMII) #ifndef ETH_PHY_TYPE #define ETH_PHY_TYPE ETH_PHY_LAN8720 #define ETH_PHY_ADDR 0 #define ETH_PHY_MDC 23 #define ETH_PHY_MDIO 18 #define ETH_PHY_POWER -1 #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN #endif // enable debug output over serial #define THINGER_SERIAL_DEBUG // skip the certificate check (private instance with a self-signed certificate) // #define THINGER_INSECURE_SSL // #define THINGER_SERVER "YOUR_SERVER" // only on a private instance // root certificate (PEM) of a server with its own certificate authority // #define THINGER_ROOT_CA R"(-----BEGIN CERTIFICATE----- // ... // -----END CERTIFICATE-----)" #include #include #include "arduino_secrets.h" ThingerESP32Eth thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); // receives firmware updates from the Thinger.io extension for Visual Studio Code ThingerESP32OTA ota(thing); void setup() { // enable serial for debugging Serial.begin(115200); // fixed address instead of DHCP: ip, gateway, subnet and, optionally, two DNS servers // thing.set_address("192.168.1.55", "192.168.1.1", "255.255.255.0", "8.8.8.8", "8.8.4.4"); // host name of the board on the network thing.set_hostname("ESP32Eth"); // network data of the board thing["eth"] >> [](pson& out){ out["hostname"] = ETH.getHostname(); out["mac"] = ETH.macAddress(); out["ip"] = ETH.localIP().toString(); out["link"] = ETH.linkSpeed(); }; } void loop() { thing.handle(); } ``` The `eth` resource returns: ```json { "hostname": "ESP32Eth", "mac": "AA:BB:CC:DD:EE:FF", "ip": "192.168.1.55", "link": 100 } ``` ### Ethernet PHY settings `ETH.begin()` only starts the Ethernet port when these values match the board. The example sets them for a LAN8720; change them for other boards, before the include. | Define | LAN8720 value | Meaning | |---|---|---| | `ETH_PHY_TYPE` | `ETH_PHY_LAN8720` | PHY chip. Others: `ETH_PHY_TLK110`, `ETH_PHY_RTL8201`, `ETH_PHY_DP83848`, `ETH_PHY_KSZ8041`, `ETH_PHY_KSZ8081`… | | `ETH_PHY_ADDR` | `0` | Address of the PHY on the management bus. | | `ETH_PHY_MDC` | `23` | GPIO of the MDC clock line. | | `ETH_PHY_MDIO` | `18` | GPIO of the MDIO data line. | | `ETH_PHY_POWER` | `-1` | GPIO that powers the PHY, or `-1` if the board has none. | | `ETH_CLK_MODE` | `ETH_CLOCK_GPIO0_IN` | Source of the 50 MHz RMII clock: here, an external clock on GPIO 0. | The board maker documents the values of each board. `#ifndef ETH_PHY_TYPE` keeps the values of board packages that already define them: the **ESP32P4 Dev Module** board of the **esp32** package defines its own PHY settings, so on an ESP32-P4 the example compiles without changes. Check them against your board. - `set_address(ip, gateway, subnet, dns1, dns2)` sets a fixed address. The DNS servers default to `8.8.8.8` and `8.8.4.4`. Call it before the first `thing.handle()`. - `set_hostname()` sets the host name the board announces on the network. - `ThingerESP32Eth` also supports `#define THINGER_FREE_RTOS` and `thing.start()`. ## ESP32 set up from a phone Example `ESP32WebConfig`. `ThingerESP32WebConfig` opens its own Wi-Fi network, where you enter the Wi-Fi network and the device credentials from a phone. See [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md). ## Notes - On the ESP32, `analogPin()` is not available: read the pin with `analogRead()` inside an output resource. - The connection uses TLS and validates the server certificate. For a private instance whose certificate comes from its own authority, define its root certificate with `THINGER_ROOT_CA` before the include, as in [Server and TLS](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls). `#define THINGER_INSECURE_SSL` skips the check, for a private instance with a self-signed certificate. - ESP32 boards join 2.4 GHz Wi-Fi networks; the ESP32-C5 also joins 5 GHz networks. - `ThingerESP32OTA` receives the firmware compressed. `#define THINGER_OTA_COMPRESSION 0` before the includes makes it receive the firmware uncompressed. ## See also - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): every board, its class and its OTA support. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): device resources, Data Buckets, properties and endpoints. - [OTA updates](https://docs.thinger.io/devices/ota.md): send new firmware over the Internet. --- Source: https://docs.thinger.io/devices/arduino/boards/esp8266.md # ESP8266 > Connect an ESP8266 to Thinger.io over Wi-Fi, with OTA updates, ESP-Touch setup from a phone or as the Wi-Fi modem of another Arduino. The ESP8266 is a Wi-Fi microcontroller from Espressif. It comes in modules such as the ESP-01, ESP-03, ESP-07 and ESP-12, with 512 KB to 4 MB of flash, and in development boards such as the NodeMCU. The Thinger.io Arduino library runs on the ESP8266 itself with `ThingerESP8266`, or uses an ESP8266 with the AT firmware as the Wi-Fi modem of another Arduino with `ThingerESP8266AT`. ![NodeMCU development board with an ESP-12 module, a micro USB connector and the FLASH and RST buttons](https://docs.thinger.io/images/devices/boards/esp8266-nodemcu.webp) *ESP8266 development board (NodeMCU)* ## Set up the board **Step 1: Add the board package URL** In the Arduino IDE, open **File > Preferences** (**Arduino IDE > Settings** on macOS) and add this URL to **Additional boards manager URLs**: ```text https://arduino.esp8266.com/stable/package_esp8266com_index.json ``` **Step 2: Install the board package** Open **Tools > Board > Boards Manager**, search for `esp8266` and install **esp8266** by ESP8266 Community. In PlatformIO, use `platform = espressif8266`. ![Arduino IDE Boards Manager with the esp8266 package by ESP8266 Community and its Install button](https://docs.thinger.io/images/devices/boards/arduino-ide-boards-manager-esp8266.webp) *The esp8266 package in the Boards Manager* **Step 3: Install the library** Install **thinger.io** from the Library Manager. See [Arduino](https://docs.thinger.io/devices/arduino.md) for PlatformIO. **Step 4: Create the credentials file** The sketches read the credentials from `arduino_secrets.h`, in the sketch folder: **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define SSID "wifi-network" #define SSID_PASSWORD "wifi-password" ``` `DEVICE_CREDENTIAL` holds the device credentials. The ESP-Touch sketch does not use `SSID` and `SSID_PASSWORD`. To upload a sketch: - Development boards with a USB port, such as the NodeMCU, enter flash mode on their own: select the board and the port and upload. - Bare modules (ESP-01, ESP-12…) need a 3.3 V USB-to-serial converter. Hold GPIO 0 to ground while the module resets to enter flash mode, then upload. The [ESP8266 Arduino core](https://github.com/esp8266/Arduino) documents the wiring of each module. Each example is in **File > Examples > thinger.io > ESP8266**. ## ESP8266 over Wi-Fi Example `ESP8266`. The board joins the Wi-Fi network set with `add_wifi()` and exposes an input resource for the built-in LED and an output resource with the milliseconds since it started. **ESP8266.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for monitoring Serial.begin(115200); // set builtin led as output pinMode(LED_BUILTIN, OUTPUT); // add WiFi credentials thing.add_wifi(SSID, SSID_PASSWORD); // add more networks calling add_wifi again: it connects to the strongest one // thing.add_wifi("other-network", "other-password"); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Without `add_wifi()`, the board joins the last network stored in its flash. With several calls to `add_wifi()`, it joins the strongest of those networks; see [Connect to several Wi-Fi networks](https://docs.thinger.io/devices/arduino/coding.md#connect-to-several-wi-fi-networks). ## ESP8266 with OTA updates Example `ESP8266OTA`. The same sketch with the OTA object, so you can send new firmware from the [Visual Studio Code extension](https://docs.thinger.io/devices/ota.md). Upload it once over USB; the next updates go over the Internet. **ESP8266OTA.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); // receives firmware updates from the Thinger.io extension for Visual Studio Code ThingerESP8266OTA ota(thing); void setup() { // open serial for monitoring Serial.begin(115200); // set builtin led as output pinMode(LED_BUILTIN, OUTPUT); // add WiFi credentials thing.add_wifi(SSID, SSID_PASSWORD); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ## ESP8266 set up with ESP-Touch Example `ESP8266SmartConfig`. `ThingerSmartConfig` takes the Wi-Fi network from a phone, so the sketch has no Wi-Fi name or password. The phone runs Espressif's [ESP-Touch app](https://www.espressif.com/en/products/software/esp-touch/resources) (SmartConfig): you type the password of the network the phone is on, and the app sends it to the board. **ESP8266SmartConfig.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerSmartConfig thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` How the board connects: 1. It tries the last network it joined, for up to 15 seconds. 2. If that fails, it waits up to 60 seconds for the ESP-Touch app, blinking the built-in LED. Send the network from the app in that time; otherwise the board tries again. 3. When it joins the network, the LED blinks quickly ten times and the board connects to Thinger.io. Pass `false` as the fourth argument to leave the LED alone: `ThingerSmartConfig thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, false);`. To set up the board from a phone with its own setup page instead, use `ThingerESP8266WebConfig` (example `ESP8266WebConfig`). See [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md). ## ESP8266 as the Wi-Fi modem of an Arduino Example `ESP8266AT`. An Arduino without Wi-Fi, such as an UNO or a Mega, uses an ESP8266 that runs the Espressif AT firmware as its Wi-Fi modem, over a serial port. Install the **TinyGSM** library, which `ThingerESP8266AT` uses to talk to the modem. **ESP8266AT.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" // emulate Serial1 on pins 10 (RX) and 11 (TX) if the board has no second serial port #ifndef HAVE_HWSERIAL1 #include "SoftwareSerial.h" SoftwareSerial Serial1(10, 11); // RX, TX #endif ThingerESP8266AT thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1); void setup() { // open serial for debugging Serial.begin(115200); // serial port of the ESP8266, at its baud rate Serial1.begin(9600); thing.add_wifi(SSID, SSID_PASSWORD); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) pinMode(LED_BUILTIN, OUTPUT); thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` - The fourth argument of the class is the serial port wired to the ESP8266. - Open the port at the baud rate of the ESP8266. To change it, send the AT command `AT+UART_DEF=9600,8,1,0,0` to the module. Use the highest rate that works with your wiring: software serial ports are not reliable at high rates. - This connection does not use TLS: it goes to the server port without TLS. > **Warning** > > `ThingerESP8266AT` does not compile with the current releases of the TinyGSM library (0.10 and later). ## Notes ### Deep sleep `ESP.deepSleep()` turns off most of the chip; the board wakes up with a reset from GPIO 16. Wire GPIO 16 (pin `D0` on most development boards) to `RST`, or the board never wakes up. Some boards also wire an LED to `D0`. On those boards, `ThingerSmartConfig` makes the board reset in a loop, because it drives the LED pin: create it with `false` as the fourth argument. ```cpp ThingerSmartConfig thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, false); // required for deep sleep ``` ### TLS `ThingerESP8266`, `ThingerSmartConfig` and `ThingerESP8266WebConfig` connect over TLS and validate the server certificate. For a private instance whose certificate comes from its own authority, define its root certificate with `THINGER_ROOT_CA` before the include, as in [Server and TLS](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls). `#define THINGER_INSECURE_SSL` skips the check, for a private instance with a self-signed certificate. ## See also - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): every board, its class and its OTA support. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): device resources, Data Buckets, properties and endpoints. - [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md): set up the Wi-Fi network and the credentials from a phone. --- Source: https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md # Arduino Wi-Fi boards > Connect the Arduino MKR, Nano, UNO and Yún Wi-Fi boards, the WiFi shield and the CC3000 module to Thinger.io, with one sketch per board. Arduino makes boards with Wi-Fi built in (MKR, Nano, UNO R4, UNO Q, Yún), and older boards connect through a shield or an external module. This page has the sketch of each one. For the Portenta H7, the Opta and the GIGA R1 WiFi, see [Portenta H7, Opta and GIGA R1 WiFi](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md). | Board | Wi-Fi library | Class | TLS | OTA | |---|---|---|---|---| | [MKR WiFi 1010](#mkr-wifi-1010) | WiFiNINA | `ThingerWiFiNINA` | Yes | Yes, `ThingerWiFiNINAOTA` | | [Nano 33 IoT](#nano-33-iot) | WiFiNINA | `ThingerWiFiNINA` | Yes | Yes, `ThingerWiFiNINAOTA` | | [UNO WiFi Rev2](#uno-wifi-rev2) | WiFiNINA | `ThingerWiFiNINA` | Yes | — | | [Nano RP2040 Connect](#nano-rp2040-connect) | WiFiNINA | `ThingerMbed` | Yes | Yes, `ThingerMbedOTA` | | [MKR1000](#mkr1000) | WiFi101 | `ThingerWifi101` | Yes | — | | [UNO R4 WiFi](#uno-r4-wifi) | WiFiS3 (in the board package) | `ThingerR4WiFi` | Yes | Yes, `ThingerR4OTA` | | [UNO Q](#uno-q) | Arduino_RouterBridge | `ThingerUnoQ` | Yes, on the Linux side | — | | [Arduino with WiFi shield](#arduino-with-wifi-shield) | WiFi | `ThingerWifi` | No | — | | [Arduino with Adafruit CC3000](#arduino-with-adafruit-cc3000) | Adafruit CC3000 | `ThingerCC3000` | No | — | | [Arduino Yún](#arduino-yun) | Bridge | `ThingerYun` | Yes | — | ## Set up the board **Step 1: Install the board package** In the Arduino IDE, open **Tools > Board > Boards Manager** and install the package of your board: **Arduino SAMD Boards** (MKR WiFi 1010, Nano 33 IoT, MKR1000), **Arduino megaAVR Boards** (UNO WiFi Rev2), **Arduino Mbed OS Nano Boards** (Nano RP2040 Connect), **Arduino UNO R4 Boards** (UNO R4 WiFi), **Arduino Q Boards** (UNO Q) or **Arduino AVR Boards** (Yún, and UNO or Mega with a shield). **Step 2: Install the libraries** Install **thinger.io** and the Wi-Fi library of your board, from the table above, with the Library Manager. The WiFiS3 and WiFi libraries come with their board packages. **Step 3: Create the credentials file** The sketches read the credentials from `arduino_secrets.h`, in the sketch folder: **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define SSID "wifi-network" #define SSID_PASSWORD "wifi-password" ``` `DEVICE_CREDENTIAL` holds the device credentials. The UNO Q and Yún sketches only use the first three. **Step 4: Upload the server certificate (WiFiNINA and WiFi101 boards)** The Wi-Fi module of these boards validates the server with the root certificates stored in it. If the board cannot connect, upload the certificate of the server, as in [Upload the server certificate](#upload-the-server-certificate). Each example is in **File > Examples > thinger.io > Arduino**. ## MKR WiFi 1010 The MKR WiFi 1010 has a SAMD21 microcontroller, a u-blox NINA-W10 Wi-Fi module and a crypto chip. Example `ArduinoMKR1010`, with OTA updates: ![Arduino MKR WiFi 1010 board with its u-blox NINA-W10 Wi-Fi module](https://docs.thinger.io/images/devices/boards/mkr-wifi-1010.webp) *Arduino MKR WiFi 1010* **ArduinoMKR1010.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" // cannot connect? Update the WiFiNINA firmware and upload the server certificate ThingerWiFiNINA thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerWiFiNINAOTA ota(thing); void setup() { // configure LED_BUILTIN for output pinMode(LED_BUILTIN, OUTPUT); // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ## Nano 33 IoT The Nano 33 IoT has a SAMD21 microcontroller, a u-blox NINA-W102 Wi-Fi module, a 6-axis IMU and a crypto chip. Example `ArduinoNano33IOT`, with OTA updates and an output resource with the gyroscope of the IMU. It needs the **Arduino_LSM6DS3** library. ![Arduino Nano 33 IoT board, top and bottom views](https://docs.thinger.io/images/devices/boards/nano-33-iot.webp) *Arduino Nano 33 IoT* **ArduinoNano33IOT.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" // IMU of the board: requires the Arduino_LSM6DS3 library #include // cannot connect? Update the WiFiNINA firmware and upload the server certificate ThingerWiFiNINA thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerWiFiNINAOTA ota(thing); void setup() { // configure LED_BUILTIN for output pinMode(LED_BUILTIN, OUTPUT); // open serial for debugging Serial.begin(115200); // initialize IMU if (!IMU.begin()) { Serial.println("Failed to initialize IMU!"); while (1); } // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); // gyroscope of the IMU, in degrees per second thing["imu"] >> [](pson& out){ float x, y, z; IMU.readGyroscope(x, y, z); out["x"] = x; out["y"] = y; out["z"] = z; }; } void loop() { thing.handle(); } ``` The `imu` resource returns the rotation on each axis, for example `{"x": 0.43, "y": -1.1, "z": 0.06}`. ## UNO WiFi Rev2 The UNO WiFi Rev2 has an ATmega4809 microcontroller and a u-blox NINA-W102 Wi-Fi module. It uses the same class as the MKR WiFi 1010, without OTA updates. It has 6 KB of RAM: keep the number of device resources and the size of their data small. **ArduinoUnoWiFiRev2.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" // cannot connect? Update the WiFiNINA firmware and upload the server certificate ThingerWiFiNINA thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // configure LED_BUILTIN for output pinMode(LED_BUILTIN, OUTPUT); // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ## Nano RP2040 Connect The Nano RP2040 Connect has a dual-core Arm Cortex-M0+ RP2040 microcontroller at 133 MHz, 264 KB of SRAM, 16 MB of flash and a u-blox NINA-W102 Wi-Fi module. It runs Mbed OS: `ThingerMbed` runs the connection in its own thread. It needs the **WiFiNINA** library. ![Arduino Nano RP2040 Connect board](https://docs.thinger.io/images/devices/boards/nano-rp2040-connect.webp) *Arduino Nano RP2040 Connect* Example `ArduinoNanoRP2040`, with OTA updates: **ArduinoNanoRP2040.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerMbed thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerMbedOTA ota(thing); // cannot connect? Update the WiFiNINA firmware and upload the server certificate void setup() { // configure LED_BUILTIN for output pinMode(LED_BUILTIN, OUTPUT); // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); // start the connection in its own thread thing.start(); } void loop() { // your code here: no thing.handle() needed // wrap variables shared with device resources in thing.lock() and thing.unlock() delay(1000); } ``` `thing.start()` starts the connection thread; `thing.stop()` ends it and `thing.is_running()` tells whether it runs. Wrap any variable that `loop()` and a device resource both use in `thing.lock()` and `thing.unlock()`. Every firmware you send over the air must include `ThingerMbedOTA.h` too, as the board installs updates with it. The board rejects a firmware without it, with `The firmware does not include ThingerMbedOTA.h, so it cannot be applied`, and keeps running its current firmware. ## MKR1000 The MKR1000 has an ATSAMW25 module: a SAMD21 microcontroller, a WINC1500 Wi-Fi chip and a crypto chip. It needs the **WiFi101** library. Example `ArduinoMKR1000`: ![Arduino MKR1000 board with its ATSAMW25 module](https://docs.thinger.io/images/devices/boards/mkr1000.webp) *Arduino MKR1000* **ArduinoMKR1000.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" // cannot connect? Update the WiFi101 firmware and upload the server certificate ThingerWifi101 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); pinMode(LED_BUILTIN, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ## UNO R4 WiFi The UNO R4 WiFi has a Renesas RA4M1 microcontroller and an ESP32-S3 module for Wi-Fi. `ThingerR4WiFi` uses the WiFiS3 library of its board package. Example `ArduinoR4Wifi`, with OTA updates: **ArduinoR4Wifi.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerR4WiFi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); // receives firmware updates from the Thinger.io extension for Visual Studio Code ThingerR4OTA ota(thing); void setup() { // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); pinMode(LED_BUILTIN, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Remove `ThingerR4OTA.h` and the `ota` object if you do not need OTA updates. - **Update the firmware of the Wi-Fi module** before you connect the board: with an old firmware, the module cannot open the TLS connection to the server. Connect the board, open **Tools > Firmware Updater** in the Arduino IDE, select the board, click **Check Updates** and install the latest firmware. Then upload your sketch again. - OTA updates also need a recent firmware in the Wi-Fi module: with an older one, the board rejects the update with `Update the UNO R4 WiFi firmware to 0.4.1 or later`. - The Wi-Fi module stores the new firmware in its own flash and programs the RA4M1 with it when the board restarts after the update. - The board validates the server with the root certificate of the library, like the ESP32. For a private instance whose certificate comes from its own authority, define its root certificate with `THINGER_ROOT_CA` or set it with `thing.set_root_ca()`, as in [Server and TLS](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls). - The Wi-Fi module always checks the server certificate: `#define THINGER_INSECURE_SSL` does not skip the check, it makes the module validate the server with its own root certificates instead of the one of the library. ## UNO Q The UNO Q combines an STM32U585 microcontroller, which runs the sketch, with a Qualcomm processor that runs Linux and has the Wi-Fi. The microcontroller has no network of its own: `ThingerUnoQ` connects through the Linux side with the **Arduino_RouterBridge** library, and the Linux side opens the TLS connection to the server. Install **Arduino_RouterBridge** with the Library Manager. Example `ArduinoUnoQ`: **ArduinoUnoQ.ino** ```cpp // the sketch runs on the microcontroller and connects through the Linux side // set up the network on Linux first (Arduino App Lab or nmcli) #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerUnoQ thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open the monitor for debugging (Serial is the Monitor of the bridge) Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Before you upload the sketch, prepare the Linux side: - **Network.** Connect the board to a Wi-Fi network from Arduino App Lab, or from a shell on the Linux side. For the first setup, open the shell over USB with `adb shell` (adb comes with the Android platform tools, and the board package includes a copy); once the board is on the network, you can also use SSH with the password set in App Lab. Then run: ```bash nmcli dev wifi connect wifi-network password wifi-password ``` The sketch does not set up the network: `SSID` and `SSID_PASSWORD` in `arduino_secrets.h` are not used. - **Clock.** The Linux side must have its clock synchronized over NTP before the sketch connects. Linux starts with an old date and synchronizes a few seconds after it joins the network; until then it rejects the server certificate as not yet valid. Check it with `timedatectl` on the Linux side: `System clock synchronized` must be `yes`. - **Debug output.** `Serial` writes to the monitor of the bridge, so the debug messages show in the monitor of Arduino App Lab or the Arduino IDE. The Linux side can also connect to Thinger.io on its own: run the [Linux client](https://docs.thinger.io/devices/linux.md) there, or install [ThinRemote](https://thinremote.io) to maintain the board remotely. ## Arduino with WiFi shield The Arduino WiFi shield adds Wi-Fi to an Arduino. Use it on an Arduino Mega: the library needs more than the 2 KB of RAM of an UNO. The shield does not support TLS: the sketch defines `_DISABLE_TLS_`, so the board connects to the server port without TLS. Example `ArduinoWifi`: ![Arduino WiFi shield with its antenna and SD card slot](https://docs.thinger.io/images/devices/boards/arduino-wifi-shield.webp) *Arduino WiFi shield* **ArduinoWifi.ino** ```cpp #define THINGER_SERIAL_DEBUG // the WiFi shield does not support TLS #define _DISABLE_TLS_ #include #include #include "arduino_secrets.h" ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); pinMode(2, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(2); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ### Static memory On boards with little RAM, the library can use a fixed memory block instead of allocating memory as it needs it. Set these options as build flags, so they reach the library code: | Option | Default | Meaning | |---|---|---| | `THINGER_USE_STATIC_MEMORY` | Not defined | Uses a fixed memory block instead of allocating memory as messages arrive. | | `THINGER_STATIC_MEMORY_SIZE` | `512` | Size of the block, in bytes. | **platformio.ini** ```ini [env:mega] platform = atmelavr board = megaatmega2560 framework = arduino lib_deps = thinger-io/thinger.io build_flags = -D THINGER_USE_STATIC_MEMORY -D THINGER_STATIC_MEMORY_SIZE=512 ``` **Arduino CLI** ```bash arduino-cli compile -b arduino:avr:mega \ --build-property "compiler.cpp.extra_flags=-DTHINGER_USE_STATIC_MEMORY -DTHINGER_STATIC_MEMORY_SIZE=512" \ ArduinoWifi ``` ## Arduino with Adafruit CC3000 The Texas Instruments CC3000 is a Wi-Fi module for microcontrollers, sold on breakout boards and shields by Adafruit and others. It needs the **Adafruit CC3000 Library**: open the Library Manager, search for `cc3000` and install it. The module does not support TLS with this library: the board connects to the server port without TLS. Use it with an Arduino Mega or another board with more than 2 KB of RAM. ![Adafruit CC3000 Wi-Fi breakout board with its ceramic antenna](https://docs.thinger.io/images/devices/boards/cc3000.webp) *CC3000 Wi-Fi module on an Adafruit breakout* ![Arduino IDE Library Manager with the search cc3000 and the Adafruit CC3000 Library installed](https://docs.thinger.io/images/devices/boards/arduino-ide-library-manager-cc3000.webp) *The Adafruit CC3000 Library in the Library Manager* Example `ArduinoCC3000`: **ArduinoCC3000.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerCC3000 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); pinMode(2, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(2); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` - The class uses the default pins of the Adafruit boards: CS on pin 10, IRQ on pin 3 (an interrupt pin) and VBAT on pin 5. For other pins, pass them after the credentials: `ThingerCC3000 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, cs, irq, vbat);`. - The module joins WPA2 networks. ## Arduino Yún The Yún combines an ATmega32u4 microcontroller with an Atheros AR9331 processor that runs Linux (OpenWrt-Yun). The Linux side handles Wi-Fi and Ethernet, and the sketch reaches the network through the Bridge library. Example `ArduinoYun`: ![Arduino Yún board with its Ethernet port, USB host port and Wi-Fi module](https://docs.thinger.io/images/devices/boards/arduino-yun.webp) *Arduino Yún* **ArduinoYun.ino** ```cpp #include #include "arduino_secrets.h" ThingerYun thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { pinMode(LED_BUILTIN, OUTPUT); // initialize bridge Bridge.begin(); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); } void loop() { thing.handle(); } ``` > **Warning** > > The ATmega32u4 of the Yún has 2.5 KB of RAM, and the current library needs more: the build fails because the sketch does not fit in memory. - Call `Bridge.begin()` in `setup()`, before any network use. - Set up the network in the web panel of the Yún, not in the sketch: join the Wi-Fi network the Yún opens, go to `http://arduino.local` or `http://192.168.240.1`, and set the wireless network and its password, or plug in an Ethernet cable. ![Yún web panel with the board name, password, time zone and the wireless network, security and password fields, and the Configure & Restart button](https://docs.thinger.io/images/devices/boards/arduino-yun-network-configuration.webp) *Network settings in the Yún web panel* ## Upload the server certificate Boards with a WiFiNINA or WiFi101 module (MKR WiFi 1010, Nano 33 IoT, UNO WiFi Rev2, Nano RP2040 Connect and MKR1000) validate the server with the root certificates stored in the Wi-Fi module. If the module is old or lacks the root certificate of the server, the TLS connection fails and the serial monitor shows the socket error again and again. **Step 1: Update the firmware of the Wi-Fi module** Connect the board, open **Tools > Firmware Updater** in the Arduino IDE, select the board, click **Check Updates** and install the latest firmware. **Step 2: Upload the root certificate of the server** Open **Tools > Upload SSL Root Certificates**, add the domain of your server and upload: `iot.thinger.io` on the free Cloud account, or `YOUR_SERVER` on a private instance. The tool reads the certificate from port 443 of that domain. Arduino describes the tool in [Upload SSL root certificates](https://support.arduino.cc/hc/en-us/articles/360016119219). **Step 3: Upload your sketch again** The updater replaces the sketch on the board with its own. Upload your sketch again and check the serial monitor. In Arduino IDE 1.8, one tool does both steps: **Tools > WiFi101 / WiFiNINA Firmware Updater**. ![WiFi101 Firmware/Certificates Updater of Arduino IDE 1.8 with the port list, the firmware selector and the list of domains, with thinger.io:443 added](https://docs.thinger.io/images/devices/boards/arduino-ide-wifi101-firmware-updater.webp) *The WiFi101 / WiFiNINA Firmware Updater of Arduino IDE 1.8* ## See also - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): every board, its class and its OTA support. - [Portenta H7, Opta and GIGA R1 WiFi](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md): the Arduino Pro boards. - [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md): a device that does not connect. --- Source: https://docs.thinger.io/devices/arduino/boards/portenta-opta.md # Portenta H7, Opta and GIGA R1 WiFi > Connect an Arduino Portenta H7, Opta or GIGA R1 WiFi to Thinger.io on the Zephyr core, or on the Mbed OS core with Ethernet and OTA updates. The Arduino Portenta H7, the Arduino Opta and the Arduino GIGA R1 WiFi share the same microcontroller, the dual-core STM32H747 (an Arm Cortex-M7 at 480 MHz and a Cortex-M4 at 240 MHz). The Thinger.io Arduino library connects them on two Arduino cores, always with TLS: - **Arduino Zephyr core**, the recommended one: `ThingerZephyr` connects the three boards over Wi-Fi and validates the server certificate. OTA updates are not available on the Zephyr core yet. - **Arduino Mbed OS core**: `ThingerMbed` connects the Portenta H7 and the Opta over Wi-Fi and `ThingerMbedEth` over Ethernet, with OTA updates (`ThingerPortentaOTA`) and the connection in its own thread. Arduino ended the maintenance of this core in July 2026; use it when you need Ethernet or OTA updates. | Board | Core | Network | Include | Class | Example | OTA | |---|---|---|---|---|---|---| | Portenta H7, GIGA R1 WiFi | Zephyr | Wi-Fi | `ThingerZephyr.h` | `ThingerZephyr` | `ArduinoZephyr` | — | | Opta WiFi | Zephyr | Wi-Fi | `ThingerZephyr.h` | `ThingerZephyr` | `ArduinoOptaZephyr` | — | | Portenta H7 | Mbed OS | Wi-Fi | `ThingerMbed.h` | `ThingerMbed` | `ArduinoPortentaH7` | `ThingerPortentaOTA` | | Portenta H7 (with an Ethernet carrier or shield) | Mbed OS | Ethernet | `ThingerMbedEth.h` | `ThingerMbedEth` | `ArduinoPortentaH7Ethernet` | `ThingerPortentaOTA` | | Opta WiFi | Mbed OS | Wi-Fi | `ThingerMbed.h` | `ThingerMbed` | `ArduinoOptaWiFi` | `ThingerPortentaOTA` | | Opta (all models) | Mbed OS | Ethernet | `ThingerMbedEth.h` | `ThingerMbedEth` | `ArduinoOptaEthernet` | `ThingerPortentaOTA` | ## Set up the board **Step 1: Install the board package** In the Arduino IDE, open **Tools > Board > Boards Manager** and install the core you chose: **Arduino Zephyr Boards** for the Zephyr core, or **Arduino Mbed OS Portenta Boards** (Portenta H7) or **Arduino Mbed OS Opta Boards** (Opta) for the Mbed OS core. The Wi-Fi and Ethernet libraries come with the package. **Step 2: Install the library** Install **thinger.io** from the Library Manager. **Step 3: Create the credentials file** The sketches read the credentials from `arduino_secrets.h`, in the sketch folder: **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define SSID "wifi-network" #define SSID_PASSWORD "wifi-password" ``` `DEVICE_CREDENTIAL` holds the device credentials. The Ethernet sketches do not use `SSID` and `SSID_PASSWORD`. **Step 4: Prepare the board** On the Zephyr core, install the Zephyr loader once, as in [Install the Zephyr loader](#install-the-zephyr-loader). On the Mbed OS core, update the bootloader, format the flash and update the Wi-Fi firmware once, as in [Prepare the board](#prepare-the-board); without these steps, the TLS connection or the OTA updates can fail. Each example is in **File > Examples > thinger.io > Arduino**. ## Portenta H7 and GIGA R1 WiFi ![Arduino Portenta H7 board with its high-density connectors and the Wi-Fi antenna connector](https://docs.thinger.io/images/devices/boards/portenta-h7.webp) *Arduino Portenta H7* ### Portenta H7 and GIGA R1 WiFi on the Zephyr core Example `ArduinoZephyr`. It runs on every Wi-Fi board of the Zephyr core in this page, the Opta WiFi included: **ArduinoZephyr.ino** ```cpp #define THINGER_SERIAL_DEBUG // install the Zephyr loader once with Tools > Burn Bootloader #include #include "arduino_secrets.h" ThingerZephyr thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` On the Zephyr core, call `thing.handle()` in `loop()`, as on most boards: the connection does not run in its own thread. While the board joins the Wi-Fi network, `thing.handle()` returns at once, so `loop()` keeps running. ### Portenta H7 over Wi-Fi Mbed OS core. Example `ArduinoPortentaH7`, with OTA updates: **ArduinoPortentaH7.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerMbed thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerPortentaOTA ota(thing); void setup() { // configure LED_BUILTIN for output pinMode(LED_BUILTIN, OUTPUT); // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); // start the connection in its own thread thing.start(); } void loop() { // your code here: no thing.handle() needed // wrap variables shared with device resources in thing.lock() and thing.unlock() delay(1000); } ``` ### Portenta H7 over Ethernet Mbed OS core. Example `ArduinoPortentaH7Ethernet`, with OTA updates. The Portenta H7 has no Ethernet connector of its own: it needs a carrier or shield with one, such as the Portenta Vision Shield Ethernet or the Portenta Breakout. The board gets its address over DHCP. **ArduinoPortentaH7Ethernet.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerMbedEth thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerPortentaOTA ota(thing); void setup() { // configure LED_BUILTIN for output pinMode(LED_BUILTIN, OUTPUT); // open serial for debugging Serial.begin(115200); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); // start the connection in its own thread thing.start(); } void loop() { // your code here: no thing.handle() needed // wrap variables shared with device resources in thing.lock() and thing.unlock() delay(1000); } ``` ## Opta The Arduino Opta is a micro PLC made with Finder for industrial automation: four relay outputs, inputs that read 0-10 V or digital signals, Ethernet and, in the Opta WiFi, Wi-Fi and Bluetooth. Each relay has a status LED. ![Arduino Opta micro PLC with its status LEDs, the USER button, the Ethernet port and the relay output terminals](https://docs.thinger.io/images/devices/boards/opta.webp) *Arduino Opta* The pins have different names on each core: | Function | Zephyr core | Mbed OS core | |---|---|---| | Relays 1 to 4 | `D0` to `D3` | `D0` to `D3` | | Status LEDs of the relays | `D4` to `D7` | `LED_D0` to `LED_D3` | | USER button | `D11` | `BTN_USER` | | Inputs I1 to I8 | `A0` to `A7` | `A0` to `A7` | ### Opta WiFi on the Zephyr core Example `ArduinoOptaZephyr`. One input resource per relay switches the relay and its status LED and, when you read it, returns the state of the relay. `led` controls the USER LED (`LED_BUILTIN`), `button` tells whether the USER button is pressed, and `inputs` returns the voltage of the eight inputs, from 0 to 10 V. **ArduinoOptaZephyr.ino** ```cpp #define THINGER_SERIAL_DEBUG // install the Zephyr loader once with Tools > Burn Bootloader #include #include "arduino_secrets.h" // pins of the Opta on the Zephyr core: relays, their status leds and user button #define RELAY_D0 D0 #define RELAY_D1 D1 #define RELAY_D2 D2 #define RELAY_D3 D3 #define LED_D0 D4 #define LED_D1 D5 #define LED_D2 D6 #define LED_D3 D7 #define BUTTON_USER D11 ThingerZephyr thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); // voltage of an input (0-10V), from its 12-bit reading and the voltage divider of the Opta float input_voltage(int pin) { return analogRead(pin) * (3.249 / 4095.0) / 0.3034; } void setup() { // open serial for debugging Serial.begin(115200); // configure relays and their status leds for output pinMode(RELAY_D0, OUTPUT); pinMode(RELAY_D1, OUTPUT); pinMode(RELAY_D2, OUTPUT); pinMode(RELAY_D3, OUTPUT); pinMode(LED_D0, OUTPUT); pinMode(LED_D1, OUTPUT); pinMode(LED_D2, OUTPUT); pinMode(LED_D3, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); pinMode(BUTTON_USER, INPUT); // read the inputs with 12 bits analogReadResolution(12); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // control each relay and its status led; reading the resource returns the relay state thing["relay_d0"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(RELAY_D0); }else{ digitalWrite(RELAY_D0, in ? HIGH : LOW); digitalWrite(LED_D0, in ? HIGH : LOW); } }; thing["relay_d1"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(RELAY_D1); }else{ digitalWrite(RELAY_D1, in ? HIGH : LOW); digitalWrite(LED_D1, in ? HIGH : LOW); } }; thing["relay_d2"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(RELAY_D2); }else{ digitalWrite(RELAY_D2, in ? HIGH : LOW); digitalWrite(LED_D2, in ? HIGH : LOW); } }; thing["relay_d3"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(RELAY_D3); }else{ digitalWrite(RELAY_D3, in ? HIGH : LOW); digitalWrite(LED_D3, in ? HIGH : LOW); } }; // control the USER led thing["led"] << digitalPin(LED_BUILTIN); // USER button (pressed when low) thing["button"] >> outputValue(digitalRead(BUTTON_USER) == LOW); // voltage of the inputs I1 to I8 thing["inputs"] >> [](pson& out){ out["I1"] = input_voltage(A0); out["I2"] = input_voltage(A1); out["I3"] = input_voltage(A2); out["I4"] = input_voltage(A3); out["I5"] = input_voltage(A4); out["I6"] = input_voltage(A5); out["I7"] = input_voltage(A6); out["I8"] = input_voltage(A7); }; } void loop() { thing.handle(); } ``` Send `true` or `false` to `relay_d0` to close or open the first relay; read it to get its state. `inputs` returns an object with the voltage of each input, such as `{"I1": 0.02, "I2": 9.87}` for the first two. ### Opta over Ethernet Mbed OS core, on every Opta model. Example `ArduinoOptaEthernet`, with OTA updates. One input resource per relay: it switches the relay and its status LED and, when you read it, returns the state of the relay. Two more input resources control the USER LED (`LED_BUILTIN`) and the red status LED (`LEDR`). **ArduinoOptaEthernet.ino** ```cpp // enable debug output over serial #define THINGER_SERIAL_DEBUG // #define THINGER_SERVER "YOUR_SERVER" // only on a private instance #include #include #include "arduino_secrets.h" ThingerMbedEth thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerPortentaOTA ota(thing); void setup() { // open serial for debugging Serial.begin(115200); // configure leds for output pinMode(LED_D0, OUTPUT); pinMode(LED_D1, OUTPUT); pinMode(LED_D2, OUTPUT); pinMode(LED_D3, OUTPUT); pinMode(LEDR, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); // configure relays for output pinMode(D0, OUTPUT); pinMode(D1, OUTPUT); pinMode(D2, OUTPUT); pinMode(D3, OUTPUT); // control each relay and its status led; reading the resource returns the relay state thing["relay_d0"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D0); }else{ digitalWrite(D0, in ? HIGH : LOW); digitalWrite(LED_D0, in ? HIGH : LOW); } }; thing["relay_d1"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D1); }else{ digitalWrite(D1, in ? HIGH : LOW); digitalWrite(LED_D1, in ? HIGH : LOW); } }; thing["relay_d2"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D2); }else{ digitalWrite(D2, in ? HIGH : LOW); digitalWrite(LED_D2, in ? HIGH : LOW); } }; thing["relay_d3"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D3); }else{ digitalWrite(D3, in ? HIGH : LOW); digitalWrite(LED_D3, in ? HIGH : LOW); } }; // control the USER led and the red status led thing["led"] << digitalPin(LED_BUILTIN); thing["led_r"] << digitalPin(LEDR); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); // start the connection in its own thread thing.start(); } void loop() { // your code here: no thing.handle() needed // wrap variables shared with device resources in thing.lock() and thing.unlock() delay(1000); } ``` Send `true` or `false` to `relay_d0` to close or open the first relay; read it to get its state. ### Opta WiFi over Wi-Fi Mbed OS core. Example `ArduinoOptaWiFi`, with OTA updates. The same device resources as the Ethernet sketch; only the include, the class and `add_wifi()` change. **ArduinoOptaWiFi.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerMbed thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerPortentaOTA ota(thing); void setup() { // open serial for debugging Serial.begin(115200); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // configure leds for output pinMode(LED_D0, OUTPUT); pinMode(LED_D1, OUTPUT); pinMode(LED_D2, OUTPUT); pinMode(LED_D3, OUTPUT); pinMode(LEDR, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); // configure relays for output pinMode(D0, OUTPUT); pinMode(D1, OUTPUT); pinMode(D2, OUTPUT); pinMode(D3, OUTPUT); // control each relay and its status led; reading the resource returns the relay state thing["relay_d0"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D0); }else{ digitalWrite(D0, in ? HIGH : LOW); digitalWrite(LED_D0, in ? HIGH : LOW); } }; thing["relay_d1"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D1); }else{ digitalWrite(D1, in ? HIGH : LOW); digitalWrite(LED_D1, in ? HIGH : LOW); } }; thing["relay_d2"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D2); }else{ digitalWrite(D2, in ? HIGH : LOW); digitalWrite(LED_D2, in ? HIGH : LOW); } }; thing["relay_d3"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D3); }else{ digitalWrite(D3, in ? HIGH : LOW); digitalWrite(LED_D3, in ? HIGH : LOW); } }; // control the USER led and the red status led thing["led"] << digitalPin(LED_BUILTIN); thing["led_r"] << digitalPin(LEDR); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); // start the connection in its own thread thing.start(); } void loop() { // your code here: no thing.handle() needed // wrap variables shared with device resources in thing.lock() and thing.unlock() delay(1000); } ``` ## Zephyr core ### Install the Zephyr loader The sketches of the Zephyr core run on top of a Zephyr firmware, the loader, that the board needs once: 1. Connect the board over USB and select it in **Tools > Board > Arduino Zephyr Boards**. 2. Double-click the reset button of the board to enter bootloader mode. 3. Click **Tools > Burn Bootloader**. If the Arduino IDE asks for a programmer, select any one in **Tools > Programmer**. 4. Double-click the reset button again and upload your sketch. The next sketches upload as usual. ### Install the Wi-Fi firmware The Wi-Fi module reads its firmware from the flash of the board. If the Wi-Fi does not start, the serial monitor shows `Communication with WiFi module failed`, or `WiFi.status()` returns `WL_NO_SHIELD`. Install the firmware: 1. Open **File > Examples > Storage > FlashFormat**, an example of the Zephyr core, and upload it. 2. Open the serial monitor and answer the questions of the sketch: `Y` to format the partitions, to restore the TLS certificates and to restore the Wi-Fi firmware. Formatting erases the data your sketches stored in the flash. 3. Upload your sketch again. The [FAQ of the Zephyr core](https://github.com/arduino/ArduinoCore-zephyr#q-wi-fi-is-not-working-or-i-get-communication-with-wifi-module-failed-in-the-serial-monitor) describes the same fix. ### TLS on the Zephyr core `ThingerZephyr` validates the server with the root certificate of the library. On a private instance, `THINGER_ROOT_CA` and `thing.set_root_ca()` set the root certificate of your server, and `#define THINGER_INSECURE_SSL` skips the check, as in [Server and TLS](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls). ## Mbed OS core The examples of the Mbed OS core are in [Portenta H7 over Wi-Fi](#portenta-h7-over-wi-fi), [Portenta H7 over Ethernet](#portenta-h7-over-ethernet), [Opta over Ethernet](#opta-over-ethernet) and [Opta WiFi over Wi-Fi](#opta-wifi-over-wi-fi). They receive OTA updates with `ThingerPortentaOTA` and run the connection in its own thread. ### The connection thread `thing.start()` starts the connection in its own thread and returns at once; `setup()` goes on and `loop()` runs your code. `thing.stop()` ends the thread and `thing.is_running()` tells whether it runs. Device resources run in the connection thread, while `loop()` runs in the main one. When you change a variable in `loop()` that a device resource also reads or writes, do it between `thing.lock()` and `thing.unlock()`, as the comment in the examples says. ### Prepare the board On the Mbed OS core, the Portenta H7 and the Opta need a recent bootloader for OTA updates, a formatted flash to store the new firmware, and an up-to-date Wi-Fi firmware with its certificates for TLS. Run these example sketches of the board package once, in this order, from **File > Examples > STM32H747_System**. Each one runs from the serial monitor: open it after the upload and follow the prompts. ![Arduino IDE examples menu open at STM32H747_System, with QSPIFormat, QSPIReadPartitions, STM32H747_getBootloaderInfo, STM32H747_getResetReason, STM32H747_manageBootloader and WiFiFirmwareUpdater](https://docs.thinger.io/images/devices/boards/arduino-ide-stm32h747-examples-bootloader.webp) *The STM32H747_System examples of the board package* | Order | Example | What it does | |---|---|---| | 1 | `STM32H747_manageBootloader` | Updates the bootloader. OTA updates need bootloader version 22 or later; with an older one, an update fails with `OTA is not supported by the current bootloader`. `STM32H747_getBootloaderInfo` shows the current version. | | 2 | `QSPIFormat` | Formats the QSPI flash and creates its partitions. The OTA update stores the new firmware there before installing it. Formatting erases the flash. | | 3 | `WiFiFirmwareUpdater` | Writes the Wi-Fi firmware and the root certificates to the flash. Run it also when the TLS connection fails, over Wi-Fi or over Ethernet. | After the three sketches, upload your own sketch again. ## See also - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): every board, its class and its OTA support. - [OTA updates](https://docs.thinger.io/devices/ota.md): send new firmware over the Internet. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): device resources, Data Buckets, properties and endpoints. --- Source: https://docs.thinger.io/devices/arduino/boards/ethernet.md # Ethernet boards > Connect an Arduino with an Ethernet shield or an ENC28J60 module to Thinger.io, with DHCP or a fixed address. An Arduino without a network connection gets one with an Ethernet shield or an external Ethernet module. The Thinger.io Arduino library connects the Arduino Ethernet shield (and other boards that use the Ethernet library) with `ThingerEthernet`, and the ENC28J60 module with `ThingerENC28J60`. Neither uses TLS: they connect to the server port without TLS. For Ethernet on other boards, see [ESP32](https://docs.thinger.io/devices/arduino/boards/esp32.md#esp32-over-ethernet), [Portenta H7 and Opta](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md) and the [Arduino Yún](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#arduino-yun). ## Set up the board **Step 1: Install the libraries** Install **thinger.io** from the Library Manager, and the library of your hardware: **Ethernet** for the Ethernet shield, or **UIPEthernet** for the ENC28J60 module. **Step 2: Create the credentials file** The sketches read the credentials from `arduino_secrets.h`, in the sketch folder: **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" ``` `DEVICE_CREDENTIAL` holds the device credentials. Each example is in **File > Examples > thinger.io > Arduino**. ## Arduino with Ethernet shield The Arduino Ethernet shield plugs on top of an Arduino and connects it to a wired network. The library and the sketch need more than the 2 KB of RAM of an UNO: use an Arduino Mega or another board with more memory. ![Arduino Ethernet shield with its RJ45 connector and microSD card slot](https://docs.thinger.io/images/devices/boards/arduino-ethernet-shield.webp) *Arduino Ethernet shield* Example `ArduinoEthernet`. The board gets its address over DHCP: **ArduinoEthernet.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerEthernet thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); pinMode(2, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(2); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` - The class starts the shield with the MAC address `DE:AD:BE:EF:FE:ED` and waits up to 30 seconds for a DHCP address. If two boards with this sketch share a network, give each one its own MAC address, as below. - It renews the DHCP lease on its own. ### Fixed address or your own MAC `thing.set_network_setup()` takes a function that starts the network your way. The function returns `true` when the network is ready. Use it for a fixed address, another MAC address or a shield on other pins, such as the MKR ETH Shield: **ArduinoEthernetFixedIP.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerEthernet thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); bool network_setup(){ byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x00, 0x01}; // Ethernet.init(5); // chip select pin of the MKR ETH Shield Ethernet.begin(mac, IPAddress(192, 168, 1, 50)); return true; } void setup() { // open serial for debugging Serial.begin(115200); // start the network with this function instead of DHCP thing.set_network_setup(network_setup); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ## Arduino with ENC28J60 The ENC28J60 is a low-cost Ethernet controller from Microchip, sold on small SPI modules. It needs the **UIPEthernet** library. ![ENC28J60 Ethernet module with its RJ45 connector and SPI header](https://docs.thinger.io/images/devices/boards/enc28j60.webp) *ENC28J60 Ethernet module* Example `ArduinoENC28J60`. DHCP takes much memory on small boards, so the example sets a MAC address and a fixed IP address with `Ethernet.begin()`, before any other network use. As with the Ethernet shield, use an Arduino Mega or another board with more than 2 KB of RAM: **ArduinoENC28J60.ino** ```cpp // requires the UIPEthernet library #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerENC28J60 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); // fixed IP address: DHCP is too big for the sketch uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}; Ethernet.begin(mac, IPAddress(192, 168, 1, 125)); pinMode(LED_BUILTIN, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Change the IP address to a free address of your network. `ThingerENC28J60` does not start the module itself: the `Ethernet.begin()` call in `setup()` is required. ## See also - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): every board, its class and its OTA support. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): device resources, Data Buckets, properties and endpoints. - [Arduino library reference](https://docs.thinger.io/reference/arduino-library.md): every class and function. --- Source: https://docs.thinger.io/devices/arduino/boards/cellular.md # Cellular boards > Connect the Arduino MKR GSM 1400, the MKR NB 1500 and Arduinos with a GSM modem to Thinger.io over the cellular network. Cellular boards connect where there is no Wi-Fi or cable: over GSM and 3G with the Arduino MKR GSM 1400, over LTE Cat M1 and NB-IoT with the Arduino MKR NB 1500, or over GPRS with a GSM modem such as the SIM800 wired to any Arduino. Each needs a SIM card with a data plan and the APN of the operator. | Board | Network | Include | Class | TLS | OTA | |---|---|---|---|---|---| | [MKR GSM 1400](#mkr-gsm-1400) | GSM / 3G | `ThingerMKRGSM.h` | `ThingerMKRGSM` | Yes | — | | [MKR NB 1500](#mkr-nb-1500) | LTE Cat M1 / NB-IoT | `ThingerMKRNB.h` | `ThingerMKRNB` | Yes | Yes, `ThingerMKRNBOTA` | | [Arduino with a GSM modem](#arduino-with-a-gsm-modem) | GPRS | `ThingerTinyGSM.h` | `ThingerTinyGSM` | If the modem supports it | — | For the Thinger.io NB-IoT boards, see [Thinger.io hardware](https://docs.thinger.io/hardware.md). For the LinkIt ONE, see [Other boards](https://docs.thinger.io/devices/arduino/boards/other.md#linkit-one-over-gprs). ## Set up the board **Step 1: Install the board package and the libraries** For the MKR boards, install **Arduino SAMD Boards** from **Tools > Board > Boards Manager**, and the **MKRGSM** or **MKRNB** library. For a GSM modem, install the **TinyGSM** library. Install **thinger.io** from the Library Manager too. **Step 2: Create the credentials file** The MKR sketches read the credentials and the SIM settings from `arduino_secrets.h`, in the sketch folder: **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define PIN_NUMBER "1234" #define GPRS_APN "internet.example" #define GPRS_LOGIN "" #define GPRS_PASSWORD "" ``` `DEVICE_CREDENTIAL` holds the device credentials. Set the PIN of your SIM and the APN of your operator, with its user and password if it has them (most have none). Each example is in **File > Examples > thinger.io > Arduino**. ## MKR GSM 1400 The MKR GSM 1400 has a SAMD21 microcontroller, a u-blox SARA-U201 modem for GSM and 3G networks, and a crypto chip. Connect its antenna and, as Arduino recommends, a LiPo battery: the modem can draw more current than USB provides when it transmits. ![Arduino MKR GSM 1400 board with its u-blox SARA-U201 modem and the SIM card holder](https://docs.thinger.io/images/devices/boards/mkr-gsm-1400.webp) *Arduino MKR GSM 1400* Example `ArduinoGSM1400`: **ArduinoGSM1400.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include "arduino_secrets.h" ThingerMKRGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // open serial for debugging Serial.begin(115200); // PIN of the SIM card (remove it if the SIM has no PIN) thing.set_pin(PIN_NUMBER); // APN of the operator thing.set_apn(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD); // set builtin led to output pinMode(LED_BUILTIN, OUTPUT); // pin control example over internet (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` - `set_apn(apn, user, password)` is required: without it, the board does not connect. The user and password default to empty. - `set_pin()` is only needed if the SIM card has a PIN. - `thing.getGSM()` and `thing.getGPRS()` give the modem objects of the MKRGSM library, for example to read the signal or the IP address. ## MKR NB 1500 The MKR NB 1500 has a SAMD21 microcontroller, a u-blox SARA-R410M-02B modem for LTE Cat M1 and NB-IoT (bands 1, 2, 3, 4, 5, 8, 12, 13, 18, 19, 20, 25, 26 and 28) and a crypto chip. Check that your operator and your SIM support LTE Cat M1 or NB-IoT where the board runs. ![Arduino MKR NB 1500 board with its u-blox SARA-R410M modem and the micro SIM holder](https://docs.thinger.io/images/devices/boards/mkr-nb-1500.webp) *Arduino MKR NB 1500* Example `ArduinoMKRNB1500`, with OTA updates and an output resource with the time of the cellular network: **ArduinoMKRNB1500.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerMKRNB thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); // press the reset button after an OTA update to start the new firmware ThingerMKRNBOTA ota(thing); void setup() { // enable serial for debugging Serial.begin(115200); // PIN of the SIM card (remove it if the SIM has no PIN) thing.set_pin(PIN_NUMBER); // APN of the operator thing.set_apn(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD); // set builtin led to output pinMode(LED_BUILTIN, OUTPUT); // pin control example over internet (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(LED_BUILTIN); // time of the cellular network, in seconds since 1970 (Unix time) thing["time"] >> [&](pson& out){ out = thing.getNB().getTime(); }; } void loop() { thing.handle(); } ``` - The board waits up to 2 minutes for the network on each attempt. If it cannot reach the server six times in a row, it restarts the modem; after twelve, it does a hard reset of the modem. - After an [OTA update](https://docs.thinger.io/devices/ota.md), press the reset button of the board to start the new firmware. - OTA updates over NB-IoT are slow: the firmware travels in small blocks over a slow network. - `thing.getNB()` and `thing.getGPRS()` give the modem objects of the MKRNB library. ## Arduino with a GSM modem Based on the example `ArduinoTinyGSM`. An Arduino with a free hardware serial port can use a GSM modem through the **TinyGSM** library: SIM800, SIM900, A6, A7, M590 and the other modems TinyGSM supports. Define the model of your modem before the includes. Use a board with a 32-bit microcontroller, such as an Arduino MKR or Zero board: on AVR boards (UNO, Mega) `ThingerTinyGSM` does not compile. The sketch talks to the modem over `Serial1`. On an ESP32, `#define THINGER_FREE_RTOS` before the includes adds `thing.start()`, which runs the connection in its own task, as in [ESP32 with the connection in its own task](https://docs.thinger.io/devices/arduino/boards/esp32.md#esp32-with-the-connection-in-its-own-task). This sketch has its own credentials file, with the names the example uses: **ArduinoTinyGSM.ino** ```cpp #define THINGER_SERIAL_DEBUG // select your modem #define TINY_GSM_MODEM_SIM800 // #define TINY_GSM_MODEM_SIM900 // #define TINY_GSM_MODEM_A6 // #define TINY_GSM_MODEM_A7 // #define TINY_GSM_MODEM_M590 // requires the TinyGSM library #include #include #include "arduino_secrets.h" // Serial1: hardware serial port wired to the modem ThingerTinyGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1); void setup() { // open serial for debugging Serial.begin(115200); // serial port of the modem, at its baud rate Serial1.begin(57600); // APN of the operator (remove the user and password if your APN has none) thing.setAPN(APN_NAME, APN_USER, APN_PSWD); // PIN of the SIM card (optional) // thing.setPIN(CARD_PIN); // resource input example (i.e, controlling a digitalPin); pinMode(LED_BUILTIN, OUTPUT); thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` **arduino_secrets.h** ```cpp #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" // APN of your operator #define APN_NAME "internet.example" #define APN_USER "" #define APN_PSWD "" // PIN of the SIM card (optional) #define CARD_PIN "1234" ``` - The fourth argument of the class is the serial port wired to the modem. - `ThingerTinyGSM` names its methods `setAPN()` and `setPIN()`, not `set_apn()` and `set_pin()`. `setAPN()` is required. - When the modem is not on the network, the class restarts it, unlocks the SIM if it has a PIN and waits up to 15 seconds for the network. `thing.setModuleReset(function)` runs your function before each connection attempt, for example to power-cycle the modem with a pin. - `thing.getTinyGsm()` gives the TinyGSM modem, for example to read the signal quality. - The connection uses TLS when the modem supports it in TinyGSM. On modems without TLS, define `_DISABLE_TLS_` before the includes to connect to the server port without TLS. ## See also - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): every board, its class and its OTA support. - [OTA updates](https://docs.thinger.io/devices/ota.md): send new firmware over the Internet. - [Thinger.io hardware](https://docs.thinger.io/hardware.md): NB-IoT boards made by Thinger.io. --- Source: https://docs.thinger.io/devices/arduino/boards/other.md # Other boards > Connect the Raspberry Pi Pico W and Pico 2 W, the Texas Instruments CC3200 LaunchPad and the SeeedStudio LinkIt ONE to Thinger.io over Wi-Fi or GPRS. The Thinger.io Arduino library also runs on boards outside the Arduino and Espressif families: the Raspberry Pi Pico W and Pico 2 W, the Texas Instruments CC3200 LaunchPad, programmed with the Energia IDE, and the SeeedStudio LinkIt ONE. The Pico boards connect over TLS; the CC3200 and the LinkIt ONE connect to the server port without TLS. For the boards made by Thinger.io, see [Thinger.io hardware](https://docs.thinger.io/hardware.md). | Board | Network | Include | Class | Example | OTA | |---|---|---|---|---|---| | [Raspberry Pi Pico W and Pico 2 W](#raspberry-pi-pico-w-and-pico-2-w) | Wi-Fi | `ThingerPicoW.h` | `ThingerPicoW` | `PicoW` | Yes, `ThingerPicoOTA` | | [TI CC3200 LaunchPad](#ti-cc3200-launchpad) | Wi-Fi | `ThingerWifi.h` | `ThingerWifi` | `EnergiaCC3200` | — | | [LinkIt ONE](#linkit-one-over-wi-fi) | Wi-Fi | `ThingerLinkItOneWifi.h` | `ThingerLinkItOneWifi` | `LinkItOneWifi` | — | | [LinkIt ONE](#linkit-one-over-gprs) | GPRS | `ThingerLinkItOneGPRS.h` | `ThingerLinkItOneGPRS` | `LinkItOneGPRS` | — | | [Thinger32 NB-IoT](https://docs.thinger.io/hardware/thinger32-nb-iot.md) and [M2 IoT Modem](https://docs.thinger.io/hardware/m2-iot-modem.md) | NB-IoT | `ThingerNBCore.h` | `ThingerNBCore` | `NBCore` | Yes, `ThingerESP32OTA` | ## Raspberry Pi Pico W and Pico 2 W The Raspberry Pi Pico W has an RP2040 microcontroller (dual-core Arm Cortex-M0+, 264 KB of SRAM, 2 MB of flash), and the Pico 2 W an RP2350 (dual-core Arm Cortex-M33, 520 KB of SRAM, 4 MB of flash). Both have an Infineon CYW43439 chip for 2.4 GHz Wi-Fi. `ThingerPicoW` runs on the [Arduino-Pico](https://github.com/earlephilhower/arduino-pico) core by Earle Philhower, and also on other RP2040 and RP2350 boards with a CYW43 Wi-Fi chip. **Step 1: Install the board package** In the Arduino IDE, open **File > Preferences** and add this URL to **Additional boards manager URLs**: ```text https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json ``` Then open **Tools > Board > Boards Manager**, search for `pico` and install **Raspberry Pi Pico/RP2040/RP2350** by Earle F. Philhower, III. Select **Raspberry Pi Pico W** or **Raspberry Pi Pico 2W** in **Tools > Board**. **Step 2: Select a flash layout with a file system** OTA updates store the new firmware in the file system of the board, so it must be large enough for the firmware. In **Tools > Flash Size**, select **2MB (Sketch: 1MB, FS: 1MB)** on the Pico W or **4MB (Sketch: 2MB, FS: 2MB)** on the Pico 2 W. Without OTA updates, any option works. **Step 3: Install the library and create the credentials file** Install **thinger.io** from the Library Manager. The sketch reads the credentials from the `arduino_secrets.h` file of the Wi-Fi boards (see [Supported boards](https://docs.thinger.io/devices/arduino/boards.md#credentials-file)). Example `PicoW`, in **File > Examples > thinger.io > RaspberryPi**, with OTA updates: **PicoW.ino** ```cpp #define THINGER_SERIAL_DEBUG #include #include #include "arduino_secrets.h" ThingerPicoW thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); // receives firmware updates from the Thinger.io extension for Visual Studio Code ThingerPicoOTA ota(thing); void setup() { // open serial for debugging Serial.begin(115200); // set builtin led as output pinMode(LED_BUILTIN, OUTPUT); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // add more networks calling add_wifi again: it connects to the strongest one // thing.add_wifi("other-network", "other-password"); // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["led"] << digitalPin(LED_BUILTIN); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` - The connection uses TLS and validates the server certificate. The board sets its clock over NTP before it connects, because the certificate check needs the current time; it waits up to 30 seconds for `pool.ntp.org` (change them with `THINGER_NTP_TIMEOUT`, in milliseconds, and `THINGER_NTP_SERVER`). For a private instance whose certificate comes from its own authority, define its root certificate with `THINGER_ROOT_CA` before the include, as in [Server and TLS](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls). `#define THINGER_INSECURE_SSL` skips the check, for a private instance with a self-signed certificate. - With several calls to `add_wifi()`, the board joins the strongest of those networks; see [Connect to several Wi-Fi networks](https://docs.thinger.io/devices/arduino/coding.md#connect-to-several-wi-fi-networks). - An OTA update writes the new firmware to the file system, and the board installs it when it restarts. If the file system is missing or too small, the board rejects the update. - The firmware is sent uncompressed. `#define THINGER_OTA_COMPRESSION 1` before the includes makes the board receive it compressed with gzip, which takes less space in the file system; it needs a recent version of the Visual Studio Code extension. - OTA updates are sent from a PlatformIO project (see [OTA updates](https://docs.thinger.io/devices/ota.md#add-ota-to-your-sketch)). Set the size of the file system there with `board_build.filesystem_size`. ## TI CC3200 LaunchPad The CC3200 is a Texas Instruments chip with Wi-Fi and a programmable Arm Cortex-M4 microcontroller, the successor of the CC3000 module. The CC3200 LaunchPad adds sensors, LEDs and a USB-to-serial converter to program it over USB. ![Texas Instruments CC3200 LaunchPad board with its red, yellow and green LEDs and the two push buttons](https://docs.thinger.io/images/devices/boards/ti-cc3200-launchpad.webp) *Texas Instruments CC3200 LaunchPad* To program it: 1. Install the [Energia IDE](https://energia.nu), the Arduino-based IDE for Texas Instruments boards, and its CC3200 board package. 2. Download the [Thinger.io Arduino library](https://github.com/thinger-io/Arduino-Library) as a ZIP file and add it in Energia with **Sketch > Include Library > Add .ZIP Library**. 3. To upload, set the SOP2 jumper of the LaunchPad as the Energia guide for the CC3200 describes; remove it to run the sketch. Example `EnergiaCC3200`, with one input resource per LED of the board. It uses the `arduino_secrets.h` file of the Wi-Fi boards (see [Supported boards](https://docs.thinger.io/devices/arduino/boards.md#credentials-file)): **EnergiaCC3200.ino** ```cpp // the CC3200 connects without TLS #define _DISABLE_TLS_ #include #include #include "arduino_secrets.h" ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // set the boards led to output pinMode(RED_LED, OUTPUT); pinMode(GREEN_LED, OUTPUT); pinMode(YELLOW_LED, OUTPUT); // configure wifi network thing.add_wifi(SSID, SSID_PASSWORD); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"]["green"] << digitalPin(GREEN_LED); thing["led"]["yellow"] << digitalPin(YELLOW_LED); thing["led"]["red"] << digitalPin(RED_LED); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` `thing["led"]["green"]` creates nested device resources: `green`, `yellow` and `red` inside `led`. ## LinkIt ONE The SeeedStudio LinkIt ONE has a MediaTek ARM7 processor with GSM/GPRS, Wi-Fi, Bluetooth and GPS. Install its board package, published by Seeed Studio, from the Boards Manager. The Wi-Fi and GPRS libraries come with the package. ![SeeedStudio LinkIt ONE board with its GSM, Wi-Fi and GPS antennas](https://docs.thinger.io/images/devices/boards/linkit-one.webp) *SeeedStudio LinkIt ONE* ### LinkIt ONE over Wi-Fi Example `LinkItOneWifi`. The board joins WPA networks. Replace the placeholders and the Wi-Fi network: **LinkItOneWifi.ino** ```cpp #include ThingerLinkItOneWifi thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); void setup() { thing.add_wifi("wifi-network", "wifi-password"); pinMode(2, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(2); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` `YOUR_TOKEN` is the device credentials. ### LinkIt ONE over GPRS Example `LinkItOneGPRS`: **LinkItOneGPRS.ino** ```cpp #include #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" ThingerLinkItOneGPRS thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // the LinkIt ONE cannot unlock a SIM with a PIN: remove the PIN from the SIM before use // set the APN of your operator if the SIM does not provide it // thing.set_apn("internet.example", "user", "password"); pinMode(2, OUTPUT); // pin control example (i.e. turning on/off a light, a relay, etc) thing["led"] << digitalPin(2); // resource output example (i.e. reading a sensor value, a variable, etc) thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` - The LinkIt ONE does not support SIM cards with a PIN: remove the PIN with a phone before you insert the SIM. `set_pin()` has no effect on this board. - Call `set_apn(apn, user, password)` only if the SIM does not set the APN on its own. ## See also - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): every board, its class and its OTA support. - [Thinger.io hardware](https://docs.thinger.io/hardware.md): boards made by Thinger.io. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): device resources, Data Buckets, properties and endpoints. --- Source: https://docs.thinger.io/devices/arduino/coding.md # Coding guide > Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. This guide shows how to write the firmware of a device that uses the Thinger.io Arduino library: expose device resources, send data to a Data Bucket, read and write properties, call endpoints and keep the connection healthy. The examples use an ESP32, but the code is the same for every [supported board](https://docs.thinger.io/devices/arduino/boards.md); only the include and the class change. ## Before you start - A sketch that already connects, as in [Arduino](https://docs.thinger.io/devices/arduino.md). - The device ID, the device credentials and your username. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. For the full list of functions, see the [Arduino library reference](https://docs.thinger.io/reference/arduino-library.md). ![A device with its sketch in the middle. On the left, the console, the REST API, dashboards, other devices and AI agents call its device resources: input resources with <<, output resources with >>, input and output resources with =, and resources without data. On the right, the device calls the platform over the same connection: write_bucket stores data in a Data Bucket, get_property and set_property read and write properties, call_endpoint calls an endpoint, call_device calls another device, and stream sends a value to an open dashboard or to a Data Bucket set to Stream by Device.](https://docs.thinger.io/diagrams/arduino-device-resources-and-calls.svg) *Device resources answer the platform; the device can also call the platform* ## Structure of a sketch Every sketch has the same shape: create the `thing` object with your credentials, declare the device resources in `setup()`, and call `thing.handle()` in `loop()`. **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); void setup() { Serial.begin(115200); thing.add_wifi("wifi-network", "wifi-password"); // declare device resources here } void loop() { thing.handle(); } ``` `thing.handle()` keeps the connection alive and answers the requests of the platform. Call it as often as possible: avoid `delay()` and long loops in `loop()`, or the device stops answering and the platform marks it as disconnected. Use `millis()` to run code at intervals, as in [Send data to a Data Bucket](#send-data-to-a-data-bucket). The examples of the library (**File > Examples > thinger.io**) take the username, device ID and device credentials from a second file, `arduino_secrets.h`, instead of writing them in the sketch. Fill in that file when you start from an example: see [Start from a library example](https://docs.thinger.io/devices/arduino.md#start-from-a-library-example). ## Define device resources A device resource is a function of the device that the platform can call: from the console, the [REST API](https://docs.thinger.io/reference/rest-api/devices.md#device-accessoutputresources), a dashboard or another device. Declare each one in `setup()` with a name and an operator that sets its direction. | Syntax | Kind | Use it for | |---|---|---| | `thing["name"] << [](pson& in){ … };` | Input resource | Receive data: switch a relay, change a setting. | | `thing["name"] >> [](pson& out){ … };` | Output resource | Send data: a sensor reading. | | `thing["name"] = [](pson& in, pson& out){ … };` | Input and output | Receive data and return a result. | | `thing["name"] = [](){ … };` | No data | Run an action: reboot, start a measurement. | `pson` holds any JSON-like value: a number, a boolean, a string or an object with named fields. > **Warning: Do not capture local variables by reference** > > The library keeps the functions of resources, of the state listener and of OTA, and runs them later, when `setup()` has already returned. A function that captures with `[&]` a local variable of `setup()`, or of a function called from it, reads memory that is no longer valid, and the device fails at random. Use global variables, or capture by value with `[=]`. ### Input resources An input resource receives a value from the platform. Read it from `in`: ```cpp bool fan = false; void setup() { // ... thing["fan"] << [](pson& in) { if (in.is_empty()) { in = fan; // report the current state } else { fan = in; // apply the new state } }; } ``` When the console opens a device resource, it first reads its current value with an empty `in`. Filling `in` when it is empty, as above, shows the current state instead of a default value. To receive several values, use named fields: ```cpp float targetTemperature = 21.0; int targetHumidity = 50; void setup() { // ... thing["setpoint"] << [](pson& in) { if (in.is_empty()) { in["temperature"] = targetTemperature; in["humidity"] = targetHumidity; } else { targetTemperature = in["temperature"]; targetHumidity = in["humidity"]; } }; } ``` ### Output resources An output resource sends a value each time the platform reads it. Fill `out` with a single value or with named fields: ```cpp void setup() { // ... thing["uptime"] >> [](pson& out) { out = millis() / 1000; }; thing["status"] >> [](pson& out) { out["rssi"] = WiFi.RSSI(); out["heap"] = ESP.getFreeHeap(); }; } ``` ### Input and output resources A resource can take an input and return a result in the same call: ```cpp void setup() { // ... thing["sum"] = [](pson& in, pson& out) { out["result"] = (int) in["a"] + (int) in["b"]; }; } ``` ### Resources without data A resource without `in` or `out` runs an action when it is called: ```cpp void setup() { // ... thing["restart"] = []() { ESP.restart(); }; } ``` ### Resources in the console The **API** tab of the device lists its device resources once it is connected. An input shows a field to send, an output shows the value it returns, a resource with both shows each side, and a resource without data shows only **Run**: ![Device API with the fan resource as an on/off switch, restart with only Run, status with its heap and rssi output, and sum with the inputs a 2 and b 3 and the output result 5 after Run](https://docs.thinger.io/screenshots/arduino-coding-device-api.webp) *The fan, restart, status and sum resources of this section in the API tab* ## Control pins and variables The library has shortcuts for the most common resources: | Shortcut | Kind | What it does | |---|---|---| | `digitalPin(pin)` | Input | Sets a digital output pin on or off, and reports its state. | | `invertedDigitalPin(pin)` | Input | The same with the logic inverted: on sets the pin `LOW`. For relay modules that switch on with a low level. Only on AVR boards (such as the Arduino UNO) and ESP8266. | | `analogPin(pin)` | Input | Writes an analog (PWM) value to a pin. Not available on ESP32. | | `outputValue(value)` | Output | Sends the value of an expression or variable. | | `outputString(value)` | Output | The same, for a text. | | `inputValue(variable)` | Input | Stores the value received in a variable, and reports it. | | `inputValue(variable, code)` | Input | The same, and runs `code` after each change. | | `servo(object)` | Input | Moves a servo of the Arduino Servo library to the angle received, and reports its angle. | ```cpp #define RELAY_PIN 26 int interval = 60; void setup() { // ... pinMode(RELAY_PIN, OUTPUT); thing["relay"] << digitalPin(RELAY_PIN); thing["light"] >> outputValue(analogRead(34)); thing["interval"] << inputValue(interval, { Serial.println("Interval changed"); }); } ``` The pin passed to `digitalPin` must be a number or a `#define`, not a variable. Configure the pin as an output with `pinMode` before you use it. On AVR boards and ESP8266, `digitalPin` reads the pin to report its state. On the other boards (ESP32, SAMD, Mbed and Renesas boards) it reports the last value set from the platform, which starts as off. Many relay modules switch on when their input is `LOW`. On AVR boards and ESP8266, `invertedDigitalPin` keeps the resource "on" when the relay is on: **main.cpp** ```cpp #include #define RELAY_PIN 5 // D1 on NodeMCU boards ThingerESP8266 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); void setup() { pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, HIGH); // relay off at start thing.add_wifi("wifi-network", "wifi-password"); thing["relay"] << invertedDigitalPin(RELAY_PIN); } void loop() { thing.handle(); } ``` On the other boards, write an input resource that inverts the value: ```cpp bool relayOn = false; void setup() { // ... pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, HIGH); // relay off at start thing["relay"] << [](pson& in) { if (in.is_empty()) { in = relayOn; } else { relayOn = in; digitalWrite(RELAY_PIN, relayOn ? LOW : HIGH); } }; } ``` ## Send data to a Data Bucket A Data Bucket stores the readings of a device as a time series. Create the bucket in **Data Buckets** first. Its **Data Source** sets who decides when a reading is stored: | Data Source | Refresh Mode | Who decides | What the sketch needs | |---|---|---|---| | **From Device Resource** | **Sampling Interval** | The platform reads the output resource at a fixed interval. | Only the output resource. | | **From Device Resource** | **Stream by Device** | The device, when it calls `thing.stream()`. | The output resource and a `thing.stream()` call. | | **From Device Write Call** | — | The device, when it calls `thing.write_bucket()`. | A `thing.write_bucket()` call with the bucket ID. | ![Three lanes compared. Sampling Interval: the platform reads the device resource every few seconds or minutes and stores the output. Stream by Device: the sketch calls thing.stream with the resource, and the bucket, which is listening, stores the value. From Device Write Call: the sketch calls thing.write_bucket with the bucket ID and a resource or a pson value, and the bucket stores it.](https://docs.thinger.io/diagrams/data-bucket-device-sources.svg) *Three ways a device fills a Data Bucket* ### Write to a bucket With **From Device Write Call**, call `thing.write_bucket()` with the bucket ID and a device resource whose output is the data to store: ```cpp unsigned long lastWrite = 0; void setup() { // ... thing["environment"] >> [](pson& out) { out["temperature"] = temperatureRead(); out["uptime"] = millis() / 1000; }; } void loop() { thing.handle(); // store a reading every 5 minutes if (millis() - lastWrite >= 5 * 60 * 1000UL) { lastWrite = millis(); thing.write_bucket("environment_data", "environment"); } } ``` You can also write a `pson` value directly with `thing.write_bucket("environment_data", data)`. A third argument `true` waits for the platform to confirm the write, and the call returns `false` if it failed. See [Data Buckets](https://docs.thinger.io/platform/data-buckets.md). > **Warning** > > Do not write in every iteration of `loop()`. The platform limits how often a device can write (see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md)), and it disables a device whose calls keep failing: see [Call the platform at a safe rate](#call-the-platform-at-a-safe-rate). ### Store a value when the device decides With **From Device Resource** and the **Stream by Device** refresh mode, the bucket listens to an output resource and stores a reading each time the sketch calls `thing.stream()`. The device decides when to store, without knowing the bucket ID. For example, store the position only while the vehicle moves: **main.cpp** ```cpp #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); float latitude = 0, longitude = 0; bool requiresRecording = false; // set it from your GPS code unsigned long lastRecord = 0; void setup() { thing.add_wifi("wifi-network", "wifi-password"); thing["location"] >> [](pson& out) { out["lat"] = latitude; out["lon"] = longitude; }; } void loop() { thing.handle(); // update latitude, longitude and requiresRecording from the GPS here // store the position at most every 10 seconds while it changes if (requiresRecording && millis() - lastRecord >= 10000UL) { lastRecord = millis(); thing.stream("location"); } } ``` In the bucket, choose the device in **Select Device**, `location` in **Select Resource** and **Stream by Device** in **Refresh Mode**. ## Read and write device properties Properties are named JSON values stored on the device in the platform. They keep configuration and state across restarts, and you can edit them in the console. Read a property with `thing.get_property()` and write it with `thing.set_property()`: ```cpp int reportInterval = 60; void loadConfig() { pson config; if (thing.get_property("config", config)) { reportInterval = config["interval"]; } } void saveConfig() { pson config; config["interval"] = reportInterval; thing.set_property("config", config, true); // true: wait for confirmation } ``` Both calls need the device to be connected and return `false` when they fail. See [Properties](https://docs.thinger.io/platform/properties.md). ## Call an endpoint An endpoint is an integration configured in the platform: an HTTP request, an email, a Telegram message. Create it in **Endpoints** and call it by its ID: ```cpp void sendAlert(float temperature) { pson data; data["temperature"] = temperature; thing.call_endpoint("high_temperature", data); } ``` | Call | Data sent to the endpoint | |---|---| | `thing.call_endpoint("id")` | None. | | `thing.call_endpoint("id", data)` | A `pson` value. | | `thing.call_endpoint("id", thing["resource"])` | The output of a device resource. | | `thing.call_endpoint("id", "resource")` | The same, by the name of the device resource. | A last argument `true` waits for the platform to confirm the call. See [Endpoints](https://docs.thinger.io/platform/endpoints.md). ### Send an email once per event Call an endpoint when something happens, not while it lasts. This sketch calls an email endpoint once when the level of a tank crosses a limit, and only again after the level drops below a lower one: **main.cpp** ```cpp #include #define LEVEL_PIN 34 #define HIGH_LEVEL 3000 // reading that sends the email #define REARM_LEVEL 2800 // reading that allows a new email ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); bool alertSent = false; void setup() { thing.add_wifi("wifi-network", "wifi-password"); thing["tank"] >> [](pson& out) { out["level"] = analogRead(LEVEL_PIN); }; } void loop() { thing.handle(); int level = analogRead(LEVEL_PIN); if (!alertSent && level > HIGH_LEVEL) { thing.call_endpoint("tank_alert", thing["tank"]); alertSent = true; } else if (alertSent && level < REARM_LEVEL) { alertSent = false; } } ``` The email endpoint `tank_alert` uses the fields of the data in its subject and body, with double braces: `{{level}}` is the `level` field of the `tank` output. ```text Subject: Tank level alert Body: The tank level is {{level}}, above the limit. ``` ## Call another device How a device calls a device resource of another device depends on the account of the other device: | The other device is in | Call | |---|---| | The same account | `thing.call_device()`, directly. | | Another account | `thing.call_endpoint()`, to an endpoint that calls the device of the other account. | The other device must be connected. Call it on an event or at an interval, as in [Call the platform at a safe rate](#call-the-platform-at-a-safe-rate). ### Devices of the same account The device that receives the call, `YOUR_DEVICE`, declares the device resources. The caller uses the same names and, to send data, the same field names: **Receiving device** ```cpp int interval = 60; float limit = 25.0; void setup() { // ... // called without data thing["blink"] = []() { Serial.println("Someone is calling me"); }; // called with data: read the fields the caller sends thing["setpoint"] << [](pson& in) { if (in.is_empty()) { in["interval"] = interval; in["limit"] = limit; } else { interval = in["interval"]; limit = in["limit"]; } }; } ``` **Calling device** ```cpp void setup() { // ... thing["config"] >> [](pson& out) { out["interval"] = 30; out["limit"] = 22.5; }; } void callOtherDevice() { // without data thing.call_device("YOUR_DEVICE", "blink"); // with a pson value pson data; data["interval"] = 120; data["limit"] = 27.5; thing.call_device("YOUR_DEVICE", "setpoint", data); // with the output of a device resource of this device thing.call_device("YOUR_DEVICE", "setpoint", thing["config"]); } ``` A last argument `true` waits for the platform to confirm the call, and the call returns `false` if it failed, for example because the other device is not connected. ### Devices of different accounts In the account of the calling device, create an endpoint that calls the device resource in the other account. You need an [access token](https://docs.thinger.io/platform/access-tokens.md) of the other account that allows calling that device resource. - **On the free Cloud server**: use the **Thinger.io Device Call** endpoint type, and fill in **Device Owner Username**, **Device Identifier**, **Resource Name** and **Device Access Token** with the values of the other account. - **On any server**: use an **HTTP Request** endpoint with the `POST` method, the URL `https://YOUR_SERVER/v3/users/{user}/devices/{device}/resources/{resource}` with the username, device ID and resource of the other account, a header `Authorization` with the value `Bearer` followed by the access token, and a JSON body. The device calls the endpoint as any other, with or without data: ```cpp pson data; data["on"] = true; thing.call_endpoint("neighbor_lamp", data); ``` ## Call the platform at a safe rate `write_bucket`, `call_endpoint`, `call_device`, `set_property` and `stream` each send a message. Too many calls use the data of a cellular plan, fill an inbox with emails or use up the quota of a third-party service. Call them when something changes, or at an interval measured with `millis()`; never in every iteration of `loop()`. > **Warning: The platform disables devices whose calls keep failing** > > If 100 Data Bucket writes or endpoint calls of a device fail within about a minute, the platform disables the device, closes its connection and sends a **Device Disabled** email to the account. A call fails when, for example, the bucket or the endpoint does not exist or is disabled, or the device goes over the limits of the account. The device cannot connect again until you fix the sketch and enable the device: see [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md#the-device-was-disabled). ## Stream a resource in real time `thing.stream()` pushes the current value of an output resource to whatever listens to it: an open dashboard or console page, or a Data Bucket in **Stream by Device** mode, which stores each value (see [Store a value when the device decides](#store-a-value-when-the-device-decides)). When nothing listens, it sends nothing and returns `false`. Call it with the name of the device resource, `thing.stream("level")`, or with the resource, `thing.stream(thing["level"])`. Stream when the value changes enough to matter: **main.cpp** ```cpp #include #define LEVEL_PIN 34 ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); int lastSent = 0; void setup() { thing.add_wifi("wifi-network", "wifi-password"); thing["level"] >> [](pson& out) { out = analogRead(LEVEL_PIN); }; } void loop() { thing.handle(); // stream only when the reading changes by more than 50 int level = analogRead(LEVEL_PIN); if (abs(level - lastSent) > 50) { lastSent = level; thing.stream(thing["level"]); } } ``` ## Manage the connection The library connects to the network and to the platform from `thing.handle()`, and reconnects on its own when the connection drops. While the device is offline, `thing.handle()` does not hold `loop()`, so the sketch keeps running: it can read its sensors, or show the connection state on a display with `thing.get_state()`. - **Wi-Fi.** Most Wi-Fi boards join the network step by step, one step on each `thing.handle()`, with the state `NETWORK_CONNECTING` in the meantime. They give up after 30 seconds without joining the network, and after 30 more without an IP address. With several networks, the board scans them for a few seconds inside `thing.handle()`. - **Other networks.** On Ethernet, on cellular modems and with [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md), ESP-Touch, the CC3000 module, the ESP8266 as Wi-Fi modem and the LinkIt ONE, `thing.handle()` waits while the board joins the network. - **Server.** Opening the TLS connection and authenticating take a few seconds on every attempt, inside `thing.handle()`. - **Retries.** Between two attempts, `thing.handle()` returns at once. After a network failure it tries again in 5 seconds. After a failure with the server (socket, TLS or authentication), it waits 5 seconds and doubles the wait on every new failure, up to 30 seconds, with a random margin of up to 25 %, so many devices do not reconnect at the same time after a server restart. The wait starts again from 5 seconds once the device connects. `RECONNECTION_TIMEOUT` and `THINGER_RECONNECTION_MAX_TIMEOUT` change these times: see [Reconnection](https://docs.thinger.io/reference/arduino-library.md#reconnection). - `thing.add_wifi(ssid, password)` adds a Wi-Fi network. Some boards accept several, as in [Connect to several Wi-Fi networks](#connect-to-several-wi-fi-networks). To let end users set the network without recompiling, see [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md). - `thing.is_connected()` returns `true` while the device is connected. - `thing.get_state()` returns the last connection state, one of the table below: `ThingerClient::THINGER_AUTHENTICATED` means the device is online, and `ThingerClient::SOCKET_DISCONNECTED` that it is offline. - `thing.get_error()` returns why the network connection failed: see [Why the network connection failed](#why-the-network-connection-failed). - `#define THINGER_SERVER "YOUR_SERVER"`, before the include, connects to a private instance. Without it, the device connects to the free Cloud account. If the certificate of your instance comes from its own authority, define its root certificate too, as in [Server and TLS](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls). To react to connection changes, register a state listener: ```cpp void setup() { // ... thing.set_state_listener([](ThingerClient::THINGER_STATE state) { switch (state) { case ThingerClient::THINGER_AUTHENTICATED: Serial.println("Connected to Thinger.io"); break; case ThingerClient::THINGER_AUTH_FAILED: Serial.println("Check the device credentials"); break; case ThingerClient::SOCKET_DISCONNECTED: Serial.println("Disconnected"); break; default: break; } }); } ``` | State | Meaning | |---|---| | `NETWORK_CONNECTING`, `NETWORK_CONNECTED`, `NETWORK_CONNECT_ERROR` | Joining the network (Wi-Fi, Ethernet or cellular). | | `SOCKET_CONNECTING`, `SOCKET_CONNECTED`, `SOCKET_CONNECTION_ERROR` | Opening the connection to the server. | | `SOCKET_DISCONNECTED`, `SOCKET_TIMEOUT`, `SOCKET_ERROR` | The connection to the server is lost. | | `THINGER_AUTHENTICATING`, `THINGER_AUTHENTICATED`, `THINGER_AUTH_FAILED` | Checking the device credentials. | | `THINGER_STOP_REQUEST` | The sketch closed the connection. | ### Why the network connection failed After a `NETWORK_CONNECT_ERROR` state, `thing.get_error()` tells the reason. Read it in the state listener or at any time; once the network is connected, it returns `ThingerClient::ERROR_NONE`. ```cpp void setup() { // ... thing.set_state_listener([](ThingerClient::THINGER_STATE state) { if (state == ThingerClient::NETWORK_CONNECT_ERROR) { switch (thing.get_error()) { case ThingerClient::NETWORK_AUTH_ERROR: Serial.println("Wrong Wi-Fi password"); break; case ThingerClient::NETWORK_NOT_REGISTERED: Serial.println("No cellular coverage"); break; default: break; } } }); } ``` | Error | Meaning | Boards | |---|---|---| | `ERROR_NONE` | The network is connected. | All | | `ERROR_UNKNOWN` | The board does not report the reason. | All | | `NETWORK_NOT_CONFIGURED` | No Wi-Fi network or APN is set. With WebConfig, the configuration page closed without a Wi-Fi network. | Wi-Fi and cellular | | `NETWORK_NOT_FOUND` | The Wi-Fi network is not available. | Wi-Fi | | `NETWORK_AUTH_ERROR` | The Wi-Fi network rejected the connection, usually for a wrong password. | Wi-Fi | | `NETWORK_NO_IP` | The board joined the Wi-Fi network but got no IP address. | Wi-Fi | | `MODEM_NOT_RESPONDING` | The modem does not answer. | `ThingerTinyGSM` | | `MODEM_SIM_ERROR` | The SIM card cannot be used, for example for a wrong PIN. | `ThingerTinyGSM` | | `NETWORK_NOT_REGISTERED` | The modem cannot register in the network, for example for lack of coverage. | `ThingerTinyGSM`, `ThingerNBCore`, `ThingerBC66` | | `NETWORK_REGISTRATION_DENIED` | The operator rejected the registration, for example because the SIM card is disabled. | `ThingerNBCore`, `ThingerBC66` | | `NETWORK_APN_ERROR` | The modem is registered, but the data connection does not open: check the APN. | `ThingerTinyGSM`, `ThingerMKRNB`, `ThingerMKRGSM` | ### Connect to several Wi-Fi networks On the ESP32, the ESP8266 and the Raspberry Pi Pico W and Pico 2 W, call `thing.add_wifi()` once per network. With two or more networks, the board scans and joins the strongest one it knows, also when it reconnects: ```cpp void setup() { thing.add_wifi("home-network", "home-password"); thing.add_wifi("office-network", "office-password"); // ... } ``` - With a single network, the board joins it without scanning. A hidden network, one that does not broadcast its name, only works this way: as the only network of the sketch. - On the other boards, the library keeps one network: each call replaces the previous one, and the board joins the last one added. - With [debug output](#debug-output) on, the serial monitor shows `Connecting to the strongest known network` with the number of networks, and then the name of the network it joined. ### Connect to a WPA2-Enterprise network On the ESP32, `thing.add_wifi_enterprise(ssid, username, password, identity, ca_pem)` adds a WPA2-Enterprise network that uses PEAP with EAP-MSCHAPv2, such as eduroam. It needs version 3 of the **esp32** board package: with version 2, the function does not exist. - `identity` is the outer identity, the name the network sees before the credentials are checked. Leave it out and the board uses the username. Many networks accept an anonymous one; on eduroam it is usually `anonymous@` followed by the domain of your institution. - `ca_pem` is the certificate, in PEM format, of the authority that signs the network's authentication server. Your organization provides it; on eduroam, each institution publishes its own. With it, the board checks the server before it sends the username and password. ```cpp const char EDUROAM_CA[] = R"(-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----)"; void setup() { thing.add_wifi_enterprise("eduroam", "user@example.com", "password", "anonymous@example.com", EDUROAM_CA); // ... } ``` You can add it next to other networks with `add_wifi()`. A network with a certificate is joined first, on its own; if the board cannot join it in 30 seconds, it tries the other networks and joins the strongest of them. Only one network can carry a certificate: a second network added with one is joined without checking its server. > **Warning: Without a certificate, the board does not verify the authentication server** > > If you leave out `ca_pem`, a rogue access point with the same network name could capture the username and password. Pass the certificate of your network, and use an account for the device, not a personal one. ### Debug output Add `#define THINGER_SERIAL_DEBUG` as the first line of the sketch, and open the serial monitor at 115200 baud. The library prints each connection step: ```text [NETWORK] Starting connection... [NETWORK] Connecting to network wifi-network [NETWORK] Connected to WiFi! [NETWORK] Getting IP Address... [NETWORK] Got IP Address: 192.168.1.40 [NETWORK] Connected! [_SOCKET] Connecting to iot.thinger.io:25202... [_SOCKET] Using secure TLS/SSL connection: yes [_SOCKET] Connected! [THINGER] Authenticating. User: YOUR_USER Device: YOUR_DEVICE [THINGER] Authenticated ``` After a failed attempt, the monitor shows how long the library waits before the next one, in milliseconds: ```text [THINGER] Retrying connection in (ms): 10641 ``` If the device does not reach `Authenticated`, see [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md). ## Result The device exposes its device resources, stores data in a Data Bucket, keeps its configuration in properties and calls endpoints when something happens. In **Devices**, open the device and its **API** tab to call each device resource. ## Next steps - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): The boards and network modules the Thinger.io Arduino library supports, with the class, the example sketch and the OTA support of each. - [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md): Let users set the Wi-Fi network and the Thinger.io credentials of an ESP32 or ESP8266 from a phone, without changing the firmware. - [Events](https://docs.thinger.io/reference/events.md): Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. --- Source: https://docs.thinger.io/devices/arduino/webconfig.md # WebConfig > Let users set the Wi-Fi network and the Thinger.io credentials of an ESP32 or ESP8266 from a phone, without changing the firmware. WebConfig lets the person who installs a device set its Wi-Fi network and its Thinger.io credentials from a phone or a computer. The device opens its own Wi-Fi network with a configuration page, so the same firmware works for every unit and every network. ## When to use it - You ship the same firmware to many devices and each one goes to a different Wi-Fi network. - The person who installs the device cannot recompile the sketch. - You want to ask for extra settings at installation time, such as a location or an interval. WebConfig is available on ESP32 and ESP8266 boards. It needs the **WiFiManager** library, version 2.0 or later: install it from the library manager of the Arduino IDE (search for **WiFiManager** by tzapu) or add `tzapu/WiFiManager` to `lib_deps` in PlatformIO. ## Add WebConfig to a sketch Use the WebConfig class of your board and create `thing` without credentials: ### ESP32 **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include ThingerESP32WebConfig thing; void setup() { Serial.begin(115200); thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ### ESP8266 **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include ThingerESP8266WebConfig thing; void setup() { Serial.begin(115200); thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Declare device resources as in any other sketch (see the [Coding guide](https://docs.thinger.io/devices/arduino/coding.md)). For a private instance, add `#define THINGER_SERVER "YOUR_SERVER"` before the include: the server is fixed in the firmware and cannot be set from the configuration page. ## Configure a device Before you start, create the device in **Devices > Add Device** with the **IOTMP Device (Thinger.io protocol)** type, and keep its device ID and device credentials at hand. See [Arduino](https://docs.thinger.io/devices/arduino.md#steps). ![WebConfig flow. At start, a device with stored settings joins its Wi-Fi network and connects to Thinger.io. A device without them opens the Thinger-Device network; a phone joins it and opens the configuration page at 192.168.4.1; the person chooses the Wi-Fi network and types the username, device ID, device credentials and any extra fields; the device stores the settings, closes its network, joins the Wi-Fi network and connects to Thinger.io. clean_credentials deletes the stored settings, so the next start opens the configuration page again.](https://docs.thinger.io/diagrams/webconfig-setup-flow.svg) *How a WebConfig device gets its settings* **Step 1: Join the device network** Power the device. The first time, it opens a Wi-Fi network called `Thinger-Device`. Join it from your phone or computer with the password `thinger.io`. **Step 2: Open the configuration page** The configuration page usually opens on its own. If it does not, open `http://192.168.4.1` in the browser. **Step 3: Enter the settings** Choose the Wi-Fi network the device will use and type its password. Fill in **User Id** (`YOUR_USER`), **Device Id** (`YOUR_DEVICE`) and **Device Credential** (the device credentials, `YOUR_TOKEN`). Save. **Step 4: Check the connection** The device closes its network, joins yours and connects to Thinger.io. In **Devices**, the device shows as connected. The device stores the settings, so it connects on its own every time it starts. On the ESP32, they are kept when you upload a firmware with another partition scheme. ## When the Wi-Fi network is not available If the device cannot join its stored Wi-Fi network, for example because it was moved to another place, it opens the `Thinger-Device` network and the configuration page again after 3 failed attempts. The page shows the current values of your extra fields. If nobody saves new settings in 180 seconds, the page closes, the stored settings stay as they were, and the device tries its network again. Change both values before the include. `THINGER_WEBCONFIG_ATTEMPTS` set to `0` turns this off, so the device keeps trying its stored network: ```cpp #define THINGER_WEBCONFIG_ATTEMPTS 3 // failed attempts before the page opens #define THINGER_WEBCONFIG_PORTAL_TIMEOUT 180 // seconds the page stays open #include ``` ## Reset the configuration `thing.clean_credentials()` deletes the stored Thinger.io credentials. On the next start, the device opens the `Thinger-Device` network and the configuration page again. A common pattern is to reset when a button is held while the board starts: **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #define RESET_PIN 0 // the BOOT button on most ESP32 boards ThingerESP32WebConfig thing; void setup() { Serial.begin(115200); pinMode(RESET_PIN, INPUT_PULLUP); // hold the button while the board starts to configure it again if (digitalRead(RESET_PIN) == LOW) { thing.clean_credentials(); } thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` ## Ask for extra settings Add up to five fields of your own to the configuration page with `thing.add_setup_parameter()`, and read their values in the configuration callback. The callback runs when the device is configured and at every start, with the stored values: **main.cpp** ```cpp #include ThingerESP32WebConfig thing; char location[32] = ""; void setup() { Serial.begin(115200); // field id, label, default value, maximum length thing.add_setup_parameter("location", "Location", "", 32); thing.set_on_config_callback([](pson& config) { strlcpy(location, config["location"], sizeof(location)); }); thing["location"] >> [](pson& out) { out = (const char*) location; }; } void loop() { thing.handle(); } ``` `add_setup_parameter()` returns `false` when the page already has five extra fields. An optional fifth argument adds HTML attributes to the field, for example `"type=\"number\""`. ## Fix the credentials in the firmware Values you set in the firmware are not asked on the configuration page. Pass them to the constructor, or set them in `setup()` before the first `thing.handle()`: **main.cpp** ```cpp #include // the page asks only for the Wi-Fi network and the device credentials ThingerESP32WebConfig thing("YOUR_USER", "YOUR_DEVICE"); void setup() { Serial.begin(115200); // close the configuration page after 5 minutes without activity thing.set_on_captive_portal_run([](WiFiManager& portal) { portal.setConfigPortalTimeout(300); }); // report whether the Wi-Fi network connected when the page closes thing.set_on_wifi_config([](bool connected) { Serial.println(connected ? "Wi-Fi connected" : "Wi-Fi not connected"); }); thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` `set_on_captive_portal_run()` receives the WiFiManager object just before the page opens, so you can use any option of the [WiFiManager library](https://github.com/tzapu/WiFiManager), such as a timeout or a title. ## Functions | Function | What it does | |---|---| | `ThingerESP32WebConfig thing(user, device, credential)` | Creates `thing`. The three arguments are optional; the ones you pass are not asked on the page. `ThingerESP8266WebConfig` takes the same arguments. | | `set_user(user)`, `set_device(device)`, `set_credential(credential)` | Set the username, the device ID or the device credentials from the firmware. The page does not ask for them. | | `add_setup_parameter(id, label, default, length, html)` | Adds an extra field to the page, up to five. `html` is optional. | | `set_on_config_callback(function)` | Runs `function` with the settings, stored or just entered, including the extra fields. | | `set_on_wifi_config(function)` | Runs `function` with `true` or `false` after the page closes, depending on whether the Wi-Fi network connected. | | `set_on_captive_portal_run(function)` | Runs `function` with the WiFiManager object before the page opens. | | `clean_credentials()` | Deletes the stored Thinger.io settings and extra fields. The next start opens the page again. | To change the name and password of the device network, define them before the include: ```cpp #define THINGER_DEVICE_SSID "Sensor-Setup" #define THINGER_DEVICE_SSID_PSWD "change-me-123" #include ``` ## Set the Wi-Fi network with ESP-Touch instead On an ESP8266, `ThingerSmartConfig` takes only the Wi-Fi network from a phone, with Espressif's ESP-Touch app (SmartConfig), and keeps the Thinger.io credentials in the firmware. The phone sends the password of the network it is on; there is no configuration page. See [ESP8266 set up with ESP-Touch](https://docs.thinger.io/devices/arduino/boards/esp8266.md#esp8266-set-up-with-esp-touch). | | WebConfig | ESP-Touch | |---|---|---| | Boards | ESP32, ESP8266 | ESP8266 | | Wi-Fi network | Chosen on the configuration page | Sent by the ESP-Touch app | | Thinger.io credentials | On the page, or in the firmware | In the firmware | | Extra fields | Up to five | None | ## Limits - ESP32 and ESP8266 only. - The username, device ID and device credentials are limited to 39 characters each. - At most five extra fields. - The server is set in the firmware, not on the configuration page. - The configuration page opens when the device has no stored settings, and when it cannot join its stored Wi-Fi network: see [When the Wi-Fi network is not available](#when-the-wi-fi-network-is-not-available). - While the configuration page is open, the device does not run the rest of the sketch: `loop()` waits. Set a timeout with `set_on_captive_portal_run()` to give up after a while. To show that the page is open, for example by blinking an LED, start a `Ticker` in `set_on_captive_portal_run()`. - If the configuration page closes without a Wi-Fi network, `thing.get_error()` returns `ThingerClient::NETWORK_NOT_CONFIGURED`. See [Why the network connection failed](https://docs.thinger.io/devices/arduino/coding.md#why-the-network-connection-failed). ## Related pages - [Arduino](https://docs.thinger.io/devices/arduino.md): Connect an Arduino-compatible board to Thinger.io with the Arduino library, from the Arduino IDE or PlatformIO, and update it over the Internet. - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): The boards and network modules the Thinger.io Arduino library supports, with the class, the example sketch and the OTA support of each. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. --- Source: https://docs.thinger.io/devices/esp-idf.md # ESP-IDF > Connect an ESP32 to Thinger.io from an ESP-IDF project with the IOTMP client component, with device resources, Data Buckets and automatic reconnection. This guide connects an ESP32 to Thinger.io from an ESP-IDF project, without the Arduino framework. You add the IOTMP client component, set the credentials, expose device resources and store data in a Data Bucket. ## Before you start - A Thinger.io account. Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - [ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/) 5.x or 6.x, with `idf.py` in your shell. - An ESP32 board, such as an ESP32, ESP32-S3 or ESP32-C3. ## Steps **Step 1: Create the device** ### Console Go to **Devices** and click **Add Device**. Choose **IOTMP Device (Thinger.io protocol)** as **Device Type**, set the **Device Id** to `YOUR_DEVICE`, click **Random** in **Device Credentials** and copy the credentials. Click **Add Device**. ### CLI ```bash thinger device create YOUR_DEVICE -t Generic ``` ### AI **Prompt for an AI agent:** > Create an IOTMP device called YOUR_DEVICE in my Thinger.io account and show me its credentials. **Step 2: Add the components** The client is two components: `iotmp-espidf` and the protocol core it uses, `iotmp-embedded`. Clone both into the `components` folder of your project: ```bash cd your-project git clone https://github.com/thinger-io/IOTMP-ESPIDF.git components/iotmp-espidf git clone https://github.com/thinger-io/IOTMP-Embedded.git components/iotmp-embedded ``` To keep them outside the project, set `EXTRA_COMPONENT_DIRS` in the top-level `CMakeLists.txt` to both folders instead. Then require the client from your `main` component. Require `esp-tls` too, which the client headers use: **main/CMakeLists.txt** ```cmake idf_component_register(SRCS "main.cpp" PRIV_REQUIRES iotmp-espidf esp-tls esp_wifi nvs_flash esp_timer) ``` **Step 3: Write the application** The application connects to Wi-Fi, sets the credentials, declares the device resources and starts the client: **main/main.cpp** ```cpp #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/event_groups.h" #include "esp_wifi.h" #include "esp_event.h" #include "esp_log.h" #include "esp_timer.h" #include "nvs_flash.h" #include #define WIFI_SSID "wifi-network" #define WIFI_PASSWORD "wifi-password" static EventGroupHandle_t wifi_events; static const int WIFI_CONNECTED = BIT0; static void on_wifi_event(void* arg, esp_event_base_t base, int32_t id, void* data) { if (base == WIFI_EVENT && (id == WIFI_EVENT_STA_START || id == WIFI_EVENT_STA_DISCONNECTED)) { esp_wifi_connect(); // connect, and reconnect after a disconnection } else if (base == IP_EVENT && id == IP_EVENT_STA_GOT_IP) { xEventGroupSetBits(wifi_events, WIFI_CONNECTED); } } static void wifi_connect() { wifi_events = xEventGroupCreate(); esp_netif_init(); esp_event_loop_create_default(); esp_netif_create_default_wifi_sta(); wifi_init_config_t init = WIFI_INIT_CONFIG_DEFAULT(); esp_wifi_init(&init); esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &on_wifi_event, NULL, NULL); esp_event_handler_instance_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &on_wifi_event, NULL, NULL); wifi_config_t config = {}; strncpy((char*) config.sta.ssid, WIFI_SSID, sizeof(config.sta.ssid)); strncpy((char*) config.sta.password, WIFI_PASSWORD, sizeof(config.sta.password)); esp_wifi_set_mode(WIFI_MODE_STA); esp_wifi_set_config(WIFI_IF_STA, &config); esp_wifi_start(); xEventGroupWaitBits(wifi_events, WIFI_CONNECTED, pdFALSE, pdTRUE, portMAX_DELAY); } static thinger::iotmp::client thing; extern "C" void app_main(void) { if (nvs_flash_init() != ESP_OK) { nvs_flash_erase(); nvs_flash_init(); } wifi_connect(); thing.set_credentials("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); // thing.set_host("YOUR_SERVER"); // only on a private instance // output resource: read by the console, the API or a Data Bucket thing["uptime"] = [](thinger::iotmp::output& out) { out["seconds"] = (uint32_t) (esp_timer_get_time() / 1000000); out["free_heap"] = (uint32_t) esp_get_free_heap_size(); }; // input resource: receives {"state": true} or {"state": false} thing["led"] = [](thinger::iotmp::input& in) { bool on = in["state"].get(); ESP_LOGI("app", "LED %s", on ? "on" : "off"); }; thing.start(); // connects and reconnects in its own task while (true) { vTaskDelay(pdMS_TO_TICKS(5 * 60 * 1000)); // store a reading in a Data Bucket every 5 minutes thinger::iotmp::json_t data; data["seconds"] = (uint32_t) (esp_timer_get_time() / 1000000); thing.write_bucket("uptime_data", data); } } ``` - `YOUR_TOKEN` is the device credentials, not an access token. - Without `set_host()`, the client connects to the free Cloud server. On a private instance, call `thing.set_host("YOUR_SERVER")`. - The client does not set up the network: your application connects to Wi-Fi (or Ethernet) before `thing.start()`. - Create the `uptime_data` Data Bucket in **Data Buckets** with **From Device Write Call** as **Data Source** before the first write. **Step 4: Build and flash** ```bash idf.py set-target esp32 idf.py build flash monitor ``` **Step 5: Check the connection** Go to **Devices**: the device shows a green status dot. Open it and go to **API**, expand `uptime` and click **Run** to read its output. You can also run `thinger device resource call YOUR_DEVICE uptime`. ## Result The ESP32 is online in **Devices**, its `uptime` device resource answers from the console, and the `uptime_data` Data Bucket gets a new reading every 5 minutes. ## Define device resources The client declares device resources with the type of their argument: | Declaration | Kind | |---|---| | `thing["name"] = [](thinger::iotmp::output& out){ … };` | Output resource. | | `thing["name"] = [](thinger::iotmp::input& in){ … };` | Input resource. | | `thing["name"] = [](thinger::iotmp::input& in, thinger::iotmp::output& out){ … };` | Input and output. | | `thing["name"] = [](){ … };` | Runs an action, without data. | Read inputs by field with `in["field"].get()` (or `get()`, `get()`…), and fill outputs with `out["field"] = value`. `thing["led"] << digitalPin(GPIO_NUM_2);` controls a GPIO configured as an output. The client can also call the platform from your code: `thing.write_bucket()`, `thing.set_property()`, `thing.get_property()`, `thing.call_endpoint()` and `thing.stream()`. These calls are safe from any task. See the [Arduino coding guide](https://docs.thinger.io/devices/arduino/coding.md) for what each one does, and the [IOTMP reference](https://docs.thinger.io/reference/iotmp.md) for the protocol. ## Connection and reconnection `thing.start()` runs the client in its own FreeRTOS task, named `iotmp`, and returns at once. The task connects, authenticates and reconnects on its own: - After a failed attempt it waits 5 seconds, and doubles the wait on each new failure up to 60 seconds. A successful connection resets the wait. `thing.set_reconnect_timeout(base_ms, max_ms)` changes both values. - It sends a keep-alive every 60 seconds; `thing.set_keepalive(seconds)` changes it. - `thing.set_state_callback()` receives the state changes (`SOCKET_CONNECTING`, `AUTHENTICATED`, `DISCONNECTED`, `AUTH_FAILED`…), for example to drive a status LED. - `thing.stop()` closes the connection and stops the task. ## Configuration Run `idf.py menuconfig` and open **Thinger IOTMP Client**: | Option | Default | Description | |---|---|---| | `CONFIG_THINGER_IOTMP_TLS` | Enabled | Connect over TLS (port 25206). Disable it for plain TCP (port 25204). | | `CONFIG_THINGER_IOTMP_STACK_SIZE` | 8192 | Stack size of the client task, in bytes. | | `CONFIG_THINGER_IOTMP_PRIORITY` | 5 | Priority of the client task. | With TLS, the client checks the server certificate with the ESP-IDF certificate bundle (`CONFIG_MBEDTLS_CERTIFICATE_BUNDLE`, enabled by default). The network must allow outgoing connections to the port in use. ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | `client.hpp` cannot find `esp_tls.h` when building | `esp-tls` is missing from the requirements of your component. | Add `esp-tls` to `REQUIRES` or `PRIV_REQUIRES`, as in step 2. | | The state goes to `AUTH_FAILED` | The credentials do not match the device. | Check the username, the device ID and the device credentials. | | The state stays in `SOCKET_CONNECTING` | The server cannot be reached. | Check the network, the host and that the port is open. | More cases in [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md). ## Next steps - [Zephyr](https://docs.thinger.io/devices/zephyr.md): Connect a Zephyr RTOS board to Thinger.io with the IOTMP client module, added to your west workspace and enabled from prj.conf. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. - [ESP-IDF client](https://docs.thinger.io/reference/esp-idf-client.md): Packages, source code, installation and documentation of the Thinger.io IOTMP client for ESP-IDF, which connects an ESP32 without the Arduino framework. - [Connect a device](https://docs.thinger.io/devices.md): Choose how to connect your hardware to Thinger.io - device libraries over IOTMP, MQTT, HTTP or a LoRaWAN or Sigfox network. --- Source: https://docs.thinger.io/devices/zephyr.md # Zephyr > Connect a Zephyr RTOS board to Thinger.io with the IOTMP client module, added to your west workspace and enabled from prj.conf. This guide connects a board running Zephyr RTOS to Thinger.io with the IOTMP client module. You add the module to your west workspace, enable it in `prj.conf`, expose device resources and turn on TLS. To program an Arduino board from the Arduino IDE with the Arduino Zephyr core, use the Arduino library instead: see [Portenta H7, Opta and GIGA R1 WiFi](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md) and the [UNO Q](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#uno-q). ## Before you start - A Thinger.io account. Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - A [Zephyr](https://docs.zephyrproject.org/latest/develop/getting_started/index.html) 4.0 or later workspace managed with `west`, and its SDK. - A board with a network interface supported by Zephyr (Ethernet, Wi-Fi or cellular) and C++ support. ## Steps **Step 1: Create the device** ### Console Go to **Devices** and click **Add Device**. Choose **IOTMP Device (Thinger.io protocol)** as **Device Type**, set the **Device Id** to `YOUR_DEVICE`, click **Random** in **Device Credentials** and copy the credentials. Click **Add Device**. ### CLI ```bash thinger device create YOUR_DEVICE -t Generic ``` ### AI **Prompt for an AI agent:** > Create an IOTMP device called YOUR_DEVICE in my Thinger.io account and show me its credentials. **Step 2: Add the module to west.yml** Add the client and the protocol core it uses to the `projects` of your manifest: **west.yml** ```yaml manifest: projects: # ... - name: iotmp-zephyr url: https://github.com/thinger-io/IOTMP-Zephyr revision: main path: modules/lib/iotmp-zephyr - name: iotmp-embedded url: https://github.com/thinger-io/IOTMP-Embedded revision: main path: modules/lib/iotmp-embedded ``` Then download them: ```bash west update ``` **Step 3: Enable it in prj.conf** The client needs networking with sockets, C++17 and `eventfd`: **prj.conf** ```ini # Networking CONFIG_NETWORKING=y CONFIG_NET_IPV4=y CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y CONFIG_DNS_RESOLVER=y CONFIG_NET_DHCPV4=y # C++ CONFIG_CPP=y CONFIG_STD_CPP17=y CONFIG_GLIBCXX_LIBCPP=y CONFIG_EVENTFD=y # Thinger.io IOTMP client CONFIG_THINGER_IOTMP=y # TLS CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_TLS_VERSION_1_2=y CONFIG_NET_SOCKETS_SOCKOPT_TLS=y CONFIG_THINGER_IOTMP_TLS=y CONFIG_MAIN_STACK_SIZE=4096 CONFIG_HEAP_MEM_POOL_SIZE=16384 ``` Add the options your board needs for its network interface, such as the Wi-Fi driver. **Step 4: Write the application** **src/main.cpp** ```cpp #include #include #include LOG_MODULE_REGISTER(app, LOG_LEVEL_INF); static thinger::iotmp::client thing; static float temperature = 22.5f; static float threshold = 30.0f; int main(void) { thing.set_credentials("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); // thing.set_host("YOUR_SERVER"); // only on a private instance // output resource: sensor readings thing["environment"] = [](thinger::iotmp::output& out) { out["temperature"] = temperature; }; // input resource: receives {"state": true} or {"state": false} thing["led"] = [](thinger::iotmp::input& in) { bool on = in["state"].get(); LOG_INF("LED %s", on ? "on" : "off"); }; // input and output resource: read and change a setting thing["threshold"] = [](thinger::iotmp::input& in, thinger::iotmp::output& out) { if (!in.is_empty()) { threshold = in["value"].get(); } out["value"] = threshold; }; int rc = thing.start(); // connects and reconnects in its own thread if (rc < 0) { LOG_ERR("Cannot start the IOTMP client: %d", rc); return rc; } while (true) { k_sleep(K_MINUTES(5)); // store a reading in a Data Bucket every 5 minutes thinger::iotmp::json_t data; data["temperature"] = temperature; thing.write_bucket("environment_data", data); } return 0; } ``` - `YOUR_TOKEN` is the device credentials, not an access token. - Without `set_host()`, the client connects to the free Cloud server. - The client does not configure the network: Zephyr brings it up (DHCP in this `prj.conf`) and the client connects when it is ready. - Create the `environment_data` Data Bucket in **Data Buckets** with **From Device Write Call** as **Data Source** before the first write. **Step 5: Add the server certificate** Over TLS, the client checks the server certificate against a CA certificate that your application registers. Register it with the Zephyr TLS credentials API before `thing.start()`, and pass the tag to the client: ```cpp #include #define CA_TAG 1 static const unsigned char ca_cert[] = "-----BEGIN CERTIFICATE-----\n" "...\n" "-----END CERTIFICATE-----\n"; // in main(), before thing.start() tls_credential_add(CA_TAG, TLS_CREDENTIAL_CA_CERTIFICATE, ca_cert, sizeof(ca_cert)); thing.set_tls_tag(CA_TAG); ``` Use the root certificate of the authority that signs your server certificate. **Step 6: Build and flash** ```bash west build -b YOUR_BOARD path/to/app west flash ``` `YOUR_BOARD` is the Zephyr name of your board. **Step 7: Check the connection** Go to **Devices**: the device shows a green status dot. Open it and go to **API** to call `environment`, `led` and `threshold`. You can also run `thinger device resource call YOUR_DEVICE environment`. ## Result The board is online in **Devices**, its device resources answer from the console and the API, and the `environment_data` Data Bucket gets a new reading every 5 minutes. ## Connection and reconnection `thing.start()` runs the client in its own thread, named `iotmp`, and returns at once (a negative value is an error). The thread connects, authenticates and reconnects on its own: after a failed attempt it waits 5 seconds, and doubles the wait on each new failure up to 60 seconds. A successful connection resets the wait. Change it with `thing.set_reconnect_timeout(base_ms, max_ms)`. `thing.set_state_callback()` receives the state changes (`SOCKET_CONNECTING`, `AUTHENTICATED`, `READY`, `DISCONNECTED`, `AUTH_FAILED`…). `thing.write_bucket()`, `thing.set_property()`, `thing.get_property()`, `thing.call_endpoint()` and `thing.stream()` are safe from any thread. See the [Arduino coding guide](https://docs.thinger.io/devices/arduino/coding.md) for what each one does. ## Configuration | Option | Default | Description | |---|---|---| | `CONFIG_THINGER_IOTMP` | — | Enables the client. Needs `NET_SOCKETS`, `CPP` and `STD_CPP17`. | | `CONFIG_THINGER_IOTMP_TLS` | `y` | Connects over TLS. Needs `NET_SOCKETS_SOCKOPT_TLS` and `MBEDTLS`. | | `CONFIG_THINGER_IOTMP_STACK_SIZE` | 4096 | Stack size of the client thread, in bytes. | | `CONFIG_THINGER_IOTMP_PRIORITY` | 7 | Priority of the client thread. | | `CONFIG_THINGER_IOTMP_LOG_LEVEL_DBG` | — | Prints every step of the connection to the log. Use it while you test. | The client connects to port 25206, the TLS port. Keep TLS enabled: without it, set the plain TCP port with `thing.set_host("YOUR_SERVER", 25204)`. ## Next steps - [ESP-IDF](https://docs.thinger.io/devices/esp-idf.md): Connect an ESP32 to Thinger.io from an ESP-IDF project with the IOTMP client component, with device resources, Data Buckets and automatic reconnection. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. - [Zephyr client](https://docs.thinger.io/reference/zephyr-client.md): Packages, source code, installation and documentation of the Thinger.io IOTMP client module for Zephyr RTOS. - [Connect a device](https://docs.thinger.io/devices.md): Choose how to connect your hardware to Thinger.io - device libraries over IOTMP, MQTT, HTTP or a LoRaWAN or Sigfox network. --- Source: https://docs.thinger.io/devices/linux.md # Linux > Build the Thinger.io IOTMP client for Linux, connect a Raspberry Pi or any Linux computer, and run it as a service with remote terminal and files. This guide connects a Linux computer, such as a Raspberry Pi, a gateway or a server, with the open source Thinger.io IOTMP client for Linux. You build the client, connect it with the device credentials and keep it running as a service. Once connected, you can open a shell and browse its files from the console. > **Tip: Remote maintenance of a Linux fleet** > > To maintain Linux machines remotely, such as gateways, edge computers or industrial PCs, use [ThinRemote](https://thinremote.io) instead of building this client. It installs with one command and adds remote SSH, file system access, remote desktop, access to local web services, monitoring and fleet management, also for AI agents. See the [ThinRemote documentation](https://docs.thinremote.io). ## Before you start - A Thinger.io account. Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - A Linux computer on x86_64 or ARM (32 or 64 bits) with internet access and `sudo`. - A C++20 compiler (GCC 11 or later, or Clang 14 or later), CMake, OpenSSL and Boost 1.86 or later, including Boost.Process. Older Boost releases, such as the one in Ubuntu 24.04, do not build the client. ## Steps **Step 1: Create the device** ### Console Go to **Devices** and click **Add Device**. Choose **IOTMP Device (Thinger.io protocol)** as **Device Type**, set the **Device Id** to `YOUR_DEVICE`, click **Random** in **Device Credentials** and copy the credentials. Click **Add Device**. ### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"device": "YOUR_DEVICE", "type": "Generic", "credentials": "a-long-random-secret"}' ``` ### CLI ```bash thinger device create YOUR_DEVICE -t Generic ``` ### AI **Prompt for an AI agent:** > Create an IOTMP device called YOUR_DEVICE in my Thinger.io account and show me its credentials. **Step 2: Install the build tools** On Ubuntu 25.10: ```bash sudo apt update sudo apt install build-essential cmake git libssl-dev libboost-all-dev libboost-process1.88-dev ``` Ubuntu packages Boost.Process on its own: without `libboost-process1.88-dev`, CMake stops with `Could not find a package configuration file provided by "boost_process"`. On other Debian-based systems, install the Boost.Process package that matches their Boost version. **Step 3: Build the client** ```bash git clone https://github.com/thinger-io/IOTMP-Linux.git cd IOTMP-Linux cmake -B build cmake --build build -j4 sudo install -m 755 build/thinger_iotmp /usr/local/bin/thinger_iotmp ``` The build downloads the libraries it needs and takes a few minutes on a Raspberry Pi. **Step 4: Connect** Run the client with your username, the device ID and the device credentials. `-h` is the server; leave it out only if your server is `iot.thinger.io`. ```bash thinger_iotmp -u YOUR_USER -d YOUR_DEVICE -p 'YOUR_TOKEN' -h YOUR_SERVER ``` Here `YOUR_TOKEN` is the device credentials. The client connects with TLS on port `25206` and reconnects by itself if the connection drops. Stop it with `Ctrl+C`. **Step 5: Run it as a service** Keep the client running across reboots with systemd. Store the credentials in an environment file that only root can read: **/etc/thinger/iotmp.env** ```ini THINGER_USERNAME=YOUR_USER THINGER_DEVICE=YOUR_DEVICE THINGER_PASSWORD=YOUR_TOKEN THINGER_HOST=YOUR_SERVER ``` **/etc/systemd/system/thinger_iotmp.service** ```ini [Unit] Description=Thinger.io IOTMP client After=network-online.target Wants=network-online.target [Service] EnvironmentFile=/etc/thinger/iotmp.env WorkingDirectory=/home/pi ExecStart=/usr/local/bin/thinger_iotmp Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target ``` The service runs as root, so the remote **Terminal** opens a root shell. Add `User=` with another account to limit what the console can do. `WorkingDirectory` is the folder that **Explorer** shows; change `/home/pi` to the folder you want to share. ```bash sudo chmod 600 /etc/thinger/iotmp.env sudo systemctl daemon-reload sudo systemctl enable --now thinger_iotmp systemctl status thinger_iotmp journalctl -u thinger_iotmp -f ``` ## Result The device shows as connected in **Devices**. Its device resources answer from the console, the API and the CLI: ```bash thinger device resource call YOUR_DEVICE version ``` ```json { "major": 1, "minor": 3, "patch": 0, "version": "1.3.0" } ``` In the console, the **API** tab of the device lists `cmd` and `version`. Fill in the `cmd` input and click **Run** to see the output of a command: ![Device API of a device connected with the Linux client: the cmd resource with the inputs cmd, mode, stdin and timeout, run with hostname, and its output retcode 0 and stdout raspberrypi, and the version resource below](https://docs.thinger.io/screenshots/linux-device-api.webp) *The cmd resource of the Linux client, run from the API tab* Open the device and use **Terminal** for a shell and **Explorer** for its files: see [Remote tools](https://docs.thinger.io/devices/remote-tools.md). ## Client options | Option | Environment variable | Default | Meaning | |---|---|---|---| | `-u`, `--username` | `THINGER_USERNAME` | | Your Thinger.io username. | | `-d`, `--device` | `THINGER_DEVICE` | | Device ID. | | `-p`, `--password` | `THINGER_PASSWORD` | | Device credentials. | | `-h`, `--host` | `THINGER_HOST` | `iot.thinger.io` | Server host. | | `-t`, `--transport` | `THINGER_TRANSPORT` | `ssl` | `ssl` (TLS, port `25206`), `ws` (WebSocket over HTTPS, port `443`, for networks that only allow web traffic) or `tcp` (no encryption, port `25204`). | | `-f`, `--fs-path` | | current folder | Folder that **Explorer** can read and write. Nothing outside it is reachable. | | `-v`, `--verbosity` | `THINGER_VERBOSITY` | `0` | `0` warnings, `1` information, `2` debug. | > **Warning** > > With `-v 1` or higher, the log shows the connection messages, including the device credentials. Use it only to diagnose a problem, and do not share the log as is. ## What the client provides | Device resource or tool | What it does | |---|---| | **Terminal** | An interactive shell on the computer, from the console. | | **Explorer** | Lists, uploads, downloads, moves and deletes files inside the `--fs-path` folder. | | `cmd` | Runs a shell command and returns `retcode`, `stdout` and `stderr`. | | `version` | Reports the client version. | Try `cmd` from the API: **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessinputresources)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/cmd" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"cmd": "uname -m"}' ``` ```json {"retcode": 0, "stderr": "", "stdout": "aarch64\n"} ``` Anyone with access to the device resources of this device can run commands on the computer. Give access tokens and agents only the permissions they need: see [Access Tokens](https://docs.thinger.io/platform/access-tokens.md). ## Write your own program The client is also a C++20 library. Add it to a CMake project and declare your own device resources, write to Data Buckets, read properties and use MQTT topics from your code. The library, its API and examples are in the [IOTMP-Linux repository](https://github.com/thinger-io/IOTMP-Linux). For the protocol, see the [IOTMP reference](https://docs.thinger.io/reference/iotmp.md). ## Test without hardware You do not need a Raspberry Pi to try Thinger.io: - Run the client on any Linux computer, a virtual machine or a container. It behaves like any other device. - Create a [virtual device](https://docs.thinger.io/devices/virtual-devices.md), whose device resources are computed on the platform. ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | `Error: unrecognised option` | An environment variable that starts with `THINGER_` is not one of the options above. | Remove or rename that variable. | | `username, device, or credentials not provided` | An option or environment variable is missing. | Pass `-u`, `-d` and `-p`, or set the three variables. | | The client keeps reconnecting and the device stays disconnected | Wrong credentials, wrong server, or the device does not exist. | Check the three values and `-h`. Run once with `-v 1` to see the authentication result. | | Cannot connect on a corporate network | Port `25206` is blocked. | Use `-t ws`, which goes through port `443`. | | **Explorer** shows an unexpected folder | The client serves the folder it was started in. | Set `--fs-path` or `WorkingDirectory`. | More cases in [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md). ## Next steps - [Remote tools](https://docs.thinger.io/devices/remote-tools.md): Open a shell, browse files and read the log of a connected device from the Thinger.io console, without VPNs or open ports. - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. - [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md): Find out why a device does not connect, does not authenticate or does not send data to Thinger.io, and fix it. - [Linux client](https://docs.thinger.io/reference/linux-client.md): Packages, source code, installation and documentation of the Thinger.io IOTMP client for Linux, the thinger_iotmp program and C++ library. --- Source: https://docs.thinger.io/devices/mqtt.md # MQTT > Connect an MQTT client to the Thinger.io broker, publish and subscribe to topics, and store the messages in a Data Bucket. This guide connects a device or program that already speaks MQTT to the broker built into every Thinger.io instance. You create an MQTT device, connect with its credentials, publish a message and store it in a Data Bucket. In MQTT, clients do not talk to each other: they connect to a broker, **publish** messages on named topics, such as `sensors/dev1/telemetry`, and **subscribe** to the topics they want to receive. The broker delivers each message to every subscriber of its topic. In Thinger.io, the subscribers can also be Data Buckets, products and devices that use the Thinger.io libraries. ![An MQTT device connects with its device ID as client ID, your username and its credentials, and publishes to a topic of the Thinger.io broker. The broker delivers the message to another MQTT device subscribed to sensors/#, to a Data Bucket with From MQTT Topic, to a product and to IOTMP devices. A product API resource publishes a command on sensors/dev1/commands, which the MQTT device receives.](https://docs.thinger.io/diagrams/mqtt-broker.svg) *Publish and subscribe in the topic space of your account* ## Before you start - A Thinger.io account. Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - An MQTT 3.1 or 3.1.1 client. The examples use `mosquitto_pub` and `mosquitto_sub` from [Mosquitto](https://mosquitto.org/download/) and Python with [paho-mqtt](https://pypi.org/project/paho-mqtt/) 2.x. MQTT 5 is not supported. ## Connection settings | Setting | Value | |---|---| | Host | `YOUR_SERVER` | | Port | `8883` with TLS, or `1883` without TLS | | WebSocket | `wss://YOUR_SERVER/mqtt`, subprotocol `mqtt` (for browser clients) | | Username | `YOUR_USER`, your Thinger.io username (not your email) | | Client ID | `YOUR_DEVICE`, the device ID | | Password | The device credentials | | Protocol | MQTT 3.1 or 3.1.1 | Use port `8883`: the connection is encrypted with the server certificate, so clients that check certificates work with their default settings. Use `1883` only on networks you trust or to rule out a TLS problem. The device must exist before it connects, and only one connection per device ID is kept: if a second client connects with the same client ID, the first one is disconnected. ## Steps **Step 1: Create the MQTT device** ### Console Go to **Devices** and click **Add Device**. Choose **MQTT Device** as **Device Type**, set the **Device Id** to `YOUR_DEVICE`, click **Random** in **Device Credentials** and copy the credentials. Click **Add Device**. ![Add Device form with MQTT Device selected, a device ID and credentials](https://docs.thinger.io/screenshots/mqtt-add-device.webp) *Add an MQTT device* ### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"device": "YOUR_DEVICE", "type": "MQTT", "credentials": "a-long-random-secret"}' ``` `YOUR_TOKEN` is an access token of your account. The credentials need at least six characters. ### CLI ```bash thinger device create YOUR_DEVICE -t MQTT ``` Without `-c`, the CLI generates random credentials and prints them once. ### AI **Prompt for an AI agent:** > Create an MQTT device called YOUR_DEVICE in my Thinger.io account with random credentials and show them to me. **Step 2: Create a Data Bucket for the topic** Go to **Data Buckets** and create a Data Bucket. Set an ID, choose **From MQTT Topic** as **Data Source** and enter `sensors/YOUR_DEVICE/telemetry` in **MQTT Topic**. Every message published to that topic is stored as one record. Topic filters with `+` and `#` work here too. Payloads stored in a Data Bucket must be JSON. **Step 3: Publish a message** ### mosquitto ```bash mosquitto_pub -h YOUR_SERVER -p 8883 --capath /etc/ssl/certs \ -u YOUR_USER -i YOUR_DEVICE -P 'YOUR_TOKEN' \ -t "sensors/YOUR_DEVICE/telemetry" -m '{"temperature": 21.5}' ``` Here `YOUR_TOKEN` is the device credentials. On macOS, replace `--capath /etc/ssl/certs` with `--cafile` and the path of a CA bundle, such as `/etc/ssl/cert.pem`. ### Python **publish.py** ```python import json import ssl import paho.mqtt.client as mqtt client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="YOUR_DEVICE", protocol=mqtt.MQTTv311) client.username_pw_set("YOUR_USER", "YOUR_TOKEN") # YOUR_TOKEN: device credentials client.tls_set_context(ssl.create_default_context()) client.connect("YOUR_SERVER", 8883) client.loop_start() info = client.publish("sensors/YOUR_DEVICE/telemetry", json.dumps({"temperature": 21.5}), qos=1) info.wait_for_publish() client.loop_stop() client.disconnect() ``` ## Result The device shows as connected in **Devices** while the client is connected, and the message appears in the Data Bucket with the time it was received. Read it from the CLI: ```bash thinger bucket read YOUR_BUCKET ``` ```json [ { "temperature": 21.5, "ts": 1792254092403 } ] ``` `YOUR_BUCKET` is the ID you gave the Data Bucket. ## Topics The broker accepts any topic name: there are no reserved topics or required prefixes. Each account has its own topic space, so your topics never mix with those of other accounts. - **Subscribe**: a client receives the messages that any device of your account publishes on the topics it subscribes to, with `+` and `#` wildcards. - **QoS**: publish and subscribe with QoS 0, 1 or 2. A message is delivered with the lower of the publish and the subscription QoS. - **Retained messages**: a retained message is kept per topic and sent to new subscribers of that exact topic. Publish an empty retained message to clear it. - **Sessions**: subscriptions last as long as the connection. There are no persistent sessions or queues for offline clients. - **Payloads**: JSON payloads are parsed and can feed Data Buckets, properties and products. Other payloads are passed on unchanged to subscribers. - **Keep alive**: the device is marked as disconnected when nothing arrives for one and a half times the keep-alive interval. Listen to a topic with `mosquitto_sub`: ```bash mosquitto_sub -h YOUR_SERVER -p 8883 --capath /etc/ssl/certs \ -u YOUR_USER -i YOUR_DEVICE -P 'YOUR_TOKEN' -t "sensors/#" -v ``` Devices that use the Thinger.io device libraries can also publish to and subscribe to topics of your account, so IOTMP and MQTT devices can talk to each other. ## Send commands to an MQTT device An MQTT device has no device resources of its own. To send it a command from the console, a dashboard, the API or an agent, assign the device to a [product](https://docs.thinger.io/platform/products.md) and add an API resource that publishes to a topic, such as `sensors/{{device}}/commands`. The device subscribes to that topic, and you call the resource like any device resource: **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessinputresources)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/command" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"relay": true}' ``` `YOUR_TOKEN` is an access token of your account. The same product can turn incoming topics into properties, Data Bucket records and device resources: see [API resources](https://docs.thinger.io/platform/products/api-resources.md). For the full list of device operations, see the [REST API reference](https://docs.thinger.io/reference/rest-api/devices.md). ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | `Connection Refused: not authorised` (CONNACK 5) | The username, client ID or credentials do not match, or the device or the account is disabled. | Check that the client ID is the device ID, the username is your username (not your email) and the password is the device credentials. Check that the device is enabled. | | `Connection Refused: identifier rejected` (CONNACK 2) | The client ID is not a valid device ID. | Use only letters, numbers, `-` and `_`, up to 32 characters. | | `Connection Refused: unacceptable protocol version` (CONNACK 1) | The client uses MQTT 5. | Set the client to MQTT 3.1.1. | | The connection closes without an answer | Empty username or password, or a TLS client on port `1883`. | Set both fields, and use TLS only on port `8883`. | | The client keeps reconnecting | Another client uses the same client ID. | Give each client its own device. | | The Data Bucket stays empty | The payload is not JSON, or the topic does not match. | Publish JSON to exactly the topic of the Data Bucket. | More cases in [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md). ## Next steps - [HTTP](https://docs.thinger.io/devices/http.md): Send data to Thinger.io from any device, script or cloud service with HTTP requests, store and process it with a product, and answer with configuration data. - [Subdevices](https://docs.thinger.io/devices/subdevices.md): Represent the sensors and machines behind an MQTT gateway as their own devices, with their own connection state, data and dashboards. - [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md): Find out why a device does not connect, does not authenticate or does not send data to Thinger.io, and fix it. --- Source: https://docs.thinger.io/devices/http.md # HTTP > Send data to Thinger.io from any device, script or cloud service with HTTP requests, store and process it with a product, and answer with configuration data. This guide connects anything that can send an HTTP request, such as a device without a Thinger.io library, a script or another cloud, as an HTTP device of a [product](https://docs.thinger.io/platform/products.md). The product decides what each request does: the Data Buckets and properties that store it, the script that transforms it and what the response carries back. You create the product and the device, and send data with `curl`. An HTTP device sends data when it wants; the platform cannot call it. If the device can keep a connection open, use the [device libraries](https://docs.thinger.io/devices.md) or [MQTT](https://docs.thinger.io/devices/mqtt.md) to send it commands at any time. ![A device without a library, a script or another cloud posts its data with a token to the data API resource of its device. The product sends the body, optionally processed by a function of the product script, to the readings device stream, which feeds a Data Bucket and the last_reading property. The response carries the value of the downlink property back to the sender. An Auto Provision rule creates the device on its first request.](https://docs.thinger.io/diagrams/http-device-product.svg) *What happens with each request to an HTTP device of a product* HTTP devices used to be configured one by one with their **Callback** settings. The callback still works, but it is deprecated: see [HTTP callback (deprecated)](#http-callback-deprecated). ## Before you start - A Thinger.io account. Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - `curl`, or any HTTP client. ## Steps **Step 1: Create the product** The product `http_sensor` turns each request into data with these entries of its profile: | Entry | What it does | |---|---| | API resource `data` | The resource the device posts to. Its request sends the body to the device stream `readings`, and its response returns the `downlink` property of the device. **Handle Device Connectivity** shows the device as connected while it sends requests. | | Data Bucket `http_sensor_readings` | Stores every reading of the `readings` stream, tagged with the device ID. | | Property `last_reading` | Keeps the last reading of each device. | | Auto Provision rule `sensors` | Creates the device on its first request when its ID matches `^sensor_[0-9]+$`. Optional. | The product property `downlink` gives every device the same default answer, `{"interval": 60}`. ### Console Go to **Products**, click **Add Product**, set the **Product ID** to `http_sensor` and a **Product Name**, and click **Add Product**. On the **Profile** tab of the product, click **Add** in each card: 1. **API Resources**: set the **Resource Identifier** to `data`. On **Request**, choose **Device Stream**, set the **Resource Name** to `readings` and the **Payload** to **Source Payload**. On **Response**, choose **Device Property**, the property `downlink` and **Source Payload**. On **Settings**, keep **Handle Device Connectivity** on and click **Save**. 2. **Buckets**: set the **Bucket Identifier** to `http_sensor_readings`. On **Bucket Source**, choose **Device Stream**, the **Resource Name** `readings` and **Source Payload**, and click **Save**. 3. **Properties**: set the **Property Identifier** to `last_reading`. On **Property Source**, choose **Device Stream**, the **Resource Name** `readings` and **Source Payload**, and click **Save**. 4. **Auto Provision**: set the **Provision Identifier** to `sensors` and the **Device Pattern** to `^sensor_[0-9]+$`, and click **Save**. Then open the **Properties** tab of the product and add the property `downlink` with the value `{"interval": 60}`. ![Profile tab of the http_sensor product with the last_reading property and the http_sensor_readings bucket fed by the readings stream, the data API resource that sends to readings and answers with the downlink property, and the sensors Auto Provision rule with the pattern ^sensor_\[0-9\]+$](https://docs.thinger.io/screenshots/http-product-profile.webp) *Profile of the http_sensor product* ### API Save the product with its profile in `http_sensor.json`: **http_sensor.json** ```json { "product": "http_sensor", "name": "HTTP sensor", "enabled": true, "profile": { "api": { "data": { "enabled": true, "handle_connectivity": true, "request": { "data": { "target": "resource_stream", "resource_stream": "readings", "payload_type": "source_payload" } }, "response": { "data": { "source": "property", "property": "downlink", "payload_type": "source_payload" } } } }, "buckets": { "http_sensor_readings": { "enabled": true, "data": { "source": "resource_stream", "resource_stream": "readings", "payload_type": "source_payload" } } }, "properties": { "last_reading": { "enabled": true, "data": { "source": "resource_stream", "resource_stream": "readings", "payload_type": "source_payload" } } }, "autoprovisions": { "sensors": { "enabled": true, "config": { "mode": "pattern", "pattern": "^sensor_[0-9]+$" } } } } } ``` Create the product, then the product property: **API call:** `POST /v1/users/{user}/products` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/products" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d @http_sensor.json ``` **API call:** `POST /v1/users/{user}/products/{product}/properties` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-createproperty)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/products/http_sensor/properties" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"property": "downlink", "value": {"interval": 60}}' ``` `YOUR_TOKEN` is an access token of your account that can create products. ### CLI Save the product document of the API tab as `http_sensor.json`, and create the product and its property: ```bash thinger product create http_sensor --from http_sensor.json thinger product property set http_sensor downlink '{"interval": 60}' ``` ### AI **Prompt for an AI agent:** > Create a product called http_sensor for HTTP devices. Add an API resource called data that sends what it receives to the device stream readings and answers with the downlink property of the device, with device connectivity handled. Store the readings stream in a bucket called http_sensor_readings and in a property called last_reading. Add an Auto Provision rule called sensors for the device pattern ^sensor_[0-9]+$, and a product property downlink with the value {"interval": 60}. The agent uses `thinger_resource_create` with the `product` type and the profile entry types. See [MCP tools](https://docs.thinger.io/ai/tools.md). Give the stream its own name, different from the API resource, as `readings` here. A stream with the name of an API resource that has a response also receives that response, and an empty reading, each time the device connects. **Step 2: Create the HTTP device** Skip this step to let the Auto Provision rule create the device on its first request, with an ID such as `sensor_001`. ### Console Go to **Devices** and click **Add Device**. Choose **HTTP Device (Sigfox, Lora, cURL)** as **Device Type**, set the **Device Id** to `YOUR_DEVICE`, choose the product `http_sensor` under **Advanced Options** and click **Add Device**. HTTP devices have no device credentials: requests are authorized with a token. ### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"device": "YOUR_DEVICE", "type": "HTTP", "product": "http_sensor"}' ``` ### CLI ```bash thinger device create YOUR_DEVICE -t HTTP -p http_sensor ``` ### AI **Prompt for an AI agent:** > Create an HTTP device called YOUR_DEVICE in the product http_sensor. **Step 3: Create a token for the device** The device needs a token that can call its `data` resource. Use a [device token](https://docs.thinger.io/platform/devices.md#share-a-device-with-a-device-token) limited to that resource, so the token cannot do anything else: ### Console Open the device, go to **Tokens** and click **Add**. Set the **Token Name**, choose **Limit the resource access for this token**, type the resource `data` and save it. Copy the **Device Token**. ### API **API call:** `POST /v1/users/{user}/devices/{device}/tokens` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-createtoken)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/tokens" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"token_name": "HTTP sensor", "token_resources": ["data"]}' ``` The response holds the `token` value. ### CLI ```bash thinger device token create YOUR_DEVICE -s 'token_name=HTTP sensor' -s 'token_resources=["data"]' ``` ### AI **Prompt for an AI agent:** > Create a device token for YOUR_DEVICE that can only call its data resource, and show me the token. A device that Auto Provision creates does not exist before its first request, so it cannot have a device token yet. Give those devices an [access token](https://docs.thinger.io/platform/access-tokens.md) with the `AccessDeviceResources` action on the **Device** type, for any device (`*`). **Step 4: Send data** Post the reading to the `data` resource of the device. `YOUR_TOKEN` is the token from the previous step. **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessinputresources)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/data" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"temperature": 21.5, "humidity": 48}' ``` If the client cannot set headers, pass the token in the URL instead: `?authorization=YOUR_TOKEN`. ## Result The request returns `200` with the `downlink` property: ```json {"interval": 60} ``` The device shows as connected in **Devices** until its **Disconnect Timeout** passes without requests (10 minutes by default, in the device **Settings**). The reading is in the Data Bucket `http_sensor_readings`, tagged with the device, which the **Buckets** tab of the device shows, and in the `last_reading` property: ```bash thinger device property get YOUR_DEVICE last_reading ``` To show the data of each device in a dashboard, add a [product dashboard](https://docs.thinger.io/platform/products/dashboard.md) with the bucket as **From Device Bucket**. ## Send data back to the device The response of each request carries the `downlink` property, so the device receives its configuration every time it reports. The product property sets the value for every device; a device property with the same name overrides it for one device. Change it from the console, a dashboard or the API, and the next response carries the new value: **API call:** `PUT /v3/users/{user}/devices/{device}/properties/{property}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-updateproperty)) ```bash curl -X PUT "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/downlink" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"value": {"interval": 120}}' ``` `YOUR_TOKEN` is an access token of your account. The API resource can answer with something else, such as the result of a [product function](https://docs.thinger.io/platform/products/script.md) or an [endpoint call](https://docs.thinger.io/platform/endpoints.md): see [API resources](https://docs.thinger.io/platform/products/api-resources.md#request-and-response). Without a response, the request returns `200` with an empty body. ## Process the payload A function of the [product script](https://docs.thinger.io/platform/products/script.md) can transform each request before it reaches the stream: decode a compact format, convert units, rename fields. The body does not need to be JSON: a `text/plain` body reaches the function as text. This function turns a reading sent as `21.5,48` into JSON: **Product Script** ```js // "21.5,48" -> {"temperature": 21.5, "humidity": 48} function parseReading(payload) { if (typeof payload !== 'string') return payload; const [temperature, humidity] = payload.split(',').map(Number); return { temperature, humidity }; } ``` Write it in the **Product Script** card of the product profile and click **Save**. Then edit the API resource `data`, set **Payload Processing** to `parseReading` on its **Request** and save it. The device can now send the short form: ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/data" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: text/plain" \ -d '21.5,48' ``` The same setting exists on each bucket and property, to transform the data for only one of them. A function that returns nothing skips the write. ### Store the location A request does not move the device on maps by itself: store its position in the `location` property of the device, which places it on maps and checks its [geofences](https://docs.thinger.io/platform/geofences.md). For readings with `lat` and `lng` fields, add this function to the script: **Product Script** ```js function toLocation(payload) { if (payload.lat === undefined || payload.lng === undefined) return; return { lat: payload.lat, lon: payload.lng }; } ``` Then add a property `location` to the profile with the **Device Stream** `readings` as source, **Source Payload** and **Payload Processing** `toLocation`. Readings without a position leave the property as it was. ## Request reference | Part | Value | |---|---| | Method and URL | `POST https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/data`, where `data` is an API resource of the product. | | Authorization | `Authorization: Bearer YOUR_TOKEN` header, or `?authorization=YOUR_TOKEN`. A device token of the device, or an access token with the `AccessDeviceResources` action on it. | | Body | A JSON document with `Content-Type: application/json`, or text with `Content-Type: text/plain`. An array writes one Data Bucket record per element. | | `ts` field | Optional. A number in the body with the time of the reading in milliseconds since the Unix epoch, for data sent late: the Data Bucket stores the record with that time. | | Response | Meaning | |---|---| | `200` | Accepted. The body is the response of the API resource, such as the `downlink` property, or empty if it has none. | | `400` | The body is not valid JSON while the content type says it is, or the device is disabled. | | `401` | No token, or the token is not valid. | | `403` | The token has no permission for this device resource. | | `404` | The device does not exist and no Auto Provision rule matches its ID, the product has no enabled API resource with that name, or the property of the response does not exist (`property not found`). In the last case the data is stored anyway. | For every device operation, see the [REST API reference](https://docs.thinger.io/reference/rest-api/devices.md). ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | `401 unauthorized` | The token is missing, mistyped or revoked. | Copy the token again, or create a new one. | | `403 not authorized` | The token belongs to another device or does not reach this device resource. | Use a device token of this device with the resource, or an access token with `AccessDeviceResources` on it. | | `404` with an empty body | The device does not exist and its ID does not match an Auto Provision rule. | Create the device, or fix the **Device Pattern** of the rule. | | `404 resource not found` | The device has no product, or the product has no enabled API resource with that name. | Assign the device to the product, and check the name and **Enabled** of the API resource. | | `404 property not found` | The response property does not exist for this device or its product. | Add the product property `downlink`, or set it on the device. | | `400 invalid json payload` | The body is not JSON but the content type says it is. | Send valid JSON, or text with `Content-Type: text/plain` and a function that decodes it. | | The device shows as disconnected between requests | The **Disconnect Timeout** is shorter than the reporting interval, or **Handle Device Connectivity** is off. | Raise the **Disconnect Timeout** in the device **Settings**, and turn the option on in the API resource. | | The Data Bucket gets empty records, or the value of the response | The stream has the name of an API resource that has a response. | Give the **Device Stream** of the request its own **Resource Name**, such as `readings`. | More cases in [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md). ## HTTP callback (deprecated) > **Warning: Deprecated** > > The HTTP callback stays available for the devices that use it, but new integrations should use a product as described above. A product covers the same needs, as [Move a callback to a product](#move-a-callback-to-a-product) shows, and adds Auto Provision, payload processing, text payloads and responses from any source. The callback is set on each HTTP device, in its **Callback** tab, with or without a product. Each request to the callback URL runs the actions of the device and answers with one of its properties. ![A device without a library, a script or another cloud posts JSON with a token to the callback of an HTTP device. The callback settings write a Data Bucket, call an endpoint and set a device property, and the response carries the value of the Response Data property back to the sender.](https://docs.thinger.io/diagrams/http-device-callback.svg) *What happens with each request to the callback of an HTTP device* ### Configure the callback Create the HTTP device as in [Steps](#steps), with or without a product. Open the device and go to **Callback**. In **Settings**, enable the actions you need: | Field | What it does | |---|---| | **Write Bucket** | Stores the request body in a Data Bucket. | | **Call Endpoint** | Calls an [endpoint](https://docs.thinger.io/platform/endpoints.md) with the request body. | | **Set Device Property** | Saves the request body in a device property, so it always holds the last value. | | **Response Data** | Answers each request with the value of a device property. | | **Timeout** | Minutes without requests before the device shows as disconnected. | The Data Bucket of **Write Bucket** and the endpoint of **Call Endpoint** must exist before the first request: if one is missing, the request still returns `200` but that action does nothing. **Set Device Property** creates the property if it does not exist. Then enable **Authorization**. The console creates an access token that can only send data to this device, and shows it in **Overview** with the **Target URL** and a **Curl Example**. ![Callback Overview tab of an HTTP device with the target URL, the authorization header and a curl example](https://docs.thinger.io/screenshots/http-callback-overview.webp) *Callback overview of an HTTP device* From the API, set the same actions with [`PUT /v3/users/{user}/devices/{device}/callback`](https://docs.thinger.io/reference/rest-api/devices.md#device-updatecallback): ```json { "actions": { "write_bucket": "YOUR_BUCKET", "set_property": "telemetry", "send_property": "downlink" }, "properties": { "timeout": 10 } } ``` ### Send data to the callback Post a JSON body to the device callback. `YOUR_TOKEN` is the token from **Overview**, or any access token with the `CallDeviceCallback` action on this device. **API call:** `POST /v3/users/{user}/devices/{device}/callback/data` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-callcallbackdata)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/callback/data" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"temperature": 21.5, "humidity": 48}' ``` The body is in the Data Bucket and in the `telemetry` property, and the response carries the **Response Data** property. Change that property as in [Send data back to the device](#send-data-back-to-the-device); read the current response without sending data with `GET /v3/users/YOUR_USER/devices/YOUR_DEVICE/callback/data`. | Part | Value | |---|---| | Method and URL | `POST https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/callback/data` | | Authorization | `Authorization: Bearer YOUR_TOKEN` header, or `?authorization=YOUR_TOKEN` | | Body | Any JSON document, with `Content-Type: application/json` | | `ts` query parameter | Optional. Time of the reading in milliseconds since the Unix epoch, for data sent late. | | Location | Optional. `lat` and `lng` (or `latitude` and `longitude`) at the top level or inside `location` update the device location and its [geofences](https://docs.thinger.io/platform/geofences.md). | | Response | Meaning | |---|---| | `200` with a JSON body | Accepted. The body is the **Response Data** property, or `""` if none is set. | | `400` | The body is not valid JSON, `ts` is not a number, or the device is disabled. | | `401` | No token, or the token is not valid. | | `403` | The token has no permission for this device. | | `404` | There is no HTTP device with that ID (`device callback not found`). The callback does not create devices with Auto Provision. | ### Move a callback to a product | Callback | Product | |---|---| | `POST …/callback/data` | `POST …/resources/`, an API resource with a **Device Stream** request | | **Write Bucket** | A [product bucket](https://docs.thinger.io/platform/products/buckets.md) with the stream as source, created on the first write | | **Set Device Property** | A [product property](https://docs.thinger.io/platform/products/properties.md) with the stream as source | | **Call Endpoint** | A [flow](https://docs.thinger.io/platform/products/flows.md) with the stream as source and an **Endpoint Call** target | | **Response Data** | The response of the API resource, such as **Device Property** | | **Timeout** | **Disconnect Timeout** in the device **Settings** | | `ts` query parameter | A `ts` field in the body | | `lat` and `lng` in the body | A `location` property filled by a function, as in [Store the location](#store-the-location) | | Authorization token from **Overview** | A device token limited to the API resource | ## Next steps - [API resources](https://docs.thinger.io/platform/products/api-resources.md): Add device resources to every device of a product, so dashboards, the API and agents can call HTTP, MQTT and virtual devices like IOTMP ones. - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. - [LoRaWAN](https://docs.thinger.io/devices/lorawan.md): Bring LoRaWAN sensors into Thinger.io through The Things Stack, ChirpStack or LORIOT, with devices created automatically and downlinks. - [MQTT](https://docs.thinger.io/devices/mqtt.md): Connect an MQTT client to the Thinger.io broker, publish and subscribe to topics, and store the messages in a Data Bucket. --- Source: https://docs.thinger.io/devices/virtual-devices.md # Virtual devices > Create devices without hardware whose device resources are computed on the platform, such as a weather station that reads a public weather API. A virtual device is a device without hardware. The platform keeps it connected while it is enabled, and its device resources come from its [product](https://docs.thinger.io/platform/products.md): each one is computed on the platform, by a function of the product script or by a call to an external service. Dashboards, Data Buckets, alarms, the API and agents use it like any other device. ## When to use it - To build and test dashboards, buckets and alarms before the hardware exists. - To run demos and training without real devices. - To expose a device built from other data, such as values combined from several devices or read from an external service: a weather API, a market price, the status of another system. Use an [HTTP device](https://docs.thinger.io/devices/http.md) instead when something outside the platform sends the data, and a [subdevice](https://docs.thinger.io/devices/subdevices.md) when the data arrives through a gateway. ## How a virtual device gets its data A virtual device has the device resources that its product defines in [API resources](https://docs.thinger.io/platform/products/api-resources.md). Each API resource has a request and a response: - The request does the work. **Product Function** runs a function of the [product script](https://docs.thinger.io/platform/products/script.md), and **Endpoint Call** calls an [endpoint](https://docs.thinger.io/platform/endpoints.md), such as an HTTP request to an external API. Its payload can include the properties of the device, so each device of the product can ask for its own data. - The response sets what the device resource returns, optionally passed through a function of the product script (**Payload Processing**). Nothing runs on its own: the device resource is computed each time something reads it. To read it at a fixed interval, add a bucket to the product with the **Device Resource** source and a **Sampling Interval** (see [Product buckets](https://docs.thinger.io/platform/products/buckets.md)). The product script cannot do this for you: its functions run only when called, and cannot make network requests or start timers. The rest of this page builds a complete example: a weather station that reads the current weather of Madrid from the public [Open-Meteo](https://open-meteo.com) API every 15 minutes, stores it in a Data Bucket and shows it on a dashboard. ![Every 15 minutes the weather bucket of the product reads the weather resource of the virtual device madrid_weather; the resource calls the open_meteo endpoint with the latitude and longitude of the device location property; the endpoint sends a GET request to the Open-Meteo API; the JSON answer goes through the parseWeather function of the product script, which keeps the temperature, humidity and wind speed; the result is stored in the weather Data Bucket and the Madrid weather dashboard reads it](https://docs.thinger.io/diagrams/virtual-device-weather.svg) *A virtual weather station* ## Build a weather station The example uses these IDs: the endpoint `open_meteo`, the product `weather_station` with its API resource and bucket `weather`, and the virtual device `madrid_weather`. Open-Meteo needs no API key. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_TOKEN` is an access token of your account with permission to create the resources of each step. ### Create the endpoint The endpoint sends the request to Open-Meteo. Its URL takes the latitude and longitude from the payload of each call. #### Console **Step 1: Open the form** Go to **Endpoints** and click **Add Endpoint**. Set the **Endpoint Identifier** to `open_meteo` and the **Endpoint Name** to `Open-Meteo current weather`, and choose **HTTP Request** as **Endpoint Type**. **Step 2: Set the request** Choose the `GET` method and set the **Request URL**: ```text https://api.open-meteo.com/v1/forecast?latitude={{lat}}&longitude={{lng}}¤t=temperature_2m,relative_humidity_2m,wind_speed_10m ``` Click **Add Endpoint**. **Step 3: Test it** Open the endpoint, go to the **Test** tab, write `{"lat": 40.4168, "lng": -3.7038}` in **Endpoint Call Payload** and click **Test Endpoint**. The **Response Body** shows the current weather in Madrid. #### API **API call:** `POST /v1/users/{user}/endpoints` ([reference](https://docs.thinger.io/reference/rest-api/endpoints.md#endpoint-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/endpoints" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "open_meteo", "name": "Open-Meteo current weather", "enabled": true, "type": "http_request", "config": { "method": "GET", "url": "https://api.open-meteo.com/v1/forecast?latitude={{lat}}&longitude={{lng}}¤t=temperature_2m,relative_humidity_2m,wind_speed_10m", "body_type": "json", "headers": [] } }' ``` #### CLI ```bash thinger endpoint create open_meteo -n "Open-Meteo current weather" \ -s enabled=true -s type=http_request \ -s config.method=GET -s config.body_type=json -s 'config.headers=[]' \ -s 'config.url=https://api.open-meteo.com/v1/forecast?latitude={{lat}}&longitude={{lng}}¤t=temperature_2m,relative_humidity_2m,wind_speed_10m' ``` #### AI **Prompt for an AI agent:** > Create an endpoint called open_meteo that sends a GET request to the Open-Meteo forecast API for the current temperature, relative humidity and wind speed, taking the latitude and longitude from the lat and lng fields of each call. The agent uses `thinger_resource_create` with the `endpoint` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). Open-Meteo answers with a JSON document. The values the example keeps are in `current`: ```json { "latitude": 40.417583, "longitude": -3.739399, "current_units": { "time": "iso8601", "interval": "seconds", "temperature_2m": "°C", "relative_humidity_2m": "%", "wind_speed_10m": "km/h" }, "current": { "time": "2026-10-18T08:15", "interval": 900, "temperature_2m": 11.6, "relative_humidity_2m": 72, "wind_speed_10m": 16.3 } } ``` ### Create the product The product holds everything its devices share: the `weather` API resource, which calls the endpoint with the location of the device; the `parseWeather` function, which keeps the three values; and the `weather` bucket, which reads the resource every 15 minutes. **Product Script** ```js function parseWeather(response) { if (!response || !response.current) return null; return { temperature: response.current.temperature_2m, humidity: response.current.relative_humidity_2m, wind_speed: response.current.wind_speed_10m }; } ``` The function returns `null` when the answer has no `current` values, for example when Open-Meteo answers with an error, and the bucket skips that reading. #### Console **Step 1: Create the product** Go to **Products** and click **Add Product**. Set the **Product ID** to `weather_station` and the **Product Name** to `Weather station`, and click **Add Product**. The product opens on its **Profile** tab. **Step 2: Write the script** In the **Product Script** card, write the `parseWeather` function and click **Save**. **Step 3: Add the API resource** Click **Add** in the **API Resources** card and set the **Resource Identifier** to `weather`. On **Request**, choose **Endpoint Call**, set the **Endpoint** to `open_meteo` and choose **Template Payload** with this template: ```json {"lat": {{property.location.lat}}, "lng": {{property.location.lng}}} ``` On **Response**, choose **Request Response**, **Source Payload** and the **Payload Processing** function `parseWeather`. Click **Save**. ![API Resource modal of the weather_station product with an Endpoint Call request to the open_meteo endpoint and a template payload with the lat and lng of the location property](https://docs.thinger.io/screenshots/virtual-devices-api-resource.webp) *API resource that calls the endpoint* **Step 4: Add the bucket** Click **Add** in the **Buckets** card and set the **Bucket Identifier** to `weather`. On **Bucket Source**, choose **Device Resource**, the **Resource Name** `weather` and a **Sampling Interval** of 15 minutes, with **Source Payload**. On **Settings**, set the **Bucket Name** and click **Save**. The **Profile Graph** of the product shows how the pieces connect: ![Profile Graph of the weather_station product: the weather resource uses the location property, calls the open_meteo endpoint and is the data source of the weather bucket](https://docs.thinger.io/screenshots/virtual-devices-profile-graph.webp) *Profile Graph of the weather_station product* #### API Save the product as `weather_station.json`. The `code` is the product script as a JSON string: **weather_station.json** ```json { "product": "weather_station", "name": "Weather station", "description": "Virtual weather stations that read the Open-Meteo API at their location", "enabled": true, "profile": { "api": { "weather": { "name": "Weather", "description": "Current temperature, humidity and wind speed at the device location", "enabled": true, "request": { "data": { "target": "endpoint_call", "endpoint": "open_meteo", "payload": "{\"lat\": {{property.location.lat}}, \"lng\": {{property.location.lng}}}" } }, "response": { "data": { "source": "request_response", "payload_type": "source_payload", "payload_function": "parseWeather" } } } }, "buckets": { "weather": { "name": "Weather", "description": "Weather readings every 15 minutes", "enabled": true, "data": { "source": "resource", "resource": "weather", "update": "interval", "interval": 15, "magnitude": "minute", "payload_type": "source_payload" }, "retention": { "period": 6, "unit": "months" } } }, "code": { "code": "function parseWeather(response) {\n if (!response || !response.current) return null;\n return {\n temperature: response.current.temperature_2m,\n humidity: response.current.relative_humidity_2m,\n wind_speed: response.current.wind_speed_10m\n };\n}\n" } } } ``` Then create the product with it: **API call:** `POST /v1/users/{user}/products` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/products" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d @weather_station.json ``` #### CLI Save the product document of the API tab as `weather_station.json` and create the product from it: ```bash thinger product create weather_station --from weather_station.json ``` #### AI **Prompt for an AI agent:** > Create a product called weather_station. Give it an API resource called weather that calls my open_meteo endpoint with the lat and lng of the location property of the device, and passes the answer through a product script function parseWeather that keeps current.temperature_2m, current.relative_humidity_2m and current.wind_speed_10m as temperature, humidity and wind_speed. Add a bucket called weather that reads the weather resource of each device every 15 minutes. The agent uses `thinger_resource_create` with the `product`, `product_profile_api` and `product_profile_bucket` types, and `thinger_resource_update` with `product_profile_code`. See [MCP tools](https://docs.thinger.io/ai/tools.md). The bucket ID has no `{{device}}`, so the product writes every station to the same Data Bucket, tagged with the `device`. The bucket is created on the first reading. ### Create the virtual device Create `madrid_weather` in the product and give it a `location` property: the API resource sends its `lat` and `lng` to the endpoint, and maps and [geofences](https://docs.thinger.io/platform/geofences.md) use it to place the device, which has no network location of its own. Virtual devices have no device credentials. #### Console **Step 1: Open the form** Go to **Devices** and click **Add Device**. **Step 2: Fill in the form** Choose **Virtual Device** as **Device Type** and set the **Device Id** to `madrid_weather` and the **Device Name** to `Madrid weather`. Choose the product `Weather station` in **Product** and click **Add Device**. ![Add Device form with Virtual Device selected, the device ID madrid_weather and the Weather station product chosen](https://docs.thinger.io/screenshots/virtual-devices-add-form.webp) *Add a Virtual device of a product* **Step 3: Set the location** Open the device, go to **Properties** and add a property with the ID `location` and the value `{"lat": 40.4168, "lng": -3.7038}`. #### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"device": "madrid_weather", "type": "Virtual", "name": "Madrid weather", "product": "weather_station"}' ``` Leave `product` out to assign the product later. Then set the location: **API call:** `POST /v3/users/{user}/devices/{device}/properties` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-createproperty)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/madrid_weather/properties" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"property": "location", "value": {"lat": 40.4168, "lng": -3.7038}}' ``` #### CLI ```bash thinger device create madrid_weather -t Virtual -n "Madrid weather" -p weather_station thinger device property set madrid_weather location '{"lat": 40.4168, "lng": -3.7038}' ``` #### AI **Prompt for an AI agent:** > Create a virtual device called madrid_weather in the product weather_station, and set its location to latitude 40.4168 and longitude -3.7038. The device shows as disconnected when it is created; it connects a moment later and stays connected while it is enabled. From then on, the bucket reads its weather every 15 minutes. Another station is one more device with its own `location`. ### Read the weather Read the device resource to check the chain end to end. Each read calls Open-Meteo. #### Console Open the device and go to **API**. Click the `weather` resource to run it and see its output. #### API **API call:** `GET /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessoutputresources)) ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/madrid_weather/resources/weather" \ -H "Authorization: Bearer YOUR_TOKEN" ``` #### CLI ```bash thinger device resource call madrid_weather weather ``` #### AI **Prompt for an AI agent:** > What is the weather right now at my device madrid_weather? The agent uses `thinger_resource_call` with the type `device_resource` and the action `call`. See [MCP tools](https://docs.thinger.io/ai/tools.md). The output is the result of `parseWeather`: ```json {"humidity": 72, "temperature": 11.6, "wind_speed": 16.3} ``` ### Build the dashboard The dashboard shows the latest reading of each value and the last 24 hours of the `weather` bucket, filtered by the device. #### Console **Step 1: Create the dashboard** Go to **Dashboards** and click **Add Dashboard**. Set the **Dashboard id** to `madrid_weather` and the **Dashboard name** to `Madrid weather`, and click **Add Dashboard**. **Step 2: Add the current values** Turn on the edit mode and click **Add Widget**. Choose the **Text/Value** type and the **From Data Bucket** source, select the `weather` bucket, the device `madrid_weather` in its **device** tag and the value `temperature`, and set the unit to `°C`. Add two more for `humidity` (`%`) and `wind_speed` (`km/h`). **Step 3: Add the charts** Add a **Time Series Chart** with the same source and value, and a **Relative** **Timeframe** of the latest 24 hours. Repeat it for the other values, place the widgets and save the dashboard. #### API This call creates the dashboard with the temperature chart. Add the other widgets in the editor, or add them to `widgets` with the same shape; see [Widgets](https://docs.thinger.io/platform/dashboards/widgets.md). **API call:** `POST /v1/users/{user}/dashboards` ([reference](https://docs.thinger.io/reference/rest-api/dashboards.md#dashboard-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/dashboards" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dashboard": "madrid_weather", "name": "Madrid weather", "tabs": [{ "name": "Weather", "icon": "fas fa-cloud-sun", "widgets": [{ "type": "chart", "layout": { "col": 0, "row": 0, "sizeX": 6, "sizeY": 8 }, "panel": { "title": "Temperature (24 hours)", "color": "#ffffff", "currentColor": "#ffffff", "showOffline": { "type": "none" } }, "properties": { "axis": true, "fill": true, "legend": false }, "sources": [{ "name": "Temperature", "color": "#e74c3c", "source": "bucket", "timespan": { "mode": "relative", "period": "latest", "value": 24, "magnitude": "hour" }, "bucket": { "id": "weather", "mapping": "temperature", "tags": { "device": ["madrid_weather"] } } }] }] }] }' ``` #### CLI Save the JSON body of the API tab as `madrid_weather.json` and create the dashboard from it: ```bash thinger dashboard create madrid_weather --from madrid_weather.json ``` #### AI **Prompt for an AI agent:** > Build a dashboard for my device madrid_weather with its current temperature, humidity and wind speed, and charts of the last 24 hours, reading the weather bucket. Agents build dashboards as [dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md) with `thinger_resource_call`, the type `dashboard` and the action `publish`, rather than widget layouts. See [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md). ### Result Every 15 minutes the `weather` bucket gets a new record with the temperature, humidity and wind speed of Madrid, tagged with the device: ![Data table of the weather bucket with one record of madrid_weather every 15 minutes, each with its humidity, temperature and wind speed](https://docs.thinger.io/screenshots/virtual-devices-bucket-data.webp) *Readings of madrid_weather in the weather bucket* The dashboard shows the current weather and how it changed over the last day: ![Madrid weather dashboard with the current temperature, humidity and wind speed, and charts of the three values over the last 24 hours](https://docs.thinger.io/screenshots/virtual-devices-dashboard.webp) *The Madrid weather dashboard* Read the stored readings of the device from the API, the CLI or an agent: #### API **API call:** `GET /v3/users/{user}/devices/{device}/buckets/{bucket}/data` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-readbucketdata)) ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/madrid_weather/buckets/weather/data?items=3" \ -H "Authorization: Bearer YOUR_TOKEN" ``` #### CLI ```bash thinger bucket read weather -d madrid_weather -n 3 ``` #### AI **Prompt for an AI agent:** > How did the temperature at madrid_weather change over the last 24 hours? Use the weather bucket. The agent uses `thinger_resource_list` with the type `bucket_data` and the `device` filter. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Limits - A virtual device does nothing on its own: without a product with API resources, it has no device resources, and they are computed only when something reads them. - The product script cannot make network requests or run on a timer. Call external services with an **Endpoint Call**, and read the resource at an interval with a bucket, a property or a flow of the product. - Every reading calls the external service. Keep the interval within what its terms allow: Open-Meteo updates its current values every 15 minutes, and its free API is for non-commercial use. - It has no **Terminal** or **Explorer**: those need a device that runs the [Linux client](https://docs.thinger.io/devices/linux.md). - Disable the device to disconnect it; enable it again to reconnect. - Virtual devices count as devices of your account: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Next steps - [API resources](https://docs.thinger.io/platform/products/api-resources.md): Add device resources to every device of a product, so dashboards, the API and agents can call HTTP, MQTT and virtual devices like IOTMP ones. - [Buckets](https://docs.thinger.io/platform/products/buckets.md): Store the data of every device of a product in Data Buckets defined once in the product profile, shared or one per device. - [Endpoints](https://docs.thinger.io/platform/endpoints.md): Configure outgoing integrations, such as emails, HTTP requests and Telegram messages, that devices, alarms, product flows and the API can call. - [Dashboards](https://docs.thinger.io/platform/dashboards.md): Build dashboards with widgets that show and control your device data, organize them in tabs and share them with a link. - [HTTP](https://docs.thinger.io/devices/http.md): Send data to Thinger.io from any device, script or cloud service with HTTP requests, store and process it with a product, and answer with configuration data. - [Subdevices](https://docs.thinger.io/devices/subdevices.md): Represent the sensors and machines behind an MQTT gateway as their own devices, with their own connection state, data and dashboards. --- Source: https://docs.thinger.io/devices/subdevices.md # Subdevices > Represent the sensors and machines behind an MQTT gateway as their own devices, with their own connection state, data and dashboards. A subdevice is a device that reaches the platform through another device, its gateway. The gateway publishes MQTT messages on behalf of the equipment behind it, and a [product](https://docs.thinger.io/platform/products.md) turns each message into data of the right subdevice. Each subdevice has its own connection state, properties, Data Buckets and dashboards, as if it were connected directly. ## When to use it - An MQTT gateway forwards the data of many sensors, PLCs or meters, and you want one device per sensor instead of one device for the whole gateway. - You need to know which equipment behind a gateway stopped reporting. Use an [MQTT device](https://docs.thinger.io/devices/mqtt.md) for the gateway itself, and a [virtual device](https://docs.thinger.io/devices/virtual-devices.md) for a device that is computed on the platform. ## How subdevices connect 1. The gateway connects as an MQTT device and publishes each reading on a topic that includes the ID of the equipment, such as `gateway/sensor_01/telemetry`. 2. A product, with the subdevices assigned to it, has a flow or API resource that listens to those topics and takes the device ID from the topic or the payload. 3. When a message arrives for a subdevice, it shows as connected and its data goes to the product's Data Buckets and properties. If messages stop, it shows as disconnected after its timeout. The product decides how to read the topics and payloads: see [Flows](https://docs.thinger.io/platform/products/flows.md) and [API resources](https://docs.thinger.io/platform/products/api-resources.md). ## Create a subdevice Create subdevices with the API, the CLI or an agent; the console's **Add Device** form does not offer this type. You can also let the product create them on their first message with [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md). ### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"device": "YOUR_DEVICE", "type": "Subdevice", "protocol": "MQTT", "parent": "my_gateway", "product": "YOUR_PRODUCT"}' ``` `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain. `YOUR_TOKEN` is an access token of your account. `parent` names the gateway device and `protocol` the protocol it uses; subdevices have no device credentials. ### CLI ```bash thinger device create YOUR_DEVICE -t Subdevice -p YOUR_PRODUCT -s parent=my_gateway -s protocol=MQTT ``` ### AI **Prompt for an AI agent:** > Create a subdevice called YOUR_DEVICE behind my gateway my_gateway, using MQTT, and assign it to the product YOUR_PRODUCT. ## List and remove subdevices Subdevices appear in **Devices** with the rest of your devices, and `thinger device list` shows their type as `Subdevice`. Delete one like any other device: ### Console Open the device, go to **Settings** and delete it. ### API **API call:** `DELETE /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-delete)) ```bash curl -X DELETE "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger device delete YOUR_DEVICE ``` ### AI **Prompt for an AI agent:** > Delete the subdevice YOUR_DEVICE from my Thinger.io account. ## Limits - Subdevices connect only through MQTT topics handled by a product. The device libraries and the Linux client do not create subdevices. - The gateway of a subdevice is not shown in the console or returned by the API: name subdevices so that their gateway is clear, or keep it in a property. - A subdevice has no **Terminal** or **Explorer**, and no device resources other than those of its product. - Subdevices count as devices of your account: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [MQTT](https://docs.thinger.io/devices/mqtt.md): Connect an MQTT client to the Thinger.io broker, publish and subscribe to topics, and store the messages in a Data Bucket. - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. - [Virtual devices](https://docs.thinger.io/devices/virtual-devices.md): Create devices without hardware whose device resources are computed on the platform, such as a weather station that reads a public weather API. --- Source: https://docs.thinger.io/devices/lorawan.md # LoRaWAN > Bring LoRaWAN sensors into Thinger.io through The Things Stack, ChirpStack or LORIOT, with devices created automatically and downlinks. **Plan:** Not available on free Cloud LoRaWAN is a radio network for battery-powered sensors that send small messages over long distances, encrypted from the sensor to the application. The sensors do not connect to Thinger.io directly: gateways pass their messages to a LoRaWAN network server, and a Thinger.io plugin receives them from it. This page explains how the pieces fit, which plugin to install and the message format they share. For a complete walkthrough, see [Connect a LoRaWAN network server](https://docs.thinger.io/guides/lorawan-network-server.md). ![A LoRaWAN sensor sends an uplink through a gateway to the network server, which forwards it with a webhook to the Thinger.io plugin. The plugin converts it to the common format and calls the uplink device resource of the product, which creates the device, stores the message in the uplink property and in a Data Bucket. A downlink goes back from the downlink device resource through the plugin and the network server to the sensor.](https://docs.thinger.io/diagrams/lorawan-uplink-downlink.svg) *Uplinks and downlinks between a LoRaWAN sensor and Thinger.io* ## Before you start - A Thinger.io private instance: plugins are not available on the free Cloud account. `YOUR_SERVER` is the hostname of your instance. - An application with devices on one of the supported network servers. ## How it works 1. The network server forwards each uplink to the plugin with an HTTP webhook. 2. The plugin converts it to one [common format](#message-format), the same for every network server, with the DevEUI, the port, the counter, the raw payload in hexadecimal and the decoded payload if the network server decodes it. Because of this format, a product and its decoder work with any network server: you can change network server without rewriting them. 3. The plugin delivers the message to the device whose ID is the **Device Id Prefix** of the application followed by the DevEUI, such as `my_device_0004A30B001C2D3E`. 4. A [product](https://docs.thinger.io/platform/products.md) with [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md) creates that device on its first uplink, keeps the last uplink in the `uplink` property, decodes the payload and stores it in a Data Bucket. Without a matching product, the plugin's **Inspector** shows the uplinks but no device receives them. 5. Downlinks go the other way: the `downlink` device resource of the product sends them through the plugin to the network server, once the device has sent at least one uplink. See [Send a downlink](#send-a-downlink). All the devices of one network server application should be the same model, because they share the product and its decoder. ## Choose the plugin | Network server | Plugin | Status | |---|---|---| | The Things Stack (The Things Network and The Things Industries) | [The Things Stack](https://docs.thinger.io/plugins/ttn.md) | Maintained | | ChirpStack | [ChirpStack](https://docs.thinger.io/plugins/chirpstack.md) | Maintained | | LORIOT | [LORIOT](https://docs.thinger.io/plugins/loriot.md) | Maintained | The three plugins deliver the same format, so choose the network server that fits your project: a community network such as The Things Network for tests and small deployments, a managed service with support for production (The Things Industries, LORIOT), or ChirpStack if you want to host the network server yourself. An older plugin for The Things Stack, `ttn-stack`, is [deprecated](https://docs.thinger.io/plugins/ttn-stack.md): it created devices and buckets by itself, without products. Use [The Things Stack](https://docs.thinger.io/plugins/ttn.md) for new projects. ## Steps **Step 1: Install the plugin** Go to **Plugins > Marketplace**: the plugins of the network servers are in the **Connectivity** category. Open the plugin of your network server and click **Install**. Its page in the plugin catalog lists its settings and versions. ![Plugin Marketplace with the Connectivity category selected: ChirpStack, EasyM2M, HTTP Device, LORIOT, Sigfox, ThingPark LNS, The Things Stack and the deprecated The Things Stack plugin](https://docs.thinger.io/screenshots/lorawan-marketplace-connectivity.webp) *The network server plugins in the Connectivity category* ![Page of The Things Stack plugin in the catalog, with its latest version, the Install button and its Readme](https://docs.thinger.io/screenshots/lorawan-plugin-ttn.webp) *The page of a plugin, before installing it* **Step 2: Add the application** Open the plugin, go to **Applications** and click **Add**. Enter the **Application Name** as the network server names it and a **Device Id Prefix**, such as `my_device_`. ChirpStack and LORIOT also ask for an access token of the network server, which the plugin needs to send downlinks. **Step 3: Create the product** Install a device plugin for your sensor model from **Plugins > Marketplace**, if there is one, or the [LoRaWAN Device Template](https://docs.thinger.io/plugins/lorawan-product-template.md). Both create a product with the uplink and downlink device resources, a Data Bucket and an Auto Provision pattern. Set the pattern to your **Device Id Prefix** followed by the DevEUI, for example `my_device_[0-9A-F]{16}`, and add your payload decoder if the network server does not decode it. **Step 4: Create the webhook** In the plugin, go to **Settings** and copy the uplink URL and the authorization token. In the network server, create the integration: the **Thinger.io** webhook template in The Things Stack, the **HTTP** integration in ChirpStack, or an **HTTP Push** output in LORIOT. The page of each plugin details the fields. ## Result When a sensor sends its next uplink, the device appears in **Devices**, assigned to the product, and its decoded data is stored in the product's Data Bucket. The plugin's **Inspector** shows each message as it arrives. ## Message format Every plugin converts the uplinks of its network server to this format before it calls the `uplink` device resource. The `uplink` property, the Data Bucket and your decoder in the product receive exactly this object: ```json { "deviceEui": "70B3D57ED0051A2B", "deviceId": "my_device_70B3D57ED0051A2B", "source": "ttn", "appId": "my-sensors", "fPort": 1, "fCnt": 42, "payload": "0109c41c", "decodedPayload": { "temperature": 25, "humidity": 28 }, "metadata": { "ack": null, "battery": 87, "offline": null, "seqNo": null } } ``` | Field | Type | Content | |---|---|---| | `deviceEui` | string | DevEUI of the sensor, in hexadecimal. ChirpStack DevEUIs are converted to uppercase. | | `deviceId` | string | Thinger.io device ID: the **Device Id Prefix** of the application followed by the DevEUI. Auto Provision uses it. | | `source` | string | Plugin that received the uplink: `ttn`, `chirpstack` or `loriot`. The `downlink` device resource uses it to choose the plugin. | | `appId` | string | Application of the network server, as configured in the plugin. | | `fPort` | integer or `null` | LoRaWAN port of the uplink. | | `fCnt` | integer or `null` | Uplink frame counter. | | `payload` | string or `null` | Raw payload in hexadecimal. The Things Stack and ChirpStack send it in lowercase, LORIOT in uppercase. | | `decodedPayload` | object or `null` | Payload decoded by the network server, if it decodes it. `null` otherwise: decode `payload` in the product. | | `metadata` | object | `ack`, `battery`, `offline` and `seqNo`, each `null` when the network server does not send it. The Things Stack fills `battery` with the last battery level it knows, in percent. | ## Send a downlink The `downlink` device resource of the product sends bytes to the sensor. It takes this input and adds the last uplink of the device from the `uplink` property, which tells the plugin the network server, the application and the DevEUI. That is why a device can only receive downlinks after its first uplink. ```json { "data": "FF0164", "port": 85, "priority": 3, "confirmed": false, "uplink": { "deviceEui": "70B3D57ED0051A2B", "source": "ttn", "appId": "my-sensors" } } ``` | Field | Type | Content | Default in the template | |---|---|---|---| | `data` | string | Bytes to send, in hexadecimal. Required. | none | | `port` | integer | LoRaWAN port of the downlink. | `85` | | `priority` | integer | From `0` (lowest) to `6` (highest). The Things Stack maps `0`–`1` to low, `2`–`4` to normal and `5`–`6` to high priority; ChirpStack and LORIOT ignore it. | `3` | | `confirmed` | boolean | Ask the sensor to confirm that it received the downlink. | `false` | | `uplink` | object | Last uplink of the device, filled in from the `uplink` property. Do not send it yourself. | the `uplink` property | The network server queues the downlink and delivers it after the next uplink of the sensor, as LoRaWAN class A sensors only listen right after they send. ### Console Open the device in **Devices** and go to **API**. Expand `downlink`, enter the `data` in hexadecimal and, if needed, the `port`, and click **Run**. ### API `YOUR_TOKEN` is an access token of your account. **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessinputresources)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/downlink" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"data": "FF0164", "port": 85}' ``` ### CLI ```bash thinger device resource call YOUR_DEVICE downlink -s 'data="FF0164"' -s port=85 ``` Keep the quotes around the `data` value: the CLI parses each value as JSON, and a hexadecimal string made only of digits would become a number. ### AI **Prompt for an AI agent:** > Send the downlink FF0164 on port 85 to my LoRaWAN device YOUR_DEVICE. The agent uses `thinger_resource_call` with the type `device_resource` and the action `call`. See [MCP tools](https://docs.thinger.io/ai/tools.md). The plugin's **Inspector** shows whether the network server accepted the downlink. ## Next steps - [Connect a LoRaWAN network server](https://docs.thinger.io/guides/lorawan-network-server.md): Bring the uplinks of a ChirpStack or The Things Stack application into Thinger.io, with devices and a Data Bucket created on the first message. - [The Things Stack](https://docs.thinger.io/plugins/ttn.md): The Things Stack Integration - [LoRaWAN Device Template](https://docs.thinger.io/plugins/lorawan-product-template.md): Product template for LoRaWAN-driven devices. Preconfigured to work with any LNS Thinger plugin. --- Source: https://docs.thinger.io/devices/sigfox.md # Sigfox > Receive Sigfox messages in Thinger.io with the Sigfox plugin or as HTTP devices, decode their payload and answer with downlinks. Sigfox is a low-power wide-area network for sensors that send a few bytes a few times an hour. Sigfox devices send their messages to the Sigfox backend, which forwards them to Thinger.io with a callback. You can receive those callbacks with the [Sigfox plugin](https://docs.thinger.io/plugins/sigfox.md), which creates a device and a Data Bucket for each new Sigfox device, or with one [HTTP device](https://docs.thinger.io/devices/http.md) per Sigfox device, which works on any account. ![A Sigfox device sends a message through a base station to the Sigfox backend, which posts it with a custom callback either to the Sigfox plugin, which creates an HTTP device and its Data Bucket, or directly to the callback of an HTTP device. The HTTP device writes the Data Bucket, calls endpoints and sets properties. For BIDIR callbacks, the Response Data property goes back as the answer, with 8 bytes of downlink data for the device.](https://docs.thinger.io/diagrams/sigfox-to-thinger.svg) *Two ways to receive Sigfox messages* ## Message limits Sigfox limits the size and the number of messages, so design the payload in bytes before you write the firmware: | Direction | Payload | Messages per day | |---|---|---| | Uplink, device to network | Up to 12 bytes | Up to 140 | | Downlink, network to device | Exactly 8 bytes | Up to 4 | The device uses the 868 MHz band in Europe and the 902 MHz band in the United States. A downlink is only sent when the device asks for one with an uplink, through a **BIDIR** callback. ## Choose how to integrate | | Sigfox plugin | HTTP device | |---|---|---| | Account | A private instance: plugins are not available on the free Cloud account. | Any account, including the free Cloud account. | | Devices | Creates an HTTP device and a Data Bucket for each new Sigfox device of a device type. | You create one HTTP device for each Sigfox device. | | Payload | Decoded by the Sigfox backend with **Custom payload config**, or by your `uplink` code in the plugin. | Decoded by the Sigfox backend with **Custom payload config**. Payload code runs only in the plugin. | | Downlinks | The `downlink` property of each device, encoded by your `downlink` code. | The **Response Data** property, already in the format Sigfox expects. | ## Before you start - Access to the [Sigfox backend](https://backend.sigfox.com), with a device type that groups your devices. - Your devices registered in the Sigfox backend with their ID and PAC. [Program a Sigfox board](#program-a-sigfox-board) shows how to read them from an Arduino MKR FOX 1200. - Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. ## Connect with the plugin **Step 1: Install the plugin** Go to **Plugins > Marketplace** and install **Sigfox**. Open it from the **Plugins** menu. **Step 2: Add the device type** In **Device Types**, add a device type with the same name as the device type in the Sigfox backend, or use **Default** for all your devices. **Step 3: Configure the callback behavior** In **Callback Config**, enable **Auto provision resources** and set: | Field | What it does | |---|---| | **Device Identifier Prefix** | Prefix of the device ID; the Sigfox device ID is added after it, such as `sigfox_1A2B3C`. | | **Bucket Identifier Prefix** | Prefix of the Data Bucket created for each device. | | **Device Connection Timeout** | Minutes without messages before the device shows as disconnected. | | **Assign Asset Type**, **Assign Asset Group**, **Assign Endpoint**, **Assign Project** | Optional. Classify the new devices and call an endpoint on each message. | | **Initialize Downlink Data** | JSON that starts the `downlink` property of each device. Set it if you use downlinks. | To decode the raw Sigfox payload into fields, enable **Callback Processing** and write the `uplink` function (and `downlink`, for downlinks) in **Callback Code**. Test it with **Test Callback Code**, then click **Save**. **Step 4: Create the callback in the Sigfox backend** Open **Sigfox Integration** in the plugin and copy the **URL Pattern** and the **Authorization Header**. In the Sigfox backend, create a custom callback for the device type with: - Type **DATA** and **UPLINK**, or **BIDIR** to answer with downlinks. - Channel **URL**, the copied URL pattern and method **POST**. - **Send duplicate** off, so that a message received by several base stations is stored once. - A **Custom payload config** if the backend decodes the payload (see [Decode the payload](#decode-the-payload)). - Header `Authorization` with the copied value, and content type `application/json`. - A JSON body with the fields you need, based on the **Sample Body** of the plugin, such as `{"temperature": {customData#temp}, "humidity": {customData#hum}, "data": "{data}"}`. On the next message of each Sigfox device, the plugin creates an HTTP device and its Data Bucket, and stores the message. ## Connect without the plugin Each Sigfox device is an HTTP device, and the Sigfox callback posts to its callback URL. The HTTP device stores the message in a Data Bucket, calls endpoints or sets properties like any other [HTTP device](https://docs.thinger.io/devices/http.md), so you can build dashboards and alerts on it. > **Warning: Deprecated** > > These steps use the [HTTP callback](https://docs.thinger.io/devices/http.md#http-callback-deprecated) of the device, which is deprecated. It keeps working, but for a new integration point the Sigfox callback to an API resource of a [product](https://docs.thinger.io/devices/http.md) instead: the same body works, the product can create each device on its first message with Auto Provision, and its response carries the downlink. Send the time as a `ts` field of the body (`"ts": {time}000`) instead of the `ts` query parameter. **Step 1: Create the Data Bucket** Go to **Data Buckets** and create a Data Bucket, such as `sigfox_data`, with **From Device Write Call** as **Data Source**. The callback only writes to Data Buckets that already exist. **Step 2: Create the HTTP device** Go to **Devices**, click **Add Device** and choose **HTTP Device (Sigfox, Lora, cURL)** as **Device Type**, with a **Device Id** that includes the Sigfox ID, such as `sigfox_1A2B3C`. Here `YOUR_DEVICE` is that ID. **Step 3: Configure the device callback** Open the device, go to **Callback** and set **Write Bucket** to `sigfox_data`, a **Timeout** longer than the time between messages, such as `30` minutes for a message every 10 minutes, and **Response Data** to `downlink` if you use [downlinks](#downlinks). Enable **Authorization** and copy the token from **Overview**: it is `YOUR_TOKEN` below. From the API, set the same with [`PUT /v3/users/{user}/devices/{device}/callback`](https://docs.thinger.io/reference/rest-api/devices.md#device-updatecallback): ```json { "actions": { "write_bucket": "sigfox_data", "send_property": "downlink" }, "properties": { "timeout": 30 } } ``` **Step 4: Create the custom callback in the Sigfox backend** In the Sigfox backend, go to **Device Type**, open your device type, click **Callbacks** and create a new **Custom callback**. ![Sigfox backend, Device Type section, Callbacks page of a device type with the Custom callback option](https://docs.thinger.io/images/devices/sigfox/sigfox-backend-custom-callback.webp) *Create a custom callback for the device type* Fill in the form: | Field | Value | |---|---| | **Type** | **DATA** and **UPLINK**. Use **BIDIR** to answer with downlinks. | | **Channel** | **URL** | | **Send duplicate** | Off. Otherwise a message received by several base stations is stored several times. | | **Custom payload config** | How to split the payload into fields, such as `temp::float:32:little-endian hum::float:32:little-endian`. See [Decode the payload](#decode-the-payload). | | **Url pattern** | `https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/callback/data?ts={time}000` | | **Use HTTP Method** | **POST** | | **Headers** | `Authorization` with the value `Bearer YOUR_TOKEN`, with a space after `Bearer`. | | **Content type** | `application/json` | | **Body** | The JSON to store, with Sigfox variables. See the example below. | ![Custom callback form of the Sigfox backend with type DATA UPLINK, channel URL, Send duplicate unchecked and the custom payload config temp::float:32:little-endian hum::float:32:little-endian, followed by the list of available and custom variables](https://docs.thinger.io/images/devices/sigfox/sigfox-callback-payload-config.webp) *Type, channel, Send duplicate and Custom payload config* `{time}` is the time of the message in seconds; `ts={time}000` turns it into the milliseconds the callback expects, so each record keeps the time the device sent it, not the time it arrived. A body that stores the decoded fields with the signal quality and the coarse location of the message: ```json { "device": "{device}", "temperature": {customData#temp}, "humidity": {customData#hum}, "data": "{data}", "seqNumber": {seqNumber}, "snr": {snr}, "rssi": {rssi}, "station": "{station}", "latitude": {lat}, "longitude": {lng} } ``` The Sigfox backend replaces each variable before it posts the body: `{device}` is the Sigfox ID, `{data}` the raw payload in hexadecimal, `{seqNumber}` the message counter, `{snr}`, `{rssi}` and `{station}` the signal and the base station, and `{lat}` and `{lng}` a location with an accuracy of kilometers. `{customData#temp}` and `{customData#hum}` exist only if the **Custom payload config** defines `temp` and `hum`. As the body has `latitude` and `longitude`, each message also updates the device location. A device type usually has several devices. To serve them all with one callback, create an HTTP device for each one, named after its Sigfox ID, and use `{device}` in the URL: `https://YOUR_SERVER/v3/users/YOUR_USER/devices/sigfox_{device}/callback/data?ts={time}000`. The token must then be an [access token](https://docs.thinger.io/platform/access-tokens.md) with the `CallDeviceCallback` action on those devices, because the token from **Overview** only works for its own device. > **Tip: Write straight to a Data Bucket** > > If you only need the data, the callback can post to the Data Bucket instead of a device: `https://YOUR_SERVER/v1/users/YOUR_USER/buckets/sigfox_data/data?ts={time}000`, with an access token that only has the `WriteBucket` action on that Data Bucket (see [`POST /v1/users/{user}/buckets/{bucket}/data`](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-writedata)). Use `{device}` in the bucket ID for one Data Bucket per device. There is no device then: no connection state, no endpoints and no downlinks. ## Decode the payload The **Custom payload config** of the Sigfox callback splits the bytes of each message into named fields, which the body uses as `{customData#name}`. Fields are read in order from the first byte, separated by spaces, with the syntax `name::type:bits:endianness`: | Type | Example | Reads | |---|---|---| | `uint` | `hum::uint:8` | An unsigned integer of the given number of bits. | | `int` | `temp::int:16:little-endian` | A signed integer of the given number of bits. | | `float` | `temp::float:32:little-endian` | A 32-bit or 64-bit floating-point number. | The default byte order is big-endian. Microcontrollers such as the SAMD21 of the Arduino MKR boards and the ESP32 store numbers in little-endian, so add `little-endian` to every field of more than one byte that the firmware copies from memory. The payload config must match the bytes the firmware sends, field by field. Send a C struct and mark it `packed`, so that the compiler adds no padding bytes between fields: | Custom payload config | Struct in the firmware | Bytes | |---|---|---| | `temp::float:32:little-endian hum::float:32:little-endian` | `struct __attribute__((packed)) { float temp; float hum; }` | 8 | | `temp::int:16:little-endian hum::uint:8` | `struct __attribute__((packed)) { int16_t temp; uint8_t hum; }` | 3 | Integers leave room for more fields within the 12 bytes. To keep decimals, send scaled values, such as the temperature in tenths of a degree (`215` for 21.5 °C), and convert them in the plugin `uplink` code or in a [product](https://docs.thinger.io/platform/products.md). ## Program a Sigfox board Any Sigfox module works with Thinger.io, as long as its payload matches the callback. This example uses the [Arduino MKR FOX 1200](https://docs.arduino.cc/hardware/mkr-fox-1200/), a SAMD21 board with an ATA8520 Sigfox module that runs on two AA or AAA batteries. ![Arduino MKR FOX 1200 board, with its headers, the antenna connector and the battery terminal](https://docs.thinger.io/images/devices/sigfox/arduino-mkrfox1200.webp) *Arduino MKR FOX 1200* Prepare the Arduino IDE: 1. In **Boards Manager**, install **Arduino SAMD Boards**. 2. In **Library Manager**, install **Arduino SigFox for MKRFox1200**, **Arduino Low Power** and **RTCZero**, and **SimpleDHT** for the sensor of the second sketch. 3. Select the board **Arduino MKR FOX 1200** and its port. ### Read the ID and PAC Upload this sketch and open the serial monitor at 9600 baud. Register the board in the Sigfox backend at [backend.sigfox.com/activate](https://backend.sigfox.com/activate) with the ID and the PAC it prints, or follow Arduino's [first configuration](https://docs.arduino.cc/tutorials/mkr-fox-1200/sigfox-first-configuration/) tutorial. **sigfox_id.ino** ```cpp #include void setup() { Serial.begin(9600); while (!Serial) {} if (!SigFox.begin()) { Serial.println("Sigfox module not found"); return; } Serial.println("Firmware version: " + SigFox.SigVersion()); Serial.println("ID: " + SigFox.ID()); Serial.println("PAC: " + SigFox.PAC()); Serial.print("Module temperature: "); Serial.println(SigFox.internalTemperature()); SigFox.end(); // put the module to sleep } void loop() { } ``` ### Send temperature and humidity This sketch reads a DHT11 sensor on pin 0 and sends the temperature and the humidity every 11 minutes, within the 140 messages a day, as two floats that match `temp::float:32:little-endian hum::float:32:little-endian`. The built-in LED blinks once when the message is sent and three times when it fails. Without a DHT11, send `SigFox.internalTemperature()` as the temperature. **sigfox_dht11.ino** ```cpp #include #include #include #define DHT11_PIN 0 #define SEND_INTERVAL (11UL * 60UL * 1000UL) // 11 minutes: 131 messages a day SimpleDHT11 dht11(DHT11_PIN); // must match the Custom payload config of the callback struct __attribute__((packed)) Reading { float temp; float hum; }; void blink(int times, unsigned long ms) { for (int i = 0; i < times; i++) { digitalWrite(LED_BUILTIN, HIGH); delay(ms); digitalWrite(LED_BUILTIN, LOW); delay(ms); } } void sendReading() { float temp = 0, hum = 0; if (dht11.read2(&temp, &hum, NULL) != SimpleDHTErrSuccess) { Serial.println("DHT11 read failed"); return; } Reading reading = {temp, hum}; SigFox.begin(); delay(100); SigFox.status(); // clear pending interrupts delay(1); SigFox.beginPacket(); SigFox.write((const uint8_t*)&reading, sizeof(reading)); // 8 bytes int error = SigFox.endPacket(); SigFox.end(); if (error) { Serial.println("Transmission failed"); blink(3, 500); } else { Serial.println("Transmission ok"); blink(1, 1000); } } void setup() { Serial.begin(9600); pinMode(LED_BUILTIN, OUTPUT); } void loop() { sendReading(); delay(SEND_INTERVAL); // on batteries, sleep instead of waiting: // LowPower.sleep(SEND_INTERVAL); } ``` > **Warning: Sleep mode and uploads** > > On batteries, replace `delay()` with `LowPower.sleep()` and remove the serial output. While the board sleeps, the IDE cannot upload a new sketch: press the reset button twice to enter the bootloader, then upload. ## Result In the Sigfox backend, open the device and go to **Messages**. Each message shows its payload in hexadecimal, the link quality and an icon with the result of the callback. ![Messages of a device in the Sigfox backend, with the time, the payload in hexadecimal, the location, the link quality and a callback icon for each message](https://docs.thinger.io/images/devices/sigfox/sigfox-backend-messages.webp) *Messages of a device in the Sigfox backend* Click the callback icon to see the answer of Thinger.io: `200 - OK` when the message was accepted. ![Callback result dialog of the Sigfox backend showing OK from a base station and the answer 200 - OK](https://docs.thinger.io/images/devices/sigfox/sigfox-callback-ok.webp) *A successful callback* In Thinger.io, the device shows as connected in **Devices**, and its Data Bucket stores one record per message with the fields of the callback body. Plot them in a [dashboard](https://docs.thinger.io/platform/dashboards.md) with the Data Bucket as the source. ![Data table of the sigfox_data bucket with one record every 10 minutes: device, humidity, rssi, seqNumber, snr, station and temperature](https://docs.thinger.io/screenshots/sigfox-bucket-records.webp) *Records of a Sigfox device* ## Downlinks With a **BIDIR** callback, Thinger.io answers each message with downlink data, and the Sigfox network delivers its 8 bytes to the device. - **With the plugin**: the plugin answers with the `downlink` property of the device, converted by your `downlink` function. - **Without the plugin**: the HTTP device answers with its **Response Data** property, so the property must hold the answer that Sigfox expects: the Sigfox ID of the device as key, and `downlinkData` with 16 hexadecimal characters. Without the plugin, set the property like this, where `YOUR_TOKEN` is an access token of your account and `1A2B3C` the Sigfox ID: **API call:** `PUT /v3/users/{user}/devices/{device}/properties/{property}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-updateproperty)) ```bash curl -X PUT "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/downlink" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"value": {"1A2B3C": {"downlinkData": "0102030405060708"}}}' ``` Change the property from the console, a dashboard or the API, and the device receives the new value the next time it asks for a downlink. On the MKR FOX 1200, ask for it with `SigFox.endPacket(true)` and read the 8 bytes with `SigFox.parsePacket()` and `SigFox.read()`. The device can only receive 4 downlinks a day. ## Next steps - [Sigfox](https://docs.thinger.io/plugins/sigfox.md): Sigfox Integration - [HTTP](https://docs.thinger.io/devices/http.md): Send data to Thinger.io from any device, script or cloud service with HTTP requests, store and process it with a product, and answer with configuration data. - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. --- Source: https://docs.thinger.io/devices/remote-tools.md # Remote tools > Open a shell, browse files and read the log of a connected device from the Thinger.io console, without VPNs or open ports. The remote tools reach a device through its own Thinger.io connection, so they work behind NAT and firewalls without opening any port on the device. **Terminal** opens a shell or a serial-like console, and **Explorer** lets you manage its files. ## When to use it - To diagnose a Linux gateway in the field without SSH access. - To read the log of an Arduino device or send it text commands. - To copy configuration files or logs to and from a device. ## Which devices support them | Tool | What it does | Device side | |---|---|---| | **Terminal** | Interactive shell on a Linux device, or a serial-like console on a microcontroller. | The [Linux client](https://docs.thinger.io/devices/linux.md) (shell), or the `ThingerConsole` class of the Arduino library on ESP32 and ESP8266 (see [Console on Arduino devices](#console-on-arduino-devices)). | | **Explorer** | Lists, uploads, downloads, renames and deletes files, with a terminal next to them. | The [Linux client](https://docs.thinger.io/devices/linux.md), inside the folder set with `--fs-path`. | Both need an IOTMP device that is connected. MQTT, HTTP, virtual devices and subdevices do not offer them. The device opens the connection to the server, and the server relays the Terminal and Explorer traffic over it. Nothing connects to the device from outside: ![The browser opens Terminal or Explorer in the Thinger.io console; the server relays them over the IOTMP connection that each device opened from behind its NAT or firewall: a shell and the files in --fs-path on a Linux device, and ThingerConsole with its commands on an Arduino device.](https://docs.thinger.io/diagrams/remote-tools-connection.svg) *How the remote tools reach a device* ## Open a terminal ### Console Open the device in **Devices** and choose **Terminal** in its menu. On a Linux device you get a shell with the permissions of the user that runs the client; on an Arduino device you see what the sketch writes to `ThingerConsole` and can type commands to it. ![Terminal of a Linux device, connected, with the prompt pi@raspberrypi:~$ and the output of ls -l: README.txt and the folders config, data, logs and scripts](https://docs.thinger.io/screenshots/remote-tools-terminal.webp) *A shell on a Linux device, run as the user pi* ### API The terminal is interactive and needs the console. To run a single command on a Linux device from the API, call its `cmd` device resource: **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessinputresources)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/cmd" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"cmd": "df -h /"}' ``` `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain. `YOUR_TOKEN` is an access token of your account. ### CLI The CLI has no interactive terminal. Run a single command on a Linux device through its `cmd` device resource: ```bash thinger device resource call YOUR_DEVICE cmd -s 'cmd=df -h /' ``` ### AI **Prompt for an AI agent:** > Run df -h / on my Linux device YOUR_DEVICE and tell me how much disk space is left. ## Browse files ### Console Open the device and choose **Explorer** in its menu. Navigate the folders, and upload, download, rename or delete files. ![Explorer of a Linux device with the folders config, data, logs and scripts and the file README.txt, the config folder open and gateway.yaml open in the editor](https://docs.thinger.io/screenshots/remote-tools-explorer.webp) *The --fs-path folder of a Linux device in Explorer, with a file open* ### API List a folder of the device: **API call:** `GET /v3/users/{user}/devices/{device}/files{file}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-readfilesfiles-file)) ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/files/" \ -H "Authorization: Bearer YOUR_TOKEN" ``` The answer lists each entry with `name`, `type`, `size`, `mode` and `modified`. The same path with `PUT`, `PATCH` and `DELETE` uploads, renames and deletes files: see the [REST API reference](https://docs.thinger.io/reference/rest-api/devices.md#device-updatefilesfiles-file). ### CLI The CLI has no commands for device files. Send the request of the API tab with `thinger api`: ```bash thinger api '/v3/users/{user}/devices/YOUR_DEVICE/files/' ``` The MCP tools do not browse device files. ## Console on Arduino devices With the `ThingerConsole` class of the [Arduino library](https://docs.thinger.io/devices/arduino.md), the **Terminal** of a device works like the serial monitor of the Arduino IDE, over the Internet: the sketch writes logs to it and reads what you type. Create the console after the `thing` object: **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerConsole console(thing); unsigned long last_log = 0; void setup() { Serial.begin(115200); thing.add_wifi("wifi-network", "wifi-password"); } void loop() { thing.handle(); // write a line every second unsigned long now = millis(); if (now - last_log >= 1000) { last_log = now; console.printf("uptime: %lu ms\r\n", now); } } ``` `YOUR_TOKEN` is the device credentials. Open the device and choose **Terminal** to see the lines. ![Terminal of the esp32_terminal device, connected, with an uptime line every second](https://docs.thinger.io/screenshots/remote-tools-arduino-log.webp) *The sketch writing to the Terminal* > **Info: Boards** > > `ThingerConsole` is meant for ESP32 and ESP8266 boards. It is not available on AVR boards, such as the UNO and the Mega. On other boards the sketch compiles, but `printf` is not available and the console's own messages (prompt, `help`, errors) do not reach the Terminal. ### Write to the console `console` has the same functions as `Serial`: `print`, `println`, `printf` and `write`. Text is sent at the end of each line, or every 128 bytes; call `console.flush()` to send text that does not end in a new line, such as a question. End lines with `\r\n` in `printf`. The device sends nothing while no Terminal is open: whatever the sketch writes is discarded. Check `if (console)` to skip work that only feeds the log, such as reading a sensor: **main.cpp** ```cpp void loop() { thing.handle(); // only when a Terminal is open if (console) { unsigned long now = millis(); if (now - last_log >= 1000) { last_log = now; console.printf("uptime: %lu ms\r\n", now); } } } ``` ### Read from the console What you type appears in the Terminal and reaches the sketch when you press **Enter**. The line ends with a carriage return (`'\r'`). Read it as you would read `Serial`: **main.cpp** ```cpp void loop() { thing.handle(); if (console.available()) { String input = console.readStringUntil('\r'); console.print("> I received: "); console.println(input); } } ``` ![Terminal of the esp32_terminal device with two typed lines, each followed by the device's answer starting with > I received:](https://docs.thinger.io/screenshots/remote-tools-arduino-read.webp) *Lines typed in the Terminal, echoed by the sketch* A line holds up to 128 characters, and **Backspace** deletes the last one. ## Add commands to the console Register commands to turn the **Terminal** into an interactive shell: it shows a prompt, runs the command you type and lists them all with `help`. Register each command in `setup()` with a name, the function to run and an optional description that `help` shows: **main.cpp** ```cpp void setup() { // ... console.command("millis", [](int argc, char* argv[]) { console.println(millis()); }, "show the time since the board started"); } ``` ![Terminal of the esp32_terminal device with the esp32_terminal$ prompt, the millis command and its output](https://docs.thinger.io/screenshots/remote-tools-arduino-command.webp) *A command typed at the prompt* The function receives the arguments as in the `main` function of a C program: `argc` is how many there are and `argv` holds them, with the command name in `argv[0]`. It can be a lambda, as above, or any function `void name(int argc, char* argv[])`. A name that is not registered answers `command not found`. Once a command is registered, the line you type goes to the command interpreter, not to `console.available()`. While a command runs, what you type goes to the command. ### Arguments Arguments are separated by spaces. Quotes keep spaces inside one argument (`print "hello world"`), and a backslash (`\`) takes the next character as is. A line that ends in `\`, or with a quote still open, continues on the next one, after a `> ` prompt. A command receives up to 10 arguments, its name included. This command turns a pin on or off, and uses `console.error()` to print a message in red: **main.cpp** ```cpp void setup() { // ... console.command("gpio", [](int argc, char* argv[]) { if (argc < 3) { console.error("usage: gpio "); return; } int pin = atoi(argv[1]); pinMode(pin, OUTPUT); digitalWrite(pin, strcmp(argv[2], "on") == 0 ? HIGH : LOW); console.printf("pin %d turned %s\r\n", pin, argv[2]); }, " turn a pin on or off"); } ``` ![Terminal with gpio 2 on answered by pin 2 turned on, and gpio without arguments answered by the usage message in red](https://docs.thinger.io/screenshots/remote-tools-arduino-gpio.webp) *A command with arguments, and its error in red* ### Long-running commands A command can run until you stop it, for example to follow a log. Loop while `console.command_running()` is `true`: it turns `false` when you press **Ctrl+C** or close the Terminal. The loop does not need to call `thing.handle()`, because `command_running()` keeps the connection alive: **main.cpp** ```cpp void setup() { // ... console.command("log", [](int argc, char* argv[]) { while (console.command_running()) { console.printf("running at %lu ms\r\n", millis()); delay(1000); } }, "print a line every second until Ctrl+C"); } ``` ![Terminal running the log command, with a line every second until ^C stops it and the prompt returns](https://docs.thinger.io/screenshots/remote-tools-arduino-log-command.webp) *A long-running command stopped with Ctrl+C* **Ctrl+C** with no command running clears the line you are typing. ### Ask for input A command can ask a question and wait for the answer. Send the question with `flush()`, since it does not end in a new line, and wait for `console.available()`, which also keeps the connection alive: **main.cpp** ```cpp void setup() { // ... console.command("hello", [](int argc, char* argv[]) { console.print("Please enter your name: "); console.flush(); while (console.command_running() && !console.available()); if (!console.command_running()) return; String name = console.readStringUntil('\r'); console.printf("Hello %s\r\n", name.c_str()); }, "ask for your name"); } ``` ![Terminal running hello: it asks Please enter your name, receives Ada and answers Hello Ada](https://docs.thinger.io/screenshots/remote-tools-arduino-hello.webp) *A command that asks for input* ### Prompt The prompt is the device ID followed by `$`. Change it in `setup()` with a text that lasts for the whole program, such as a literal: **main.cpp** ```cpp void setup() { // ... console.set_prompt("Arduino"); } ``` ![Terminal with the Arduino$ prompt and the millis command](https://docs.thinger.io/screenshots/remote-tools-arduino-prompt.webp) *A custom prompt* ### Built-in commands Once you register a command, these come with it: | Command | What it does | |---|---| | `help` | Lists the commands with their descriptions. | | `clear` | Clears the Terminal. | | `reboot` | Prints `device will reboot now...` and restarts the device. | | `exit` | Listed by `help` as "close terminal", but it does nothing: close the Terminal from the console. | ![Terminal with the output of help: the built-in commands clear, reboot, exit and help, and the commands of the sketch with their descriptions](https://docs.thinger.io/screenshots/remote-tools-arduino-help.webp) *The output of help* ### ThingerConsole functions `ThingerConsole` is an Arduino `Stream`, so it also has `read()`, `peek()`, `readString()`, `parseInt()`, `setTimeout()` and the rest of the `Stream` functions. | Function | Description | |---|---| | `ThingerConsole(ThingerClient& client)` | Creates the console on the `thing` object. | | `operator bool()` | `true` while a Terminal is open on the device. | | `size_t write(uint8_t value)` | Writes one byte. `print`, `println` and `printf` write through it. | | `void flush()` | Sends the pending text without waiting for the end of the line. | | `int available()` | Bytes of the lines received and not read yet. | | `int read()` | Reads one byte, or `-1` if there is none. | | `int peek()` | Returns the next byte without reading it, or `-1`. | | `void command(const char* cmd, std::function callback, const char* desc = "")` | Registers a command, with an optional description for `help`. | | `bool command_running()` | `true` while a command runs and has not been cancelled with **Ctrl+C** or by closing the Terminal. | | `bool is_running()` | `true` while a Terminal is open. | | `void error(const char* message)` | Prints a message in red, followed by a new line. | | `void set_prompt(const char* prompt)` | Replaces the prompt; the text must last for the whole program. | ## Permissions The remote tools act with the permissions of whoever opens them. Anyone with access to the device resources of a device can open its **Terminal** and **Explorer**, so give access tokens, project members and agents only the devices they need: see [Access Tokens](https://docs.thinger.io/platform/access-tokens.md). ## Limits - The device must be connected. Otherwise the console reports that it is not connected. - On Linux, the shell and the files have the permissions of the user that runs the client. - **Explorer** cannot reach files outside the folder the client shares. - On Arduino devices, the console handles lines of up to 128 characters and commands of up to 10 arguments. Arrow keys and the command history are not supported. ## Related pages - [Linux](https://docs.thinger.io/devices/linux.md): Build the Thinger.io IOTMP client for Linux, connect a Raspberry Pi or any Linux computer, and run it as a service with remote terminal and files. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. - [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md): Find out why a device does not connect, does not authenticate or does not send data to Thinger.io, and fix it. --- Source: https://docs.thinger.io/devices/ota.md # OTA updates > Update the firmware of your devices over their Thinger.io connection from Visual Studio Code, one device or a whole product at a time. An OTA update sends new firmware to a device over its Thinger.io connection, so you can update devices in the field without a cable. You build and send the firmware from Visual Studio Code with the Thinger.io extension, to one device or to every device of a product. ## When to use it - To fix or improve the firmware of devices that are already installed. - To roll out the same firmware to every device of a product. ## How an update works The extension builds the firmware with PlatformIO and sends it in blocks through the REST API. The server relays each block to the device over its IOTMP connection, and the device installs the firmware and restarts. ![Visual Studio Code builds the firmware and reads its version, reads the OTA options of the device through the Thinger.io server, sends begin, the firmware blocks and end, and asks the device to reboot; the device restarts and connects again. With a product as the target, the steps repeat for each device.](https://docs.thinger.io/diagrams/ota-update-flow.svg) *An OTA update from Visual Studio Code* What the extension does for you: - **Builds and uploads in one step**, with the active PlatformIO environment, or asks which one if the project has several. - **Skips devices that already run the version** you are sending (see [Firmware versions](#firmware-versions)). - **Asks for confirmation before installing a firmware built for other hardware**, when the firmware declares its compatibility fields (see [Check the hardware compatibility](#check-the-hardware-compatibility)). - **Compresses the firmware** when the board supports it: zlib on ESP32, LZSS on Portenta H7 and Opta, gzip on ESP8266 if you build with `-D ATOMIC_FS_UPDATE`, and gzip on Raspberry Pi Pico W and Pico 2 W if you define `THINGER_OTA_COMPRESSION 1`. The other boards receive it uncompressed. - **Verifies an MD5 checksum** of the firmware, compressed or not, before the device installs it. The Nano 33 IoT and the MKR WiFi 1010 also read back the firmware stored in their Wi-Fi module and check it before they install it. - **Shows the state of the target** in the status bar: whether the device is connected, and the bytes it sends and receives in real time. - **Logs each update** in the **Thinger.io OTA Log** output, with the result of every device. ## Requirements - An IOTMP device with one of the supported boards: ESP32 (also S2, S3, C3, C5, C6 and P4), ESP8266, Raspberry Pi Pico W, Pico 2 W, Arduino Nano 33 IoT, MKR WiFi 1010, Nano RP2040 Connect, MKR NB 1500, UNO R4 WiFi, or Portenta H7 and Opta on the Mbed OS core. Each board's OTA include and class are in [Supported boards](https://docs.thinger.io/devices/arduino/boards.md). OTA updates are not available on the Arduino Zephyr core yet. - A PlatformIO project with firmware that connects to Thinger.io and has OTA support (see [Add OTA to your sketch](#add-ota-to-your-sketch)), flashed once over USB. - [Visual Studio Code](https://code.visualstudio.com/) with [PlatformIO](https://platformio.org/) and the [Thinger.io extension](https://marketplace.visualstudio.com/items?itemName=thinger-io.thinger-io). Install the extension from the **Extensions** view of VS Code: search for "Thinger.io". - An access token with the permissions `ListDevices`, `ListProducts`, `AccessDeviceResources` and `ReadDeviceStatistics`. See [Access Tokens](https://docs.thinger.io/platform/access-tokens.md). ## Add OTA to your sketch Include the OTA header of your board and create the OTA object after the `thing` object. The rest of the sketch does not change. ### ESP32 / ESP8266 **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerESP32OTA ota(thing); void setup() { Serial.begin(115200); pinMode(16, OUTPUT); thing.add_wifi("wifi-network", "wifi-password"); // turn GPIO 16 on and off from Thinger.io thing["GPIO_16"] << digitalPin(16); // read the time since the board started thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` On ESP8266, use `ThingerESP8266.h` and `ThingerESP8266OTA.h`, with the classes `ThingerESP8266` and `ThingerESP8266OTA`. `YOUR_TOKEN` is the device credentials. On ESP32, the board can go back to its previous firmware when a new one does not connect: see [Roll back a failed update](#roll-back-a-failed-update-esp32). ### Nano 33 IoT / MKR WiFi 1010 **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerWiFiNINA thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerWiFiNINAOTA ota(thing); void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); thing.add_wifi("wifi-network", "wifi-password"); thing["led"] << digitalPin(LED_BUILTIN); thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` **platformio.ini** ```ini [env:nano_33_iot] platform = atmelsam board = nano_33_iot framework = arduino lib_archive = no lib_deps = thinger-io/thinger.io arduino-libraries/WiFiNINA [env:mkrwifi1010] platform = atmelsam board = mkrwifi1010 framework = arduino lib_archive = no lib_deps = thinger-io/thinger.io arduino-libraries/WiFiNINA ``` > **Warning** > > Add `lib_archive = no` to the environment of these boards in `platformio.ini`. Without it, PlatformIO leaves out of the firmware the boot code that installs the update, and the board never runs the new firmware. These boards also need the `WiFiNINA` library in `lib_deps`. The new firmware is stored in the Wi-Fi module until the board restarts. Before it restarts, the board reads it back and checks it: if the copy is corrupted, the update fails with `The firmware stored in the WiFi module is corrupted`, and the board keeps running its current firmware. ### Nano RP2040 Connect **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerMbed thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerMbedOTA ota(thing); void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); thing.add_wifi("wifi-network", "wifi-password"); thing["led"] << digitalPin(LED_BUILTIN); thing["millis"] >> outputValue(millis()); // run the Thinger.io connection in its own thread thing.start(); } void loop() { // your code } ``` **platformio.ini** ```ini [env:nanorp2040connect] platform = raspberrypi board = nanorp2040connect framework = arduino lib_deps = thinger-io/thinger.io arduino-libraries/WiFiNINA ``` `thing.start()` keeps the connection in its own thread, so `loop()` does not call `thing.handle()`. The Wi-Fi module of this board needs the `WiFiNINA` library in `lib_deps`. Every firmware you send must include `ThingerMbedOTA.h`, because the board installs updates with it. A firmware without it is rejected with `The firmware does not include ThingerMbedOTA.h, so it cannot be applied`, and the board keeps running its current firmware. ### Portenta H7 / Opta On the Mbed OS core: **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerMbed thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerPortentaOTA ota(thing); unsigned long counter = 0; void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); thing.add_wifi("wifi-network", "wifi-password"); thing["led"] << digitalPin(LED_BUILTIN); thing["counter"] >> outputValue(counter); // run the Thinger.io connection in its own thread thing.start(); } void loop() { // lock the connection while you change values that a resource reads thing.lock(); counter++; thing.unlock(); delay(1000); } ``` `thing.start()` keeps the connection in its own thread, and `loop()` works as in any sketch. Wrap with `thing.lock()` and `thing.unlock()` the code that changes variables your resources read. With Ethernet, use `ThingerMbedEth.h` and `ThingerMbedEth` instead. > **Warning: Update the bootloader first** > > Boards with an old bootloader cannot install updates. In the Arduino IDE, with the board connected over USB, open **File > Examples > STM32H747_System** and run, in this order: **STM32H747_manageBootloader** to update the bootloader, **QSPIFormat** to format the QSPI flash, and **WiFiFirmwareUpdater** to update the Wi-Fi firmware. ![Arduino IDE examples menu, STM32H747_System submenu with QSPIFormat, STM32H747_manageBootloader and WiFiFirmwareUpdater](https://docs.thinger.io/images/devices/ota/arduino-ide-stm32h747-system-examples.webp) *The STM32H747_System examples in the Arduino IDE* ### Pico W / Pico 2 W **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerPicoW thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerPicoOTA ota(thing); void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); thing.add_wifi("wifi-network", "wifi-password"); thing["led"] << digitalPin(LED_BUILTIN); thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` **platformio.ini** ```ini [env:rpipicow] platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = rpipicow framework = arduino board_build.core = earlephilhower board_build.filesystem_size = 1m lib_deps = thinger-io/thinger.io [env:rpipico2w] platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = rpipico2w framework = arduino board_build.core = earlephilhower board_build.filesystem_size = 2m lib_deps = thinger-io/thinger.io ``` These boards use the [Arduino-Pico](https://github.com/earlephilhower/arduino-pico) core, which PlatformIO installs from the platform of the example. The update is stored in the file system before the board installs it: `board_build.filesystem_size` must leave room for the whole firmware, and the first flash over USB must use the same setting. To send the firmware compressed with gzip, add `#define THINGER_OTA_COMPRESSION 1` before the includes; it needs a recent version of the extension. See [Raspberry Pi Pico W and Pico 2 W](https://docs.thinger.io/devices/arduino/boards/other.md#raspberry-pi-pico-w-and-pico-2-w). ### UNO R4 WiFi **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerR4WiFi thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerR4OTA ota(thing); void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); thing.add_wifi("wifi-network", "wifi-password"); thing["led"] << digitalPin(LED_BUILTIN); thing["millis"] >> outputValue(millis()); } void loop() { thing.handle(); } ``` Keep the firmware of the Wi-Fi module up to date with **Tools > Firmware Updater** in the Arduino IDE: with an old firmware, the board cannot connect to the server over TLS or install updates. The module stores the new firmware and programs the board with it when it restarts. See [UNO R4 WiFi](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#uno-r4-wifi). ### MKR NB 1500 **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include #include ThingerMKRNB thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerMKRNBOTA ota(thing); void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); // SIM PIN (empty if it has none) and APN of your operator thing.set_pin(""); thing.set_apn("apn-name", "apn-user", "apn-password"); thing["led"] << digitalPin(LED_BUILTIN); // network time of the modem thing["time"] >> [](pson& out){ out = thing.getNB().getTime(); }; } void loop() { thing.handle(); } ``` **platformio.ini** ```ini [env:mkrnb1500] platform = atmelsam board = mkrnb1500 framework = arduino lib_archive = no lib_deps = thinger-io/thinger.io arduino-libraries/MKRNB ``` Add `lib_archive = no` and the `MKRNB` library to `platformio.ini`, as with the Nano 33 IoT and MKR WiFi 1010. The MKR NB 1500 may not start the new firmware until you press its reset button after the update. The OTA object can also reject updates, report progress or change its block size and timeout: see [Over-the-air updates](https://docs.thinger.io/reference/arduino-library.md#over-the-air-updates) in the library reference. ## Check the hardware compatibility Devices with the same board can carry different hardware: another PCB version, other sensors, or a cellular modem instead of Wi-Fi. To keep a device from installing a firmware built for other hardware, declare the compatibility fields of the firmware with `THINGER_OTA_CHECK`, before the OTA include. Each `FIELD` is a key and a value, both text: **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG // compatibility fields of this firmware #define THINGER_OTA_CHECK(FIELD) FIELD("PCB_MODEL", "SENSOR_I2C") FIELD("PCB_VERSION", "V2") #include #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerESP32OTA ota(thing); void setup() { thing.add_wifi("wifi-network", "wifi-password"); } void loop() { thing.handle(); } ``` The fields are stored in the firmware, and the device reports them in its `$ota/options` device resource. Before each update, the extension compares the fields of the device with those of the new firmware: | Device | New firmware | What happens | |---|---|---| | Same fields | Same fields | The update goes on as usual. | | Fields | Different fields, or none | The extension shows the fields that changed, were added or were removed, and asks you to confirm. With a product as the target, **Continue for All** and **Skip All** apply your answer to the rest of its devices. | | No fields | Any | The update goes on as usual. | - The device checks the fields too: it rejects an update with different or missing fields unless you confirmed it in the extension. The extension then reports `Firmware not compatible with this device (OTA check)`, with the fields of the device. - When the fields do not match, the update is not skipped even if the device runs the same version (see [Firmware versions](#firmware-versions)). - Up to 16 fields, with keys of 1 to 32 characters and values of up to 128 characters. Keys and values are case-sensitive, and keys cannot repeat. A sketch that breaks these limits does not compile. - It works on every board with OTA updates. ## Roll back a failed update (ESP32) A firmware with a bug, or with a wrong Wi-Fi password or wrong device credentials, can leave a remote device offline. On the ESP32, define `THINGER_OTA_ROLLBACK` before the OTA include: the new firmware must then connect to Thinger.io within `THINGER_OTA_ROLLBACK_TIMEOUT` seconds of its first start (300 by default), or the board goes back to the previous firmware. It also goes back if it restarts before it connects, for example after a crash. **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG // go back to the previous firmware if this one cannot connect to Thinger.io #define THINGER_OTA_ROLLBACK // seconds to connect (300 by default) #define THINGER_OTA_ROLLBACK_TIMEOUT 300 #include #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ThingerESP32OTA ota(thing); void setup() { Serial.begin(115200); thing.add_wifi("wifi-network", "wifi-password"); } void loop() { thing.handle(); } ``` - The firmware you send is the one that must define `THINGER_OTA_ROLLBACK`: a firmware without it is accepted as soon as it starts. Keep it in every release. - With debug output on, the serial monitor shows `The new firmware connected to Thinger.io, so it is valid`, or `The new firmware cannot connect to Thinger.io, rolling back to the previous one...` before the board restarts with the previous firmware. - After a rollback, the device connects with the previous firmware and reports its version in `$ota/version`. - It works on every ESP32 family (ESP32, S2, S3, C3, C5, C6 and P4). Define it in only one source file of the project, the one that includes the OTA header. ## Set up the extension Open the VS Code settings and search for **Thinger.io**. The extension starts when you open a PlatformIO project. | Setting | Default | Description | |---|---|---| | `thinger-io.host` | `iot.thinger.io` | Server of your account. Keep the default on the free Cloud account, or set your own domain, `YOUR_SERVER`. | | `thinger-io.port` | `443` | Server port. | | `thinger-io.ssl` | `true` | Use a TLS connection. | | `thinger-io.secure` | `true` | Verify the TLS certificate. Turn it off only for a private server with a self-signed certificate. | | `thinger-io.token` | (empty) | Access token of your account. If it is empty, the extension asks for one. | | `thinger-io.otaTimeout` | `0` | Seconds to wait for each step of the update. `0` uses the timeout the device reports, or 30 seconds. Raise it on slow links such as NB-IoT. | | `thinger-io.otaBlockSize` | `0` | Bytes per block. `0` uses the block size of the device. Lower it on slow or unreliable links. | ## Update a device Firmware is sent from Visual Studio Code. There is no console screen, REST API call, `thinger` command or MCP tool that sends firmware. This video shows the whole process: [Video: OTA updates from Visual Studio Code with Thinger.io](https://www.youtube.com/watch?v=AHqfI7yP1-o) **Step 1: Choose the target** Click the rocket in the status bar, or run **Thinger.io: Switch Target Destination** from the command palette (`Ctrl+Shift+P`, `Cmd+Shift+P` on macOS). Choose **Device** and search for the device, or **Product** to update every device of a product. ![Two Thinger.io buttons in the VS Code status bar: a rocket to choose the target and a play button to upload](https://docs.thinger.io/images/devices/ota/vscode-status-bar-buttons.webp) *Target and upload buttons in the status bar* The status bar shows the target. A device target turns red while the device is disconnected. ![Searching for a device by its name in the VS Code target selector and selecting it](https://docs.thinger.io/images/devices/ota/vscode-select-device.gif) *Choosing a device as the target* **Step 2: Upload the firmware** Click the play button in the status bar, or run **Thinger.io: Upload Firmware**. The extension builds the active PlatformIO environment, asks you to confirm and sends the firmware. A notification shows each stage: initializing the update, uploading, ending the update and rebooting the device. You can cancel it from the notification. ![PlatformIO builds an ESP8266 project and a Thinger.io notification shows the upload progress until the device reboots](https://docs.thinger.io/images/devices/ota/vscode-upload-firmware.gif) *Building and uploading to an ESP8266* To stop sending updates to a target, run **Thinger.io: Clear Target Destination**. ## Firmware versions Give each firmware a version with the `THINGER_OTA_VERSION` compile option. We recommend [semantic versioning](https://semver.org/), `MAJOR.MINOR.PATCH`: increase `MAJOR` for incompatible changes, `MINOR` for new features and `PATCH` for fixes. The device reports its version, and the extension reads the version of the firmware it has just built. Before uploading, it shows the target, the version and the environment: ![VS Code dialog asking to upload the firmware, with Device portenta_h7, Firmware Version 1.0.0, Environment opta and the Cancel and Yes buttons](https://docs.thinger.io/images/devices/ota/vscode-confirm-upload.webp) *Confirmation before an upload* A device that already runs that version is not updated: the extension reports that its firmware is up to date and moves on. Without `THINGER_OTA_VERSION`, the version is empty and every upload goes through, which is handy while you develop. Set the version in one of these ways: ### In the code Define it before the first Thinger.io include, and change it by hand for each release: **main.cpp** ```cpp #define THINGER_OTA_VERSION 1.0.0 #include #include ``` Write the version without quotes, as in the build flag: quotes become part of the version. ### Build flag Set it in `platformio.ini`, and change it there for each release: **platformio.ini** ```ini build_flags = -D THINGER_OTA_VERSION=1.0.0 ``` ### Git tag Recommended. PlatformIO takes the version from the latest git tag of the project each time it builds, so tagging a release is enough: **platformio.ini** ```ini build_flags = !echo "-D THINGER_OTA_VERSION=$(git describe --tags --always)" ``` On a tagged commit the version is the tag (`v1.2.0`); after it, `git describe` adds the number of commits and the commit (`v1.2.0-3-g1a2b3c4`). Without tags, `--always` uses the commit. The `!` runs the command in your shell: this line works on macOS and Linux. ## Check the update After the reboot, the device connects again with the new firmware and reports its version in the `$ota/version` device resource. ### Console Open the device in **Devices**: it shows as connected, and its connection time starts again from the reboot. ### API Read the connection of the device: **API call:** `GET /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-readstatus)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" ``` `connection.state` is `connected` and `connection.ts` is the time of the new connection. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain. `YOUR_TOKEN` is an access token of your account. Read the firmware version: **API call:** `GET /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessoutputresources)) ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/\$ota/version" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ```json {"version": "1.0.0"} ``` ### CLI ```bash thinger device get YOUR_DEVICE thinger device resource call YOUR_DEVICE '$ota/version' ``` ### AI **Prompt for an AI agent:** > Check whether my device YOUR_DEVICE is connected, tell me when it connected for the last time and read the firmware version from its $ota/version resource. ## Firmware on other SDKs - **ESP-IDF** and **Zephyr**: their clients do not receive OTA updates through Thinger.io. Use the update mechanism of each SDK. See [ESP-IDF](https://docs.thinger.io/devices/esp-idf.md) and [Zephyr](https://docs.thinger.io/devices/zephyr.md). - **Linux**: update the client with the package or build process you used to install it. See [Linux](https://docs.thinger.io/devices/linux.md). ## Limits - The device must be connected and running firmware with OTA support. The first flash is always over USB. - A product update goes through the IOTMP devices of the product one after another. Devices that are not connected fail and are listed in the **Thinger.io OTA Log**; send the update again when they are back. - A device whose sketch calls `ota.set_enabled(false)` rejects updates. - The boards of the Arduino Zephyr core (`ThingerZephyr`) do not receive OTA updates yet. - Updates over NB-IoT and GPRS take longer: raise `thinger-io.otaTimeout` or lower `thinger-io.otaBlockSize` if they fail. ## Related pages - [Arduino](https://docs.thinger.io/devices/arduino.md): Connect an Arduino-compatible board to Thinger.io with the Arduino library, from the Arduino IDE or PlatformIO, and update it over the Internet. - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): The boards and network modules the Thinger.io Arduino library supports, with the class, the example sketch and the OTA support of each. - [Arduino library](https://docs.thinger.io/reference/arduino-library.md): Classes, functions, macros and compile options of the Thinger.io Arduino library, with their exact signatures and default values. - [VS Code extension](https://docs.thinger.io/reference/vscode-extension.md): Package, source code, installation and documentation of the Thinger.io extension for Visual Studio Code, which sends firmware over the air to devices and products. - [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md): Find out why a device does not connect, does not authenticate or does not send data to Thinger.io, and fix it. --- Source: https://docs.thinger.io/devices/provisioning.md # Provisioning at scale > Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. Every device needs a record in your account before the platform accepts its data. You can create that record by hand, let a product create it when the device first connects, or create the devices yourself and let other accounts claim them. This page explains when each way fits. ![Three ways to add devices: by hand you create the device and flash its credentials; with Auto Provision a device whose ID matches a product pattern is created when it first connects; with claims another account claims your devices with a URL or code and they are shared with it in a project](https://docs.thinger.io/diagrams/device-provisioning.svg) *Manual, Auto Provision and claims* ## Manual You create each device in **Devices**, with the API or with the CLI, and flash its device ID and credentials into the firmware. It is the simplest way and the right one for a few devices, prototypes and tests. Each guide in [Connect a device](https://docs.thinger.io/devices.md) starts this way. ## Auto Provision A [product](https://docs.thinger.io/platform/products.md) can create devices by itself. In its [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md) settings you set a device ID pattern, such as `sensor_[0-9A-F]{12}`. When a device that does not exist yet tries to connect with an ID that matches the pattern, the platform creates it in that product, with its properties, Data Buckets and dashboards, and accepts it from then on: | Device type | The device is created when | |---|---| | IOTMP or MQTT | It connects for the first time. The credentials it presents become its device credentials. | | HTTP | It sends its first request to a device resource of the product. See [HTTP](https://docs.thinger.io/devices/http.md). | | Subdevice | A product flow receives its first MQTT message. | Use it for fleets: flash the same firmware on every unit, each with its own ID (for example, derived from its MAC address) and its own credentials, and the devices appear as they are switched on. The [LoRaWAN](https://docs.thinger.io/devices/lorawan.md) plugins rely on it too. For a complete walkthrough, see [Provision a device fleet](https://docs.thinger.io/guides/fleet-provisioning.md). ## Claims A [claim](https://docs.thinger.io/platform/toolbox/claims.md) lets another account take some of your devices, and other resources such as dashboards, into a project you share with it. You create the claim in **Toolbox > Claims** and give its URL or code to the other party, for example printed on the box of the device. When they claim it, the devices join the project and they can use them with the permissions of that project. You can limit how many times a claim works. Use it when you make devices for others: you provision them first, by hand or with Auto Provision, and each customer claims their own. ## Choose a way | Way | Best for | Who creates the device | Needs | |---|---|---|---| | Manual | A few devices, prototypes | You | Nothing else | | Auto Provision | Fleets of the same product | The platform, on first connection | A product with a device ID pattern | | Claims | Devices you hand over to other accounts | You, before shipping | Devices, a project and a claim | ## Learn more - [Connect a device](https://docs.thinger.io/devices.md): Choose how to connect your hardware to Thinger.io - device libraries over IOTMP, MQTT, HTTP or a LoRaWAN or Sigfox network. - [Subdevices](https://docs.thinger.io/devices/subdevices.md): Represent the sensors and machines behind an MQTT gateway as their own devices, with their own connection state, data and dashboards. - [LoRaWAN](https://docs.thinger.io/devices/lorawan.md): Bring LoRaWAN sensors into Thinger.io through The Things Stack, ChirpStack or LORIOT, with devices created automatically and downlinks. --- Source: https://docs.thinger.io/devices/troubleshooting.md # Troubleshooting > Find out why a device does not connect, does not authenticate or does not send data to Thinger.io, and fix it. This guide helps you find out why a device does not show as connected or its data does not arrive. Start by reading what the device itself reports, then look up the symptom below. ![Four stages in a row, each with the debug message of the Arduino library that shows it was reached and the section of this page to read when it fails. Network: Wi-Fi, Ethernet or cellular, reached with \[NETWORK\] Connected!. Server: socket and TLS to the server port, reached with \[_SOCKET\] Connected!. Authentication: username, device ID and device credentials, reached with \[THINGER\] Authenticated. Data: device resources and Data Buckets, reached when the device shows as connected in Devices; if data does not arrive or the device was disabled, read those sections.](https://docs.thinger.io/diagrams/connection-failure-stages.svg) *Where a connection fails* ## Before you start - Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - Check the device in **Devices**: its state (connected, disconnected or disabled) tells you where to look. ## Steps **Step 1: Turn on the debug output** ### Arduino Define `THINGER_SERIAL_DEBUG` before any include, and open the serial monitor at the speed of `Serial.begin()`: **main.cpp** ```cpp #define THINGER_SERIAL_DEBUG #include ``` A healthy connection ends like this: ```text [_SOCKET] Connecting to YOUR_SERVER:25202... [_SOCKET] Using secure TLS/SSL connection: yes [_SOCKET] Connected! [THINGER] Authenticating. User: YOUR_USER Device: YOUR_DEVICE [THINGER] Authenticated ``` ### Linux Run the client in the foreground with `-v 1`: ```bash thinger_iotmp -u YOUR_USER -d YOUR_DEVICE -p 'YOUR_TOKEN' -h YOUR_SERVER -v 1 ``` A healthy connection ends with `Authenticated successfully!`. The log at this level shows the device credentials: do not share it as is. ### MQTT Most clients print the CONNACK code. With Mosquitto, add `-d` to `mosquitto_pub` or `mosquitto_sub`: `received CONNACK (0)` means the connection was accepted. ### HTTP Add `-i` to `curl` to see the status code and the error message of the response. **Step 2: Find the symptom** Look for what the output shows in the tables below. ## The device does not reach the network | Symptom | Cause | Fix | |---|---|---| | The output stops before `Connecting to` | No Wi-Fi, Ethernet or cellular connection. | Check the Wi-Fi name and password, the cable, or the APN, power and antenna of the cellular module. | | No output at all | The sketch blocks before connecting, or the serial monitor speed is wrong. | Remove long `delay()` calls and endless loops from `setup()`, check the sensors it waits for, and match the monitor speed. | | `Communication with WiFi module failed` on a Portenta H7, Opta or GIGA R1 WiFi with the Zephyr core | The Wi-Fi firmware of the board is missing or corrupted. | [Install the Wi-Fi firmware](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#install-the-wi-fi-firmware) with the `FlashFormat` example of the core. | ## The device cannot connect to the server | Symptom | Cause | Fix | |---|---|---| | `Connecting to iot.thinger.io` when your server is another | The library uses its default server. | Set your server: `#define THINGER_SERVER "YOUR_SERVER"` before the includes on Arduino, or `-h YOUR_SERVER` on Linux. | | The connection times out | The network blocks the port. | The Arduino library uses port `25202` (TLS) or `25200`; ESP-IDF, Zephyr and the Linux client use `25206` (TLS) or `25204`; MQTT uses `8883` (TLS) or `1883`. Open the port, or on Linux use `-t ws`, which goes through port `443`. | | The TLS handshake fails | The device clock or its certificates are wrong, or TLS is not supported by the board. | Check the time and the certificates: on a private instance whose certificate comes from its own authority, [define its root certificate](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls) with `THINGER_ROOT_CA`; on WiFiNINA and WiFi101 boards, [upload the server certificate](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#upload-the-server-certificate); on the UNO R4 WiFi, [update the firmware of the Wi-Fi module](https://docs.thinger.io/devices/arduino/boards/arduino-wifi.md#uno-r4-wifi); on the Portenta H7 and the Opta, update the Wi-Fi firmware, with [FlashFormat](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#install-the-wi-fi-firmware) on the Zephyr core or [WiFiFirmwareUpdater](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#prepare-the-board) on the Mbed OS core. To rule out TLS, try once without it: `#define _DISABLE_TLS_` on Arduino, port `1883` on MQTT. Turn TLS back on afterwards. | After each failed attempt, the Arduino library shows `[THINGER] Retrying connection in (ms):` and the wait before the next one. When the server cannot be reached or rejects the device, the wait doubles on every failure up to 30 seconds, plus a random margin, so a device can take more than half a minute to try again after you fix the cause. See [Manage the connection](https://docs.thinger.io/devices/arduino/coding.md#manage-the-connection). ## The device connects but does not authenticate | Symptom | Cause | Fix | |---|---|---| | `Authenticating` and then disconnects (IOTMP), or `not authorised` (MQTT) | The username, device ID or device credentials do not match the device in the console. | Copy the three values again. The username is not your email. If you lost the credentials, set new ones in the device **Settings** and flash them. | | Same as above, and the values are right | The device or the account is disabled, or the device is on another server. | [Enable the device](#the-device-was-disabled), and check `YOUR_SERVER`. | | The device connects and disconnects every few seconds | Two devices use the same device ID. | Give each device its own ID. Only the last connection is kept. | ## The device is connected but data does not arrive | Symptom | Cause | Fix | |---|---|---| | A device resource returns `404` | The device is not connected, or the resource name is wrong. | Check the state in **Devices** and the names with `thinger device resource list YOUR_DEVICE`. | | A Data Bucket stays empty | The bucket reads another device or resource, or the data is not JSON. | Check the **Data Source** of the bucket, and send JSON. | | An HTTP request returns `401`, `403` or `404` | Missing token, token without permission, or wrong device ID. | See [HTTP](https://docs.thinger.io/devices/http.md#troubleshooting). | | An HTTP or MQTT device shows as disconnected between messages | The timeout is shorter than the reporting interval. | Raise the timeout of the device. | ## The device was disabled | Symptom | Cause | Fix | |---|---|---| | The device shows as disabled in **Devices**, you received a **Device Disabled** email, and the device no longer authenticates | 100 Data Bucket writes or endpoint calls of the device failed within about a minute: the bucket or the endpoint does not exist or is disabled, or the device went over the limits of the account. The platform disables the device and closes its connection. | Fix the calls in the firmware, then enable the device. | Call the platform only when something changes or at an interval, as in [Call the platform at a safe rate](https://docs.thinger.io/devices/arduino/coding.md#call-the-platform-at-a-safe-rate). If you enable the device before you fix the firmware, the same calls fail again and the platform disables it again. To enable the device: ### Console Open the device in **Devices** and go to **Settings**. Turn on **Enabled** and click **Update Device**. ![Settings of the greenhouse_01 device with the Enabled switch on, highlighted, and the Update Device button](https://docs.thinger.io/screenshots/troubleshooting-device-enabled.webp) *Enabled switch of a device* ### API **API call:** `PUT /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-update)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"enabled": true}' ``` `YOUR_TOKEN` is an access token with permission to update the device. ### CLI ```bash thinger device update YOUR_DEVICE -s enabled=true ``` ### AI **Prompt for an AI agent:** > Enable my device YOUR_DEVICE in Thinger.io. ## An OTA update fails The Visual Studio Code extension shows the error of each device, and logs it in the **Thinger.io OTA Log** output. See [OTA updates](https://docs.thinger.io/devices/ota.md). | Error or symptom | Cause | Fix | |---|---|---| | `Firmware not compatible with this device (OTA check)` | The compatibility fields of the new firmware (`THINGER_OTA_CHECK`) do not match those of the device. | Check that you are sending the firmware built for that hardware. If it is the right one, upload it again and confirm the update when the extension asks. See [Check the hardware compatibility](https://docs.thinger.io/devices/ota.md#check-the-hardware-compatibility). | | `The firmware does not include ThingerMbedOTA.h, so it cannot be applied` | Nano RP2040 Connect: the new firmware does not include the OTA header of the board. | Add `#include ` and the `ota` object to the new firmware and send it again. The device keeps running its current firmware. | | `The firmware stored in the WiFi module is corrupted` | Nano 33 IoT or MKR WiFi 1010: the copy of the firmware stored in the Wi-Fi module does not match the firmware sent. | Send the update again. The device keeps running its current firmware. If it keeps failing, flash the new firmware over USB. | | `Update the UNO R4 WiFi firmware to 0.4.1 or later` | UNO R4 WiFi: the firmware of the Wi-Fi module is too old for OTA updates. | Update it with **Tools > Firmware Updater** in the Arduino IDE, over USB. | | `OTA is not supported by the current bootloader` | Portenta H7 or Opta on the Mbed OS core: the bootloader is too old. | [Prepare the board](https://docs.thinger.io/devices/arduino/boards/portenta-opta.md#prepare-the-board). | | The ESP32 restarts with its previous firmware a few minutes after the update | The new firmware defines `THINGER_OTA_ROLLBACK` and could not connect to Thinger.io in time, or restarted before connecting. | Check the Wi-Fi network, the device credentials and the server of the new firmware, and look for crashes in its debug output. See [Roll back a failed update](https://docs.thinger.io/devices/ota.md#roll-back-a-failed-update-esp32). | ## Get help Many questions are already answered in the [Community forum](https://community.thinger.io): search it first. If you open a new topic: - Write in English, so that more people can help. - Choose a title that describes the problem, and the category that fits it best. - Describe what you want to do and what happens instead. - Include what others need to reproduce it: the code, the board and the library versions, the compiler output, the debug output of the connection and the Thinger.io settings involved (device type, buckets, endpoints). - Paste code and logs as **Preformatted text**, so they keep their format. Remove credentials and tokens first. - Be polite: the people who answer are other users who help for free. ![Editor of a new topic in the Thinger.io Community forum, with the Preformatted text button of the toolbar highlighted and a code block in the text](https://docs.thinger.io/images/devices/troubleshooting/community-forum-preformatted-text.webp) *The Preformatted text button of the forum editor* Private instances can add a support plan: see [thinger.io](https://thinger.io). ## Next steps - [Arduino](https://docs.thinger.io/devices/arduino.md): Connect an Arduino-compatible board to Thinger.io with the Arduino library, from the Arduino IDE or PlatformIO, and update it over the Internet. - [Linux](https://docs.thinger.io/devices/linux.md): Build the Thinger.io IOTMP client for Linux, connect a Raspberry Pi or any Linux computer, and run it as a service with remote terminal and files. - [MQTT](https://docs.thinger.io/devices/mqtt.md): Connect an MQTT client to the Thinger.io broker, publish and subscribe to topics, and store the messages in a Data Bucket. --- Source: https://docs.thinger.io/platform/devices.md # Devices > Register devices, check their connection status, store properties, organize them with labels and watch them live from the console. Every device that connects to Thinger.io has a record in **Devices**: its ID, its device type, its credentials and its connection status. From the device page you call its device resources, store properties, add labels to find it later and watch its activity live. This page covers the device record. To connect a device over IOTMP, MQTT or HTTP, see [Connect a device](https://docs.thinger.io/devices.md). ![A device record in the center, with what belongs to it: its ID, device type and credentials for IOTMP and MQTT, or its callback for HTTP; its connection status; its device resources, called through the REST API; its properties, its own and those inherited from its asset type, asset group and product; the Data Buckets that store its data; its device tokens; and its labels.](https://docs.thinger.io/diagrams/device-record.svg) *What a device record holds* ## When to use it - To register a device before it connects for the first time. - To check whether a device is online, and since when. - To keep configuration and state for a device in properties. - To label devices by site, customer or batch and filter the list by those labels. ## Device types | Device type | `type` | Use it for | |---|---|---| | IOTMP | `Generic` | Devices that use the Thinger.io libraries (Arduino, ESP-IDF, Zephyr, Linux). | | MQTT | `MQTT` | Devices that publish and subscribe on the MQTT broker. | | HTTP | `HTTP` | Devices and services that send data with HTTP requests. | | Virtual | `Virtual` | Devices without hardware, implemented on the platform. See [Virtual devices](https://docs.thinger.io/devices/virtual-devices.md). | | Subdevice | `Subdevice` | Devices that reach the platform through another device. See [Subdevices](https://docs.thinger.io/devices/subdevices.md). | IOTMP and MQTT devices authenticate with device credentials. Keep them when you create the device: they cannot be read back later, only replaced. Subdevices are created from the API or the CLI. ## Create a device `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Devices** Go to **Devices** and click **Add Device** (or **Create a Device** if you have none yet). **Step 2: Fill in the form** Choose the **Device Type** (**IOTMP Device**, **HTTP Device**, **MQTT Device** or **Virtual Device**) and set the **Device Id**. For IOTMP and MQTT devices, type the **Device Credentials** or click **Random**. Optionally, set a **Device Name** and a **Device Description**; under **Advanced Options** you can assign an asset type, an asset group and a [product](https://docs.thinger.io/platform/products.md). ![Add Device form with the IOTMP device type, a device ID, credentials, name and description](https://docs.thinger.io/screenshots/devices-add-form.webp) *Add a device* **Step 3: Save the device** Click **Add Device**. Copy the credentials now: the console cannot show them again. ### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "device": "YOUR_DEVICE", "type": "Generic", "name": "Greenhouse 01", "credentials": "YOUR_DEVICE_CREDENTIALS", "enabled": true }' ``` Here `YOUR_TOKEN` is an access token with permission to create devices, and `YOUR_DEVICE_CREDENTIALS` the secret the device will use to connect. ### CLI ```bash thinger device create YOUR_DEVICE --type Generic --name "Greenhouse 01" ``` Without `--credentials`, the CLI prints generated credentials once. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-create). ### AI **Prompt for an AI agent:** > Create an IOTMP device called YOUR_DEVICE named Greenhouse 01 and give me its credentials. The agent uses `thinger_resource_create` with the `device` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Check the status The device page shows whether the device is connected, when it last connected or disconnected, its address and the data it has sent and received. The list of **Devices** shows the same status for every device. ### Console Go to **Devices** and click the device. The **Status** tab shows the **Device State**, the **Last connection**, the **IP Address**, the **Transmitted Data** and **Received Data**, and a **Live Transmission** chart. Below them: - **Device Location**: an approximate location on a map. Add a `location` property with `lat` and `lon` fields to set the exact one. - **Daily Data Transmission**: the data sent and received each day. - **Report for last 30 days**: the **Total Data**, **Total Connections**, **Total Sent** and **Total Received** of the last 30 days, counting only the payload the device exchanged. ![Status page of a connected device with transmitted and received data, IP address, state, connection time and location](https://docs.thinger.io/screenshots/devices-status.webp) *Status page of a connected device* ### API **API call:** `GET /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-readstatus)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" ``` `connection.active` is `true` while the device is connected, and `connection.ts` is the time of the last change. The daily usage of the last 30 days, the data of **Daily Data Transmission**, has its own call: **API call:** `GET /v3/users/{user}/devices/{device}/stats` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-readstatistics)) ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/stats" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger device get YOUR_DEVICE thinger device stats YOUR_DEVICE ``` `thinger device list` shows every device with `online` or `offline`. ### AI **Prompt for an AI agent:** > Is YOUR_DEVICE online? Tell me when it last connected. The agent uses `thinger_resource_call` with the type `device` and the action `overview`, and with the `stats` action for the daily usage. ## Call device resources Device resources are the inputs and outputs that the firmware of an IOTMP device declares, such as a sensor reading or a relay. While the device is connected, you call them through the REST API: a `GET` reads an output, and a `POST` sends an input and returns the output. ![A client, such as the console, a dashboard, a script or an app with a device token, sends GET or POST /v3/users/{user}/devices/{device}/resources/{resource} to the platform. The platform forwards the call over the IOTMP connection to the device resource, which can be an input, an output, both, or have no data. The device runs it and the JSON answer goes back to the client.](https://docs.thinger.io/diagrams/device-resource-call.svg) *Calling a device resource* ### Console Open the device and go to the **API** tab. It lists the device resources with their inputs. Fill in the inputs and click **Run** to call a resource. Click **Show query** to see the REST call behind it: | Tab | Shows | |---|---| | **Overview** | The **Method** and URL, the **Authorization** header, and the **Request Body** and **Response Body** of the last run. | | **Curl** | The same call as a `curl` command to copy. | | **Info** | A reminder that the **Authorization** header shown is temporary. | The header shown is the token of your console session: it lasts a few hours and has access to your whole account. To call the device from a script or an app, use a [device token](#share-a-device-with-a-device-token) or an [access token](https://docs.thinger.io/platform/access-tokens.md) instead. ![Device API of office_climate with the climate resource expanded, its output and the Curl tab of the query with the request and its Authorization header](https://docs.thinger.io/screenshots/devices-api-show-query.webp) *Show query of a device resource, Curl tab* ### API **API call:** `GET /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessoutputresources)) ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/temperature" \ -H "Authorization: Bearer YOUR_TOKEN" ``` **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-accessinputresources)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/setpoint" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "interval": 120, "limit": 27.5 }' ``` The body is the input the device resource expects: an object with its fields, or the value alone, such as `true`, for a resource with a single value. `GET /v3/users/{user}/devices/{device}/resources` lists the device resources with their inputs and outputs. ### CLI ```bash thinger device resource call YOUR_DEVICE temperature thinger device resource call YOUR_DEVICE setpoint -s interval=120 -s limit=27.5 ``` `thinger device resource list YOUR_DEVICE` lists them. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-resource). ### AI **Prompt for an AI agent:** > Read the temperature resource of YOUR_DEVICE, then set its setpoint resource to an interval of 120 and a limit of 27.5. The agent uses `thinger_resource_list` with the type `device_resource`, and `thinger_resource_call` with the type `device_resource` and the action `call`. ## Share a device with a device token A device token gives access to one device and nothing else: use it in a dashboard, an app or a third-party service that calls the device resources, instead of a session or an account-wide token. You can limit it to some device resources and make it expire. | Setting | What it sets | |---|---| | **Token Name** | A name that tells you who uses it, such as `Display panel`. | | **Token Access** | All the device resources, or only the ones you list. | | **Token Expiration** | Never, or a date after which the token stops working and is deleted. | Send the token in the `Authorization: Bearer` header of each call, or in an `authorization` URL parameter. A token limited to some device resources also reaches their subpaths, such as `temperature/celsius` for `temperature`. A device token without a list of device resources reaches all the resources of its device and reads its connection status. No device token can modify or delete the device, nor manage its tokens and properties: use an [access token](https://docs.thinger.io/platform/access-tokens.md) for that. Device tokens are deleted together with their device. ### Console **Step 1: Open the tokens of the device** Open the device, go to the **Tokens** tab and click **Add**. **Step 2: Set the token** Set the **Token Name**. In **Token Access**, keep all the device resources or choose **Limit the resource access for this token** and pick them. In **Token Expiration**, keep **This token will never expire** or choose a date. Save it. **Step 3: Copy the token** The dialog shows the **Device Token**: copy it. **Show QR Code** shows it as a QR code, to pass it to a phone or another device. The token stays in the list of the **Tokens** tab, where you can open it again or delete it. ![Add Device Token dialog with the token name, Limit the resource access selected with the climate and settings resources, and a token that never expires](https://docs.thinger.io/screenshots/devices-token-created.webp) *Device token limited to two resources* ### API **API call:** `POST /v1/users/{user}/devices/{device}/tokens` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-createtoken)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/tokens" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "token_name": "Display panel", "token_resources": ["temperature", "humidity"], "token_expiration": 1798761600000 }' ``` `token_resources` is optional: without it, the token reaches all the device resources. `token_expiration` is a unix timestamp in **milliseconds**; without it, the token does not expire. The response holds the `token` value. `GET /v1/users/{user}/devices/{device}/tokens` lists the tokens with their values, and `DELETE /v1/users/{user}/devices/{device}/tokens/{token}` revokes one by its `id`. Then call the device with the token: ```bash curl "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/temperature?authorization=YOUR_TOKEN" ``` ### CLI ```bash thinger device token create YOUR_DEVICE -s 'token_name=Display panel' \ -s 'token_resources=["temperature", "humidity"]' -s token_expiration=1798761600000 ``` `thinger device token list YOUR_DEVICE` lists the tokens with their values, and `thinger device token delete` revokes one by its `id`. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-token). ### AI **Prompt for an AI agent:** > Create a device token for YOUR_DEVICE called Display panel that can only read the temperature and humidity resources, and give me its value. The agent uses `thinger_resource_create` with the `device_token` type. ## Change the settings or credentials The **Settings** tab of a device edits its record: | Setting | What it does | |---|---| | **Device Credentials** | New credentials for IOTMP and MQTT devices. Leave it empty to keep the current ones. | | **Device Name**, **Device Description** | The name and description shown in the console. | | **Asset Type**, **Asset Group**, **Product** | Under **Advanced Options**: the [asset type, asset group](https://docs.thinger.io/platform/assets.md) and [product](https://docs.thinger.io/platform/products.md) of the device. | | **Enabled** | Turn it off to close the connection of the device and refuse new ones. | | **Sleep Timeout** | Seconds without activity after which the device counts as asleep. Empty disables the asleep state. | | **Disconnect Timeout** | Seconds without activity after which the device counts as disconnected; at least 60. Empty uses the default (600 seconds for HTTP devices). | The sleep timeout must be shorter than the disconnect timeout. Timeouts apply at once, also to a device that is connected. New credentials do not close the current connection: the device keeps working until it reconnects, and then it needs the new credentials, so update the firmware first. ### Console Open the device and go to **Settings**. Change the fields and click **Update Device**. ### API **API call:** `PUT /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-update)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "credentials": "YOUR_DEVICE_CREDENTIALS", "connection": { "timeouts": { "sleep": 300, "disconnect": 900 } } }' ``` Send only the fields you change. `{"enabled": false}` disables the device. ### CLI ```bash thinger device update YOUR_DEVICE -s connection.timeouts.sleep=300 -s connection.timeouts.disconnect=900 ``` Send only the fields you change: `-s enabled=false` disables the device, and `-s credentials=YOUR_DEVICE_CREDENTIALS` sets new credentials. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-update). ### AI **Prompt for an AI agent:** > Set the disconnect timeout of YOUR_DEVICE to 15 minutes and the sleep timeout to 5 minutes. The agent uses `thinger_resource_update` with the `device` type. ## Store properties A property is a named JSON value stored on the device: a configuration the device reads when it starts, a threshold, a location. Properties stay on the platform when the device is offline. See [Properties](https://docs.thinger.io/platform/properties.md) for how properties work across devices, products and assets. ### Console Open the device, go to the **Properties** tab and click **Add**. Set the property ID and its JSON value, and save. ### API **API call:** `POST /v3/users/{user}/devices/{device}/properties` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-createproperty)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "property": "location", "value": { "lat": 40.4, "lon": -3.7 } }' ``` ### CLI ```bash thinger device property set YOUR_DEVICE location '{"lat": 40.4, "lon": -3.7}' ``` `thinger device property get YOUR_DEVICE location` reads it back. ### AI **Prompt for an AI agent:** > Set the location property of YOUR_DEVICE to latitude 40.4 and longitude -3.7. ## Label devices Labels are free key-value pairs on the device record, such as `site: madrid` or `batch: 2026-10`. Use them to find and group devices without creating asset types or groups. A label can have an empty value when only its key matters. Filter the device list by labels: | Query | Returns | |---|---| | `?labels=site` | Devices that have the `site` label, with any value. | | `?labels=site&labels=batch` | Devices that have both labels. | | `?labels.site=madrid` | Devices whose `site` label is `madrid`. | | `?labels.site=madrid&labels.site=paris` | Devices whose `site` label is either value. | Label keys start with a letter, a digit or `_`, and contain only letters, digits, `_` and `-`. ### Console The console does not show or edit labels yet. Set them and filter by them with the API or an agent. ### API **API call:** `PUT /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-update)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "labels": { "site": "madrid", "batch": "2026-10" } }' ``` The update replaces all the labels of the device. Then filter the list: **API call:** `GET /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-list)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/devices?labels.site=madrid" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger device update YOUR_DEVICE -s labels.site=madrid -s labels.batch=2026-10 thinger device list --filter labels=site ``` The update replaces all the labels of the device. `--filter labels=site` lists the devices that have the `site` label. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-list). ### AI **Prompt for an AI agent:** > Add the label site with value madrid to YOUR_DEVICE, then list all my devices that have the site label. The agent uses `thinger_resource_update`, and `thinger_resource_list` with a `labels` filter. ## Watch a device live The tabs of the device page follow the device as it works and give access to everything it holds. Some tabs show only for the device types they apply to: | Tab | Shows | |---|---| | **Status** | Connection state, live traffic, location and the [daily data transmission](#check-the-status) of the device. | | **Inspector** | The activity of the device as it happens. | | **API** | The device resources of a connected IOTMP device, which you can call from the console. | | **Terminal**, **Explorer** | A shell and a file browser on IOTMP devices that support them. See [Remote tools](https://docs.thinger.io/devices/remote-tools.md). | | **Dashboard** | The [dashboard](https://docs.thinger.io/platform/dashboards.md) of the device, when the device or its product has one. | | **Buckets** | The Data Buckets that store data of the device. | | **Tokens** | The [device tokens](#share-a-device-with-a-device-token) of the device. | | **Properties** | The [properties](#store-properties) of the device. | | **Callback** | The request and response settings of an HTTP device, for the [HTTP callback](https://docs.thinger.io/devices/http.md#http-callback-deprecated), which is deprecated: new integrations use a [product](https://docs.thinger.io/devices/http.md). | | **Geofences** | The [geofences](https://docs.thinger.io/platform/geofences.md) the device is checked against. | | **Settings** | The [settings and credentials](#change-the-settings-or-credentials) of the device. | To follow device activity from your own code, subscribe to [events](https://docs.thinger.io/reference/events.md) such as `device_state_change` and `device_resource_stream`. ## Limits - The device ID cannot be changed after the device is created. - Deleting a device cannot be undone: its properties and credentials are deleted with it. - Labels are replaced as a whole on each update: send every label you want to keep. - Device tokens cannot be edited: to change the device resources or the expiration of a token, create a new one and delete the old one. - The number of devices depends on your plan: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Data Buckets](https://docs.thinger.io/platform/data-buckets.md): Store time series data from your devices, read it back with filters and aggregations, and export it to a file. - [Dashboards](https://docs.thinger.io/platform/dashboards.md): Build dashboards with widgets that show and control your device data, organize them in tabs and share them with a link. - [Devices](https://docs.thinger.io/reference/rest-api/devices.md): REST API reference for Devices: create and configure devices, call their resources, and manage their tokens, properties, callbacks and files. 45 operations. - [CLI](https://docs.thinger.io/reference/cli.md): Every command and option of the thinger CLI, plus how to install it, sign in, use profiles, script it with JSON output and run its MCP server. --- Source: https://docs.thinger.io/platform/dashboards.md # Dashboards > Build dashboards with widgets that show and control your device data, organize them in tabs and share them with a link. A dashboard is a screen of widgets that shows device data in real time and lets you act on your devices: charts of a Data Bucket, gauges of a device resource, maps of your assets, buttons that change a property. You design it in the console, without code. For a dashboard written as a web app, see [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md). ## When to use it - To monitor devices in real time or over a time range. - To control devices from the console: switches, sliders and property buttons. - To share a read-only view of your data with people who have no account. ## Widgets Each widget has a type, a data source and display settings. The types are grouped in the **Widget Settings** dialog: | Group | Widgets | |---|---| | Display | **Time Series Chart**, **Apex Charts**, **Donut Chart**, **Progressbar**, **Gauge**, **Tachometer**, **Text/Value**, **Led Indicator**, **Clock**, **Google Map**, **Assets Map**, **Assets Table**, **Image/MJPEG**, **HTML Widget**, **HTML Time Series**, **Group Widget** | | Device Control | **On/Off State**, **Slider**, **Property Button**, **Property Table** | | Dashboard Control | **Source Switcher** | A widget reads its data from one of these sources: **From Device Resource** (live data of a connected device), **From Data Bucket** (stored data, the latest value or a time range), **From Device Bucket** (the data a [product](https://docs.thinger.io/platform/products.md) bucket keeps for one device), **From Device Property**, or **Manual** (fixed values, to try a widget). Time series widgets can aggregate and transform the data, and any source can pass its values through a [function](#functions) of the dashboard before the widget shows them. ![Five source types (device resource, device property, Data Bucket, device bucket and manual value) feed a chain of options: Refresh Mode and Time Period for live data, Timeframe, Aggregate and Transform for stored data, then an optional Processing function of the dashboard, and finally the widget.](https://docs.thinger.io/diagrams/dashboard-widget-data-flow.svg) *From the source to the widget* Every widget and its options are in [Widgets](https://docs.thinger.io/platform/dashboards/widgets.md); the source types, refresh modes, timeframes, aggregations and transformations are in [Widget data sources](https://docs.thinger.io/platform/dashboards/data-sources.md). The **HTML Widget** and the **HTML Time Series** widget show your own HTML, CSS and JavaScript, from a snippet or from a file of a [File Storage](https://docs.thinger.io/platform/file-storages.md): see [HTML Widget](https://docs.thinger.io/platform/dashboards/html-widget.md). To use one dashboard for many devices, add a [Source Switcher](https://docs.thinger.io/platform/dashboards/widgets.md#source-switcher). ## Create a dashboard `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Dashboards** Go to **Dashboards** and click **Add Dashboard** (or **Create a Dashboard** if you have none yet). **Step 2: Fill in the form** Set the **Dashboard id**, the **Dashboard name** and an optional **Dashboard description**, and click **Add Dashboard**. The empty dashboard opens. **Step 3: Add widgets** Turn on the edit mode in the dashboard toolbar and click **Add Widget**. Choose the **Type**, the data source and the display options, and save. Drag the widgets to place and resize them, and click **Add Tab** to split the dashboard into tabs. ![Widget Settings dialog of the Time Series Chart of the greenhouse dashboard, reading temperature and humidity from the climate bucket](https://docs.thinger.io/screenshots/dashboards-widget-settings.webp) *Widget Settings of a Time Series Chart* ### API **API call:** `POST /v1/users/{user}/dashboards` ([reference](https://docs.thinger.io/reference/rest-api/dashboards.md#dashboard-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/dashboards" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dashboard": "greenhouse", "name": "Greenhouse", "description": "Climate of the greenhouse", "tabs": [ { "name": "Main", "icon": "fas fa-tachometer-alt", "widgets": [] } ] }' ``` `YOUR_TOKEN` is an access token with permission to create dashboards. The API creates the dashboard; design its widgets in the console editor, which stores them in the same object. ### CLI ```bash thinger dashboard create greenhouse -n "Greenhouse" -d "Climate of the greenhouse" \ -s 'tabs=[{"name": "Main", "icon": "fas fa-tachometer-alt", "widgets": []}]' ``` As with the API, design its widgets in the console editor. `thinger dashboard` also builds and publishes [dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md). See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-dashboard-create). ### AI **Prompt for an AI agent:** > Create a dashboard for my greenhouse that shows the temperature and humidity of the greenhouse_climate bucket over the last 24 hours. Agents build dashboards as [dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md), with `thinger_resource_call` and the `publish` action of the `dashboard` type, rather than widget layouts. See [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md). ## Organize a dashboard in tabs Tabs split a dashboard into pages. Each tab has its own widgets and sources; the settings of **Layout** (columns, row height, background, border radius) apply to every tab. A tab loads its widgets the first time you open it and keeps receiving live data while you look at another tab. Turn on the edit mode and click **Add Tab**. The new tab is named **New Tab**. While in edit mode, every tab shows its controls: - Type in the name field to rename the tab. - Click the icon to choose another one from the icon menu. - Click **×** to delete the tab and its widgets. - Drag a tab to change the order. A dashboard has up to 10 tabs. With a single tab, the tab bar is hidden. ![Dashboard in edit mode with the Overview, Climate and Energy tabs, each with its icon, an editable name and a delete button, and the Settings, Add Tab and Add Widget buttons](https://docs.thinger.io/screenshots/dashboards-tabs-edit.webp) *Dashboard tabs in edit mode* ## Configure a dashboard Turn on the edit mode and click **Settings** in the dashboard toolbar to open **Dashboard Settings**: | Tab | What it sets | |---|---| | **Layout** | Name, description, columns, row height, background, border radius and whether to hide the header. | | **Share** | The public link of the dashboard (see [Share a dashboard](#share-a-dashboard)). | | **Developer** | The dashboard as JSON, to copy it or edit it by hand. | | **Placeholders** | Values you write as `{{name}}` in the dashboard and its widgets (see [Placeholders](#placeholders)). | | **Functions** | JavaScript functions that process the values of widget sources (see [Functions](#functions)). | | **Controls** | The aggregation, time range selector and hours controls shown to viewers. | ### Placeholders A placeholder is a named value of the dashboard. Write it between double braces in the dashboard name, in widget titles and subtitles, in **Manual** values and in the code of an [HTML Widget](https://docs.thinger.io/platform/dashboards/html-widget.md#template-variables), and read it in [functions](#functions). Click **Add Source** in **Placeholders** and set: | Field | What it does | |---|---| | **Name** | The name you write between the braces. | | **Data Source** | **From Device Property**: the value of a [property](https://docs.thinger.io/platform/properties.md) of a device, all of it or the fields you pick in **Select Fields**. **Manual**: a fixed number. | For example, a device has a property `location` with the value `"My house"`. Add a placeholder named `location` from that property, and set the **Manual** value of a **Text/Value** widget to `{{location}}`: the widget shows `My house`. With a [Source Switcher](https://docs.thinger.io/platform/dashboards/widgets.md#source-switcher), the placeholders read the properties of the device it selects. In text, a placeholder shows a text or a number. When its value is an object, such as a placeholder `site` from a property with several fields, read the fields in a function (`shared.placeholders.site.city`) or in an HTML Widget (`placeholders.site.city`). ![Placeholders tab of Dashboard Settings with a placeholder named location read from the location property of esp32_climate](https://docs.thinger.io/screenshots/dashboards-placeholders.webp) *A placeholder from a device property* ### Functions Functions process the values of a widget source before the widget shows them: round a number, convert units, turn a code into a text. Write them in JavaScript in **Functions**; **Add Function** inserts an empty one. Then choose the function in the **Processing** field of the source in the widget settings ([Processing](https://docs.thinger.io/platform/dashboards/data-sources.md#processing)). Each function receives one value and returns the value the widget shows: ```js function convertFunction(value, ts, series) { // multiply by the factor stored in the precision_factor property return value * shared.placeholders.precision_factor.multiplier; } function toFahrenheit(value, ts, series) { // one decimal return Math.round((value * 9 / 5 + 32) * 10) / 10; } ``` | Parameter | Content | |---|---| | `value` | The value of the source, after **Select Fields**: a number, a text or an object. | | `ts` | Its timestamp, in milliseconds. | | `series` | The configuration of the source, such as its `name`. | `shared` is an object that every function of the dashboard can read and write. `shared.placeholders` holds the [placeholders](#placeholders) by name. In the example, the device property `precision_factor` holds `{"multiplier": 6}`, and a placeholder named `precision_factor` reads it, so `convertFunction` multiplies each value by 6. > **Info** > > A function runs once per value, not over the whole series: a chart of 100 points calls it 100 times, and a chart of several fields calls it for each field. It cannot compute a total or an average over the series; use [Aggregate](https://docs.thinger.io/platform/dashboards/data-sources.md#aggregate) for that. Rules of the editor: - Declare each function as `function name(value, ts, series) { ... }`. Each name appears in **Processing**; code outside the functions is ignored. - Do not use the `function` keyword inside a function. Write helpers as arrow functions (`const round = x => Math.round(x)`), or keep them in `shared` to use them from several functions. - If a function throws an error, the widget shows the value without processing, and the error appears in the browser console. ![Functions tab of Dashboard Settings with convertFunction, which reads shared.placeholders, and toFahrenheit in the code editor](https://docs.thinger.io/screenshots/dashboards-functions.webp) *Dashboard functions* ## Share a dashboard Sharing gives a dashboard a public link that works without signing in. ![Turning on Share creates the access token Dashboard_ followed by the dashboard ID, with read access to the devices, buckets, properties and File Storages of the widgets; Update Token keeps those permissions in step each time you save the dashboard. The Share URL carries the token, and a person without an account opens it to see the dashboard read-only.](https://docs.thinger.io/diagrams/dashboard-sharing.svg) *How a shared dashboard reaches its data* ### Console Open the dashboard, turn on the edit mode, click **Settings** and go to **Share**. Turn on **Share**, click **Save**, and copy the **Share URL** or click **Open Link**. > **Warning** > > Sharing a dashboard creates an access token (named `Dashboard_` followed by the dashboard ID) that grants read access to the resources its widgets use. Anyone with the link can see them. Turn off **Share** or delete the token to revoke the link. The token gets the permissions the widgets need when you turn on **Share**. To keep them up to date, turn on **Update Token**, shown while the dashboard is shared: each time you save the dashboard, the token gets the permissions of its current widgets. Without it, widgets you add later with other devices, buckets or File Storages show no data on the shared link until you turn **Share** off and on again. ![Share tab of the Dashboard Settings of the greenhouse dashboard, with Share turned on and the Share URL](https://docs.thinger.io/screenshots/dashboards-share.webp) *Share tab of Dashboard Settings* ### API The API has no share call. Create an [access token](https://docs.thinger.io/platform/access-tokens.md) with read permissions on the resources the dashboard uses, and open `https://YOUR_SERVER/dashboards/{dashboard}?authorization=`. ### CLI The CLI has no share command either. Create the [access token](https://docs.thinger.io/platform/access-tokens.md) with `thinger token create` and open the same URL. ### AI **Prompt for an AI agent:** > Create a read-only access token for the devices and buckets of my greenhouse dashboard so I can share it. ## Show a dashboard on a device, product or asset A device, a [product](https://docs.thinger.io/platform/products.md), an asset type, an asset group or a project can have its own dashboard, shown in a **Dashboard** tab of its page. Store the dashboard object (with its widgets, or as a [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md)) in a property named `dashboard` of that resource. A product dashboard serves every device of the product. ![One dashboard serves many devices in three ways: a Source Switcher lets the viewer pick the device or bucket of every widget, placeholders take their values from the properties of the device, and the dashboard property of a product gives every device of the product the same dashboard in its Dashboard tab.](https://docs.thinger.io/diagrams/dashboard-templating.svg) *One dashboard for many devices* Combine it with a [Source Switcher](https://docs.thinger.io/platform/dashboards/widgets.md#source-switcher) and [placeholders](#placeholders) to build one dashboard that works for every device of the same kind. ## Limits - Widgets show only what the viewer may read: on a shared dashboard, the permissions of its access token. - Device resources update live only while the device is connected; buckets and properties work when it is offline. - Plan limits apply: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Widgets](https://docs.thinger.io/platform/dashboards/widgets.md): Every dashboard widget with all its options, from charts and gauges to maps, device controls and the Source Switcher. - [HTML Widget](https://docs.thinger.io/platform/dashboards/html-widget.md): Build dashboard widgets with your own HTML, CSS and JavaScript, from a code snippet or from the files of a File Storage. - [Widget data sources](https://docs.thinger.io/platform/dashboards/data-sources.md): Where dashboard widgets read their data, and how to set the refresh mode, timeframe, aggregation, transformations and processing of each source. - [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md): Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. - [Data Buckets](https://docs.thinger.io/platform/data-buckets.md): Store time series data from your devices, read it back with filters and aggregations, and export it to a file. - [Dashboards](https://docs.thinger.io/reference/rest-api/dashboards.md): REST API reference for Dashboards: create, read, update, clone and delete dashboards. 8 operations. --- Source: https://docs.thinger.io/platform/dashboards/widgets.md # Widgets > Every dashboard widget with all its options, from charts and gauges to maps, device controls and the Source Switcher. Every widget of a [dashboard](https://docs.thinger.io/platform/dashboards.md), with what it shows, when to use it and each option of its settings. Where the data comes from (device resources, Data Buckets, properties, timeframes, aggregation and transformations) is in [Widget data sources](https://docs.thinger.io/platform/dashboards/data-sources.md). ## Add or edit a widget Turn on the edit mode in the dashboard toolbar and click **Add Widget**. The **Widget Settings** dialog has three tabs: | Tab | What it sets | |---|---| | **Widget** | The [common settings](#common-settings) and the widget **Type**. | | The widget name (for example **Time Series Chart**) | The data source, or the device resource or property the widget controls. | | **Display Options** | The options of that widget type, listed on this page. | In edit mode each widget shows **Clone**, **Edit** and **Remove** buttons; double-click a widget to edit it. Drag a widget to move it and drag its corner to resize it. ![Widget tab of the Widget Settings dialog with the Title, Subtitle, Link To, Show Update, Show Offline, Show Fullscreen, Background and Type settings of a Time Series Chart](https://docs.thinger.io/screenshots/widgets-common-settings.webp) *Widget tab of Widget Settings* ## Common settings The **Widget** tab is the same for every widget type. | Setting | Default | What it does | |---|---|---| | **Title** | empty | Text at the top of the widget. Optional. | | **Subtitle** | empty | Smaller text below the title. Optional. | | **Link To** | none | Another dashboard. The widget shows a button that opens it, to go from a summary to a detailed dashboard. | | **Show Update** | off | Shows the time of the last value the widget received, next to the title. | | **Show Offline** | **None** | With **Timespan**, the widget is shown muted and marked offline when it receives no data for that time. With **None**, a widget fed by a device resource is marked offline while its device is disconnected. | | **Show Fullscreen** | off | Shows a button that opens the widget full screen. | | **Background** | `#ffffff` | Background color of the widget. Click **+** to add [colors by value](#background-colors-by-value). | | **Type** | | The widget type, grouped in **Display**, **Device Control** and **Dashboard Control**. | ### Background colors by value Click **+** next to **Background** to add a range with a **Min**, a **Max** and a color. When the widget receives a number between the minimum and the maximum of a range (both included), the background takes that color; the first matching range wins. Outside every range, the widget uses the **Background** color. Use it to make a value stand out: a Tachometer of pressure that turns red above a safe limit, or a Text/Value of battery level that turns orange when it is low. The text of the widget switches between dark and light to stay readable on the color. ![Tachometer of boiler pressure at 132 psi on a red background, the color of the Background range that contains the value](https://docs.thinger.io/screenshots/widgets-background-ranges.webp) *Background color by value* ## Display widgets ### Time Series Chart A line chart of one or more values over time. Use it to follow how a measure changes: the temperature of the last 24 hours, or the power of several devices side by side. Each line is a source, with one field. To draw several fields of the same bucket, add a source for each one: **Clone Source** copies the selected source, so you only change the field. Add sources with **Add Source** and delete the selected one with **Remove Source**. Each source has: | Field | What it does | |---|---| | **Name** | Name of the series, shown in the legend and the tooltip. Must be unique in the widget. | | Color | The color of the series, next to the name. Each new source gets a different color. | | **Data Source** | Where the values come from: **From Data Bucket**, **From Device Bucket**, **From Device Resource**, **From Device Property** or **Manual**, and the field to draw. See [Data sources](https://docs.thinger.io/platform/dashboards/data-sources.md#source-types). | | **Timeframe** | For bucket sources: which time range to show. See [Timeframe](https://docs.thinger.io/platform/dashboards/data-sources.md#timeframe). | | **Time Period** | For device resources and properties: how much live data to keep in the chart. See [Time Period](https://docs.thinger.io/platform/dashboards/data-sources.md#time-period). | | **Aggregate** and **Transform** | For buckets that support them: group the data in intervals and transform it. See [Aggregate](https://docs.thinger.io/platform/dashboards/data-sources.md#aggregate) and [Transform](https://docs.thinger.io/platform/dashboards/data-sources.md#transform). | | **Processing** | A dashboard function applied to the values. See [Processing](https://docs.thinger.io/platform/dashboards/data-sources.md#processing). | **Display Options**: | Option | Default | What it does | |---|---|---| | **Axis** | on | Shows the X and Y axes. | | **Legend** | off | Shows the legend with the name of each series. | | **Fill Splines** | off | Fills the area under each line. | | **Multiple Axes** | off | Gives each series its own Y axis, for values with different scales (temperature and pressure). | | **X Axis** | automatic | Number of ticks of the X axis (1 to 1000). Shown when **Axis** is on. | | **Y Axis** | automatic | Minimum, maximum and number of ticks (1 to 1000) of the Y axis. Leave them empty to fit the data. Shown when **Axis** is on. | ![Time Series Chart of the last 24 hours with two series, temperature and humidity of greenhouse_01, and the legend on](https://docs.thinger.io/screenshots/widgets-time-series-chart.webp) *Time Series Chart with two series* ### Apex Charts A chart drawn with [ApexCharts](https://apexcharts.com/): lines, areas, columns, scatter, heatmap, pie, donut, radial, radar or polar. Use it when the Time Series Chart is not enough: stacked columns of energy per day, or a pie with the share of each device. Its sources work as in the [Time Series Chart](#time-series-chart). In time charts (line, area, column, scatter, heatmap) each source is a series. In pie, donut, radial and polar charts each source is a slice with its latest value: the slice takes the name and the color of the source. **Display Options**: | Option | Default | What it does | |---|---|---| | **Real Time Update** | on | Updates the chart as new data arrives. Off, the chart keeps the data it loaded first. | | **Align Time Series** | off | Aligns the series on the same timestamps, adding empty points where a series has no value. It needs extra processing: turn it on only when a chart type needs it, such as stacked columns. Available with two or more sources and not in pie, donut, radial or polar charts. | | **Chart Template** | **Line** | The starting chart. Choosing a template replaces the chart options. | | **Show code** / **Preview chart** | | Switches between the chart preview and the code of its options. | The 17 templates are **Line**, **Line with Labels**, **Line with Markers**, **Step Line**, **Area**, **Spline Area**, **Stacked Area**, **Column**, **Column Stacked**, **Column Stacked 100%**, **Scatter**, **Heatmap**, **Pie Chart**, **Donut**, **Radial**, **Radar** and **Polar**. **Show code** opens the options of the chart as JavaScript that assigns an ApexCharts options object to `options`. Edit it to change anything ApexCharts supports: colors, curves, markers, axes, annotations. The data series come from the sources, so the code does not set them. The **Templates** link opens the ApexCharts demos for more examples. For instance, this code draws columns with rounded corners and data labels: ```js var options = { chart: { type: 'bar' }, plotOptions: { bar: { borderRadius: 4 } }, dataLabels: { enabled: true }, xaxis: { type: 'datetime' } }; ``` ![Display Options tab of an Apex Charts widget with Real Time Update, the Spline Area chart template and the preview of the chart](https://docs.thinger.io/screenshots/widgets-apex-charts.webp) *Apex Charts with the Spline Area template* ### HTML Time Series An [HTML Widget](#html-widget) that receives time series instead of single values: its sources work as in the [Time Series Chart](#time-series-chart), with timeframe, aggregation and transformations. Use it to draw a custom chart or table with your own HTML and JavaScript. Its **Display Options** are those of the HTML Widget. The shape of its data and a table example are in [HTML Widget](https://docs.thinger.io/platform/dashboards/html-widget.md#html-time-series). ![HTML Time Series widget with a table of the date, temperature and humidity of the latest records of the climate bucket](https://docs.thinger.io/screenshots/html-widget-time-series-table.webp) *HTML Time Series as a table* ### Donut Chart A ring that fills from a minimum to a maximum, with the value in the center. Use it for values with known limits: a tank level, a battery percentage. It has one source with one value (see [Data sources](https://docs.thinger.io/platform/dashboards/data-sources.md#source-types)), which can go through a dashboard function with **Processing**. | Option | Default | What it does | |---|---|---| | **Units** | empty | Unit shown with the value (`%`, `°C`). | | **Min Value** | `0` | Value of the empty ring. | | **Max Value** | `100` | Value of the full ring. | | **Donut Color** | `#1E313E` | Color of the filled part. | ![Donut Chart of the greenhouse humidity at 65 %](https://docs.thinger.io/screenshots/widgets-donut-chart.webp) *Donut Chart* ### Progressbar A horizontal bar that fills from a minimum to a maximum. Use it for progress or fill levels: a process completion, a tank, a disk. It has one source with one value. | Option | Default | What it does | |---|---|---| | **Units** | empty | Unit shown with the value. | | **Min Value** | `0` | Value of the empty bar. | | **Max Value** | `100` | Value of the full bar. | | **Icon** | none | A Font Awesome class (`fas fa-tachometer-alt`) or the URL of an image, shown with the bar. | | **Icon Color** | `#ffffff` | Color of a Font Awesome icon. Not shown for image URLs. | | **Icon Size** | `24` | Height of the icon in pixels, 16 to 128. | ### Gauge A semicircular gauge with the value in the center. Use it for a single reading with a range: speed, CPU load, noise level. It has one source with one value. | Option | Default | What it does | |---|---|---| | **Units** | empty | Unit shown below the value. | | **Min Value** | `0` | Start of the gauge. | | **Max Value** | `100` | End of the gauge. | | **Text Color** | `#1E313E` | Color of the value. With **Gradient** off, it is also the color of the gauge. | | **Gradient** | on | Colors the gauge from green (low) through yellow to red (high). | ![Gauge of CPU load at 72 % on a scale from 0 to 100](https://docs.thinger.io/screenshots/widgets-gauge.webp) *Gauge* ### Tachometer A dial with a needle, ticks and colored ranges, like a car speedometer. Use it when the reader must see at a glance whether a value is in a normal, warning or danger zone. It has one source with one value. | Option | Default | What it does | |---|---|---| | **Units** | empty | Unit shown on the dial. | | **Range Values** | `0` to `100` | Minimum and maximum of the dial. Click **+** to add colored ranges (min, max and color) drawn on the scale. | | **Plate Color** | `#ffffff` | Color of the dial face. | | **Text Color** | `#1E313E` | Color of the numbers and units. | | **Tick Color** | `#000000` | Color of the ticks. | | **Major Ticks** | `10` | Spacing between major ticks. | | **Show Value** | on | Shows the value as a number in the dial. | To change the whole widget color when the value is dangerous, add [background colors by value](#background-colors-by-value) too. ![Tachometer of line pressure at 72 psi with green, yellow and red ranges and the value shown as a number](https://docs.thinger.io/screenshots/widgets-tachometer.webp) *Tachometer with color ranges* ### Text/Value Shows a value or a text, with units, an icon and an extra text, each of them able to change with the value. Use it for any reading that needs no chart: the current temperature, a device status, the last error message. It has one source with one value; with **Manual**, the fixed value is a text. The **Display Options** tab has three tabs. **Value**: | Option | Default | What it does | |---|---|---| | **Decimal Places** | `2` | Decimal places of numeric values. | | **Units** | empty | Unit shown after the value. | | **Units Size** | `20px` | Size of the unit, in px, em or rem. | | **Text Color** | `#1E313E` | Color of the value. Accepts conditions (see below). | | **Text Size** | `75px` | Size of the value, in px, em or rem. | | **Text Weight** | **Light** | **Light**, **Normal** or **Bold**. | | **Text Alignment** | **Center** | **Left**, **Center** or **Right**. | | **Open URL** | empty | A link opened when you click the value. | **Icon**: | Option | Default | What it does | |---|---|---| | **Icon** | none | A Font Awesome icon or the URL of an image. Accepts conditions. | | **Icon Color** | off, `#1E313E` | Turn it on to give the icon its own color; off, Font Awesome icons use the text color and images keep theirs. Accepts conditions. | | **Icon Size** | off, `75px` | Turn it on to give the icon its own size; off, it uses the text size. | | **Icon Position** | **Before Value** | **Before Value**, **After Value**, **Top Right**, **Bottom Left** or **Bottom Right**. | | **Icon Gap** | `8px` | Space between the icon and the value. | | **Vertical Offset** | `0px` | Moves the icon up (negative) or down to align it with the value. | **Extra Text**: | Option | Default | What it does | |---|---|---| | **Text** | empty | An additional text shown with the value. Accepts conditions. | | **Text Color** | off, `#1E313E` | Turn it on to give the extra text its own color; off, it uses the main text color. Accepts conditions. | | **Text Size** | `20px` | Size of the extra text. | | **Text Weight** | **Light** | **Light**, **Normal** or **Bold**. | | **Text Position** | **Above Value** | **Above Value**, **Below Value**, **After Value**, **Before Value** or **Replace Value**. With **Replace Value** the text is shown instead of the value: use it with conditions to show a word for each value (`0` → "Closed", `1` → "Open"). | **Conditions by value.** The options that accept conditions let you add values for ranges: each condition has the value to use (a color, an icon or a text), a **Min** and a **Max**. When the widget value is a number greater than the minimum and lower than or equal to the maximum, the option takes the value of the first matching condition; otherwise it keeps its normal value. ![Three Text/Value widgets: a temperature of 28.4 °C with a thermometer icon, a battery at 12 % with a red battery icon and a door shown as Open](https://docs.thinger.io/screenshots/widgets-text-value.webp) *Text/Value widgets with icons and text conditions* ### Led Indicator A round light whose color depends on the value, and that can blink. Use it for states and alarms: green when a machine runs, red when it stops, blinking when it needs attention. It has one source with one value. | Option | Default | What it does | |---|---|---| | **Led Size** | `75px` | Diameter of the LED, as a CSS size. | | **Color** | `#4bd763` | Color of the LED when no range matches. Click **+** to add colored ranges. | | Color ranges | | Each range has a color, a **Min**, a **Max** and a blink switch. A value between the minimum and the maximum (both included) gives the LED that color; with the switch on, the LED blinks. Click the LED to stop the blinking. | For an RGB LED with three states, add three ranges: `0` to `0` red, `1` to `1` green and `2` to `2` blue, and turn on blinking in the red one. ![Three Led Indicator widgets: Pump 1 in red (value 0, blinking), Pump 2 in green (value 1) and Pump 3 in blue (value 2)](https://docs.thinger.io/screenshots/widgets-led-row.webp) *Three Led Indicators by value* ![Display Options tab of a Led Indicator with the LED size and three color ranges: 0 red with blink, 1 green and 2 blue](https://docs.thinger.io/screenshots/widgets-led-indicator.webp) *Color ranges of a Led Indicator* ### Clock The current time of the viewer's computer, as `HH:mm:ss`. Use it on dashboards shown on a screen, or to compare local time with UTC. It has no data source. | Option | Default | What it does | |---|---|---| | **Color** | `#1E313E` | Color of the digits. | | **UTC** | off | **Show in UTC** shows UTC instead of the local time of the browser. | ![Clock widget showing 12:00:00 in UTC](https://docs.thinger.io/screenshots/widgets-clock.webp) *Clock in UTC* ### Google Map A Google map with the location of one or more devices, live or from stored data. Use it to track vehicles, assets or sensors in the field: a GPS tracker, a Sigfox device that reports its position to a Data Bucket. Each source is a marker. For each source, choose where the location comes from and select the **Latitude** and **Longitude** fields of the data (in degrees): | Source | What it shows | |---|---| | **From Device Resource** | The position a connected device reports. | | **From Data Bucket** or **From Device Bucket** | The stored positions. With a **Timeframe**, the map draws the track of that time range. | | **From Device Property** | A position stored in a property. | | **Fixed Location** | A latitude and longitude you enter. | | **Current Location** | The location of the viewer's browser. | **Display Options**: | Option | Default | What it does | |---|---|---| | **Center** | on | Centers the map on the latest position. | | **Zoom Level** | `8` | Initial zoom, 1 (world) to 20 (buildings). | | **Map Type** | **Roadmap** | **Roadmap**, **Satellite**, **Hybrid** or **Terrain**. | | **Waypoints** | on | Shows a mark at each point of the track. | | **Location** | `0`, `0` | Latitude and longitude where the map starts, before it receives any position. | | **Geofences** | none | A device whose [geofences](https://docs.thinger.io/platform/geofences.md) the map draws. | | **Hide Controls** | off | Hides the Google Maps controls (zoom, map type, street view). | This video shows a device sending its GPS position over GPRS to a live map. It was recorded with an earlier version of the console; the map works the same way. [Video: LinkItOne Real-Time GPS Tracking](https://www.youtube.com/watch?v=3QDDOPMg22g) ![Google Map widget with the track of a van in Madrid over the last 8 hours, drawn from the latitude and longitude of a Data Bucket](https://docs.thinger.io/screenshots/widgets-google-map.webp) *Google Map with the track of a vehicle* ![Google Map tab of Widget Settings with the fleet_gps bucket of van_01 as source and its lat and lon fields mapped to Latitude and Longitude](https://docs.thinger.io/screenshots/widgets-google-map-source.webp) *Latitude and Longitude fields of a Google Map source* ### Assets Map A map with the location of many devices at once, with clusters, search and connection filters. Use it to see a whole fleet: every truck of a group, every sensor of a product. The **Assets Map** tab sets **Assets to Plot**: **All assets**, **From Asset Type**, **From Asset Group** or **From Asset Product**, and the type, group or product to show. A device appears on the map when it has a location. See [Assets](https://docs.thinger.io/platform/assets.md). **Display Options**: | Option | Default | What it does | |---|---|---| | **Map Type** | **Roadmap** | **Roadmap**, **Satellite**, **Hybrid** or **Terrain**. | | **Show Options** | off | Shows controls on the map to turn its features on and off. | | **Show Search** | on | Shows a search box to find a device on the map. | | **Geofences** | on | Draws the geofences of the asset type or group. Shown when you plot a type or a group. | | **Connected** | on | Shows the connected devices. | | **Disconnected** | on | Shows the disconnected devices. | | **Clustering** | on | Groups nearby devices into clusters that show how many devices they hold. | ![Assets Map with two clusters, four assets near Madrid and three in Valencia, and the search box](https://docs.thinger.io/screenshots/widgets-assets-map.webp) *Assets Map with clusters* ### Assets Table A table with one row per device, with the columns you define, sortable and searchable, that you can export. Use it for fleet lists: name, product, connection state and time since the last connection of each device. The **Assets Table** tab sets **Assets to Plot** as in the [Assets Map](#assets-map). In **Display Options**, add **Columns**. Each column has: | Field | What it does | |---|---| | **Column Name** | Header of the column. | | **Field Type** | How the value is shown and sorted: **String**, **Switch**, **Number**, **Date**, **Time**, **DateTime** or **TimeAgo** (time since the value, such as "5 minutes ago"). | | **Value Template** | The value of the cell: text with fields of the device between double braces, such as `{{name}}`, `{{asset_group}}` or `{{connection.active}}`. Empty fields show `-`. | The available fields are `device`, `name`, `description`, `type`, `enabled`, `connection`, `asset_type`, `asset_group` and `product`. Click a header to sort, and use the search icon of a text column to filter. **Export to CSV** and **Export to PDF** download the table. ![Assets Table of the madrid_plant group with the columns Name, Product, Connected as a switch and Last connection, and the Export to CSV and Export to PDF buttons](https://docs.thinger.io/screenshots/widgets-assets-table.webp) *Assets Table* ### Image/MJPEG An image from a URL: a still image that can refresh, or the MJPEG stream of an IP camera. Use it for logos and plans, or to watch a camera next to the readings of the same place. | Option | Default | What it does | |---|---|---| | **Image Source** | | **MJPEG Url** for a camera stream, or **Still Image Url** for an image. | | **MJPEG URL** | | URL of the MJPEG stream. | | **Image URL** | | URL of the image. | | **Refresh Interval** | `0` | For still images, seconds between reloads of the image. `0` loads it once. | The browser of the viewer loads the URL, so it must be reachable from it and, on an HTTPS console, served over HTTPS. ![Image/MJPEG widget showing the floor plan of a greenhouse, a still image loaded from a public File Storage](https://docs.thinger.io/screenshots/widgets-image-mjpeg.webp) *Image/MJPEG with a still image* ### HTML Widget A widget made with your own HTML, CSS and JavaScript, for anything the other widgets do not show. It receives the values of its sources, and can select several fields of a source. | Option | What it does | |---|---| | **HTML Source** | **Code Snippet** to write the HTML in an editor, or **File Storage** to load it from a file of a [File Storage](https://docs.thinger.io/platform/file-storages.md). | | **File Storage** | The file storage and the file (`index.html` by default), with **File Storage**. | How to write the code, the variables it receives and examples are in [HTML Widget](https://docs.thinger.io/platform/dashboards/html-widget.md). ![HTML Widget with the hello world template: a Hello World heading, the timestamp, the date and the latest value of the climate bucket](https://docs.thinger.io/screenshots/widgets-html.webp) *HTML Widget with a hello world template* ### Group Widget A container for other widgets, with its own grid. Use it to keep related widgets together, such as the gauge and the humidity chart of one room, and move them as one block. In edit mode, click **+** in the group to add a widget inside it; drag the inner widgets to arrange them. A group can hold any widget except another Group Widget, an Assets Table and a Property Table. > **Info** > > The Group Widget has no data of its own: each widget inside it has its own source and settings. ![Group Widget titled Greenhouse 01 with a temperature gauge and a Time Series Chart of humidity inside](https://docs.thinger.io/screenshots/widgets-group-widget.webp) *Group Widget with a gauge and a chart* ## Device control widgets Control widgets change a device resource or a property. They write to **Device Resource** (an input resource of a device; the device must be connected) or **Device Property**, selected in **Target Value**. They also show the current value: the one the resource returns, or the one stored in the property. To write the input resources in your firmware, see [Arduino coding](https://docs.thinger.io/devices/arduino/coding.md). ### On/Off State A switch or a button that turns a boolean on and off. Use it to control a light, a relay or a motor, and to see its current state. | Option | Default | What it does | |---|---|---| | **Switch Style** | **Switch** | **Switch** shows a toggle. **Button** shows a round button that toggles on each click. **Push Button** is on while you hold it pressed and off when you release it, like a doorbell. | | **On Color** | `#4bd763` | Color of the button when the value is on. | | **Off Color** | `#ff4d4f` | Color of the button when the value is off. | | **Icon** | `fa-power-off` | A Font Awesome icon or the URL of an image, shown in the button. | | **Icon Color** | `#ffffff` | Color of a Font Awesome icon. | | **Icon Size** | `42` | Height of the icon in pixels, 16 to 48. | All the options but **Switch Style** apply to the **Button** and **Push Button** styles. ![Two On/Off State widgets: Fan with the Switch style turned on and Lights with the Button style and a lightbulb icon in green](https://docs.thinger.io/screenshots/widgets-on-off-state.webp) *On/Off State with the Switch and Button styles* ### Slider A slider that sets a number. Use it to adjust a set point: a target temperature, a threshold, the speed of a fan. | Option | Default | What it does | |---|---|---| | **Min Value** | `0` | Lowest value of the slider. | | **Max Value** | `100` | Highest value of the slider. | | **Step Width** | `1` | Increment between values, from `0.01`. | The slider sends the value as you move it. ![Slider of the target temperature from 10 to 30 with the handle at 24](https://docs.thinger.io/screenshots/widgets-slider.webp) *Slider* ### Property Button A button that opens a property of a device in a form, to read and edit it from the dashboard. Use it for settings that change rarely: the configuration of a device, its calibration. | Option | Default | What it does | |---|---|---| | **Property** | | The device and the property to open. | | **Button Icon** | `far fa-list-ul` | Icon of the button. | ![Property dialog opened by a Property Button with the settings property of greenhouse_01: sampling interval, temperature offset and alert thresholds](https://docs.thinger.io/screenshots/widgets-property-button.webp) *Property form opened by a Property Button* See [Properties](https://docs.thinger.io/platform/properties.md). ### Property Table A table of device properties that you can read and edit in place. Use it to manage the same setting across devices, or the fields of several properties of one device. Each source is a row: a **From Device Property** source with a device and a **Property Identifier**, or a **Property Pattern** that adds one row for each property of the device that matches it. In **Display Options**, add **Columns**: | Field | What it does | |---|---| | **Column Name** | Header of the column. | | **Field Type** | **Text** (read only), **Switch**, **Input Text**, **Input Number**, **Slider**, **Color Picker**, **Time Picker**, **Property Button** (opens the property, as the [Property Button](#property-button)) or **Save Button** (saves the changes of the row). | | **Value Path** | The field of the property shown in the column. Not used by **Property Button** and **Save Button**. | | Min and max | For **Input Number** and **Slider**, the limits of the value. | | **Button Icon** / **Save Icon** | For **Property Button** and **Save Button**, the icon of the button. | Changes stay in the row until you click its **Save Button**, which writes them to the property. Add a **Save Button** column to any table with editable columns. ![Property Table with one row per climate device and the columns Name, Enabled as a switch, Threshold as a number input and a Save button](https://docs.thinger.io/screenshots/widgets-property-table.webp) *Property Table* ## Dashboard control widgets ### Source Switcher A drop-down that changes the device, bucket or bucket tags of the widgets of the same dashboard tab. Use it to build one dashboard for every device of the same kind: the viewer picks a device and every widget shows its data. | Option | What it does | |---|---| | **Source Type** | What the switcher changes: **Device**, **Bucket** or **Bucket Tags**. | | **Search Hint** | Text of the drop-down before a selection, such as "Select truck...". | | **Search Icon** | Icon shown with the selected item. Defaults to a rocket for devices, a database for buckets and a tag for tags. **Device** and **Bucket** only. | | **Asset Type**, **Asset Group** and **Product** | Limit the items offered to those of an asset type, an asset group or a product. **Device** and **Bucket** only. | | **Bucket Tag** | For **Bucket Tags**: the bucket, the tag, and the **Minimum Tag Number** and **Maximum Tag Number** of values the viewer must and can select. | What each type changes: - **Device**: the device of the device resource, device property and device bucket sources, and the `device` tag of Data Bucket sources. - **Bucket**: the Data Bucket of the bucket sources. - **Bucket Tags**: the selected values of that tag in the sources of that bucket, to show one or several devices, places or groups stored in a shared bucket. Configure the widgets with one device or bucket first: the switcher starts on it and replaces it with the viewer's choice. ![Source Switcher open with the devices of the env_sensor product, above the temperature, humidity and temperature chart of the selected device](https://docs.thinger.io/screenshots/widgets-source-switcher.webp) *Source Switcher with the devices of a product* ## Related pages - [Widget data sources](https://docs.thinger.io/platform/dashboards/data-sources.md): Where dashboard widgets read their data, and how to set the refresh mode, timeframe, aggregation, transformations and processing of each source. - [Dashboards](https://docs.thinger.io/platform/dashboards.md): Build dashboards with widgets that show and control your device data, organize them in tabs and share them with a link. - [Data Buckets](https://docs.thinger.io/platform/data-buckets.md): Store time series data from your devices, read it back with filters and aggregations, and export it to a file. --- Source: https://docs.thinger.io/platform/dashboards/html-widget.md # HTML Widget > Build dashboard widgets with your own HTML, CSS and JavaScript, from a code snippet or from the files of a File Storage. The **HTML Widget** and the **HTML Time Series** widget show the data of their sources with your own HTML, CSS and JavaScript. Use them for anything the other [widgets](https://docs.thinger.io/platform/dashboards/widgets.md) do not show: a custom card, a table of records, a third-party snippet or a whole AngularJS component. ![The HTML Widget receives the latest value of one source as value and its timestamp as ts. The HTML Time Series widget receives several sources merged by timestamp as an array of rows, newest first, with one key per source name. Both pass value to your template, which comes from a code snippet or from a File Storage file, together with ts, source, sources, properties and placeholders.](https://docs.thinger.io/diagrams/html-widget-data.svg) *What your code receives* Your code runs in the browser of whoever opens the dashboard, not on the server. The console compiles it as an [AngularJS](https://docs.angularjs.org/guide/templates) template, so you write the values with double braces, such as `{{value}}`, and use AngularJS directives and filters such as `ng-repeat` and `date`. ## Choose a widget | | **HTML Widget** | **HTML Time Series** | |---|---|---| | Sources | One. | One or more. | | Data | The latest value of the source, all of it or the fields you select. | The time series of each source, with timeframe, aggregation and transformation, as in the [Time Series Chart](https://docs.thinger.io/platform/dashboards/widgets.md#time-series-chart). | | `value` | The value, or an object with the selected fields. | An array of rows, one per timestamp, newest first. | | Use it for | Cards, status panels, third-party snippets. | Custom tables and charts of stored data. | ## Settings The **Widget** tab has the [common settings](https://docs.thinger.io/platform/dashboards/widgets.md#common-settings) of every widget. The source tab of the **HTML Widget** takes one source of any type: **From Data Bucket**, **From Device Bucket**, **From Device Resource**, **From Device Property** or **Manual**. **Select Fields** picks the fields of the value; leave it empty to receive the whole value. The source tab of the **HTML Time Series** takes several sources, configured as in the Time Series Chart; the **Name** of each source is its key in the rows. Both offer **Processing** with the [functions of the dashboard](https://docs.thinger.io/platform/dashboards.md#functions). The source types are in [Widget data sources](https://docs.thinger.io/platform/dashboards/data-sources.md). The **Display Options** tab sets where the code comes from: | Option | Default | What it does | |---|---|---| | **HTML Source** | | **Code Snippet** to write the code in an editor, or **File Storage** to load it from a file. | | **File Storage** | | With **File Storage**, the storage and the name of the file. | | File name | `index.html` | An `.html` file is compiled as a template; a `.js` file is loaded as an AngularJS directive (see [Build a widget as a directive](#build-a-widget-as-a-directive)). | ![Display Options tab of an HTML Widget with HTML Source set to Code Snippet and the hello world template in the code editor](https://docs.thinger.io/screenshots/html-widget-display-options.webp) *HTML Widget with a code snippet* ## Template variables A code snippet and an `.html` file can use these variables: | Variable | Content | |---|---| | `value` | **HTML Widget**: the latest value of the source, such as `21.5`, or an object with its fields, such as `{"temperature": 21.5, "humidity": 40}`. **HTML Time Series**: the array of rows (see [HTML Time Series](#html-time-series)). | | `ts` | **HTML Widget**: the timestamp of the latest value, in milliseconds. `0` until the first value arrives. | | `source` | The configuration of the first source of the widget: its name, type, device or bucket and fields. | | `sources` | The configuration of every source of the widget, as an array. | | `properties` | The **Display Options** of the widget. | | `placeholders` | The values of the [dashboard placeholders](https://docs.thinger.io/platform/dashboards.md#placeholders), by name: `{{placeholders.location}}`. | The code is a fragment that goes inside the widget: do not add ``, `` or ``. Each new value updates the template on its own. > **Info** > > Do not name a dashboard placeholder like a template variable (`value`, `ts`, `source`): the dashboard replaces every `{{name}}` of a placeholder in the widget settings, the template included. Read placeholders in templates as `placeholders.`. ## Code snippet With **HTML Source** set to **Code Snippet**, write the code in the editor of **Display Options**. ### Show the latest value This snippet shows the timestamp as a number and as a date, and the value: ```html

Hello World

Ts: {{ts}}

Date: {{ts | date:'medium'}}

Value: {{value}}

``` When the source has several fields, read each one with a dot: ```html

Temperature: {{value.temperature | number:1}} °C

Humidity: {{value.humidity | number:0}} %

``` ### Draw with CSS Bind the value to styles with `ng-style`. This bar fills to a percentage, such as the level of a tank: ```html

Level: {{value | number:0}} %

``` ### Add third-party snippets Paste the snippet of an external service, such as a weather forecast or a banner, as the service gives it. Its ` ``` Replace the address with the one of your provider. Snippets whose script writes with `document.write` do not work in a widget: the page has already loaded, so the browser ignores what the script writes or replaces the whole dashboard with it. Ask your provider for a version that inserts its content into an element. > **Warning** > > The code of the widget runs inside the console with the session of whoever opens the dashboard. Add only scripts you trust. ## HTML Time Series The **HTML Time Series** widget merges the data of all its sources by timestamp. `value` is an array with one row per timestamp, newest first: each row has `ts`, in milliseconds, and one key per source **Name** with the value of that source at that time. A source with no value at a timestamp has no key in that row. For two sources named `temperature` and `humidity`, `value` looks like this: ```json [ { "ts": 1718000060000, "temperature": 21.6, "humidity": 41 }, { "ts": 1718000000000, "temperature": 21.5, "humidity": 40 } ] ``` This template shows the rows in a table. `ng-repeat` repeats the `` for each entry of `value`, and the column names match the source names: ```html
Date Temperature Humidity
{{entry.ts | date:'medium'}} {{entry.temperature}} {{entry.humidity}}
``` Use sources with the same timestamps, such as fields of one Data Bucket, so each row is complete. ![HTML Time Series widget with a table of the date, temperature and humidity of the latest records of the climate bucket](https://docs.thinger.io/screenshots/html-widget-time-series-table.webp) *HTML Time Series as a table* ## From a File Storage For larger widgets, or to use one widget in several dashboards, keep its code in a [File Storage](https://docs.thinger.io/platform/file-storages.md). Set **HTML Source** to **File Storage**, choose the storage and type the file name: - An `.html` file is compiled like a code snippet, with the same [variables](#template-variables). - A `.js` file is loaded as an AngularJS directive, which can have its own logic and react to each change. The console reads the file with the access of whoever opens the dashboard. When you [share the dashboard](https://docs.thinger.io/platform/dashboards.md#share-a-dashboard), its access token can read the files of the storage. If a viewer cannot read the storage, such as a [project](https://docs.thinger.io/platform/projects.md) member without permission on it, the widget loads only if the storage has **Public Read** on. ### Build a widget as a directive **Step 1: Create the storage** Create a [File Storage](https://docs.thinger.io/platform/file-storages.md#create-a-file-storage) for your widgets. **Step 2: Add the two files** Create `helloWidget.js` and `helloWidget.html` in the storage, with the code below. The `.js` file holds the logic; the `.html` file, the view. The directive finds its `.html` next to its `.js`. **Step 3: Point the widget to the script** Add an **HTML Widget**, set **HTML Source** to **File Storage**, choose the storage and type `helloWidget.js`. The widget shows the source, the timestamp and the value. **helloWidget.js** ```js angular.module('helloWidget', []) .directive('helloWidget', function () { return { restrict: 'EA', scope: { source: "=", ts: "=", value: "=" }, templateUrl: function () { // load helloWidget.html from the same folder as this script const script = document.querySelector("script[src*='helloWidget.js']"); return script.src.replace('.js', '.html'); }, controller: ["$scope", function ($scope) { console.log("controller initialized, scope is", $scope); // runs when the source configuration changes $scope.$watch('source', function (newVal, oldVal) { console.log("Source has changed:", newVal, oldVal); }); // runs when a new value arrives $scope.$watch('value', function (newVal, oldVal) { console.log("Value has changed:", newVal, oldVal); }); }] }; }); ``` **helloWidget.html** ```html

Hello World from an AngularJS directive

Source is {{source}}

Timestamp is {{ts}}

Value is {{value}}

``` The console names the directive after the file: it takes the name up to the first dot and turns `camelCase` into dashes, so `helloWidget.js` becomes ``. Name the file in `camelCase`, exactly like the directive and its module. The directive receives these attributes; declare in its `scope` the ones it uses: | Attribute | Content | |---|---| | `value`, `ts`, `source`, `sources`, `properties` | As in the [template variables](#template-variables). | | `callback` | An object where the directive sets functions the widget calls (see below). | | Callback | Called | |---|---| | `onUpdate(rows)` | **HTML Time Series**: after the rows of `value` change, with the rows. | | `onSourceUpdate(source, data)` | **HTML Time Series**: when one source receives data, with its configuration and its points as `[ts, value]` pairs. | | `onClear(source)` | When the widget clears its data: after you edit the widget, when a [Source Switcher](https://docs.thinger.io/platform/dashboards/widgets.md#source-switcher) selects another device or bucket, or when the time range changes. | In an **HTML Time Series** widget, `value` keeps the same array and changes its content, so `$scope.$watch('value', …)` does not fire: use `onUpdate`, or `$scope.$watchCollection('value', …)`. ### React to each new value This directive draws a dot that pulses each time a new value arrives, next to the value. It watches `ts`, which changes with every record even when the value repeats: **pulseWidget.js** ```js angular.module('pulseWidget', []) .directive('pulseWidget', function () { return { restrict: 'EA', scope: { ts: "=", value: "=", callback: "=" }, templateUrl: function () { const script = document.querySelector("script[src*='pulseWidget.js']"); return script.src.replace('.js', '.html'); }, controller: ["$scope", "$timeout", function ($scope, $timeout) { $scope.pulse = false; // restart the animation on every new record $scope.$watch('ts', function (newTs, oldTs) { if (!newTs || newTs === oldTs) return; $scope.pulse = false; $timeout(function () { $scope.pulse = true; }, 20); }); // stop the animation when the widget clears its data $scope.callback.onClear = function () { $scope.pulse = false; }; }] }; }); ``` **pulseWidget.html** ```html
{{value}}
``` Use it in an **HTML Widget** with one value, such as the temperature of a device resource. ## Related pages - [Widgets](https://docs.thinger.io/platform/dashboards/widgets.md): Every dashboard widget with all its options, from charts and gauges to maps, device controls and the Source Switcher. - [Widget data sources](https://docs.thinger.io/platform/dashboards/data-sources.md): Where dashboard widgets read their data, and how to set the refresh mode, timeframe, aggregation, transformations and processing of each source. - [File Storages](https://docs.thinger.io/platform/file-storages.md): Keep files on your Thinger.io instance, edit them online, serve them over HTTP and use them from dashboards, apps and product code. - [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md): Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. --- Source: https://docs.thinger.io/platform/dashboards/data-sources.md # Widget data sources > Where dashboard widgets read their data, and how to set the refresh mode, timeframe, aggregation, transformations and processing of each source. Every display widget reads its values from one or more sources, set in the tab named after the widget in **Widget Settings**. This page lists the source types and the options that choose, group and transform the data before the [widget](https://docs.thinger.io/platform/dashboards/widgets.md) shows it. ![Five source types (device resource, Data Bucket, device bucket, device property and manual value) feed a chain of options: Refresh Mode or Time Period for live data, Timeframe, Aggregate and Transform for bucket data, then Processing with a dashboard function, and finally the widget](https://docs.thinger.io/diagrams/dashboard-widget-data-flow.svg) *From the source to the widget* ## Source types Choose the type in **Data Source**. Not every widget offers every type: control widgets write to a target instead (see [Device control widgets](https://docs.thinger.io/platform/dashboards/widgets.md#device-control-widgets)), and the Google Map adds fixed and browser locations. | Data Source | What it reads | Stored | |---|---|---| | **From Data Bucket** | The records of a [Data Bucket](https://docs.thinger.io/platform/data-buckets.md). | yes | | **From Device Bucket** | The records a [product](https://docs.thinger.io/platform/products/buckets.md) bucket keeps for one device. | yes | | **From Device Resource** | The live values of an output resource of a device. | no | | **From Device Property** | A [property](https://docs.thinger.io/platform/properties.md) of a device. | yes | | **Manual** | A fixed value you type in **Fixed Value**: a number, or a text in the Text/Value widget. Use it to try a widget. | | After the source, select the value to show in **Source value** or **Select Value**. Each source gives one value or series; charts take several sources. The HTML Widget can take several fields of one source with **Select Fields**, and the Google Map maps a **Latitude** and a **Longitude** field. ### From Data Bucket Select the bucket in **Select Bucket** and the value or fields. If the bucket has tags, a **Tag** field for each one filters the records, for example to show only some devices of a shared bucket. Single-value widgets show the latest record; charts use the [Timeframe](#timeframe). The widget updates when the bucket receives a record. If the live connection of the dashboard is not available, it reads the bucket again every minute. ### From Device Bucket Select the device in **Select Device**, then the bucket in **Select Bucket**. It works as **From Data Bucket**, on the records of that device only. ### From Device Resource Select the device in **Select Device**, the resource in **Select Resource** and the value or fields. The list shows output and input-output resources; the device must be connected, or belong to a product, to list them. If the console cannot read the resources, type the name in **Enter Resource Name**. The values are not stored: the widget shows what it receives while the dashboard is open, and starts empty when you reload it. To keep a history, store the resource in a [Data Bucket](https://docs.thinger.io/platform/data-buckets.md) and read the bucket. The widget is marked offline while the device is disconnected. Choose how the values arrive in **Refresh Mode**: | Refresh Mode | What it does | |---|---| | **Sampling Interval** | The platform reads the resource at a fixed interval while the dashboard is open, `5` minutes by default, from seconds to years. When several widgets read the same resource at different intervals, the device is read at their greatest common divisor and each widget takes the readings it needs. | | **Stream by Device** | The device sends the value when it decides, with `thing.stream()`: for example when a door opens. See [Stream a resource in real time](https://docs.thinger.io/devices/arduino/coding.md#stream-a-resource-in-real-time). | | **None** | The dashboard does not request periodic readings. As with **Stream by Device**, the widget only shows the values the device streams. | ### From Device Property Select the device in **Select Device** (the list can be filtered by project, product, group, type or device), the property in **Select Property**, and the value. In a widget that takes several fields, leave **Select Fields** empty to take every value of the property. The widget updates when the property changes. ## Time Period Charts fed by a device resource or a property keep the values they receive for a **Time Period**: `30` minutes by default, from seconds to years. Older values leave the chart. As the values are not stored, the chart starts empty when you reload the dashboard. ## Timeframe Charts and maps fed by a bucket show the records of a **Timeframe**: | Timeframe | What it shows | |---|---| | **Latest Value** | The latest record, and the new ones as they arrive. | | **Relative** | A window that moves with time, set in **Time Period**: **latest** N seconds, minutes, hours, days, weeks, months or years (the last 6 hours by default), or **previous** N units (the same span just before it, from 2N to N ago, to compare two periods). | | **Absolute** | A fixed range between a **Start Date** and an **End Date**. | | **Configurable** | The range the viewer chooses in the date selector of the dashboard header. | Single-value widgets always show the latest record of the bucket. ### Configurable timeframe and aggregation A source with **Configurable** timeframe makes the dashboard show a date selector in its header, with a relative range (latest or previous N units) or an absolute range, so viewers can explore the data without editing the dashboard. If an aggregation is **Configurable** too, the selector also offers the aggregation interval. Changing the selection reloads every source with a configurable timeframe. Until you set them in **Dashboard Settings > Controls**, the selector starts at the last 30 minutes, aggregated by 1 minute. ![Dashboard with the date selector set to Last 30 minutes and the aggregation set to 5m in its header, above a chart of compressor pressure](https://docs.thinger.io/screenshots/data-sources-dashboard-controls.webp) *Date and aggregation selectors of a dashboard* ## Aggregate **Aggregate** groups the bucket records in intervals and keeps one value per interval and field. Use it to show long ranges without thousands of points, or to chart statistics such as the hourly maximum. It is available for buckets whose **Backend** is InfluxDB or MongoDB. Choose the interval and, next to it, the function (`mean` by default): | Interval | Meaning | |---|---| | **None** | No aggregation: every record. | | **5 min**, **15 min**, **30 min** | Intervals of minutes. | | **1 hour**, **3 hour**, **6 hour**, **12 hour** | Intervals of hours. | | **1 day**, **1 week** | Daily and weekly intervals. | | **1 month**, **3 month**, **6 month**, **1 year** | Monthly and yearly intervals. | | **Configurable** | The interval the viewer chooses in the dashboard header. Only with a **Configurable** timeframe. | | **Timeframe** | One interval as long as the selected timeframe: a single value for the whole range, such as the total energy of the period. Only with a **Configurable** timeframe. | The nine functions: | Function | What it returns | Typical use | |---|---|---| | `count` | Number of records in the interval. | Check that a sensor reports regularly. | | `mean` | Average of the values. | General trends, such as the average temperature. | | `median` | Middle value of the sorted values. | Trends without the distortion of outliers. | | `mode` | Most frequent value. | Recurring states, such as on and off. | | `spread` | Difference between the maximum and the minimum. | Variability, such as temperature swings. | | `stddev` | Standard deviation of the values. | Stability of a measure. | | `max` | Highest value. | Peaks of voltage or pressure. | | `min` | Lowest value. | Dips, such as the lowest battery level. | | `sum` | Sum of the values. | Totals, such as the energy used per day. | The same data looks very different with each function: a raw signal sampled every few seconds, its `median` and `mean` by 5 minutes follow the trend, while `count` shows how many samples arrived in each interval. ![Four Time Series Charts of compressor pressure over one hour: raw data, and aggregated every 5 minutes with median, count and mean](https://docs.thinger.io/screenshots/data-sources-aggregation-comparison.webp) *Raw data and three aggregations of the same field* ## Transform **Transform** applies a function to the values after they are read and aggregated, and before the widget draws them. Use it to turn a counter into a rate, round noisy decimals or build a running total, without changing the firmware. It is available for buckets whose **Backend** is InfluxDB or MongoDB. | Transform | What it returns | Typical use | |---|---|---| | **None** | The values unchanged. | Raw readings. | | `abs` | The absolute value. | The magnitude of a current that changes sign. | | `ceil` | The value rounded up to an integer. | Counts that must never show less than the real amount. | | `floor` | The value rounded down to an integer. | Whole units completed, such as batches. | | `round` | The value rounded to the nearest integer. | Clean figures for non-technical viewers. | | `difference` | The change from the previous record. | The consumption of each interval from a cumulative meter. | | `non_negative_difference` | As `difference`, without negative results. | Cumulative meters that reset to zero. | | `derivative` | The rate of change per second, which can be negative. | Speed from distance, bandwidth from bytes. | | `non_negative_derivative` | As `derivative`, without negative results. | Counters that roll over or reset, such as network bytes or water meters. | | `cumulative_sum` | The running total of the values. | Production totals. | | `elapsed` | Seconds since the previous record. | Time between machine cycles or messages. | The transforms that compare a record with the previous one (`difference`, `derivative`, their non-negative versions and `elapsed`) return no value for the first record. ## Processing **Processing** passes the values of a source through a function of the dashboard, written in JavaScript in **Dashboard Settings > Functions**. Use it for conversions the other options do not cover: Celsius to Fahrenheit, a code to a text, a value computed from several fields. The selector lists the functions of the dashboard and is shown only when the dashboard has at least one; **Disabled** turns it off. See [Configure a dashboard](https://docs.thinger.io/platform/dashboards.md#configure-a-dashboard). ## Related pages - [Widgets](https://docs.thinger.io/platform/dashboards/widgets.md): Every dashboard widget with all its options, from charts and gauges to maps, device controls and the Source Switcher. - [Data Buckets](https://docs.thinger.io/platform/data-buckets.md): Store time series data from your devices, read it back with filters and aggregations, and export it to a file. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. --- Source: https://docs.thinger.io/platform/dashboards/apps.md # Dashboard apps > Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. A dashboard app is a dashboard written as a web application instead of designed with widgets. The app is a folder of a [File Storage](https://docs.thinger.io/platform/file-storages.md) with its `index.html`; a URL dashboard points at it, and the console shows it inside its own layout. With the Dashboard SDK (`@thinger-io/dashboard-sdk`), the app reads devices, buckets, properties and alarms of the person viewing it, with live updates. ## When to use it - When widgets are not enough: your own layout, navigation, tables or logic. - To build a fleet or customer view with your usual web tools (Angular, React, Vite…). - To embed the same app in another website, outside the console. ## How it works A dashboard has a `source`: `widgets` for the dashboards of the [widget editor](https://docs.thinger.io/platform/dashboards.md), or `url` for a dashboard app. A URL dashboard has a `url`, usually the folder of a public File Storage that holds the app. When someone opens the dashboard, the console loads the app in a sandboxed frame and hands it the session of that person, the user, the current project and the subject of the dashboard (the device, product, asset type or asset group it belongs to). The console keeps the route of the app in its own URL, so a reload or a shared console link reopens the same screen. > **Warning: The app runs with the viewer's session** > > A URL dashboard receives the session token of the person viewing it (only for pages served from the same instance). The app can do anything that person can do. Publish only code you trust, and treat apps in **public** storages with care: anyone can read their files, and anything you put in them is visible. Outside the console, the same app runs **standalone** with an access token passed in its URL, for example to embed it in another website. Give that token only the permissions the app needs; see [Access Tokens](https://docs.thinger.io/platform/access-tokens.md). ## Publish a dashboard app `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console The console shows dashboard apps but does not create them: its **Dashboards** form creates widget dashboards only. Upload the app to a File Storage from **File Storages**, then point a dashboard at it with the API, the CLI or an agent. ![Fleet dashboard app inside the console layout, with device counters and a table of the devices, their product, type and status](https://docs.thinger.io/screenshots/dashboard-apps-view.webp) *A dashboard app inside the console* ### API Upload the build of the app to a public File Storage, then create the dashboard with `source: "url"` and the URL of the storage folder, **with the trailing slash**: **API call:** `POST /v1/users/{user}/dashboards` ([reference](https://docs.thinger.io/reference/rest-api/dashboards.md#dashboard-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/dashboards" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dashboard": "fleet", "name": "Fleet", "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" }' ``` `url` starts with `/` (a path of the instance) or with `https://`. ### CLI ```bash thinger dashboard init fleet-app cd fleet-app npm install npm run dev ``` `init` creates a TypeScript project on the Dashboard SDK with a `thinger.json` manifest. While `npm run dev` runs, `thinger dashboard dev --device YOUR_DEVICE` prints a link that opens the app from your dev server against your account, with a temporary token. To publish it: ```bash npm run build thinger dashboard publish --to dashboard:fleet ``` `publish` uploads the build to the public storage named in `thinger.json` (created if missing) and points the dashboard at it, creating the dashboard if it does not exist. `--to device:YOUR_DEVICE` or `--to product:` sets the app as the dashboard of a device or a product instead. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-dashboard). ### AI **Prompt for an AI agent:** > Build a dashboard app that lists my devices with their connection status and shows the last 24 hours of the greenhouse_climate bucket for the selected one, and publish it as the fleet dashboard. The agent uses `thinger_resource_call` with the type `dashboard` and the actions `init` and `publish`. See [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md). ## Build with the Dashboard SDK The SDK is an npm package that gives the app typed access to devices, buckets (with real-time subscriptions), properties, alarms, storages and projects, using the session the console hands over or the access token of a standalone link: ```bash npm install @thinger-io/dashboard-sdk ``` The [Dashboard SDK reference](https://docs.thinger.io/reference/dashboard-sdk.md) has the modules and functions, the rules an app must follow inside the console, how to publish it and how to build standalone links. For a complete walkthrough, see [Build a dashboard app](https://docs.thinger.io/guides/dashboard-app.md). ## Limits - The app must be in a **public** File Storage: the frame cannot send credentials when it loads the files. - Files are served with HTTP revalidation, so the console reloads the app only when its files change. - People who open a shared dashboard app may lack some permissions; the app has to handle refused calls. ## Related pages - [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md): Every function and type of @thinger-io/dashboard-sdk, the package for dashboards built as web apps, plus how to start, publish and share them. - [Dashboards](https://docs.thinger.io/platform/dashboards.md): Build dashboards with widgets that show and control your device data, organize them in tabs and share them with a link. - [CLI](https://docs.thinger.io/reference/cli.md): Every command and option of the thinger CLI, plus how to install it, sign in, use profiles, script it with JSON output and run its MCP server. --- Source: https://docs.thinger.io/platform/data-buckets.md # Data Buckets > Store time series data from your devices, read it back with filters and aggregations, and export it to a file. A data bucket stores time series: every record has a timestamp and a JSON value with your fields, such as `temperature` and `humidity`. Dashboards, alarms, the REST API and agents read the stored data with time ranges, aggregations and filters. ## When to use it - To keep the history of what your devices report, for charts and reports. - To collect data written by an MQTT topic, an HTTP client or a third-party service. - To feed alarms that check aggregated values, such as the mean temperature of the last five minutes. - To export data to a CSV, ARFF or JSON file for analysis outside Thinger.io. ## Data sources The data source sets how records reach the bucket. You choose it when you create the bucket. | Source | `config.source` | How records arrive | |---|---|---| | **From Device Resource** | `device` | The platform reads an output resource of a device every **Sampling Interval** (`"update": "interval"`), or stores each value the device streams (**Stream by Device**, `"update": "events"`). | | **From Device Write Call** | `write` | Devices write records themselves, for example with `write_bucket` in the [Arduino library](https://docs.thinger.io/devices/arduino/coding.md#write-to-a-bucket). | | **From API Request** | `api` | Any HTTP client writes records with the REST API and an access token. | | **From MQTT Topic** | `mqtt` | Every message published on a topic of the MQTT broker is stored. | ![Four inputs on the left reach a Data Bucket in the center: an IOTMP device whose resource the platform reads every interval or that streams it, a device that calls write_bucket, an HTTP client with an access token, and an MQTT topic. Each record holds a timestamp, a JSON value and optional tags. On the right, dashboards, alarms, the API, the CLI and agents read the bucket, and exports write it to a CSV, ARFF or JSON file and notify by email or through an endpoint.](https://docs.thinger.io/diagrams/data-bucket-sources.svg) *How data reaches a Data Bucket and who reads it* A bucket can also keep **tags**: fields that identify each record, such as `device` or `site`, so that one bucket holds the series of many devices and you can read them one by one. ### Stream from the device With **From Device Resource** and the **Stream by Device** refresh mode, the device decides when a record is stored: the bucket keeps each value the device sends with `thing.stream()`. Use it to store readings only when something changes, instead of at a fixed interval. This sketch stores the temperature and humidity of a DHT22 sensor when the temperature changes by half a degree: **main.cpp** ```cpp #include #include #define DHT_PIN 4 ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); DHT dht(DHT_PIN, DHT22); float lastTemperature = 0; void setup() { thing.add_wifi("wifi-network", "wifi-password"); dht.begin(); thing["TempHum"] >> [](pson& out) { out["temperature"] = dht.readTemperature(); out["humidity"] = dht.readHumidity(); }; } void loop() { thing.handle(); // store a record only when the temperature changes by 0.5 °C or more float temperature = dht.readTemperature(); if (!isnan(temperature) && fabs(temperature - lastTemperature) >= 0.5) { lastTemperature = temperature; thing.stream("TempHum"); } } ``` Create the bucket with **From Device Resource**, choose the device in **Select Device**, `TempHum` in **Select Resource** and **Stream by Device** in **Refresh Mode**. The same stream also updates any open dashboard of the device. Stream when the data changes, not in every loop: see [Call the platform at a safe rate](https://docs.thinger.io/devices/arduino/coding.md#call-the-platform-at-a-safe-rate). ## Create a Data Bucket `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Data Buckets** Go to **Data Buckets** and click **Add Bucket** (or **Create a Data Bucket** if you have none yet). **Step 2: Fill in the form** Set the **Bucket Id**, a **Bucket Name** and an optional **Bucket Description**, and choose the **Data Source**. For **From Device Resource**, choose the device in **Select Device**, the resource in **Select Resource** and the **Refresh Mode**: **Sampling Interval** or **Stream by Device**. For **From MQTT Topic**, set the **MQTT Topic**. Under **Database Options**, the instance may let you choose the **Backend** and a **Retention** period. ![Add Bucket form with the bucket ID, the name and From API Request as data source](https://docs.thinger.io/screenshots/data-buckets-add-form.webp) *Add a Data Bucket* **Step 3: Save the bucket** Click **Add Bucket**. The bucket opens on its **Data** tab, still empty. ### API **API call:** `POST /v1/users/{user}/buckets` ([reference](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/buckets" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "bucket": "climate", "name": "Climate", "description": "Temperature and humidity", "enabled": true, "config": { "source": "api" } }' ``` `YOUR_TOKEN` is an access token with permission to create buckets. Other sources need more fields in `config`: `device`, `resource`, `update` and `interval` for a device resource, or `topic` for MQTT. Optional fields set the storage `backend` and the `retention` period; see the [REST API reference](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-create) for the full body. ### CLI ```bash thinger bucket create climate -n "Climate" -d "Temperature and humidity" -s enabled=true -s config.source=api ``` `-s` sets the other fields of the body, with dots for nested ones, and `--from bucket.json` takes the whole body from a file. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-bucket-create). ### AI **Prompt for an AI agent:** > Create a data bucket called climate that stores the records I send through the API, and describe the fields it accepts. The agent uses `thinger_resource_create` with the `bucket` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Write data Buckets with the **From API Request** source accept records over HTTP. Each record is a JSON object, or an array of objects to write several at once. The server sets the timestamp when it receives the record; to set your own, add `?ts=` to the call or a numeric `ts` field to the record. ### Console The console does not write single records. To load existing data, upload a CSV file to a [File Storage](https://docs.thinger.io/platform/file-storages.md), open the bucket, go to the **Import** tab, choose the **File Storage** and the **File Name**, and click **Import Data**. ### API **API call:** `POST /v1/users/{user}/buckets/{bucket}/data` ([reference](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-writedata)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/buckets/climate/data" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "temperature": 21.5, "humidity": 40 }' ``` ### CLI ```bash thinger bucket write climate -s temperature=21.5 -s humidity=40 ``` `--from records.json` writes an array of records with their `ts`. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-bucket-write). ### AI **Prompt for an AI agent:** > Write a record with temperature 21.5 and humidity 40 to my climate bucket. The agent uses `thinger_resource_create` with the type `bucket_data`. ### Import a CSV file An import loads the records of a CSV file into a bucket, whatever its data source: the way to load a long history at once. The file must be in a [File Storage](https://docs.thinger.io/platform/file-storages.md) first. The file follows these rules: | Part | Rule | |---|---| | Extension | `.csv`. Other files are refused with `invalid import file, only csv is supported`. | | First line | The header, with the name of each column. Up to 99 columns. | | Separator | `;` if the header contains one, otherwise `,`. Values can be quoted with `"`. | | Timestamp | A column named `ts`, `date` or `timestamp` (in any case), with an ISO 8601 date in UTC, such as `2026-10-01T08:00:00.000Z`, or a unix timestamp in milliseconds. Without one, every record gets the time of the import. | | Values | Numbers are stored as numbers, any other text as a string. Empty cells and `null` are left out of the record. | | Rows | A row with more values than the header stops the import. | **climate.csv** ```csv ts;temperature;humidity;status 2026-10-01T08:00:00.000Z;21.5;40;ok 2026-10-01T08:05:00.000Z;21.7;41; 1790842200000;22.1;39;"fan on" ``` This file creates three records; the second one has no `status` field. A CSV file exported from a bucket imports as it is when you export it with the **ISO** or **milliseconds** timestamp format: a timestamp in seconds would be read as milliseconds. #### Console Upload the file to a File Storage. Open the bucket, go to the **Import** tab, choose the **File Storage** and the **File Name**, and click **Import Data**. **Import Progress** shows the percentage of the file imported. ![Import tab of the climate bucket with the documents File Storage and the file reports/2026-09-office-climate.csv, before importing](https://docs.thinger.io/screenshots/data-buckets-import.webp) *Import a CSV file into a Data Bucket* #### API **API call:** `POST /v1/users/{user}/buckets/{bucket}/imports` ([reference](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-createimport)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/buckets/climate/imports" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "source": "storage", "storage": "imports", "file": "climate.csv" }' ``` The response arrives line by line while the import runs, one JSON object per block of records with the percentage of the file read: `{"progress":42}`, and `{"progress":100}` at the end. A file that cannot be read fails at once with an error. An import that fails halfway ends without `{"progress":100}`, and the records imported before stay in the bucket. While an import runs, the bucket refuses exports, clearing and deletion. #### CLI ```bash thinger storage file upload imports climate.csv thinger bucket import climate -s source=storage -s storage=imports -s file=climate.csv ``` The CLI shows the last progress line. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-bucket-import). #### AI **Prompt for an AI agent:** > Import the file climate.csv from my imports file storage into the climate bucket. The agent uses `thinger_resource_call` with the `import` action of the `bucket` type. ## Read data Reads return the most recent records first. Narrow them with these query parameters: | Parameter | Effect | |---|---| | `items` | Number of records, between 1 and 1000. | | `min_ts`, `max_ts` | Time range, as unix timestamps in milliseconds. | | `sort` | `desc` (newest first, the default) or `asc`. | | `agg`, `agg_type` | Aggregate the records in windows (`5m`, `1h`, `1d`…) with a reducer such as `mean`, `min`, `max`, `sum` or `count`. | | `fields` | Comma-separated list of the fields to return. | | `group_by` | Group the results by a tag, such as `device`. | | `tz` | Time zone of the aggregation windows. | A parameter with an invalid value, such as `items=0` or `sort=up`, is refused with `400 Bad Request` and a message that names it; the read never falls back to the whole bucket. ### Console **Step 1: Open the bucket** Go to **Data Buckets** and click the bucket. The **Data** tab shows the latest records. **Step 2: Change the time range** Choose a date range above the table to see older data, and use **Tags Filtering** to show the records of one tag value, such as one device. ![Data table of a bucket with temperature and humidity records, filtered by the device tag](https://docs.thinger.io/screenshots/data-buckets-data-table.webp) *Records of a Data Bucket* ### API **API call:** `GET /v1/users/{user}/buckets/{bucket}/data` ([reference](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-readdata)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/buckets/climate/data?items=10&sort=desc" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ```json [ { "ts": 1792253184387, "val": { "humidity": 41, "temperature": 22.1 } }, { "ts": 1792253184214, "val": { "humidity": 40, "temperature": 21.5 } } ] ``` With `agg=1h&agg_type=mean`, each item holds the window start in `ts` and the mean of each field. ### CLI ```bash thinger bucket read climate --items 10 ``` Aggregate with `--agg` and `--agg-type`, for example `thinger bucket read climate --minutes 360 --agg 1h --agg-type mean`. The CLI selects time with `--minutes` (the last N minutes) instead of `min_ts` and `max_ts`. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-bucket-read). ### AI **Prompt for an AI agent:** > Show me the hourly mean temperature of my climate bucket over the last 24 hours. The agent uses `thinger_resource_list` with the type `bucket_data`, whose filter accepts the same parameters as the API. ## Export data An export writes the records of a time range to a file that you download later. The export runs in the background; you can be notified by email or by calling an [endpoint](https://docs.thinger.io/platform/endpoints.md) when it finishes. ### Console Open the bucket and go to the **Export** tab. Choose the **Export Format** (CSV, ARFF or JSON), the **Timestamp** format and the **Export Range**, optionally an endpoint to call in **Callback**, and click **Export Data**. When the file is ready, download it from the same tab. ![Export tab of a bucket with the CSV format and a custom range](https://docs.thinger.io/screenshots/data-buckets-export.webp) *Export tab of a Data Bucket* ### API **API call:** `POST /v1/users/{user}/buckets/{bucket}/exports` ([reference](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-createexport)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/buckets/climate/exports" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "data_type": "csv", "timestamp_format": "iso" }' ``` `data_type` is `csv`, `arff` or `json`. Without `min_ts` and `max_ts` the export includes all the data. `GET /v1/users/{user}/buckets/{bucket}/exports` lists the files with their download URL. ### CLI ```bash thinger bucket export climate --format csv -o climate.csv ``` The CLI waits for the export and downloads the file. `--min-ts` and `--max-ts` set the range in unix milliseconds, and `--timestamps` the timestamp format. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-bucket-export). ### AI **Prompt for an AI agent:** > Export last month's data of my climate bucket as a CSV file and give me the download link when it is ready. ## Limits - **Reserved fields**: on buckets stored in MongoDB (the default backend), a record with a field named `tags` or `_id` is refused with `400 Bad Request`. In an array write, one such record refuses the whole array. Rename the field before writing. - Invalid read parameters return `400 Bad Request` instead of data. - Clearing data (the **Clear** tab, for all the data or a range) or deleting the bucket removes the stored data, and it cannot be undone. - In a [project](https://docs.thinger.io/platform/projects.md) with `limit_bucket_access`, members read only the data of the devices of the project. - Storage and retention depend on your plan: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Dashboards](https://docs.thinger.io/platform/dashboards.md): Build dashboards with widgets that show and control your device data, organize them in tabs and share them with a link. - [Alarms](https://docs.thinger.io/platform/alarms.md): Define alarm rules that watch bucket data, device properties or connection status, and notify through endpoints when a condition is met. - [Data Buckets](https://docs.thinger.io/reference/rest-api/buckets.md): REST API reference for Data Buckets: create data buckets, write and read their data, and manage tags, exports and imports. 17 operations. - [CLI](https://docs.thinger.io/reference/cli.md): Every command and option of the thinger CLI, plus how to install it, sign in, use profiles, script it with JSON output and run its MCP server. --- Source: https://docs.thinger.io/platform/endpoints.md # Endpoints > Configure outgoing integrations, such as emails, HTTP requests and Telegram messages, that devices, alarms, product flows and the API can call. An endpoint is an outgoing action configured once and called many times: send an email, make an HTTP request to a webhook or a REST API, or use a template for services such as Telegram or IFTTT. Devices, [alarms](https://docs.thinger.io/platform/alarms.md), product flows and the REST API call it with a JSON payload, and the endpoint uses that payload in its message. ![Callers on the left (a device with call_endpoint, an alarm rule, a product flow, a Data Bucket export and the REST API) send a JSON payload to the endpoint. The endpoint fills its placeholders with fields of the payload, or with the whole payload, in the URL, headers, subject and body, and runs as Email, HTTP Request, a template such as Telegram, or Virtual. The answer returns to the caller, and the platform emits the endpoint_call and endpoint_call_response events.](https://docs.thinger.io/diagrams/endpoint-call.svg) *How an endpoint call works* ## When to use it - To send an email or a message when a device reports something. - To forward device data to your own backend or a third-party service. - To notify someone when an alarm activates. - To call a device of another account. ## Endpoint types | Type | `type` | What it does | |---|---|---| | Email | `email` | Sends an email with a subject and a body: the call data as JSON, or your own text or HTML. | | HTTP Request | `http_request` | Makes a request with a method, a URL, headers and a body. See [HTTP request bodies](#http-request-bodies). | | Template | the template ID | A ready-made integration configured with a few parameters, such as **Telegram Send Message**. See [Templates](#templates). | | Virtual | `virtual` | Does nothing; useful to test calls and flows. | ## Placeholders Placeholders take values from the payload of each call. Write them between double braces: | Placeholder | Becomes | |---|---| | `{{temperature}}` | The `temperature` field of the payload. | | `{{location.lat}}` | A nested field: `lat` inside the `location` object. | | `{{}}` | The whole payload as JSON: `23.5` for a number, `"open"` (with quotes) for a text, or the full object. | | `{{temperature=0}}` | The `temperature` field. Endpoints ignore the text after `=`: it is not used as a default. | They work in these settings: | Endpoint | Settings that accept placeholders | |---|---| | Email | **Destination Addresses**, **Reply To**, **Subject** and the custom **Email body**. | | HTTP Request | **Request URL**, the keys and values of **Request Headers**, and the custom **Request Body**. | | Template | The parameters of the template. | A field that is not in the payload becomes `null`, also with `{{field=value}}`: send every field the message uses. When a call has no payload at all, the email and the headers and custom body of a request keep the placeholders as written, and the URL gets `null` in their place. ### Send an email with device data This email endpoint, `greenhouse_report`, reports the temperature and humidity that the device sends: | Setting | Value | |---|---| | **Destination Addresses** | `ops@example.com` (separate several addresses with commas) | | **Subject** | `Greenhouse report` | | **Email body** | **Send custom body**: `The greenhouse is at {{temperature}} °C and {{humidity}} % humidity.` | The device sends a `pson` with the two fields, for example from a DHT sensor: ```cpp pson data; data["temperature"] = dht.readTemperature(); data["humidity"] = dht.readHumidity(); thing.call_endpoint("greenhouse_report", data); ``` To send a single value, write `{{}}` in the body, such as `Temperature is {{}} °C`, and call the endpoint with a `pson` that holds only that value: ```cpp pson data = dht.readTemperature(); thing.call_endpoint("greenhouse_report", data); ``` With **Resend call data (JSON)** as the **Email body**, the email contains the payload as JSON instead. See [Call an endpoint](https://docs.thinger.io/devices/arduino/coding.md#call-an-endpoint) for the other ways a sketch calls endpoints. ### HTTP request bodies The **Request Body** of an HTTP request sets what it sends with `POST`, `PUT`, `PATCH` and `DELETE`. `GET` requests send no body. | Request Body | `body_type` | What the request sends | |---|---|---| | **No data** | `none` | No body. | | **Resend call data (JSON)** | `json` | The payload of the call as JSON. A call with a `null` payload is skipped and fails with `endpoint data is null`. | | **Send custom body** | `custom` | Your text with placeholders: JSON, XML, form data. Without a `Content-Type` header, it is sent as `text/plain`. | | **Send function return** | `function` | What the JavaScript function `endpointPayload(payload)` returns. | A function body transforms the payload before sending it. A string is sent as is; any other value is sent as JSON. A function that returns `null` skips the call. ```js function endpointPayload(payload) { return { device: payload.device, celsius: payload.temperature, fahrenheit: payload.temperature * 9 / 5 + 32 }; } ``` **Send function return** needs the scripting engine of the server: on an instance without it, saving the endpoint fails with `Node.js scripting engine is not enabled on this server.` ### Templates Templates are integrations that the platform describes for you: you fill in a few parameters instead of a full request. `GET /v1/endpoints/templates` lists them: | Template | ID | Parameters | What it sends | |---|---|---|---| | **Telegram Send Message** | `telegram_send_message` | **Bot Token**, **Chat Identifier**, **Chat Message** | A text message to a Telegram chat. | | **IFTTT Webhook Trigger** | `ifttt_maker_trigger` | **Maker event name**, **Maker channel secret key** | The payload as JSON to an IFTTT webhook event. | | **Thinger.io Device Call** | `thinger_device_call` | **Device Owner Username**, **Device Identifier**, **Resource Name**, **Device Access Token** | The payload to a device resource of another account. See [Call a device of another account](#call-a-device-of-another-account). | | **Keen IO Analytics** | `keen_io_event` | **Project ID**, **Event Collection**, **Write Key** | The payload as JSON to a Keen event collection. | | **Initial State Event** | `initial_state_event` | **Access Key**, **Bucket Key** | The payload as JSON to an Initial State bucket. | The parameters are required. Each one can hold a fixed value or placeholders of the call: a parameter set to `{{message}}` takes the `message` field of each call, and `Greenhouse at {{temperature}} °C` builds the text from the payload. ### Send a Telegram message **Step 1: Create a bot** In Telegram, talk to **@BotFather**, send `/newbot` and follow the questions. BotFather answers with the token of the bot. **Step 2: Get the chat identifier** Send any message to your bot, or add it to a group. Then open `https://api.telegram.org/bot/getUpdates` in a browser: the `chat.id` field of the message is the chat identifier. Group IDs are negative numbers. **Step 3: Create the endpoint** Create an endpoint with the **Telegram Send Message** type. Set **Bot Token** and **Chat Identifier**, and set **Chat Message** to the text, such as `Greenhouse at {{temperature}} °C`, or to `{{message}}` to send the text from the device. **Step 4: Call it** Call the endpoint from the device with the fields the message uses: ```cpp pson data; data["temperature"] = dht.readTemperature(); thing.call_endpoint("telegram_alert", data); ``` The message travels in the URL of the request to Telegram, so keep it short. In the API, a template endpoint has the ID of the template as its `type`, and `config` holds the `template` and its `parameters`: ```json { "endpoint": "telegram_alert", "name": "Telegram alert", "enabled": true, "type": "telegram_send_message", "config": { "template": "telegram_send_message", "parameters": { "token": "YOUR_BOT_TOKEN", "chat": "YOUR_CHAT_ID", "message": "Greenhouse at {{temperature}} °C" } } } ``` ### Call a device of another account A device calls a device of its own account with `thing.call_device()`. To call a device of another account, create an endpoint in the account of the caller that calls the device resource of the other account, and give it a token of the other account that allows that call: a [device token](https://docs.thinger.io/platform/devices.md#share-a-device-with-a-device-token) or an [access token](https://docs.thinger.io/platform/access-tokens.md). - **On any server**: an **HTTP Request** endpoint with the `POST` method, the URL `https://YOUR_SERVER/v3/users/{user}/devices/{device}/resources/{resource}` with the username, device ID and device resource of the other account, a header `Authorization` with the value `Bearer` followed by the token, and **Resend call data (JSON)** as the body. - **On the free Cloud server**: the **Thinger.io Device Call** template does the same with four parameters. It always calls the Cloud server, so it does not work between accounts of a private instance. The device calls the endpoint as any other: ```cpp pson data; data["on"] = true; thing.call_endpoint("neighbor_lamp", data); ``` ## Create an endpoint `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Endpoints** Go to **Endpoints** and click **Add Endpoint** (or **Create an Endpoint** if you have none yet). **Step 2: Choose the type** Set the **Endpoint Identifier**, the **Endpoint Name** and an optional **Endpoint Description**, and choose the **Endpoint Type**: **Email**, **HTTP Request**, **Virtual** or one of the templates. **Step 3: Configure it** Fill in the settings of the type. An email needs the **Destination Addresses**, an optional **Reply To**, the **Subject** and the **Email body**. An HTTP request needs the method and the **Request URL**, optional **Request Headers**, and a **Request Body**. A template needs its parameters. Click **Add Endpoint**. ![Add Endpoint form with the HTTP Request type, the POST method and a request URL](https://docs.thinger.io/screenshots/endpoints-add-form.webp) *Add an HTTP Request endpoint* ### API **API call:** `POST /v1/users/{user}/endpoints` ([reference](https://docs.thinger.io/reference/rest-api/endpoints.md#endpoint-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/endpoints" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "ops_webhook", "name": "Operations webhook", "enabled": true, "type": "http_request", "config": { "method": "POST", "url": "https://example.com/hooks/thinger", "body_type": "json", "headers": [], "body": "" } }' ``` `YOUR_TOKEN` is an access token with permission to create endpoints. An email endpoint has `type` `email` and a `config` with `recipient`, `subject`, `body_type` (`json` or `html` for a custom body), `body` and an optional `reply_to`. The [REST API reference](https://docs.thinger.io/reference/rest-api/endpoints.md#endpoint-create) has examples for each type. ### CLI ```bash thinger endpoint create ops_webhook -n "Operations webhook" -s enabled=true -s type=http_request \ -s config.method=POST -s config.url=https://example.com/hooks/thinger \ -s config.body_type=json -s 'config.headers=[]' -s 'config.body=""' ``` `--from endpoint.json` takes the whole body from a file. `thinger endpoint list`, `get`, `update` and `delete` manage the endpoints you have. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-endpoint). ### AI **Prompt for an AI agent:** > Create an endpoint called ops_webhook that sends a POST request with the call data as JSON to https://example.com/hooks/thinger. The agent uses `thinger_resource_create` with the `endpoint` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Call an endpoint A call sends a JSON payload to the endpoint and returns what the endpoint answered. Devices call endpoints with `call_endpoint` in the [Arduino library](https://docs.thinger.io/devices/arduino/coding.md#call-an-endpoint); alarms, product flows and Data Bucket exports call them on their own. ### Console Open the endpoint in **Endpoints** and go to the **Test** tab. Write a JSON payload in **Endpoint Call Payload** and click **Test Endpoint**; the **Response Body** shows what the destination answered. ![Test tab of the ops_webhook endpoint with a JSON payload and the response headers; the Response Body is empty because the example destination does not answer](https://docs.thinger.io/screenshots/endpoints-test.webp) *Test tab of an endpoint* ### API **API call:** `POST /v1/users/{user}/endpoints/{endpoint}/call` ([reference](https://docs.thinger.io/reference/rest-api/endpoints.md#endpoint-call)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/ops_webhook/call" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "device": "YOUR_DEVICE", "temperature": 31.2 }' ``` ### CLI ```bash thinger endpoint call ops_webhook -s device=YOUR_DEVICE -s temperature=31.2 ``` It prints what the endpoint answered. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-endpoint-call). ### AI **Prompt for an AI agent:** > Call my ops_webhook endpoint with a test payload where temperature is 31.2 and tell me what it answered. The agent uses `thinger_resource_call` with the `call` action. ## Limits - An endpoint call fails if the destination does not answer or answers with an error; the response of the call tells you why. - A disabled endpoint refuses calls with `endpoint is disabled`. - Every call emits the `endpoint_call` and `endpoint_call_response` [events](https://docs.thinger.io/reference/events.md), which you can use to monitor integrations. - Your account can have a minimum interval between calls to an endpoint; a call that comes too soon fails with `rate limit reached`. Plan limits apply to the use of endpoints: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Alarms](https://docs.thinger.io/platform/alarms.md): Define alarm rules that watch bucket data, device properties or connection status, and notify through endpoints when a condition is met. - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): Write Arduino firmware for Thinger.io - device resources, pins, Data Buckets, properties, endpoints and connection handling. - [Endpoints](https://docs.thinger.io/reference/rest-api/endpoints.md): REST API reference for Endpoints: create and call endpoints, and list the endpoint templates. 11 operations. - [Events](https://docs.thinger.io/reference/events.md): Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. --- Source: https://docs.thinger.io/platform/alarms.md # Alarms > Define alarm rules that watch bucket data, device properties or connection status, and notify through endpoints when a condition is met. An alarm rule checks your data at a fixed interval and raises an alarm when a condition is met, such as a temperature above 30 °C or a device disconnected for ten minutes. Each alarm has a severity and a state, notifies through [endpoints](https://docs.thinger.io/platform/endpoints.md) and clears itself when the data goes back to normal. ## When to use it - To be notified when a device reports values out of range. - To detect devices that stop connecting. - To keep a record of incidents with their activation, acknowledgment and resolution. ## How a rule works A rule has four parts: | Part | What it sets | |---|---| | **Data sources** | Where the values come from: a Data Bucket (`bucket`, aggregated per device), a device property (`device_property`) or the connection status (`device_status`). Property and status sources can be narrowed to a project, a product, an asset type, an asset group or some devices. | | **Activation** | The conditions that raise the alarm (`above`, `below`, `equal`, `not_equal`, `inside`, `outside`, `present`, `absent`), how they are confirmed (at once, after several checks in a row or after a time span) and the endpoints to notify. | | **Normalization** | The conditions that clear the alarm, with their own confirmation and notifications. | | **Reminder** | Optional notifications repeated while the alarm stays active. | The rule runs every **check interval** and evaluates each device of its sources separately: one rule can raise one alarm per device. A condition value can be a number or an expression over another source of the same device, such as a per-device threshold stored in a property. [Alarm rules](https://docs.thinger.io/platform/alarms/rules.md) describes every setting, how to test a rule and complete examples; [Alarm notifications](https://docs.thinger.io/platform/alarms/notifications.md) describes what the endpoints receive. Each alarm (an alarm *instance*) has a severity (**Low**, **Medium**, **High** or **Critical**) and a state: **Activated**, **Acknowledged**, **Latched**, **Shelved** or **Cleared** (**Non-confirmed** while the activation is not confirmed yet). ![Every check interval the rule reads its sources for each device. When the activation conditions hold, the alarm is Non-confirmed and, once the confirmation is met (immediate, a sequence of checks or a time span), it becomes Activated and notifies its endpoints, with optional reminders. From Activated, a person can acknowledge, latch or shelve it; with a reactivation time, it returns to Activated when the time passes. When the normalization conditions hold, the alarm becomes Cleared and notifies its normalization endpoints; someone can also clear it by hand.](https://docs.thinger.io/diagrams/alarm-lifecycle.svg) *The life of an alarm* ### Read fields in conditions Each data source has a name, and conditions read its fields as `.`: | Source | Example field | What it reads | |---|---|---| | Data Bucket | `climate.temperature` | The `temperature` field of the records of a bucket source named `climate`, such as `{"temperature": 21.5, "humidity": 40, "pressure": 1013}`. | | Device property | `limits.value.max_depth_m` | A field inside the property: the value of a property is under `value`. | | Device status | `status.connection.active` | A field of the state of the device: see [From Device Status](https://docs.thinger.io/platform/alarms/rules.md#from-device-status). | > **Tip: One rule for every device of a product** > > Use the [bucket of a product](https://docs.thinger.io/platform/products/buckets.md), which tags each record with its `device`, as the source instead of one bucket per device. The rule then watches every device of the product, present and future, and raises one alarm per device. ## Create an alarm rule `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Alarms** Go to **Alarms**, open the **Rules** tab and click **Add Rule**. Set the **Rule Identifier**, the **Name** and an optional **Description**; in **Configuration**, choose the **Severity** and the **Check Interval**, and click **Add Rule**. Data sources, conditions and notifications become available once the rule exists. **Step 2: Add the data sources** In the **Data Source** tab of the rule, click **Add Source**, set its **Name** and choose **From Data Bucket**, **From Device Property** or **From Device Status**, with the fields to check. **Test Source** shows what it reads now. See [Data sources](https://docs.thinger.io/platform/alarms/rules.md#data-sources) for every option. **Step 3: Set activation and normalization** In the **Activation** tab, click **Add Condition** for each condition (such as **IS ABOVE** a value), choose the **Confirmation** (**Immediate**, **Sequence** or **Timespan**) and click **Add Notification** to pick the endpoints to notify. Do the same in **Normalization**, and optionally in **Reminder**. See [Conditions](https://docs.thinger.io/platform/alarms/rules.md#conditions) and [Confirmation](https://docs.thinger.io/platform/alarms/rules.md#confirmation). ![Alarm rule form with a data source that reads the temperature of the climate bucket](https://docs.thinger.io/screenshots/alarms-rule-form.webp) *Data source of an alarm rule* **Step 4: Evaluate and enable it** Open the **Evaluation** tab and click **Evaluate** to see which devices would raise an alarm with the current data (see [Test a rule](https://docs.thinger.io/platform/alarms/rules.md#test-a-rule)). Turn on **Enabled** and click **Update Rule**. ### API **API call:** `POST /v1/users/{user}/alarms/rules` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-createrule)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rule": "greenhouse_hot", "name": "Greenhouse too hot", "enabled": true, "config": { "severity": 3, "check_interval": { "value": 5, "magnitude": "minute" }, "data": { "sources": [ { "name": "climate", "source": "bucket", "bucket": { "id": "greenhouse_climate", "mapping": ["temperature"] } } ] }, "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "above", "value": "30" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "type": "endpoint", "id": "ops_webhook" } ] }, "normalization": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "below", "value": "28" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "type": "none", "notifications": [] } } }' ``` Condition values are strings, even for numbers. Before you enable a rule, `POST .../alarms/rules/{rule}/test-source`, `test-rule` and `test-notification` check its sources, its conditions and its notifications: see [Test a rule](https://docs.thinger.io/platform/alarms/rules.md#test-a-rule). [Alarm rules](https://docs.thinger.io/platform/alarms/rules.md#examples) has complete rules, such as a device offline rule, and [Alert on per-device temperature limits](https://docs.thinger.io/guides/per-device-alarm-limits.md) builds a rule with a threshold per device. ### CLI ```bash thinger alarm rule create greenhouse_hot --from greenhouse_hot.json ``` `greenhouse_hot.json` holds the body of the API call. `thinger alarm rule test`, `test-source` and `test-notification` test the rule: see [Test a rule](https://docs.thinger.io/platform/alarms/rules.md#test-a-rule). See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-alarm-rule). ### AI **Prompt for an AI agent:** > Create an alarm rule that notifies my ops_webhook endpoint when the temperature in the greenhouse_climate bucket goes above 30, and clears when it drops below 28. The agent uses `thinger_resource_create` with the `alarm_rule` type and can test the rule with `thinger_resource_call`. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Manage alarms When a rule raises an alarm, it appears in the alarms list with its rule, device, severity and state. These actions change it: | Action | Effect | |---|---| | **Acknowledge** | Marks that someone is on it. State **Acknowledged** (`2`). | | **Latch** | Keeps the alarm on hold until a set time. State **Latched** (`3`). | | **Shelve** | Puts the alarm aside for a while to attend more urgent ones. State **Shelved** (`4`). | | **Clear** | Closes the alarm as solved. State **Cleared** (`5`), final. | | **Set Projects** | Changes the [projects](https://docs.thinger.io/platform/projects.md) the alarm belongs to. | | **Remove** | Deletes the alarm. | An acknowledged, latched or shelved alarm stops sending reminders. With a **Reactivation** time, it goes back to **Activated** when the time passes, and the reminders resume; without one, it stays in its state. In any of these states, the alarm clears itself when the normalization conditions of the rule are met. ### Console Go to **Alarms**, open the **Instances** tab, select one or more alarms and open the context menu. Choose **Acknowledge**, **Shelve**, **Latch** or **Clear**: the dialog asks for an optional **Annotation** and, except to clear, a **Reactivation** (**None** or **Timespan**). **Set Projects** and **Remove** are in the same menu. The **Inspector** tab shows the activity of your alarms live. ![Alarms list with active and acknowledged alarms of low, medium, high and critical severity](https://docs.thinger.io/screenshots/alarms-instances-list.webp) *Alarm instances* ### API **API call:** `GET /v1/users/{user}/alarms/instances` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances?alarm.rule=greenhouse_hot" \ -H "Authorization: Bearer YOUR_TOKEN" ``` Change the state with `PUT /v1/users/{user}/alarms/instances/{instance}`: `{"state": 2}` acknowledges the alarm, `3` latches it, `4` shelves it and `5` clears it. Add an `annotation`, and a `reactivation` to bring it back: **API call:** `PUT /v1/users/{user}/alarms/instances/{instance}` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "state": 4, "annotation": "Planned maintenance", "reactivation": { "type": "timespan", "timespan": { "value": 4, "magnitude": "hour" } } }' ``` `YOUR_INSTANCE` is the `instance` ID that the list returns. `DELETE /v1/users/{user}/alarms/instances/{instance}` removes an alarm, and `PUT .../alarms/instances/{instance}/projects` sets its projects. Lists accept filters on nested fields, such as `?alarm.rule=`. ### CLI ```bash thinger alarm instance list --filter alarm.rule=greenhouse_hot thinger alarm instance update YOUR_INSTANCE -s state=4 -s 'annotation=Planned maintenance' \ -s reactivation.type=timespan -s reactivation.timespan.value=4 -s reactivation.timespan.magnitude=hour ``` `thinger alarm instance delete YOUR_INSTANCE` removes an alarm. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-alarm-instance). ### AI **Prompt for an AI agent:** > List the active alarms of the greenhouse_hot rule and acknowledge the ones of greenhouse_01. The agent uses `thinger_resource_list` and `thinger_resource_update` with the `alarm_instance` type. ## Limits - Alarms are evaluated at the check interval of the rule, not on every new record. - A field missing from the data does not clear an alarm unless the normalization condition says so (for example, with `absent`). See [Missing data](https://docs.thinger.io/platform/alarms/rules.md#missing-data). - Alarms emit the `alarm_instance_activate` and `alarm_instance_normalize` [events](https://docs.thinger.io/reference/events.md). Project members and project tokens receive only the events of their project. ## Related pages - [Alarm rules](https://docs.thinger.io/platform/alarms/rules.md): Configure every part of an alarm rule, from data sources and conditions to confirmation and reminders, and test it before you enable it. - [Alarm notifications](https://docs.thinger.io/platform/alarms/notifications.md): What alarm rules send to your endpoints when an alarm activates, clears or reminds, with every field of the payload and email and webhook examples. - [Endpoints](https://docs.thinger.io/platform/endpoints.md): Configure outgoing integrations, such as emails, HTTP requests and Telegram messages, that devices, alarms, product flows and the API can call. - [Data Buckets](https://docs.thinger.io/platform/data-buckets.md): Store time series data from your devices, read it back with filters and aggregations, and export it to a file. - [Alarms](https://docs.thinger.io/reference/rest-api/alarms.md): REST API reference for Alarms: manage alarm rules and alarm instances, and test rules and their notifications. 18 operations. - [Events](https://docs.thinger.io/reference/events.md): Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. --- Source: https://docs.thinger.io/platform/alarms/rules.md # Alarm rules > Configure every part of an alarm rule, from data sources and conditions to confirmation and reminders, and test it before you enable it. An alarm rule reads one or more data sources every check interval, evaluates its conditions for each device and raises, confirms or clears one alarm per device. This page describes every setting of a rule, how to test it and some complete rules. [Alarms](https://docs.thinger.io/platform/alarms.md) explains alarms and how to handle them; [Alarm notifications](https://docs.thinger.io/platform/alarms/notifications.md) explains what your endpoints receive. ## When to use it - To configure a rule in the console or write one for the API, knowing what each option does. - To compare each device with its own threshold, stored in a property (see [Alert on per-device temperature limits](https://docs.thinger.io/guides/per-device-alarm-limits.md)). - To detect devices that disconnect or stop sending data. - To check a rule against your current data before you enable it. ## How a rule is evaluated ![Every check interval, three sources on the left return values per device: a Data Bucket source named climate (latest or aggregated value of each device, grouped by the device tag), a device property source named limits (the property of each device or of its type, group or product, enabled devices only) and a device status source named status (connection state, enabled devices only). In the center the values are joined by device ID: greenhouse_01 has climate.temperature 31.2, limits.value.max_temp 30, limits.value.min_temp 5 and status.connection.active 1; greenhouse_02 has no data from the climate source. On the right, the activation condition climate.temperature IS ABOVE limits.value.max_temp is evaluated per device, with four results: activation (raises or confirms the alarm), normalization (clears it), no action (neither holds) and skipped (nothing changes). greenhouse_01 goes to activation and greenhouse_02, which misses a whole source, is skipped. Conditions read source name dot field, and a value can read another source of the same device.](https://docs.thinger.io/diagrams/alarm-rule-evaluation.svg) *How a rule evaluates each device* When you save an enabled rule, it runs a check at once and then every **Check Interval**. In each check: 1. Every data source returns its values per device ID. 2. The rule joins them by device: the conditions of a device see the values of that device in every source. 3. For each device, the rule evaluates the activation conditions and, if they do not hold, the normalization conditions. The result decides what happens to the alarm of that device: | Result | When | Effect on the alarm of the device | |---|---|---| | Activation | The activation conditions hold. | Without an alarm, the rule raises one. A **Non-confirmed** alarm counts one more check toward its [confirmation](#confirmation). An active alarm stays active. | | Normalization | The activation conditions do not hold and the normalization conditions do, or the rule has none. | An active alarm counts toward its normalization and is **Cleared** once it is confirmed. A **Non-confirmed** alarm is removed. | | No action | Neither holds. Only possible when the normalization has conditions of its own. | A **Non-confirmed** alarm is removed. The normalization of an active alarm starts over. | | Skipped | The device lacks the data to evaluate it. See [Missing data](#missing-data). | Nothing changes. | An active alarm is one in the **Activated**, **Acknowledged**, **Latched** or **Shelved** state. A rule keeps at most one open alarm per device; when it is cleared, the next activation raises a new one. The **Rules** tab of **Alarms** shows the last check of each rule: **Execution** (when it ran), **Duration**, **Checks** (devices evaluated), **Activations** and **Normalizations** (devices where each held) and **Skipped**. The [`alarm_rule_execute`](https://docs.thinger.io/reference/events.md#alarm_rule_execute) event carries the same figures. ## General settings Go to **Alarms**, open the **Rules** tab and click **Add Rule**. The form starts with these settings; the **Data Source**, **Activation**, **Normalization**, **Reminder** and **Evaluation** tabs appear once you click **Add Rule** and the rule exists. | Console | Field | Description | |---|---|---| | **Rule Identifier** | `rule` | Unique ID: letters, digits, `_` and `-`, up to 32 characters. It cannot be changed. The IDs of the alarms start with its initials, such as `CH-` for `climate_hot`. | | **Name** | `name` | Name of the rule, up to 255 characters. Each alarm takes it as its own name. | | **Description** | `description` | Optional text, up to 255 characters, copied to each alarm. | | **Enabled** | `enabled` | Only enabled rules run. Saving a rule restarts it with its new settings; its alarms keep their state. | | **Severity** | `config.severity` | Severity of the alarms of the rule: see the table below. | | **Check Interval** | `config.check_interval` | How often the rule runs: `{"value": 5, "magnitude": "minute"}`. `magnitude` is `second`, `minute`, `hour`, `day`, `week`, `month` or `year`. With a value of 0 the rule never runs. | | Severity | `severity` | |---|---| | **None** | `0` | | **Low** | `1` | | **Medium** | `2` | | **High** | `3` | | **Critical** | `4` | A new rule in the console starts enabled, with **Medium** severity, a **Check Interval** of 30 minutes and a reminder interval of 1 day. The **Confirmation** of the activation and of the normalization starts as **Timespan** of 5 minutes. To put a rule in [projects](https://docs.thinger.io/platform/projects.md), select it in the **Rules** tab, open the context menu and choose **Set Projects**, or call `PUT /v1/users/{user}/alarms/rules/{rule}/projects` with the list of `@` IDs. Each alarm belongs to the projects of its rule and to those of its device. A complete rule, as the API takes it: ```json { "rule": "climate_hot", "name": "Climate too hot", "description": "Mean temperature above 30 °C for 3 checks in a row", "enabled": true, "config": { "severity": 3, "check_interval": { "value": 5, "magnitude": "minute" }, "data": { "sources": [ { "name": "climate", "source": "bucket", "bucket": { "id": "climate", "mapping": ["temperature"], "group_by": ["device"], "aggregation": { "period": "5m", "type": "mean" } } } ] }, "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "above", "value": "30" } ], "confirmation": { "mode": "sequence", "sequence": { "value": 3 } }, "notifications": [ { "type": "endpoint", "id": "ops_email" } ] }, "normalization": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "below", "value": "28" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "type": "endpoint", "id": "ops_email" } ] }, "reminder": { "type": "none", "notifications": [] } } } ``` Create it with `POST /v1/users/{user}/alarms/rules` (see [Create an alarm rule](https://docs.thinger.io/platform/alarms.md#create-an-alarm-rule)). `PUT /v1/users/{user}/alarms/rules/{rule}` replaces the fields you send, and `config` as a whole: read the rule first to change part of it. ## Data sources A rule reads one or more sources. In the **Data Source** tab, click **Add Source**, give it a **Name** and choose the **Data Source**. **Clone Source** copies the open source, **Remove Source** deletes it and **Test Source** reads it now (see [Test a rule](#test-a-rule)). | Console | Field | Description | |---|---|---| | **Name** | `name` | Unique name of the source in the rule. Conditions read its values as `.`. Use letters, digits and `_`, starting with a letter, such as `climate`. Names are case-sensitive. | | **Data Source** | `source` | **From Data Bucket** (`bucket`), **From Device Property** (`device_property`) or **From Device Status** (`device_status`). | | (the options below) | `bucket`, `device_property` or `device_status` | Options of the source, under a key named like its type. | ### From Data Bucket Reads the records of a [Data Bucket](https://docs.thinger.io/platform/data-buckets.md) and gives one value per device. For that, each record must carry its device in the `device` **tag** of the bucket, and the source must group by it: - A [product bucket](https://docs.thinger.io/platform/products/buckets.md) with a fixed ID, such as `meter_telemetry`, tags each record with its `device`: one rule watches every device of the product, present and future. - A bucket of your own needs `device` among its tags (`"config": {"tags": ["device"]}`) and a `device` field with the device ID in each record. Without the `device` tag there is no value per device, and nothing to join with property or status sources. | Console | Field | Description | |---|---|---| | **Select Bucket** | `id` | ID of the bucket. | | **Tag** `` | `tags` | Only the records with these tag values: `{"device": ["greenhouse_01", "greenhouse_02"]}`. One entry per tag of the bucket; leave it empty to read every record. | | **Select Fields** | `mapping` | Fields of the records that the conditions read: `["temperature", "humidity"]`. Each field is read on its own, so a device whose records lack one still gets the others. | | **Aggregation** (period) | `aggregation.period` | Time window to read and reduce: `5m`, `15m`, `30m`, `1h`, `3h`, `6h`, `12h`, `1d`, `1w`, `1mo`, `3mo`, `6mo` or `1y` in the console; the API takes any number with `m`, `h`, `d`, `w`, `mo` or `y`. **None** reads without aggregation. | | **Aggregation** (type) | `aggregation.type` | How the records of the window become one value per device and field: `mean`, `median`, `mode` (most frequent value), `min`, `max`, `sum`, `count` (number of records), `spread` (maximum minus minimum) or `stddev`. | | **Transform Data** | `transform` | Optional function applied to the result, such as `abs`, `ceil`, `floor` or `round`. | | **Group by** | `group_by` | `["device"]`: one value per device. | The console shows **Tag** and **Group by** only when the bucket has tags, and **Aggregation** and **Transform Data** only when the **Backend** of the bucket supports aggregation (see [Data Buckets](https://docs.thinger.io/platform/data-buckets.md)). The API accepts every field. The window the source reads ends at the moment of the check: - **With aggregation**, it spans the period: `{"period": "15m", "type": "mean"}` gives the mean of the last 15 minutes of each device. - **Without aggregation**, it spans the **Check Interval**, and each device gives its latest record in it. A device that wrote nothing in the window has no value from this source in that check, and is [skipped](#missing-data). Make the period, or the check interval, longer than the time between two records of a device. ```json { "name": "climate", "source": "bucket", "bucket": { "id": "climate", "mapping": ["temperature", "humidity"], "group_by": ["device"], "aggregation": { "period": "15m", "type": "mean" } } } ``` Each device then has `climate.temperature` and `climate.humidity`. [Test Source](#test-a-rule) returns what the source reads now, one entry per device: ```json [ { "ts": 1792310400000, "device": "greenhouse_01", "temperature": 31.2, "humidity": 48.5 }, { "ts": 1792310400000, "device": "greenhouse_02", "temperature": 24.8, "humidity": 52.1 } ] ``` ### From Device Property Reads a [property](https://docs.thinger.io/platform/properties.md) of each device. When a device does not have it, the source takes the property of its asset type, its asset group or its product, the first that has it in that order (see [Assets](https://docs.thinger.io/platform/assets.md#share-properties-with-a-type-or-group)). Put a default on the product or the group and override it on the devices that need another value. A device without the property at any level has no value from this source. | Console | Field | Description | |---|---|---| | **Property Identifier** | `property` | ID of the property, such as `limits`. | | | `fields` | API only, optional: paths of the property document to read, such as `["value.max_temp"]`. Without it, the source reads the whole document, as the console does. | | **Filter by Project** | `project` | Devices of these [projects](https://docs.thinger.io/platform/projects.md) (project IDs, without the owner). | | **Filter by Product** | `product` | Devices of these [products](https://docs.thinger.io/platform/products.md). | | **Filter by Group** | `asset_group` | Devices of these asset groups. | | **Filter by Type** | `asset_type` | Devices of these asset types. | | **Filter by Device** | `device` | These devices. | Each filter takes one ID (`"product": "env_sensor"`) or a list (`"product": ["env_sensor", "meter"]`, any of them). Several filters must all match. Without filters, the source reads every device of the account. It only reads enabled devices. The source reads the property document, not only its value. Conditions read its fields with these paths, for a source named `limits`: | Path | What it reads | |---|---| | `limits.value` | The value, when it is a number or a boolean, such as `30`. | | `limits.value.max_temp` | A field of the value, when the value is an object such as `{"min_temp": 5, "max_temp": 30}`. | | `limits.modified`, `limits.created` | When the property was last changed and created, in unix milliseconds. | ```json { "name": "limits", "source": "device_property", "device_property": { "property": "limits", "product": "env_sensor" } } ``` ### From Device Status Reads the state of each device. It takes the same filters as **From Device Property** (**Filter by Project**, **Filter by Product**, **Filter by Group**, **Filter by Type** and **Filter by Device**) and only reads enabled devices, so a disabled device does not raise a disconnection alarm. For each device it reads these fields: | Field | Value | |---|---| | `device` | The device ID. | | `created`, `modified` | When the device was created and last modified, in unix milliseconds. | | `enabled` | Whether the device is enabled. | | `connection.active` | Whether the device is connected now: the field to detect a device that stops connecting. | | `connection.ts` | When the device last connected or disconnected, in unix milliseconds. It is not the time of its last data. | ```json { "name": "status", "source": "device_status", "device_status": { "product": "meter" } } ``` Conditions read `status.connection.active`. Booleans compare as `1` (true) and `0` (false). ## Conditions The **Activation** tab holds the conditions that raise the alarm, and the **Normalization** tab those that clear it. Click **Add Condition** for each one: the first row starts with **When**, and the next ones with **AND** or **OR**. Each row has the field, the comparison and its value, or **from** and **to** for a range. ![Activation tab of an alarm rule with the condition climate.temperature IS ABOVE 30, a Sequence confirmation of 3 consecutive events and the Operations email endpoint as notification](https://docs.thinger.io/screenshots/alarm-rules-activation-tab.webp) *Activation tab of the climate_hot rule* | Field | Description | |---|---| | `operator` | `and` or `or`: how the condition joins the one before it. The first condition ignores it. | | `type` | Always `value_check`. | | `field` | What to compare: `.`, such as `climate.temperature`, or an [expression](#expressions). | | `comparison` | One of the comparisons below. | | `value` | Value to compare with, as a string: `"30"`, not `30`. It can be an [expression](#expressions). | | `min`, `max` | Bounds of a range, as strings, for `inside` and `outside`. | | Console | `comparison` | Holds when | Takes | |---|---|---|---| | **IS ABOVE** | `above` | field > value | `value` | | **IS BELOW** | `below` | field < value | `value` | | **IS EQUAL** | `equal` | field = value | `value` | | **IS NOT EQUAL** | `not_equal` | field ≠ value, and the device has both | `value` | | **IS WITHIN RANGE** | `inside` | min ≤ field ≤ max | `min`, `max` | | **IS OUTSIDE RANGE** | `outside` | field < min, or field > max | `min`, `max` | | **IS PRESENT** | `present` | The device has the field. | nothing | | **IS ABSENT** | `absent` | The device does not have the field. | nothing | Write every value as a string. A number, such as `"value": 30`, is not read: the rule never activates, and **Evaluate** warns that the activation expression failed to initialize. ### Combine conditions **AND** groups before **OR**, as in most languages: `A OR B AND C` holds when A holds, or when B and C both hold. There are no parentheses: to require that several conditions hold at once, join them all with **AND**. ```json [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "above", "value": "30" }, { "operator": "and", "type": "value_check", "field": "climate.humidity", "comparison": "below", "value": "20" } ] ``` These conditions hold when the temperature is above 30 and, at the same time, the humidity is below 20. ### Expressions Fields, values and range bounds are expressions over the values of the same device, from any source of the rule: - arithmetic with `+`, `-`, `*`, `/`, `%`, `^` and parentheses; - functions such as `abs()`, `min()`, `max()`, `avg()`, `round()`, `floor()`, `ceil()` and `sqrt()`; - `ts()`, the current time in unix milliseconds. | Field | Comparison | Value | Holds when | |---|---|---|---| | `climate.temperature` | `above` | `limits.value.max_temp` | The temperature is above the limit of that device. | | `well.depth_m` | `below` | `limits.value.max_depth_m * 0.9` | The depth is below 90 % of the limit of that device. | | `abs(climate.temperature - climate.setpoint)` | `above` | `2` | The temperature is more than 2 degrees away from the setpoint that the device reports. | | `ts() - status.connection.ts` | `above` | `600000` | The device connected or disconnected more than 10 minutes ago. | | `ts() - limits.modified` | `above` | `3600000` | The `limits` property has not changed in the last hour. | Rules for the names and values that conditions read: - A name can be read when it has letters, digits and `_`, with dots between levels: `climate.env_1.temperature`. A field with a hyphen or a space, such as `temp-1`, cannot be read in a condition. - Names are case-sensitive: `climate.Temperature` is not `climate.temperature`. - Only numbers and booleans can be compared. A field that holds a text, such as `"on"`, makes the device [skipped](#missing-data). ### Missing data Devices do not always have every value. The rule handles it this way: - A comparison on a field that the device does not have is false, except **IS ABSENT**, which is true. So `zone1 IS ABOVE 5 OR zone2 IS ABOVE 5` works on devices that only report `zone1`. - A device is skipped when it has no value from one of the sources, when it has none of the fields that the activation conditions read, or when a field holds a text. - A device that does not meet the activation, misses some field and belongs to a rule without normalization conditions is skipped too. A field that did not arrive does not clear its alarm. - With **IS PRESENT** or **IS ABSENT** in the activation conditions, the device is evaluated even if it misses fields or a whole source: the way to raise an alarm when data does not arrive. The device must still appear in some source, such as a status source (see [No data received](#no-data-received)). **Evaluate** lists the skipped devices with the reason (see [Test a rule](#test-a-rule)), and the **Skipped** column of the rules list counts them. ## Confirmation Each of the **Activation** and **Normalization** tabs has a **Confirmation**: how many checks the conditions must hold before the alarm is activated or cleared. It filters out values that cross the threshold once. | Console | `confirmation` | Activation | Normalization | |---|---|---|---| | **Immediate** (Confirm as soon as detected) | `{"mode": "immediate"}` | The alarm is **Activated** in the first check where the conditions hold. | The alarm is **Cleared** in the first check where the normalization holds. | | **Sequence** (Consecutive Events) | `{"mode": "sequence", "sequence": {"value": 3}}` | Activated when the conditions hold in that number of checks in a row. | Cleared when the normalization holds in that number of checks in a row. | | **Timespan** | `{"mode": "timespan", "timespan": {"value": 10, "magnitude": "minute"}}` | Activated when the conditions have held in every check for that time. `magnitude` as in the check interval. | Cleared when the normalization has held in every check for that time. | | **None** (Never confirm) | `{"mode": "none"}` | Do not use it for the activation. | The rule never clears the alarm: someone clears it by hand. | While the activation is not confirmed, the alarm is **Non-confirmed** (state `0`) in the **Instances** tab. If a check does not meet the conditions, the alarm is removed and the count starts over. The same happens with the normalization of an active alarm: if the activation holds again, or neither holds, the count starts over. The rule only checks at its **Check Interval**, so the confirmation takes whole checks. With checks every minute, **Sequence** of 5 takes about 5 minutes, and **Timespan** of 10 minutes is confirmed in the first check after the 10 minutes. Make the timespan a multiple of the check interval. Without a `confirmation`, the API confirms at once, as **Immediate**. ### Normalization conditions Leave the normalization conditions empty to clear the alarm when the activation conditions stop holding. Give them conditions of their own to leave a margin (hysteresis): activate above 30 and clear below 28, so a temperature around 30 does not raise and clear the alarm on every check. Between both values, the result is **No action** and the alarm stays as it is. ## Notifications The **Notification** list of the **Activation**, **Normalization** and **Reminder** tabs sets the [endpoints](https://docs.thinger.io/platform/endpoints.md) to call. Click **Add Notification** and choose an endpoint; add as many as you need. ```json { "notifications": [ { "type": "endpoint", "id": "ops_email" } ] } ``` `type` is always `endpoint`. The activation notifications go out when an alarm becomes **Activated**, the normalization ones when the rule clears it, and the reminders on their interval. Each endpoint receives the alarm as its payload: see [Alarm notifications](https://docs.thinger.io/platform/alarms/notifications.md) for its fields, placeholders and examples. ## Reminder The **Reminder** tab repeats a notification while an alarm stays active and nobody handles it. | Console | `reminder` | Effect | |---|---|---| | **None** | `{"type": "none", "notifications": []}` | No reminders. | | **Interval** | `{"type": "interval", "interval": {"value": 1, "magnitude": "hour"}, "notifications": [{"type": "endpoint", "id": "ops_email"}]}` | Every interval, the reminder notifications go out for each alarm of the rule that is still **Activated** and has not been notified in the last interval. `magnitude` as in the check interval. | Acknowledged, latched and shelved alarms get no reminders; they start again if the alarm returns to **Activated** with its reactivation time. A notification counts once its endpoint answers without error: if the activation notification failed, the reminder goes out at the next interval. ## Test a rule Test the sources and the conditions of a rule against your current data before you enable it. **Evaluate** and `test-rule` raise no alarm and send nothing; the test notification does send. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Test each source** In the **Data Source** tab, open a source and click **Test Source**. The console reads the source now and shows how many records it returned, the records, one per device, and the **Available Variables**: the `.` names with a number or a boolean, ready to use in conditions. Click a variable to copy it. ![Data Source tab of an alarm rule after Test Source: a bucket source named climate with the temperature and humidity fields, the message that it returned 5 records, the record of each device and the Available Variables climate.humidity, climate.temperature and climate.ts](https://docs.thinger.io/screenshots/alarm-rules-test-source.webp) *Test Source on a bucket source* **Step 2: Evaluate the rule** Open the **Evaluation** tab and click **Evaluate**. The rule runs once as it is in the form, saved or not. The summary shows the **Duration**, **Total Processed** and the number of devices in each result: **Activations**, **Normalizations**, **No Action** and **Skipped**. Each result has a tab that lists the devices (**Origin**) with the **Values** that the conditions read; in **Skipped**, the missing values show as N/A. Warnings at the top point to conditions that cannot be evaluated, such as an empty field. ![Evaluation tab of an alarm rule after Evaluate: 5 devices processed, 1 activation, 2 normalizations, 2 with no action and none skipped, and the Activations tab listing greenhouse_01 with climate.temperature 30.9 and its Notification button](https://docs.thinger.io/screenshots/alarm-rules-evaluation.webp) *Result of Evaluate* **Step 3: Send a test notification** In the **Activations** or **Normalizations** tab, click **Notification** on a device. The console sends the notifications of that event to their endpoints, with the values of that device. They are real: people receive the email or the webhook. ### API The rule ID in the path does not need to exist. Read one source as the rule would: **API call:** `POST /v1/users/{user}/alarms/rules/{rule}/test-source` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-testrulesourcetest-source)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/climate_hot/test-source" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "climate", "source": "bucket", "bucket": { "id": "climate", "mapping": ["temperature"], "group_by": ["device"], "aggregation": { "period": "15m", "type": "mean" } } }' ``` It returns an array with an entry per device. A bucket source without aggregation reads the window of the rule's check interval, or of a `check_interval` in the body (1 minute if neither exists). Evaluate a whole rule: the body is the rule as you would save it, without `rule`. **API call:** `POST /v1/users/{user}/alarms/rules/{rule}/test-rule` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-testruletest-rule)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/climate_hot/test-rule" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Climate too hot", "enabled": true, "config": { "severity": 3, "check_interval": { "value": 5, "magnitude": "minute" }, "data": { "sources": [ { "name": "climate", "source": "bucket", "bucket": { "id": "climate", "mapping": ["temperature"], "group_by": ["device"], "aggregation": { "period": "15m", "type": "mean" } } } ] }, "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "above", "value": "30" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "normalization": { "conditions": [], "confirmation": { "mode": "immediate" }, "notifications": [] } } }' ``` The answer groups the devices by result. Each entry has the device (`origin`) and the values read; `state_info` has the confirmation modes (`0` none, `1` immediate, `2` timespan, `3` sequence), and each skipped device has a `reason`: `missing data sources` or `missing condition fields`. `warnings` lists conditions that cannot be evaluated. For example: ```json { "activations": { "total": 1, "items": [ { "origin": "greenhouse_01", "values": { "climate.temperature": 31.2 }, "state_info": { "activation": true, "normalization": false, "activation_mode": 1, "normalization_mode": 1 } } ] }, "normalizations": { "total": 1, "items": [ { "origin": "greenhouse_02", "values": { "climate.temperature": 24.8 }, "state_info": { "activation": false, "normalization": true, "activation_mode": 1, "normalization_mode": 1 } } ] }, "no_action": { "total": 0, "items": [] }, "skipped": { "total": 0, "items": [] }, "warnings": { "total": 0, "items": [] }, "summary": { "total_processed": 2, "total_skipped": 0 }, "execution": { "started": 1792310400000, "stopped": 1792310400042, "duration": 42 } } ``` Send the notifications of an event, as the rule would for a device. They are real: people receive them. **API call:** `POST /v1/users/{user}/alarms/rules/{rule}/test-notification` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-testrulenotificationtest-notification)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/climate_hot/test-notification" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Climate too hot", "description": "Mean temperature above 30 °C", "config": { "severity": 3, "activation": { "notifications": [ { "type": "endpoint", "id": "ops_email" } ] } }, "event": { "type": "activation", "origin": "greenhouse_01", "values": { "climate.temperature": 31.2 } } }' ``` `event.type` is `activation`, `normalization` or `reminder`, and the notifications are those of `config..notifications`. The answer has the `alarm_instance` that the endpoints received and the list of `notifications` sent. Nothing is stored. ### CLI ```bash thinger alarm rule test-source climate_hot --from source.json thinger alarm rule test climate_hot --from rule.json thinger alarm rule test-notification climate_hot --from notification.json ``` Each file holds the body of the matching API call. Without `--from`, `thinger alarm rule test` evaluates the saved rule. `test-notification` sends real notifications. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-alarm-rule-test). ### AI **Prompt for an AI agent:** > Test my climate_hot alarm rule against the current data and tell me which devices would raise an alarm and which ones are skipped, and why. The agent uses `thinger_resource_call` with the `alarm_rule` type and the `test_source`, `test_rule` and `test_notification` actions. A test notification asks first: the agent sends it only after you confirm. See [MCP tools](https://docs.thinger.io/ai/tools.md#actions). ## Examples Two complete rules, ready to adapt. [Alert on per-device temperature limits](https://docs.thinger.io/guides/per-device-alarm-limits.md) builds a rule step by step, with a threshold per device, an email endpoint and the tests. ### Device offline Raise an alarm when a meter stays disconnected for 10 minutes, clear it when it connects again, and remind every hour through a webhook. ```json { "rule": "meter_offline", "name": "Meter offline", "description": "A meter has been disconnected for 10 minutes", "enabled": true, "config": { "severity": 2, "check_interval": { "value": 1, "magnitude": "minute" }, "data": { "sources": [ { "name": "status", "source": "device_status", "device_status": { "product": "meter" } } ] }, "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "status.connection.active", "comparison": "equal", "value": "0" } ], "confirmation": { "mode": "timespan", "timespan": { "value": 10, "magnitude": "minute" } }, "notifications": [ { "type": "endpoint", "id": "ops_webhook" } ] }, "normalization": { "conditions": [ { "operator": "and", "type": "value_check", "field": "status.connection.active", "comparison": "equal", "value": "1" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "type": "endpoint", "id": "ops_webhook" } ] }, "reminder": { "type": "interval", "interval": { "value": 1, "magnitude": "hour" }, "notifications": [ { "type": "endpoint", "id": "ops_webhook" } ] } } } ``` With checks every minute, a disconnection shorter than 10 minutes removes the **Non-confirmed** alarm without notifying. Disabled meters are not read, so they raise no alarm. To use the time since the disconnection instead, join two conditions with **AND**, `status.connection.active` **IS EQUAL** `0` and `ts() - status.connection.ts` **IS ABOVE** `600000`, with an **Immediate** confirmation. ### No data received A device can stay connected and stop sending data, or send it over HTTP or MQTT without a connection. This rule raises an alarm when a sensor of `env_sensor` writes nothing to the `climate` bucket for 30 minutes: ```json { "rule": "climate_no_data", "name": "No climate data", "description": "No records in the climate bucket for 30 minutes", "enabled": true, "config": { "severity": 2, "check_interval": { "value": 10, "magnitude": "minute" }, "data": { "sources": [ { "name": "status", "source": "device_status", "device_status": { "product": "env_sensor" } }, { "name": "climate", "source": "bucket", "bucket": { "id": "climate", "mapping": ["temperature"], "group_by": ["device"], "aggregation": { "period": "30m", "type": "count" } } } ] }, "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "absent" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "type": "endpoint", "id": "ops_email" } ] }, "normalization": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "present" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "type": "none", "notifications": [] } } } ``` The status source lists every enabled sensor of the product, so a sensor without records in the last 30 minutes is still evaluated: **IS ABSENT** holds and the alarm is activated. It clears when records arrive again. ## Limits - A rule evaluates its sources at its check interval, not on each new record or connection. - A rule keeps at most one open alarm per device. - Conditions compare numbers and booleans. Texts cannot be compared. - A bucket source gives values per device only when it groups by the `device` tag of the bucket. - Device property and device status sources only read enabled devices. - Endpoint calls are subject to the minimum interval between calls of your account: a notification that comes too soon fails. See [Endpoints](https://docs.thinger.io/platform/endpoints.md#limits). ## Related pages - [Alarms](https://docs.thinger.io/platform/alarms.md): Define alarm rules that watch bucket data, device properties or connection status, and notify through endpoints when a condition is met. - [Alarm notifications](https://docs.thinger.io/platform/alarms/notifications.md): What alarm rules send to your endpoints when an alarm activates, clears or reminds, with every field of the payload and email and webhook examples. - [Alert on per-device temperature limits](https://docs.thinger.io/guides/per-device-alarm-limits.md): Raise an alarm when a sensor leaves its own temperature range, kept in a property with a default for the product, and email it. - [Endpoints](https://docs.thinger.io/platform/endpoints.md): Configure outgoing integrations, such as emails, HTTP requests and Telegram messages, that devices, alarms, product flows and the API can call. - [Alarms](https://docs.thinger.io/reference/rest-api/alarms.md): REST API reference for Alarms: manage alarm rules and alarm instances, and test rules and their notifications. 18 operations. --- Source: https://docs.thinger.io/platform/alarms/notifications.md # Alarm notifications > What alarm rules send to your endpoints when an alarm activates, clears or reminds, with every field of the payload and email and webhook examples. An alarm rule notifies through [endpoints](https://docs.thinger.io/platform/endpoints.md): when an alarm is activated, when the rule clears it and, optionally, at regular intervals while it stays active. Each endpoint receives the alarm as its payload, so an email or a webhook can say which rule, device, severity and values triggered it. ## When to use it - To email the people on duty when an alarm is activated, and again when it clears. - To post alarms to a ticketing tool, a chat or your own service through a webhook. - To remind someone of an alarm that nobody has acknowledged. ## When a rule notifies Each rule has three lists of notifications, one per event. Each entry calls an endpoint: | Event | `notification.type` | Sent when | List | |---|---|---|---| | Activation | `activation` | The alarm becomes **Activated**: when its activation is confirmed. | **Activation** tab, `config.activation.notifications` | | Normalization | `normalization` | The rule clears the alarm because its normalization is confirmed. Clearing an alarm by hand sends nothing. | **Normalization** tab, `config.normalization.notifications` | | Reminder | `reminder` | Every reminder interval, for each alarm that is still **Activated** and has not been notified in the last interval. | **Reminder** tab, `config.reminder.notifications` | An alarm that returns to **Activated** after its reactivation time sends no new activation notification; its reminders start again. A notification is sent once: if the endpoint fails, it is not repeated, and the alarm keeps its state. Every call emits the `endpoint_call` and `endpoint_call_response` [events](https://docs.thinger.io/reference/events.md), which you can use to monitor them. ## Add notifications to a rule `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Create the endpoint** Create the endpoint that sends the message in **Endpoints**, such as an email or an HTTP request. See [Send an email](#send-an-email) and [Send a webhook](#send-a-webhook) for endpoints made for alarms. **Step 2: Add it to the rule** Open the rule in **Alarms > Rules**. In the **Activation** tab, click **Add Notification** under **Notification** and choose the endpoint. Do the same in the **Normalization** tab to notify when the alarm clears. Click **Update Rule**. **Step 3: Set reminders** In the **Reminder** tab, choose **Interval** instead of **None**, set the time between reminders, such as 4 hours, and add the endpoints under **Notification**. Click **Update Rule**. ### API Notifications are part of the `config` of the rule. Each entry is `{"type": "endpoint", "id": ""}`: ```json { "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "above", "value": "30" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "type": "endpoint", "id": "alarm_email" }, { "type": "endpoint", "id": "alarm_webhook" } ] }, "normalization": { "conditions": [], "confirmation": { "mode": "immediate" }, "notifications": [ { "type": "endpoint", "id": "alarm_email" } ] }, "reminder": { "type": "interval", "interval": { "value": 4, "magnitude": "hour" }, "notifications": [ { "type": "endpoint", "id": "alarm_email" } ] } } ``` Send the whole `config` with `PUT /v1/users/{user}/alarms/rules/{rule}`: it replaces the stored one, so read the rule first. See [Alarm rules](https://docs.thinger.io/platform/alarms/rules.md#general-settings) for the full body. ### AI **Prompt for an AI agent:** > Add my alarm_email endpoint to the activation and normalization notifications of the climate_hot alarm rule, and send a reminder through it every 4 hours while an alarm stays active. The agent reads the rule and updates its `config` with `thinger_resource_update` and the `alarm_rule` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## What the endpoint receives The payload of each call is the alarm, as JSON. For the activation of an alarm of the `climate_hot` rule on `greenhouse_01`: ```json { "instance": "CH-1593458210", "name": "Climate too hot", "description": "Mean temperature above 30 °C for 3 checks in a row", "severity": 3, "state": 1, "origin": { "id": "greenhouse_01", "name": "Greenhouse 01", "source": "device" }, "alarm": { "rule": "climate_hot", "type": "", "group": "" }, "asset_type": "climate_sensor", "asset_group": "madrid_plant", "project": [], "created": 1792310100000, "modified": 1792310700000, "activation": { "detections": 3, "initiated": 1792310100000, "completed": 1792310700000 }, "normalization": { "detections": 0, "initiated": 0, "completed": 0 }, "evaluation": { "last_completed": 1792310400000, "last_values": { "climate.temperature": 31.2 }, "total_duration": 300000 }, "notification": { "type": "activation", "last_completed": 0, "last_failed": 0, "total_completed": 0, "total_failed": 0 } } ``` | Field | Content | |---|---| | `instance` | ID of the alarm: the initials of the rule and a number. | | `name`, `description` | Name and description of the rule. | | `severity` | `0` none, `1` low, `2` medium, `3` high, `4` critical. | | `state` | `1` (**Activated**) in activations and reminders, `5` (**Cleared**) in normalizations. | | `origin.id`, `origin.name` | ID and name of the device. `origin.source` is `device`. | | `alarm.rule` | ID of the rule. | | `asset_type`, `asset_group` | Asset type and asset group of the device, empty if it has none. | | `project` | Projects of the alarm: those of the rule and of the device. | | `created`, `modified`, `resolved` | When the alarm was raised, last changed and, once cleared, resolved. | | `activation` | `initiated`: first check where the conditions held; `completed`: when the alarm was activated; `detections`: checks counted. | | `normalization` | The same for clearing; zeros until the normalization starts. | | `evaluation.last_values` | Values that the activation conditions read in the last check, by `.`. | | `evaluation.last_completed` | Time of the last check of the alarm. | | `notification.type` | `activation`, `normalization` or `reminder`. | | `notification.last_completed`, `notification.total_completed` | Time and count of the notifications already sent for this alarm. | | `annotation`, `reactivation` | When someone acknowledged, latched or shelved the alarm: their note and reactivation time. | Times are unix timestamps in milliseconds. ### Placeholders for alarms Endpoints take fields of the payload with [placeholders](https://docs.thinger.io/platform/endpoints.md#placeholders), in the subject, body, URL, headers or template parameters: | Placeholder | Becomes | |---|---| | `{{name}}` | Name of the rule: `Climate too hot`. | | `{{origin.name}}`, `{{origin.id}}` | Name and ID of the device: `Greenhouse 01`, `greenhouse_01`. | | `{{severity}}` | Severity as a number: `3`. | | `{{notification.type}}` | `activation`, `normalization` or `reminder`. | | `{{instance}}` | ID of the alarm. | | `{{alarm.rule}}` | ID of the rule: `climate_hot`. | | `{{evaluation.last_values}}` | The values read, as JSON: `{"climate.temperature":31.2}`. | | `{{activation.completed}}` | Time of the activation, in unix milliseconds. | | `{{}}` | The whole alarm as JSON. | One endpoint can serve several rules and the three events: the placeholders tell them apart. ### Send an email This email endpoint, `alarm_email`, works for any rule and any event: | Setting | Value | |---|---| | **Destination Addresses** | `ops@example.com` | | **Subject** | `[{{notification.type}}] {{name}} on {{origin.name}}` | | **Email body** | **Send custom body**, with the HTML below | ```html

{{name}} ({{notification.type}}) on device {{origin.name}} ({{origin.id}}).

Severity: {{severity}} (1 low, 2 medium, 3 high, 4 critical).

Values in the last check: {{evaluation.last_values}}

Alarm {{instance}} of the rule {{alarm.rule}}.

``` The activation of the example above arrives with the subject `[activation] Climate too hot on Greenhouse 01`, and the body says `Values in the last check: {"climate.temperature":31.2}`. With **Resend call data (JSON)** as the **Email body**, the email contains the whole alarm as JSON instead. ![Email endpoint ops_email with ops@example.com as destination, a subject with the notification type, the rule name and the device name as placeholders, and Send custom body with an HTML body that adds the device ID, the severity, the values of the last check, the alarm ID and the rule ID](https://docs.thinger.io/screenshots/alarm-notifications-email-endpoint.webp) *An email endpoint with this subject and body* #### Console Go to **Endpoints**, click **Add Endpoint**, set the **Endpoint Identifier** to `alarm_email` and choose the **Email** type. Fill in the settings of the table and click **Add Endpoint**. #### API **API call:** `POST /v1/users/{user}/endpoints` ([reference](https://docs.thinger.io/reference/rest-api/endpoints.md#endpoint-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/endpoints" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "alarm_email", "name": "Alarm email", "enabled": true, "type": "email", "config": { "recipient": "ops@example.com", "subject": "[{{notification.type}}] {{name}} on {{origin.name}}", "body_type": "html", "body": "

{{name}} ({{notification.type}}) on device {{origin.name}} ({{origin.id}}).

Severity: {{severity}} (1 low, 2 medium, 3 high, 4 critical).

Values in the last check: {{evaluation.last_values}}

Alarm {{instance}} of the rule {{alarm.rule}}.

" } }' ``` #### CLI ```bash thinger endpoint create alarm_email --from alarm_email.json ``` `alarm_email.json` holds the body of the API call. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-endpoint-create). #### AI **Prompt for an AI agent:** > Create an email endpoint called alarm_email that sends to ops@example.com, with the rule name, the event type and the device name in the subject, and the severity and the values that triggered the alarm in the body. The agent uses `thinger_resource_create` with the `endpoint` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ### Send a webhook An **HTTP Request** endpoint with **Resend call data (JSON)** posts the whole alarm to your service, which reads `notification.type`, `origin.id` and the rest of the fields. To send only some of them, use **Send custom body** with placeholders: | Setting | Value | |---|---| | **Request URL** | `https://hooks.example.com/alarms` (method `POST`) | | **Request Headers** | `Content-Type`: `application/json` | | **Request Body** | **Send custom body**: `{"event": "{{notification.type}}", "rule": "{{alarm.rule}}", "device": "{{origin.id}}", "severity": {{severity}}, "values": {{evaluation.last_values}}}` | The activation of the example above posts `{"event": "activation", "rule": "climate_hot", "device": "greenhouse_01", "severity": 3, "values": {"climate.temperature":31.2}}`. Text placeholders go between quotes; numbers and objects do not. ## Test a notification Send the notifications of a rule as if an alarm had been raised, to check the endpoints and the messages. They are real: people receive the email and the webhook is called. Nothing is stored. ### Console Open the rule, go to the **Evaluation** tab and click **Evaluate**. In the **Activations** or **Normalizations** tab, click **Notification** on a device: the console sends the notifications of that event with the values of that device. ### API **API call:** `POST /v1/users/{user}/alarms/rules/{rule}/test-notification` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-testrulenotificationtest-notification)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/climate_hot/test-notification" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Climate too hot", "description": "Mean temperature above 30 °C", "config": { "severity": 3, "normalization": { "notifications": [ { "type": "endpoint", "id": "alarm_email" } ] } }, "event": { "type": "normalization", "origin": "greenhouse_01", "values": { "climate.temperature": 27.5 } } }' ``` `event.type` chooses the list of `config` that is sent: `activation`, `normalization` or `reminder`. `event.origin` is the device and `event.values` becomes `evaluation.last_values`. The answer has the `alarm_instance` that the endpoints received; its `instance` contains `TEST`. ### CLI ```bash thinger alarm rule test-notification climate_hot --from notification.json ``` `notification.json` holds the body of the API call. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-alarm-rule-test-notification). ### AI **Prompt for an AI agent:** > Send a test activation notification of the climate_hot alarm rule for greenhouse_01, with a temperature of 31.2, so I can check the email. The agent uses `thinger_resource_call` with the `alarm_rule` type and the `test_notification` action. The action asks first: the agent sends only after you confirm. See [MCP tools](https://docs.thinger.io/ai/tools.md#actions). ## Limits - Only endpoints can be notified (`type` `endpoint`). - A notification that fails, because the endpoint is disabled, does not answer or answers with an error, is not sent again. - Your account can have a minimum interval between calls to an endpoint. When several alarms notify the same endpoint at once, the calls that come too soon fail with `rate limit reached`. See [Endpoints](https://docs.thinger.io/platform/endpoints.md#limits). - A field that is not in the payload becomes `null` in a placeholder. ## Related pages - [Alarm rules](https://docs.thinger.io/platform/alarms/rules.md): Configure every part of an alarm rule, from data sources and conditions to confirmation and reminders, and test it before you enable it. - [Endpoints](https://docs.thinger.io/platform/endpoints.md): Configure outgoing integrations, such as emails, HTTP requests and Telegram messages, that devices, alarms, product flows and the API can call. - [Alarms](https://docs.thinger.io/platform/alarms.md): Define alarm rules that watch bucket data, device properties or connection status, and notify through endpoints when a condition is met. - [Events](https://docs.thinger.io/reference/events.md): Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. --- Source: https://docs.thinger.io/platform/access-tokens.md # Access Tokens > Create tokens with scoped permissions to call the Thinger.io REST API from scripts, apps and agents, and make them expire. An access token lets a script, an app or an AI agent call the REST API with a limited set of permissions, without your password. Each token has its own permissions, can expire on a given date and can be disabled or deleted at any time. ## When to use it - To call the API from a script, a backend service or a CI job. - To give an agent or a [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md) access to only some devices or buckets. - To hand out temporary access that stops working on its own. ## Permissions A token has a list of allowed permissions (`allow`) and, optionally, denied ones (`deny`). Each permission names a resource type, a resource ID (or `*` for all of them) and the actions allowed on it: ```json { "Device": { "greenhouse_01": ["Read*", "AccessDeviceResources"] }, "Bucket": { "greenhouse_climate": ["ReadBucket"] } } ``` Actions accept a trailing `*`: `Read*` covers every action that starts with `Read`, and `"*"` alone covers every action. The `*` resource type applies to every type: `{"*": {"*": ["Read*"]}}` reads everything, and `{"*": {"*": "*"}}` gives full access to the account; avoid it outside your own tools. A call is allowed when the token is enabled and has not expired, no `deny` permission matches it and some `allow` permission does: ![A request names a resource type, a resource ID and an action. The token must be enabled and not expired, otherwise the call is refused. A token created in a project only reaches the resources of that project. Then, if any deny permission matches the type, the ID and the action, the call is refused with 403. If an allow permission matches, by type or *, by ID or *, and by action, an action prefix with * or *, the call is allowed; otherwise it is refused with 403.](https://docs.thinger.io/diagrams/access-token-permissions.svg) *How the platform checks an access token* A token never gives more access than the account that owns it: an action the account cannot do is refused even if the token allows it. ### Resource types and actions Each row is a resource type with the actions it accepts in `allow` and `deny`, and the wildcards the console offers for it. The [REST API reference](https://docs.thinger.io/reference/rest-api.md) gives the action of every operation, as **Operation**. | Type | Actions | Wildcards | |---|---|---| | `Alarm` | `CloneAlarmRule`, `CloneAlarmRuleConfig`, `CreateAlarmInstance`, `CreateAlarmRule`, `DeleteAlarmInstance`, `DeleteAlarmRule`, `ListAlarmInstances`, `ListAlarmRules`, `ReadAlarmInstanceConfig`, `ReadAlarmInstanceStats`, `ReadAlarmRuleConfig`, `TestRule`, `TestRuleNotification`, `TestRuleSource`, `UpdateAlarmInstance`, `UpdateAlarmInstanceProjects`, `UpdateAlarmRule`, `UpdateAlarmRuleProjects` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Test*`, `Update*` | | `Asset` | `ReadAssetsLocations` | — | | `Brand` | `CreateBrand`, `DeleteBrand`, `ListBrands`, `TestBrandEmail`, `UpdateBrand` | — | | `Bucket` | `CloneBucket`, `CloneBucketConfig`, `CreateBucket`, `CreateBucketExport`, `CreateBucketImport`, `DeleteBucket`, `DeleteBucketExport`, `ListBucketExports`, `ListBucketTags`, `ListBuckets`, `ReadBucket`, `ReadBucketConfig`, `ReadBucketExport`, `ReadBucketTag`, `UpdateBucket`, `UpdateBucketProjects`, `WriteBucket` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `Claim` | `CloneClaim`, `CloneClaimConfig`, `CreateClaim`, `DeleteClaim`, `ListClaims`, `ReadClaim`, `ReadClaimConfig`, `RequestClaim`, `UpdateClaim`, `UpdateClaimProjects` | `Clone*`, `Read*`, `Update*` | | `Dashboard` | `CloneDashboard`, `CloneDashboardConfig`, `CreateDashboard`, `DeleteDashboard`, `ListDashboards`, `ReadDashboardConfig`, `UpdateDashboard`, `UpdateDashboardProjects` | `Clone*`, `Update*` | | `Device` | `AccessDeviceRemoteDesktop`, `AccessDeviceResources`, `AccessDeviceWebServices`, `CallDeviceCallback`, `CloneDevice`, `CloneDeviceConfig`, `CloneDeviceProperty`, `CloneDevicePropertyConfig`, `CreateDevice`, `CreateDeviceProperty`, `CreateDeviceToken`, `DeleteDevice`, `DeleteDeviceFiles`, `DeleteDeviceProperty`, `DeleteDeviceToken`, `ListDeviceBucketTags`, `ListDeviceBuckets`, `ListDeviceProperties`, `ListDeviceServices`, `ListDeviceTokens`, `ListDevices`, `ReadDeviceBucket`, `ReadDeviceBucketTag`, `ReadDeviceCallbackConfig`, `ReadDeviceCallbackResponse`, `ReadDeviceFiles`, `ReadDeviceProperty`, `ReadDeviceService`, `ReadDeviceStatistics`, `ReadDeviceStatus`, `RenameDeviceFiles`, `UpdateDevice`, `UpdateDeviceCallback`, `UpdateDeviceFiles`, `UpdateDeviceProjects`, `UpdateDeviceProperty` | `Access*`, `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `Domain` | `CreateDomain`, `DeleteDomain`, `ListDomains`, `ReadDomainConfig`, `UpdateDomain`, `VerifyDomain` | — | | `Endpoint` | `CallEndpoint`, `CloneEndpoint`, `CloneEndpointConfig`, `CreateEndpoint`, `DeleteEndpoint`, `ListEndpointTemplates`, `ListEndpoints`, `ReadEndpointConfig`, `ReadEndpointTemplateConfig`, `UpdateEndpoint`, `UpdateEndpointProjects` | `Clone*`, `List*`, `Read*`, `Update*` | | `Group` | `CloneGroup`, `CloneGroupConfig`, `CloneGroupProperty`, `CloneGroupPropertyConfig`, `CreateGroup`, `CreateGroupProperty`, `DeleteGroup`, `DeleteGroupProperty`, `ListGroupProperties`, `ListGroups`, `ReadAssetsLocations`, `ReadGroupConfig`, `ReadGroupProperty`, `UpdateGroup`, `UpdateGroupProjects`, `UpdateGroupProperty` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `Host` | `CreateHost`, `DeleteHost`, `ListHosts`, `ReadHostConfig`, `ReadHostLogs`, `ReadHostSettings`, `UpdateHost`, `UpdateHostSettings`, `UpdateHostState` | `Read*`, `Update*` | | `IdentityProvider` | `CreateIdentityProvider`, `DeleteIdentityProvider`, `ListIdentityProviders`, `ReadIdentityProviderConfig`, `UpdateIdentityProvider` | — | | `OauthClient` | `CreateOauthClient`, `DeleteOauthClient`, `ListOauthClients`, `ReadOauthClientConfig`, `UpdateOauthClient` | — | | `Plugin` | `CallPluginEndpoint`, `ClonePluginProperty`, `ClonePluginPropertyConfig`, `CreatePluginProperty`, `DeletePluginProperty`, `ListPluginProperties`, `ListPlugins`, `ManagePluginState`, `ReadPluginFiles`, `ReadPluginInfo`, `ReadPluginLogs`, `ReadPluginProperty`, `RunPluginCommand`, `RunPluginShell`, `UpdatePluginProperty` | `Clone*`, `List*`, `Read*`, `Run*` | | `Product` | `AccessProductResources`, `CloneProduct`, `CloneProductConfig`, `CloneProductProperty`, `CloneProductPropertyConfig`, `CreateProduct`, `CreateProductFirmware`, `CreateProductProperty`, `DeleteProduct`, `DeleteProductFirmware`, `DeleteProductProperty`, `DeleteProductServices`, `ExportProduct`, `FlashProductFirmware`, `ListProductFirmwares`, `ListProductProperties`, `ListProducts`, `ReadProductConfig`, `ReadProductFirmwareConfig`, `ReadProductProfile`, `ReadProductProperty`, `ReadProductServices`, `UpdateProduct`, `UpdateProductFirmware`, `UpdateProductProfile`, `UpdateProductProjects`, `UpdateProductProperty`, `UpdateProductServices` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `Project` | `CloneProject`, `CloneProjectConfig`, `CloneProjectProperty`, `CloneProjectPropertyConfig`, `CloneProjectRole`, `CloneProjectRoleConfig`, `CreateProject`, `CreateProjectMember`, `CreateProjectProperty`, `CreateProjectRole`, `DeleteProject`, `DeleteProjectMember`, `DeleteProjectProperty`, `DeleteProjectRole`, `ListProjectMembers`, `ListProjectProperties`, `ListProjectRoles`, `ListProjects`, `ReadProjectConfig`, `ReadProjectMemberConfig`, `ReadProjectProperty`, `ReadProjectRoleConfig`, `UpdateProject`, `UpdateProjectMember`, `UpdateProjectProperty`, `UpdateProjectRole` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `Property` | `CloneProperty`, `ClonePropertyConfig`, `CreateProperty`, `DeleteProperty`, `ListProperties`, `ReadProperty`, `UpdateProperty` | `Clone*` | | `Proxy` | `CreateProxy`, `DeleteProxy`, `ListProxies`, `ReadProxyConfig`, `UpdateProxy` | — | | `Role` | `CloneRole`, `CloneRoleConfig`, `CreateRole`, `DeleteRole`, `ListRoles`, `ReadRoleConfig`, `UpdateRole` | `Clone*` | | `Server` | `ReadServerActions`, `ReadServerSettings`, `ReadServerStatistics`, `ReadServerVersion` | `Read*` | | `Storage` | `AccessStorageTerminal`, `CloneStorage`, `CloneStorageConfig`, `CreateStorage`, `CreateStorageFiles`, `DeleteStorage`, `DeleteStorageFiles`, `ListStorageFiles`, `ListStorages`, `ReadStorageConfig`, `ReadStorageFiles`, `RenameStorageFiles`, `UpdateStorage`, `UpdateStorageFiles`, `UpdateStorageProjects` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `Sync` | `CloneSync`, `CloneSyncConfig`, `CreateSync`, `CreateSyncLock`, `DeleteSync`, `DeleteSyncLock`, `ListSyncLocks`, `ListSyncs`, `ReadSyncConfig`, `ReadSyncLockConfig`, `UpdateSync`, `UpdateSyncLock`, `UpdateSyncProjects` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `Token` | `CloneToken`, `CloneTokenConfig`, `CreateToken`, `DeleteToken`, `ListTokens`, `ReadTokenConfig`, `UpdateToken`, `UpdateTokenProjects` | `Clone*`, `Update*` | | `Type` | `CloneType`, `CloneTypeConfig`, `CloneTypeProperty`, `CloneTypePropertyConfig`, `CreateType`, `CreateTypeProperty`, `DeleteType`, `DeleteTypeProperty`, `ListTypeProperties`, `ListTypes`, `ReadAssetsLocations`, `ReadTypeConfig`, `ReadTypeProperty`, `UpdateType`, `UpdateTypeProjects`, `UpdateTypeProperty` | `Clone*`, `Create*`, `Delete*`, `List*`, `Read*`, `Update*` | | `User` | `AuthorizeDevice`, `AuthorizeOauth`, `CreateUser`, `CreateUserTOTPBackupCodes`, `DeleteUser`, `DeleteUserFederatedIdentity`, `DeleteUserPasskey`, `DeleteUserTOTP`, `DeleteWebAuthnCredential`, `ListDeviceLocations`, `ListUsers`, `PasskeyRegisterOptions`, `PasskeyRegisterVerify`, `ReadProjectPermissions`, `ReadUserAccount`, `ReadUserConfig`, `ReadUserEmail`, `ReadUserLimits`, `ReadUserMFA`, `ReadUserPasskeys`, `ReadUserProfile`, `ReadUserStatistics`, `ReadUserTimezone`, `SetupUserTOTP`, `SubscribeUserEvents`, `UpdateUser`, `UpdateUserPasskey`, `UpdateUserPassword`, `UpdateUserProfile`, `UpdateUserTimezone`, `UpdateWebAuthnCredential`, `VerifyUserTOTP`, `WebAuthnRegisterOptions`, `WebAuthnRegisterVerify` | `Authorize*`, `Create*`, `Delete*`, `List*`, `Passkey*`, `Read*`, `Update*`, `Web*` | Besides these: - The **Device** type has actions that only decide which tabs of the device page the console shows: `ViewDeviceDashboard`, `ViewDeviceStatistics`, `ViewDeviceTokens`, `ViewDeviceProperties`, `ViewDeviceBuckets`, `ViewDeviceTerminal`, `ViewDeviceAPI`, `ViewDeviceCallbackConfig`, `ViewDeviceGeofences`, `ViewDeviceInspector` and `ViewDeviceSettings` (`View*` covers all of them). The **Claim** type has `ViewClaimRequest`. - `SetProperty`, such as `SetDeviceProperty`, allows both creating and updating the properties of the type. - Operations that need no token, such as `GET /v1/server/healthcheck`, have no action. ## Create an access token `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Access Tokens** Go to **Access Tokens** and click **Add Token** (or **Create an Access Token** if you have none yet). **Step 2: Name the token** Set the **Token ID**, the **Token Name** and an optional **Token Description**, and leave **Enabled** on. The console does not set an expiration: to create a token that expires, use the API or an agent. **Step 3: Add permissions** In **Allow**, click **Add** for each permission the token needs. In the dialog, choose the resource type in **Select Resource Type**, any resource or a specific one in **Access**, and **Any action** or specific ones in **Actions**. Add denied permissions the same way in **Deny**. Click **Add Token**. ![Add Token form with one permission in Allow: read the status of the greenhouse_01 device](https://docs.thinger.io/screenshots/access-tokens-add-form.webp) *Add Token with one permission* **Step 4: Copy the token** The token opens on its **Settings** tab. Copy the **Access Token** value and use it in the `Authorization: Bearer` header of your calls. ### API **API call:** `POST /v1/users/{user}/tokens` ([reference](https://docs.thinger.io/reference/rest-api/tokens.md#token-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/tokens" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "token": "greenhouse_read", "name": "Greenhouse read-only", "enabled": true, "allow": { "Bucket": { "greenhouse_climate": ["ReadBucket"] } }, "expire": 1794845199818 }' ``` Here `YOUR_TOKEN` is a token of yours that can create tokens. The response includes `access_token`, the value the new token uses in the `Authorization` header. `GET /v1/users/{user}/tokens/{token}` returns it again; the token list does not. ### CLI ```bash thinger token create greenhouse_read -n "Greenhouse read-only" -s enabled=true \ -s 'allow.Bucket.greenhouse_climate=["ReadBucket"]' -s expire=1794845199818 ``` `thinger token get greenhouse_read -f access_token` prints the value of the token. When you sign in with username and password, `thinger login` creates the token the CLI itself uses (`thinger_cli`), and `thinger logout` revokes it. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-token). ### AI **Prompt for an AI agent:** > Create an access token that can only read the greenhouse_climate bucket and that expires in 30 days. The agent uses `thinger_resource_create` with the `token` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Change the permissions of a token You can change the permissions of a token at any time; its value does not change, and its next calls get the new permissions. ### Console Go to **Access Tokens** and open the token. In **Allow** or **Deny**, click **Add** to add a permission, click the type or the resource of a permission to edit it and click **OK**, or select permissions and click **Remove**. Click **Update Token** to save. ![Permission dialog of the greenhouse_read token editing its Device permission: the device greenhouse_01 and the actions ReadDeviceStatus and ReadDeviceProperty](https://docs.thinger.io/screenshots/access-tokens-edit.webp) *Edit a permission of a token* ### API **API call:** `PUT /v1/users/{user}/tokens/{token}` ([reference](https://docs.thinger.io/reference/rest-api/tokens.md#token-update)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/tokens/greenhouse_read" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "allow": { "Bucket": { "greenhouse_climate": ["ReadBucket"] }, "Device": { "greenhouse_01": ["ReadDeviceStatus"] } } }' ``` `allow` and `deny` are replaced as a whole: send every permission the token keeps. ### CLI ```bash thinger token update greenhouse_read \ -s 'allow.Bucket.greenhouse_climate=["ReadBucket"]' \ -s 'allow.Device.greenhouse_01=["ReadDeviceStatus"]' ``` ### AI **Prompt for an AI agent:** > Let the greenhouse_read access token also read the status of the device greenhouse_01. The agent uses `thinger_resource_update` with the `token` type. ## Clone a token A clone is a new token with the permissions of an existing one, under a new ID and with its own value. Use it to hand out the same access to several apps, each with a token you can revoke on its own. ### Console Go to **Access Tokens**, select the token, open the context menu and choose **Clone**. In **Clone Resource**, set the **Identifier** of the copy and, optionally, a **Name**, a **Description** and **Enabled**, and confirm. ### API **API call:** `POST /v1/users/{user}/tokens/{token}/clone` ([reference](https://docs.thinger.io/reference/rest-api/tokens.md#token-clone)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/tokens/greenhouse_read/clone" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "token": "greenhouse_read_app2", "name": "Greenhouse read-only, app 2" }' ``` ### CLI ```bash thinger token clone greenhouse_read greenhouse_read_app2 -n "Greenhouse read-only, app 2" ``` ### AI **Prompt for an AI agent:** > Clone the greenhouse_read access token as greenhouse_read_app2. The agent uses `thinger_resource_clone` with the `token` type. ## Set an expiration `expire` is the moment the token stops working, as a unix timestamp in **milliseconds**: - It must be in the future when you create the token; otherwise the call fails with `400 Bad Request` (`expire must be a future unix timestamp in milliseconds`). - It cannot be changed after the token is created: an update with a different `expire` fails with `expire cannot be changed: create a new token`. To extend access, create a new token and delete the old one. - Once it passes, every call with the token is refused, and the platform deletes the token shortly after. - Without `expire`, the token does not expire. - Tokens created on earlier server versions that already had an `expire` value show it, but do not expire. Delete them or replace them with new tokens if you relied on that date. ## Revoke a token Disable a token to stop it temporarily, or delete it to revoke it for good. Calls made with it are refused from that moment. ### Console Go to **Access Tokens**, open the token and turn off **Enabled** to disable it. To delete it, select it in the list and click **Remove**. ### API **API call:** `DELETE /v1/users/{user}/tokens/{token}` ([reference](https://docs.thinger.io/reference/rest-api/tokens.md)) ```bash curl -X DELETE "https://YOUR_SERVER/v1/users/YOUR_USER/tokens/greenhouse_read" \ -H "Authorization: Bearer YOUR_TOKEN" ``` To disable it instead, send `{"enabled": false}` with `PUT /v1/users/{user}/tokens/{token}`. ### CLI ```bash thinger token delete greenhouse_read ``` To disable it instead, run `thinger token update greenhouse_read -s enabled=false`. ### AI **Prompt for an AI agent:** > Delete the greenhouse_read access token. ## Limits - Anyone with the token value can use its permissions: store it like a password and never put it in client code that others can read. - A token created inside a [project](https://docs.thinger.io/platform/projects.md) only works with the resources of that project, also for real-time [events](https://docs.thinger.io/reference/events.md). - Device credentials are not access tokens: they authenticate a device connection. See [Devices](https://docs.thinger.io/platform/devices.md). ## Related pages - [Access Tokens](https://docs.thinger.io/reference/rest-api/tokens.md): REST API reference for Access Tokens: create, read, update, clone and delete access tokens. 8 operations. - [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md): Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. - [Events](https://docs.thinger.io/reference/events.md): Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. --- Source: https://docs.thinger.io/platform/assets.md # Assets > Classify devices by asset type and asset group, share properties with every device of a type or group, and see them on a map. Asset types and asset groups classify your devices. A type says what a device is, such as a boiler or a meter; a group says where or whose it is, such as a site, a building or a customer. Each device can belong to one type and one group, and inherits the properties you set on them. ## When to use it - To give every device of a kind the same configuration, such as a temperature threshold, from one place. - To organize devices by site or customer, with groups nested inside other groups. - To filter device lists, dashboards and agents by type or group. - To see where your devices are on a map, with their connection state. The **Assets** menu has three entries: **Overview** (the map of every device with a location), **Types** and **Groups**. ## Create an asset type or group `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Types or Groups** Go to **Assets > Types** and click **Add Asset Type**, or go to **Assets > Groups** and click **Add Asset Group**. **Step 2: Fill in the form** For a type, set the **Type ID**, the **Type name** and an optional **Type description**. For a group, set the **Group ID**, the **Group name** and an optional **Group description**. To nest the group inside another one, choose it in **Optional Parent Group**. ![Add Group form with a parent group, the group ID and the name](https://docs.thinger.io/screenshots/assets-group-add-form.webp) *Add an asset group* **Step 3: Save it** Click **Add Type** or **Add Group**. The type or group opens on its **Overview** tab. ### API **API call:** `POST /v1/users/{user}/types` ([reference](https://docs.thinger.io/reference/rest-api/types.md#type-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/types" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"type": "boiler", "name": "Boiler", "description": "Gas boilers with remote control"}' ``` **API call:** `POST /v1/users/{user}/groups` ([reference](https://docs.thinger.io/reference/rest-api/groups.md#group-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/groups" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"group": "madrid_line_2", "name": "Line 2", "parent": "madrid_plant"}' ``` `YOUR_TOKEN` is an access token with permission to create types or groups. `parent` is optional and must be an existing group. ### CLI ```bash thinger asset type create boiler -n "Boiler" -d "Gas boilers with remote control" thinger asset group create madrid_line_2 -n "Line 2" -s parent=madrid_plant ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-asset). ### AI **Prompt for an AI agent:** > Create an asset type called boiler, and an asset group called madrid_line_2 inside the group madrid_plant. The agent uses `thinger_resource_create` with the `asset_type` and `asset_group` types. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Assign devices to a type or group ### Console Open the device, go to **Settings**, and under **Advanced Options** choose the **Asset Type** and the **Asset Group**. Click **Update Device**. To change many devices at once, select them in **Devices**, and choose **Set Type** or **Set Group** in the context menu of the list. ![Device settings with the Advanced Options: an asset type and an asset group selected](https://docs.thinger.io/screenshots/assets-device-advanced-options.webp) *Asset type and asset group of a device* ### API **API call:** `PUT /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-update)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"asset_type": "boiler", "asset_group": "madrid_line_2"}' ``` Set the same fields when you create the device. List the devices of a type or group with `GET /v1/users/YOUR_USER/devices?asset_type=boiler` or `?asset_group=madrid_line_2`. ### CLI ```bash thinger device update YOUR_DEVICE -s asset_type=boiler -s asset_group=madrid_line_2 ``` `thinger device list --filter asset_type=boiler` or `--filter asset_group=madrid_line_2` lists the devices of a type or group. ### AI **Prompt for an AI agent:** > Put every device whose ID starts with boiler_ in the asset type boiler and the asset group madrid_line_2. The agent lists the devices with `thinger_resource_list` and updates each one with `thinger_resource_update`. ## Share properties with a type or group A property of an asset type or group is inherited by every device in it. When a device reads a property, the first one that defines it wins, in this order: the device itself, its asset type, its asset group, its [product](https://docs.thinger.io/platform/products.md). Delete the property on the device to use the inherited value again. ### Console Open the type or group, go to the **Properties** tab, add the property and save it. Open a device of the type to see the inherited value among its properties. ### API **API call:** `POST /v1/users/{user}/types/{type}/properties` ([reference](https://docs.thinger.io/reference/rest-api/types.md#type-createproperty)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/types/boiler/properties" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"property": "max_temp", "value": 80}' ``` Groups use `POST /v1/users/{user}/groups/{group}/properties`. In `GET /v3/users/YOUR_USER/devices/YOUR_DEVICE/properties`, an inherited property carries `"source": "type"` or `"source": "group"`. ### CLI ```bash thinger asset type property set boiler max_temp 80 ``` Groups use `thinger asset group property set`. `thinger device property list YOUR_DEVICE` lists the properties of a device, inherited ones included. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-asset-type-property-set). ### AI **Prompt for an AI agent:** > Set the property max_temp to 80 on the asset type boiler, and check that the device boiler_01 inherits it. The agent uses `thinger_resource_create` with the `asset_type_property` or `asset_group_property` type. ## See your assets on a map **Assets > Overview** shows on a map every device that reports a location, green when connected and red when disconnected. Use **Search Asset** to find one, **Show Connected** and **Show Disconnected** to filter them, and **Clustering** to group nearby markers. The **Overview** tab of a type or group shows only its own devices and, with **Show Geofences**, its geofences. The **Geofences** tab of a type or group defines the areas that raise events when its devices enter or leave: see [Geofences](https://docs.thinger.io/platform/geofences.md). ![Assets map with clusters of connected and disconnected devices in Madrid and Valencia](https://docs.thinger.io/screenshots/assets-overview-map.webp) *Assets map with clustering* The same data is available from `GET /v1/users/{user}/assets/locations`, filtered with `type`, `group` or `product`: see the [REST API reference](https://docs.thinger.io/reference/rest-api/assets.md#asset-readlocations). ## Limits - IDs use letters, numbers and underscores. The ID of a type or group cannot change after you create it, and neither can the parent of a group. - A group cannot be its own parent, and its parent must exist first. - Devices inherit the properties of their own group only, not those of its parent groups. The `asset_group` filter of the device list also matches the exact group, without its subgroups. - Creating a device with an asset type or group that does not exist creates it, empty. - Removing a type or group (**Remove** in the context menu of its list) deletes it and its properties. Its devices keep the type or group ID in their settings. - The number of types and groups depends on your plan: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Devices](https://docs.thinger.io/platform/devices.md): Register devices, check their connection status, store properties, organize them with labels and watch them live from the console. - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [Asset Types](https://docs.thinger.io/reference/rest-api/types.md): REST API reference for Asset Types: manage asset types, their properties and the locations of their assets. 17 operations. - [Asset Groups](https://docs.thinger.io/reference/rest-api/groups.md): REST API reference for Asset Groups: manage asset groups, their properties and the locations of their assets. 17 operations. --- Source: https://docs.thinger.io/platform/file-storages.md # File Storages > Keep files on your Thinger.io instance, edit them online, serve them over HTTP and use them from dashboards, apps and product code. A file storage is a folder of files on your instance, with its own ID and permissions. You upload and edit its files from the console, the REST API or an agent, and other features read them: HTML widgets, dashboard apps, product code and data imports. ![Files reach a storage from the console explorer, the REST API, an agent, the terminal or VS Code, and HTML widgets, dashboard apps, product scripts, Data Bucket imports and HTTP clients read them](https://docs.thinger.io/diagrams/file-storage-flow.svg) *Where the files of a storage come from and where they go* ## When to use it - To host a [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md) or the code of an HTML widget. - To keep the [script of a product](https://docs.thinger.io/platform/products/script.md), or a whole application with its dashboard and its product code in one place. - To upload a CSV file and import it into a [Data Bucket](https://docs.thinger.io/platform/data-buckets.md). - To publish files, such as images or manuals, at a fixed URL. - To keep firmware builds by version, so devices download them over HTTP (see [Serve files over HTTP](#serve-files-over-http)). ## Create a File Storage `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open File Storages** Go to **File Storages** and click **Add Storage** (or **Create a File Storage** if you have none yet). **Step 2: Fill in the form** Set the **Storage ID**, the **Storage name** and an optional **Storage description**. Turn on **Public Read** only if anyone may read the files without a token. ![Add Storage form with the storage ID, the name and Public Read turned off](https://docs.thinger.io/screenshots/file-storages-add-form.webp) *Add a File Storage* **Step 3: Save it** Click **Add Storage**. The storage opens on its **Explorer** tab, empty. ### API **API call:** `POST /v1/users/{user}/storages` ([reference](https://docs.thinger.io/reference/rest-api/storages.md#storage-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/storages" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"storage": "documents", "name": "Documents", "public": false}' ``` `YOUR_TOKEN` is an access token with permission to create storages. Optional fields set the `description`, the `index` file served at the root and the `terminal_image`. ### CLI ```bash thinger storage create documents -n "Documents" -s public=false ``` `thinger dashboard publish` also creates a public storage for a dashboard app if it does not exist: see [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md). See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-storage-create). ### AI **Prompt for an AI agent:** > Create a private file storage called documents for the manuals of my devices. The agent uses `thinger_resource_create` with the `storage` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Upload and manage files ### Console Open the storage on its **Explorer** tab: - **Upload** sends files or a whole folder; drop them on the **Files** or **Folder** area and click **Upload**. - **New** creates a **New File** or a **New Folder**. Click a text file to edit it in the code editor, with syntax highlighting by file extension, one tab per open file, a mark on tabs with unsaved changes, and search and replace. Save it with **Save** (Ctrl+S or Cmd+S). - Images, PDF files, video and audio open in a preview instead of the editor. - The context menu of a file has **Download**, **Info**, **Rename** and **Delete**. Drag files in the tree to move them. ![Explorer tab of the documents storage with the folder tree and the env-sensor.md manual open in the editor](https://docs.thinger.io/screenshots/file-storages-explorer.webp) *Explorer tab of a File Storage* ### API Upload a file by sending its content as the body. Folders on the path are created; add `?overwrite=false` to refuse to replace an existing file. **API call:** `PUT /v2/users/{user}/storages/{storage}/files{file}` ([reference](https://docs.thinger.io/reference/rest-api/storages.md#storage-updatefilesfiles-file)) ```bash curl -X PUT "https://YOUR_SERVER/v2/users/YOUR_USER/storages/documents/files/manuals/boiler.pdf" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/octet-stream" \ --data-binary @boiler.pdf ``` A path that ends in `/` creates a folder, with the folders above it: ```bash curl -X PUT "https://YOUR_SERVER/v2/users/YOUR_USER/storages/documents/files/manuals/2026/" \ -H "Authorization: Bearer YOUR_TOKEN" ``` `GET` on a folder lists its files, with `name`, `path`, `type` (`file` or `directory`) and `size`. Add `?hidden=true` to include the files whose name starts with a dot, and `?recursive=true` to include the subfolders: **API call:** `GET /v2/users/{user}/storages/{storage}/files{file}` ([reference](https://docs.thinger.io/reference/rest-api/storages.md#storage-readfilesfiles-file)) ```bash curl "https://YOUR_SERVER/v2/users/YOUR_USER/storages/documents/files/manuals?recursive=true" \ -H "Authorization: Bearer YOUR_TOKEN" ``` `GET` on a file downloads it. Add `?info=true` to get its metadata instead: ```bash curl "https://YOUR_SERVER/v2/users/YOUR_USER/storages/documents/files/manuals/boiler.pdf?info=true" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ```json { "name": "boiler.pdf", "path": "/manuals/boiler.pdf", "type": "file", "size": 482113, "mime": "application/octet-stream", "modified": 1760702400 } ``` `modified` is the time of the last change, in seconds. To rename or move a file or a folder, send its new path with `PATCH`; add `"overwrite": true` to replace a file that already exists there: **API call:** `PATCH /v2/users/{user}/storages/{storage}/files{file}` ([reference](https://docs.thinger.io/reference/rest-api/storages.md#storage-renamefilesfiles-file)) ```bash curl -X PATCH "https://YOUR_SERVER/v2/users/YOUR_USER/storages/documents/files/manuals/boiler.pdf" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"path": "/manuals/2026/boiler.pdf"}' ``` Delete a file or a folder with `DELETE` on its path. See the [REST API reference](https://docs.thinger.io/reference/rest-api/storages.md). ### CLI ```bash thinger storage file upload documents boiler.pdf --to manuals/boiler.pdf thinger storage file list documents manuals thinger storage file download documents manuals/boiler.pdf -o boiler.pdf thinger storage file delete documents manuals/boiler.pdf ``` `upload` also takes a local folder and overwrites what is there; `--to` sets the path in the storage. The CLI does not rename or move files. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-storage-file). ### AI **Prompt for an AI agent:** > Upload the folder ./manuals of my computer to the documents storage, and list what it contains afterwards. The agent uses `thinger_resource_create`, `thinger_resource_list`, `thinger_resource_get` and `thinger_resource_delete` with the type `storage_file`. It asks before it deletes a file. ## Serve files over HTTP Every file has a URL: `https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/files/`. The **Settings** tab of the storage shows the base URL in **HTTP Path**, and the **Index File** (such as `index.html`) is what the root of that URL serves. | Storage | Who can list and read files | Who can write | |---|---|---| | Private (**Public Read** off) | The owner, and access tokens or [project](https://docs.thinger.io/platform/projects.md) members with permission. | Same as read, with write permission. | | Public (**Public Read** on) | Anyone, without a token. | Only with a token or a session with permission. | Files are served with `ETag` and `Last-Modified` headers, so browsers and dashboard apps download them again only when they change. Add `?download=true` to download a file instead of opening it in the browser. The access tokens and the [project](https://docs.thinger.io/platform/projects.md) roles that use a private storage need these permissions: | Permission | Allows | |---|---| | `ListStorageFiles` | Listing the files with the v1 API. | | `ReadStorageFiles` | Listing and downloading files. | | `UpdateStorageFiles` | Uploading files and creating folders. | | `CreateStorageFiles` | Uploading files with a form (v1 API). | | `RenameStorageFiles` | Renaming and moving files. | | `DeleteStorageFiles` | Deleting files and folders. | | `AccessStorageTerminal` | Opening the **Terminal**. Only the owner can use it. | See [Access tokens](https://docs.thinger.io/platform/access-tokens.md#permissions) for how to grant them. ### Download firmware by version A public storage can serve firmware to devices without a token. Keep each build in a folder of its version and a `latest.txt` file with the current version: ```text firmware/ latest.txt 1.4.2 1.4.1/firmware.bin 1.4.2/firmware.bin ``` A device, or the script that updates it, reads the version and downloads its build: ```bash BASE="https://YOUR_SERVER/v2/users/YOUR_USER/storages/YOUR_STORAGE/files/firmware" VERSION=$(curl -fsS "$BASE/latest.txt") curl -fsS -o firmware.bin "$BASE/$VERSION/firmware.bin" ``` For a private storage, add `-H "Authorization: Bearer YOUR_TOKEN"` with a token that has `ReadStorageFiles` on the storage. This is a plain HTTP download: to update Arduino devices over their connection, see [OTA updates](https://docs.thinger.io/devices/ota.md). > **Warning** > > A public storage exposes every file and its list to anyone who knows the URL. Never keep credentials, tokens or private data in one. A dashboard app in a public storage receives the session token of whoever opens it: see [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md). ## Open a terminal or VS Code The activity bar of the **Explorer** tab has a **Terminal**: a shell with the files of the storage in `/workspace`, where you can run `git`, `npm` and other tools. It runs on the **Terminal Image** set in **Settings** (`alpine:latest` by default). Only the owner of the storage can open it. The **VS Code** tab opens the storage in VS Code in the browser. It needs the VS Code plugin installed on the instance: see [Plugins](https://docs.thinger.io/plugins.md). ## Limits - The **Storage ID** uses letters, numbers and underscores, and cannot change after you create the storage. - Paths cannot point outside the storage (`..` is refused), and the root folder cannot be deleted. - The **Terminal** is for the owner only; project members and access tokens cannot open it. - The number of storages, the size of each upload and of all your storages depend on your plan and the instance: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). > **Danger: Cannot be undone** > > Removing a storage deletes all its files. ## Related pages - [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md): Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. - [Script](https://docs.thinger.io/platform/products/script.md): Write the JavaScript functions of a product, inline or from a File Storage folder, and debug them with the real-time script console. - [File Storages](https://docs.thinger.io/reference/rest-api/storages.md): REST API reference for File Storages: create file storages and upload, read, rename and delete their files. 19 operations. - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. --- Source: https://docs.thinger.io/platform/products.md # Products > Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. A product is the template of a fleet of devices of the same model. You configure its profile once, and every device assigned to it gets the same properties, Data Buckets, flows, device resources, dashboard and services, whether it connects over IOTMP, MQTT or HTTP. ## When to use it - To manage many devices of the same model without configuring each one. - To turn the MQTT topics or HTTP requests of a device into properties, stored data and device resources. - To compute values on the platform with JavaScript, for example for [virtual devices](https://docs.thinger.io/devices/virtual-devices.md). - To create devices automatically when they first connect. ## Create a product `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Products** Go to **Products** and click **Add Product** (or **Create a new Product** if you have none yet). **Step 2: Fill in the form** Set the **Product ID**, the **Product Name** and an optional **Product Description**, and leave **Enabled** on. ![Add Product form with the product ID, name and description filled in](https://docs.thinger.io/screenshots/products-add-form.webp) *Add a product* **Step 3: Save it** Click **Add Product**. The product opens on its **Profile** tab, where you configure what it does. ### API **API call:** `POST /v1/users/{user}/products` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/products" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"product": "meter", "name": "Meter", "description": "Energy meters", "enabled": true}' ``` `YOUR_TOKEN` is an access token with permission to create products. The body can also carry the whole `profile`. ### CLI ```bash thinger product create meter -n "Meter" -d "Energy meters" ``` Add `--from product.json` to create it from a JSON document with its `config` and `profile`. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product). ### AI **Prompt for an AI agent:** > Create a product called meter for my energy meters. The agent uses `thinger_resource_create` with the `product` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Assign devices to a product A device follows the profile of its product as soon as you assign it. Each device can belong to one product. ### Console Open the device, go to **Settings**, and under **Advanced Options** choose the **Product**. Click **Update Device**. You can also choose the product when you add the device. ### API **API call:** `PUT /v1/users/{user}/devices/{device}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-update)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"product": "meter"}' ``` ### CLI ```bash thinger device set-product YOUR_DEVICE meter ``` Pass `""` as the product to unassign the device, or use `-p meter` in `thinger device create`. ### AI **Prompt for an AI agent:** > Assign the devices meter_001 to meter_010 to the product meter. ## The product profile The **Profile** tab holds what the product does for each of its devices, in one card per part. Each entry of a card can be enabled or disabled on its own, and only runs while the product is enabled. - [Properties](https://docs.thinger.io/platform/products/properties.md): Fill the properties of every device of a product from its resources, topics, events or streams, and give them a default value and a form. - [Buckets](https://docs.thinger.io/platform/products/buckets.md): Store the data of every device of a product in Data Buckets defined once in the product profile, shared or one per device. - [Flows](https://docs.thinger.io/platform/products/flows.md): Route the data of every device of a product from a source to a target - a topic, a property, an endpoint, a function or a product stream. - [API resources](https://docs.thinger.io/platform/products/api-resources.md): Add device resources to every device of a product, so dashboards, the API and agents can call HTTP, MQTT and virtual devices like IOTMP ones. - [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md): Let a product create its devices when they first connect or are first called, with an ID pattern, an asset type, an asset group and a project. - [Script](https://docs.thinger.io/platform/products/script.md): Write the JavaScript functions of a product, inline or from a File Storage folder, and debug them with the real-time script console. The product also has its own tabs for what its devices show and expose: - [Dashboard](https://docs.thinger.io/platform/products/dashboard.md): Design one dashboard for a product and show it on every device of the product, with the data of the device being viewed. - [Services](https://docs.thinger.io/platform/products/services.md): Reach the web interfaces and remote desktops of the devices of a product from the console, through the device connection, without opening ports. The **Properties** tab holds the properties of the product itself, which every device inherits (see [Product properties](https://docs.thinger.io/platform/products/properties.md)). The menu of the product also has **Inspector** (the live events of the product), **Profile Graph** (a graph of what feeds each entry and where its data goes), **Plugin Exporter** (package the product as a [plugin](https://docs.thinger.io/plugins.md)) and **Settings**, where **Product Icon** and **Product Fields** set how its devices look on asset maps and tables. ![Profile tab of the meter product with its Properties, Buckets, Flows, API Resources, Auto Provision and Product Script cards](https://docs.thinger.io/screenshots/products-profile-tab.webp) *Profile tab of a product* ![The devices of a product feed sources such as device resources and topics into the profile cards, backed by the product script, which write to device properties, Data Buckets, topics, endpoints and product streams](https://docs.thinger.io/diagrams/product-profile.svg) *Product profile at a glance* ### Sources, targets and payloads Properties, buckets and flows take their data from a **source**; flows and API resources send data to a **target**. The console offers the same choices in every card: | Source | `source` | Data | |---|---|---| | **Device Resource** | `resource` | The platform reads a device resource every **Sampling Interval**, or the device streams it (**Stream by Device**). | | **Device Stream** | `resource_stream` | A device resource that the device streams on its own. | | **Device Topic** | `topic` | Messages on an MQTT topic, such as `devices/{{device}}/telemetry`. See [Topics](#topics). | | **Device Event** | `event` | A platform [event](https://docs.thinger.io/reference/events.md) of the device, such as `device_state_change`. | | **Product Stream** | `product_stream` | A stream published by a flow or API resource of a product. See [Flows](https://docs.thinger.io/platform/products/flows.md). | ![A datum goes from its source through the payload type and the optional Payload Processing function, with template placeholders filled in, to its target](https://docs.thinger.io/diagrams/product-payload-pipeline.svg) *Payload pipeline* #### Topics A **Device Topic** source or target uses the topics of the devices of the product. In a topic, `{{device}}` and any other `{{name}}` match one level, and the MQTT wildcards work too: `+` matches one level and `#` the rest of the topic. Both of these receive the temperature of every device, as long as each device publishes under its own ID: ```text my_product/{{device}}/temperature my_product/+/temperature ``` `{{name=a|b}}` matches only the listed values: product buckets use it to store several topics in one record (see [Tags and fields from the topic](https://docs.thinger.io/platform/products/buckets.md#tags-and-fields-from-the-topic)). #### Payloads Each source or target builds a **Payload**: **Source Payload** (the data as received), **Source Event** (the whole event), **Template Payload** (a JSON template) or **None**. **Payload Processing** passes it through a function of the [product script](https://docs.thinger.io/platform/products/script.md). With **Source Event**, the payload is the event that carried the data. A message on a topic arrives as a `device_topic_publish` event: ```json { "event": "device_topic_publish", "user": "YOUR_USER", "device": "plug_01", "product": "shelly_plug_s", "asset_type": "", "asset_group": "", "topic": "shellies/plug_01/relay/0/power", "payload": 6.55, "qos": 0, "dup": 0, "retain": 0, "ts": 1760702400000 } ``` A device resource arrives as a `device_resource_stream` event, with `resource` instead of `topic`, `qos`, `dup` and `retain`. `ts` is the time in milliseconds. Templates use these placeholders: | Placeholder | Value | |---|---| | `{{payload}}`, `{{payload.}}` | The incoming data, or one of its fields. | | `{{device}}`, `{{user}}`, `{{product}}` | The device ID, the account and the product ID. | | `{{}}` | Any other field of the event, such as `{{topic}}`, `{{asset_type}}`, `{{asset_group}}` or `{{ts}}`. In the request of an API resource, `{{resource}}` is the name of the API resource. | | `{{property.}}`, `{{property..}}` | A property of the device, inherited ones included, or one of its fields. | | `{{api.}}`, `{{api..}}` | The result of another API resource of the product. | | `{{meta.}}` | A field of the device record, such as `name`. | | `{{:}}` | The placeholder passed through a function of the [product script](https://docs.thinger.io/platform/products/script.md). | A placeholder writes its value as is: a number or a JSON object as JSON, a text without quotes. Put quotes around the placeholders that hold text. This template stores two fields of the payload under new names: ```json {"update": {{payload.new_fw}}, "ip": "{{payload.ip}}"} ``` If the result is not valid JSON, the target receives it as plain text. In the request of an API resource, `{{payload=}}` and `{{payload.=}}` also set the input of the resource: see [Default input](https://docs.thinger.io/platform/products/api-resources.md#default-input). Anywhere else, the text after `=` is ignored. ## Examples Three products, step by step, with real devices: - [Shelly Plug S](https://docs.thinger.io/guides/shelly-plug-s.md): Connect a Shelly Plug S smart plug to Thinger.io over MQTT, without reflashing it, and control it with a ready-made product. - [Shelly Plus 1PM](https://docs.thinger.io/guides/shelly-plus-1-pm.md): Connect a Shelly Plus 1PM relay with power metering to Thinger.io over MQTT and switch it, read its status and store its energy readings. - [Kunbus Revolution Pi](https://docs.thinger.io/guides/kunbus-revpi.md): Connect a Kunbus Revolution Pi to Thinger.io with the Linux client and open its terminal, PiCtory and Node-RED from the console. ## Limits - The **Product ID** uses letters, numbers and underscores, and cannot change after you create the product. - A disabled product, or a disabled entry of its profile, does nothing for its devices. - Removing a product keeps its devices, without a product. The Data Buckets it created stay too. - Saving the profile from the API replaces a whole card (`PUT .../profile/{category}`) or one entry (`PUT .../profile/{category}/{resource}`): see the [REST API reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateprofile). - The number of products depends on your plan: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. - [Assets](https://docs.thinger.io/platform/assets.md): Classify devices by asset type and asset group, share properties with every device of a type or group, and see them on a map. - [Products](https://docs.thinger.io/reference/rest-api/products.md): REST API reference for Products: manage products and their profile, properties, firmwares and services. 38 operations. - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. --- Source: https://docs.thinger.io/platform/products/properties.md # Properties > Fill the properties of every device of a product from its resources, topics, events or streams, and give them a default value and a form. The **Properties** card of a product profile defines properties that every device of the product has. Each entry can fill the device property from a source, such as an MQTT topic, and can give it a default value, a form to edit it in the console and permissions for project members. ## When to use it - To keep the last status or configuration a device reports as a [property](https://docs.thinger.io/platform/properties.md), for example from the `devices/{{device}}/status` topic. - To give every device a configuration value, such as a threshold, that users can change from a form. - To hide a property from project members, or make it read only for them. ## Add a property to the profile `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. ### Console **Step 1: Open the Properties card** Open the product on its **Profile** tab and click **Add** in the **Properties** card. **Step 2: Set the source** Set the **Property Identifier**. On the **Property Source** tab, choose where the value comes from (**Device Resource**, **Device Stream**, **Device Topic**, **Device Event** or **Product Stream**) and the **Payload**. Click **Add Source** to fill the property from several sources, and turn on **Patch** to merge each value into the property instead of replacing it. ![Property modal of the env_sensor product with a Device Topic source and the Source Payload option](https://docs.thinger.io/screenshots/products-properties-source.webp) *Product property fed by a device topic* **Step 3: Set the default value and the form** On **Default Value**, type the JSON value devices start with. On **User Form**, define the fields the console shows to edit it. **Step 4: Set who sees it** On **Settings**, set the **Property Name**, the **Property Description** and the **Property Type** (**Default** or **Configuration**). **Hidden** and **Read Only** choose the roles that cannot see or cannot change the property. Click **Save**. ### API **API call:** `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateproductprofileresource)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/properties/status" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Status", "enabled": true, "data": { "source": "topic", "topic": "devices/{{device}}/status", "payload_type": "source_payload" }, "default": { "value": { "state": "unknown" } } }' ``` `data` can be an array to use several sources. `perm.hidden` and `perm.readOnly` take the roles (`owner`, `member`) the restriction applies to. `PUT .../profile/properties` replaces every entry at once. ### CLI ```bash thinger product profile property create YOUR_PRODUCT status \ -n Status \ -s enabled=true \ -s data.source=topic \ -s 'data.topic=devices/{{device}}/status' \ -s data.payload_type=source_payload \ -s 'default.value={"state": "unknown"}' ``` Each `-s key=value` sets a field of the entry, and dots nest. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-profile-property-create). ### AI **Prompt for an AI agent:** > Add a status property to the product YOUR_PRODUCT that stores the last message each device publishes on its status topic (devices/YOUR_DEVICE/status for YOUR_DEVICE), starting with state unknown. The agent uses `thinger_resource_create` with the `product_profile_property` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Set a value for every device A default value makes the property a property of the product: it appears in the product **Properties** tab, and every device inherits it until it sets its own value. You can also add or change those product properties directly. ![A device property is resolved from the device first, then its asset type, its asset group and its product; the first level that defines it wins](https://docs.thinger.io/diagrams/property-inheritance.svg) *Where a device property comes from* ### Console Open the product on its **Properties** tab, add or edit the property and save it. ### API **API call:** `POST /v1/users/{user}/products/{product}/properties` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-createproperty)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"property": "settings", "value": {"threshold": 30}}' ``` In the property list of a device, an inherited product property carries `"source": "product"`. ### CLI ```bash thinger product property set YOUR_PRODUCT settings '{"threshold": 30}' ``` `thinger product property list`, `get` and `delete` read and remove them. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-property). ### AI **Prompt for an AI agent:** > Set the threshold of every device of the product YOUR_PRODUCT to 30 with a product property called settings. The agent uses the `product_property` type. A device reads a property from the first place that defines it: the device itself, its [asset type and group](https://docs.thinger.io/platform/assets.md), and then its product. ## Limits - An entry with the **Template Payload** option and an empty template writes nothing. - A product created with its whole profile in one request (`POST` with `profile`, or `thinger product create --from`) does not create the product properties of the default values. Save the properties entries again (`PUT .../profile/properties`) to create them. - Removing an entry with a default value also removes the inherited value from the devices. ## Related pages - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [Flows](https://docs.thinger.io/platform/products/flows.md): Route the data of every device of a product from a source to a target - a topic, a property, an endpoint, a function or a product stream. - [Products](https://docs.thinger.io/reference/rest-api/products.md): REST API reference for Products: manage products and their profile, properties, firmwares and services. 38 operations. --- Source: https://docs.thinger.io/platform/products/buckets.md # Buckets > Store the data of every device of a product in Data Buckets defined once in the product profile, shared or one per device. The **Buckets** card of a product profile stores the data of every device of the product without creating a Data Bucket per device by hand. Each entry takes its data from a source, such as a device resource read every minute, and writes it to a bucket that the platform creates on the first write. ## When to use it - To keep the history of a fleet: telemetry read at an interval, or every message on a topic. - To let users and project members read the data of their own devices without access to the whole bucket. - To feed dashboards with the **From Device Bucket** source, which shows the data of the device being viewed. ## One bucket or one per device The bucket ID decides how the data is split: | Bucket ID | Result | |---|---| | A fixed ID, such as `meter_telemetry` | One bucket for the whole product. Each record is tagged with its `device` (and its `group`), so you can read the data of one device. | | An ID with `{{device}}`, such as `{{device}}_readings` or `{{product}}_{{device}}` | One bucket per device. Its records do not get the `device` and `group` tags. | | An ID with other fields of the event, such as `{{asset_group}}_telemetry` | One bucket per value, for example one per customer when each customer has its own asset group. Records keep the `device` and `group` tags. | The ID can use any field of the event that carries the data: `{{device}}`, `{{user}}`, `{{product}}`, `{{asset_type}}` and `{{asset_group}}` (see [Payloads](https://docs.thinger.io/platform/products.md#payloads)). ![With a fixed bucket ID, the records of every device go to one bucket tagged with device and group; with the device placeholder in the ID, each device gets its own bucket](https://docs.thinger.io/diagrams/product-bucket-split.svg) *One bucket or one per device* ### Tags and fields from the topic With a **Device Topic** source, `{{device}}` or the wildcard `+` in the topic receive the messages of every device: `my_product/{{device}}/temperature` or `my_product/+/temperature`. Each `{{name}}` of the topic, such as `{{line}}` in `plant/{{line}}/{{device}}`, becomes a tag of the record. `{{field=a|b}}` is different: it matches one of the listed levels and stores each one as a **field** of the same record. With the topic `plant/{{device}}/{{field=temperature|humidity}}`, a device that publishes `21.5` on `plant/sensor_01/temperature` and `40` on `plant/sensor_01/humidity` writes one record with both values. Messages with the same tags that arrive within one second go to the same record. ![A topic with a device placeholder and a field placeholder for temperature or humidity: the device level becomes the device tag, and each alternative of field becomes a column of the same record](https://docs.thinger.io/diagrams/product-topic-placeholders.svg) *Tags and fields from the topic* **Payload Processing** receives the merged fields. With the topic `shellies/{{device}}/relay/0/{{field=energy|power}}`, the function gets: ```json {"energy": 1386640, "power": 6.55} ``` ## Add a bucket to the profile `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. ### Console **Step 1: Open the Buckets card** Open the product on its **Profile** tab and click **Add** in the **Buckets** card. **Step 2: Set the source** Set the **Bucket Identifier**. On **Bucket Source**, choose the source, such as **Device Resource** with the **Resource Name** and a **Sampling Interval**, and the **Payload**. ![Bucket modal of the env_sensor product with a Device Resource source, the climate resource, sampled every 60 seconds](https://docs.thinger.io/screenshots/products-buckets-source.webp) *Product bucket fed by a device resource* **Step 3: Set the bucket options** On **Settings**, set the **Bucket Name**, the **Bucket Description**, the **Data Tags** (record fields stored as tags, besides `device` and `group`) and the **Backend**. Leave **Enabled** on and click **Save**. ### API **API call:** `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateproductprofileresource)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/buckets/meter_telemetry" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Telemetry", "enabled": true, "data": { "source": "resource", "resource": "telemetry", "update": "interval", "interval": 60, "magnitude": "second", "payload_type": "source_payload" }, "retention": { "period": 6, "unit": "months" } }' ``` `backend` and `retention` apply when the bucket is created. A bucket ID with `{{device}}` cannot go in the path: send it in the body of `PUT .../profile/buckets`, which replaces every entry. ### CLI ```bash thinger product profile bucket create YOUR_PRODUCT meter_telemetry \ -n Telemetry \ -s enabled=true \ -s data.source=resource \ -s data.resource=telemetry \ -s data.update=interval \ -s data.interval=60 \ -s data.magnitude=second \ -s data.payload_type=source_payload \ -s retention.period=6 \ -s retention.unit=months ``` Each `-s key=value` sets a field of the entry, and dots nest. Read the data with `thinger bucket read meter_telemetry`. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-profile-bucket-create). ### AI **Prompt for an AI agent:** > Add a bucket to the product YOUR_PRODUCT that stores the telemetry resource of each device every minute, and keeps six months of data. The agent uses `thinger_resource_create` with the `product_profile_bucket` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Read the data of one device The **Buckets** entry of a device of the product lists its product buckets and shows only its own data. From the API, `GET /v3/users/{user}/devices/{device}/buckets` lists them and `GET /v3/users/{user}/devices/{device}/buckets/{bucket}/data` reads the data, with the same parameters as a [Data Bucket](https://docs.thinger.io/platform/data-buckets.md#read-data) (see the [REST API reference](https://docs.thinger.io/reference/rest-api/devices.md#device-readbucketdata)); the CLI uses `thinger bucket read meter_telemetry --device YOUR_DEVICE`, and agents use `thinger_resource_list` with the type `bucket_data` and `device` in the filter. Users with access to the device read its data without access to the whole bucket. ## Limits - The bucket is created on the first write, outside any [project](https://docs.thinger.io/platform/projects.md). Add it to a project yourself if its members need the whole bucket. - Do not create the bucket by hand. The product creates it with the tags it needs (`device`, `group`, the **Data Tags** and the topic tags); a bucket you create with the same ID receives the data without those tags, so filtering its data by device does not work (for example, **Limit Bucket Data** in a [project](https://docs.thinger.io/platform/projects.md)). If you remove the bucket, the next write creates it again. - The tags, the backend and the retention apply only when the bucket is created. After changing the **Data Tags** or the placeholders of the topic, remove the bucket so the product creates it again with the new tags. - Removing the entry stops new writes; the bucket and its data stay. ## Related pages - [Data Buckets](https://docs.thinger.io/platform/data-buckets.md): Store time series data from your devices, read it back with filters and aggregations, and export it to a file. - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [Products](https://docs.thinger.io/reference/rest-api/products.md): REST API reference for Products: manage products and their profile, properties, firmwares and services. 38 operations. --- Source: https://docs.thinger.io/platform/products/flows.md # Flows > Route the data of every device of a product from a source to a target - a topic, a property, an endpoint, a function or a product stream. The **Flows** card of a product profile moves data for every device of the product: each flow listens to a source and sends what it receives to a target. Use it to forward MQTT messages to an HTTP service, to call an endpoint when a device disconnects or to pass data between products. ## When to use it - To forward the telemetry of a device to another service with an [endpoint](https://docs.thinger.io/platform/endpoints.md). - To react to device events, such as a disconnection, with a notification. - To copy a device resource or a topic into a property, or to publish it on another topic. - To pass data from one part of the profile, or one product, to another with a product stream. ## Sources and targets A flow takes its data from the same sources as properties and buckets (**Device Resource**, **Device Stream**, **Device Topic**, **Device Event** or **Product Stream**; see [Sources, targets and payloads](https://docs.thinger.io/platform/products.md#sources-targets-and-payloads)) and sends it to one of these targets: | Target | `target` | What it does | |---|---|---| | **Device Resource** | `resource` | Calls a device resource of the device (IOTMP devices). | | **Device Stream** | `resource_stream` | Streams the data as a device resource of the device. | | **Device Topic** | `topic` | Publishes to an MQTT topic, optionally **Retained**. | | **Device Property** | `property` | Writes a property of the device. | | **Product Function** | `function` | Runs a function of the [product script](https://docs.thinger.io/platform/products/script.md). | | **Endpoint Call** | `endpoint_call` | Calls an [endpoint](https://docs.thinger.io/platform/endpoints.md). | | **Plugin Endpoint** | `plugin_endpoint` | Sends the data to a path of a [plugin](https://docs.thinger.io/plugins.md). | | **Product Stream** | `product_stream` | Publishes the data on a stream of a product. | ### Product streams A product stream is a named channel inside a product. A flow or an [API resource](https://docs.thinger.io/platform/products/api-resources.md) with the **Product Stream** target publishes on it, and any property, bucket or flow with the **Product Stream** source and the same **Stream** receives the data, with the device it came from. The target names the **Product**, which can be another product: that is how one product hands data to another. ![A flow of product A publishes on the readings stream of product B, where a property, a bucket and a flow listen to that stream and receive the data with its device](https://docs.thinger.io/diagrams/product-flows-streams.svg) *Flows and product streams* Listeners receive data from the moment they start: a flow, bucket or property that you add or enable gets the next value published, not the last one. ## Add a flow `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. This flow calls the endpoint `notify_email` when a device disconnects. ### Console **Step 1: Open the Flows card** Open the product on its **Profile** tab and click **Add** in the **Flows** card. Set the **Flow** identifier. **Step 2: Set the source** On **Flow Source**, choose **Device Event**, the **Event** `device_state_change`, and filter it by the state `disconnected`. Choose **Source Event** as the **Payload**. **Step 3: Set the target** On **Flow Target**, choose **Endpoint Call** and the **Endpoint**. Use a **Template Payload** to shape what the endpoint receives. ![Flow modal of the meter product on its Flow Target tab, with an Endpoint Call to ops_webhook and a template payload](https://docs.thinger.io/screenshots/products-flows-target.webp) *Flow that calls an endpoint* **Step 4: Save it** On **Settings**, leave **Enabled** on. Turn on **Split Data** to send each element of an array on its own. Click **Save**. ### API **API call:** `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateproductprofileresource)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/flows/offline_alert" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "data": { "source": "event", "event": "device_state_change", "filter": { "state": "disconnected" }, "payload_type": "source_event" }, "sink": { "target": "endpoint_call", "endpoint": "notify_email", "payload": "{\"text\": \"{{device}} is offline\"}" } }' ``` To publish on a product stream, use `"sink": {"target": "product_stream", "product": "YOUR_PRODUCT", "product_stream": "readings"}`; to listen to it, `"data": {"source": "product_stream", "product_stream": "readings"}`. ### CLI Save the body of the API request as `offline_alert.json` and create the entry from it: ```bash thinger product profile flow create YOUR_PRODUCT offline_alert --from offline_alert.json ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-profile-flow-create). ### AI **Prompt for an AI agent:** > Add a flow to the product YOUR_PRODUCT that calls my endpoint notify_email with the device ID whenever one of its devices disconnects. The agent uses `thinger_resource_create` with the `product_profile_flow` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Flows for data that does not name its device A flow that listens to a topic shared by many devices, or that an external system feeds, can find the device of each message with a **Device Identifier Resolver**: a function of the [product script](https://docs.thinger.io/platform/products/script.md) that returns the device ID from the payload. With **Handle Device Connectivity** on, the device shows as connected while its data arrives. This is how a gateway feeds its [subdevices](https://docs.thinger.io/devices/subdevices.md). ## Limits - A flow only runs for devices assigned to the product, while the flow and the product are enabled. - The **Product Stream** target needs the **Product**; without it, the flow fails. - The **Endpoints** card of the profile is deprecated: use a flow with the **Endpoint Call** target. ## Related pages - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [API resources](https://docs.thinger.io/platform/products/api-resources.md): Add device resources to every device of a product, so dashboards, the API and agents can call HTTP, MQTT and virtual devices like IOTMP ones. - [Endpoints](https://docs.thinger.io/platform/endpoints.md): Configure outgoing integrations, such as emails, HTTP requests and Telegram messages, that devices, alarms, product flows and the API can call. - [Events](https://docs.thinger.io/reference/events.md): Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. --- Source: https://docs.thinger.io/platform/products/api-resources.md # API resources > Add device resources to every device of a product, so dashboards, the API and agents can call HTTP, MQTT and virtual devices like IOTMP ones. The **API Resources** card of a product profile adds device resources to every device of the product. Each API resource has a request, which does something when it is called, and a response, which sets what the call returns. Dashboards, the REST API and agents call them like the device resources of an IOTMP device. ## When to use it - To send commands to MQTT devices: the request publishes to a topic, and the response waits for the reply. - To give HTTP or [virtual devices](https://docs.thinger.io/devices/virtual-devices.md) device resources, computed by the [product script](https://docs.thinger.io/platform/products/script.md). - To set a device property from a dashboard button or an external system. - To receive data from an external system that does not know the device, through one URL for the whole product. ## Request and response The **Request** tab chooses the target of a call: **Device Resource**, **Device Stream**, **Device Topic**, **Device Property**, **Product Function**, **Endpoint Call**, **Plugin Endpoint**, **Product Stream** or **None** (see [Flows](https://docs.thinger.io/platform/products/flows.md#sources-and-targets) for what each one does). With **Device Property**, the call writes the property you choose. **None** does nothing on request: use it for a resource that only returns a value, such as a property or the result of a function. The **Response** tab chooses what the call returns: **Request Response** (what the request target returned), **Device Resource**, **Device Property**, **Device Topic** (the next message on a topic, from the same device or, with **Publish Source**, from any publisher), **Product Function**, **Endpoint Call** or **None**. Both tabs build their payload as described in [Sources, targets and payloads](https://docs.thinger.io/platform/products.md#sources-targets-and-payloads). ### Commands over MQTT An MQTT device answers a command on another topic. Set the request to **Device Topic** on the command topic, such as `devices/{{device}}/cmd`, and the response to **Device Topic** on the reply topic, such as `devices/{{device}}/reply`. The call publishes the command and returns the first message that the device publishes on the reply topic, or fails after 15 seconds without one. With a **Device Topic** request, **Request Response** returns the message that was published, not an answer from the device. ![A client calls the device resource, the platform publishes the command on the cmd topic of the device, the device answers on its reply topic, and the reply returns to the client within 15 seconds](https://docs.thinger.io/diagrams/product-api-resource-mqtt.svg) *API resource call over MQTT* ### Default input The API tab of the device and dashboard widgets show the input of a resource. They cannot guess its type from `{{payload}}` alone, so give it a default value in the request payload: ```text {{payload:toOnOff=false}} ``` Here `toOnOff` is a function of the [product script](https://docs.thinger.io/platform/products/script.md) that converts the input before it is sent. The default after `=` is a JSON value (`false`, `0`, `{}`) or the path of a current value, such as `property.relay`. It sets the input that the API tab and widgets show. With several inputs, name each one; a call that leaves out one of them gets its default: ```text {"threshold": {{payload.threshold=30}}, "enabled": {{payload.enabled=false}}} ``` ## Add an API resource `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. This resource writes the `settings` property of the device and returns what it wrote. ### Console **Step 1: Open the API Resources card** Open the product on its **Profile** tab and click **Add** in the **API Resources** card. Set the **Resource Identifier**. **Step 2: Set the request** On **Request**, choose **Device Property**, the property `settings`, and **Source Payload**. ![API Resource modal of the meter product with a Device Property request target that writes the relay property](https://docs.thinger.io/screenshots/products-api-request.webp) *API resource with a Device Property target* **Step 3: Set the response** On **Response**, choose **Request Response**. On **Settings**, set the **API Description**, leave **Enabled** on and click **Save**. ### API **API call:** `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateproductprofileresource)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/api/configure" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "request": { "data": { "target": "property", "property": "settings", "payload_type": "source_payload" } }, "response": { "data": { "source": "request_response", "payload_type": "source_payload" } } }' ``` ### CLI ```bash thinger product profile api create YOUR_PRODUCT configure \ -s enabled=true \ -s request.data.target=property \ -s request.data.property=settings \ -s request.data.payload_type=source_payload \ -s response.data.source=request_response \ -s response.data.payload_type=source_payload ``` Each `-s key=value` sets a field of the entry, and dots nest. `--from configure.json` takes the whole entry from a file. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-profile-api-create). ### AI **Prompt for an AI agent:** > Add an API resource called configure to the product YOUR_PRODUCT that saves what it receives in the settings property of the device. The agent uses `thinger_resource_create` with the `product_profile_api` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Call an API resource Every device of the product now has the device resource. Call it for one device: ### Console Open the device on its **API** tab, choose the resource, fill in the input and run it. Dashboard widgets can also call it. ### API **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/configure" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"threshold": 30}' ``` ### CLI ```bash thinger device resource call YOUR_DEVICE configure -s threshold=30 ``` Each `-s key=value` adds a field to the input. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-resource-call). ### AI **Prompt for an AI agent:** > Call the configure resource of YOUR_DEVICE with a threshold of 30. The agent uses `thinger_resource_call` with the type `device_resource` and the action `call`. See [MCP tools](https://docs.thinger.io/ai/tools.md). ### Call it for the whole product An external system that sends data for many devices, without knowing which device is which, can call the resource on the product. Set a **Device Identifier Resolver** in **Settings**: a function of the product script that returns the device ID from the payload. The console then shows the URL of the product call, which needs an access token with the `AccessProductResources` permission. **API call:** `POST /v1/users/{user}/products/{product}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-accessresources)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/resources/configure" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"serial": "001", "threshold": 30}' ``` An array calls the resource once per element. From the CLI: ```bash thinger product profile api call YOUR_PRODUCT configure -s serial=001 -s threshold=30 ``` Agents use `thinger_resource_call` with the type `product_profile_api` and the action `call`. ## Limits - An API resource runs only while it and the product are enabled. - Without a **Device Identifier Resolver**, the product call does not reach any device. - The **Device Resource** target and response work only with IOTMP devices, which must be connected. - A **Device Topic** response waits up to 15 seconds for the message. - A call to a device that does not exist, with an ID that matches an Auto Provision pattern of the product, creates the device: see [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md). ## Related pages - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [Script](https://docs.thinger.io/platform/products/script.md): Write the JavaScript functions of a product, inline or from a File Storage folder, and debug them with the real-time script console. - [MQTT](https://docs.thinger.io/devices/mqtt.md): Connect an MQTT client to the Thinger.io broker, publish and subscribe to topics, and store the messages in a Data Bucket. - [Virtual devices](https://docs.thinger.io/devices/virtual-devices.md): Create devices without hardware whose device resources are computed on the platform, such as a weather station that reads a public weather API. --- Source: https://docs.thinger.io/platform/products/auto-provision.md # Auto Provision > Let a product create its devices when they first connect or are first called, with an ID pattern, an asset type, an asset group and a project. The **Auto Provision** card of a product profile creates devices on their own. You set a pattern for the device ID; when a device that does not exist yet reaches the platform with an ID that matches it, the platform creates the device in the product, with the asset type, the asset group and the project you choose. ## When to use it - To deploy a fleet without creating each device by hand: flash the same firmware with a different ID on each unit. - To accept the devices that a gateway, a network server or an external system starts sending. To compare Auto Provision with adding devices by hand and with claims, which hand your devices to other accounts, see [Provisioning](https://docs.thinger.io/devices/provisioning.md). Claims are configured in [**Toolbox > Claims**](https://docs.thinger.io/platform/toolbox/claims.md). ## How a device is created A rule applies when a device that does not exist tries to authenticate, or when a device resource of the product is called for a device that does not exist, and its ID matches the **Device Pattern**. The new device belongs to the product, so it gets its properties, Data Buckets, API resources and dashboard at once. What starts the creation depends on the device type: see [Provisioning](https://docs.thinger.io/devices/provisioning.md#auto-provision). An IOTMP or MQTT device is refused on that first connection and is accepted when it reconnects; an HTTP device is created by its first request, which then goes through. ![An IOTMP or MQTT device that does not exist connects and is refused, the product creates it because its ID matches the Auto Provision pattern, and the device is accepted when it connects again; an HTTP device is created on its first request](https://docs.thinger.io/diagrams/product-auto-provision.svg) *Auto Provision on first connection* ## Add an Auto Provision rule `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. ### Console **Step 1: Open the Auto Provision card** Open the product on its **Profile** tab and click **Add** in the **Auto Provision** card. Set the **Provision Identifier**. **Step 2: Set the pattern** On **Auto Provision**, leave the **Provisioning Mode** in **Device Pattern** and type the **Device Pattern**, a regular expression such as `^meter_[0-9]{6}$`. Optionally, choose the **Device Type** (asset type), the **Device Group** (asset group) and the **Project** of the new devices. ![Auto Provision modal of the meter product with the device pattern ^meter_\[0-9\]{3}$, the energy_meter asset type and the madrid_plant asset group](https://docs.thinger.io/screenshots/products-auto-provision.webp) *Auto Provision rule of a product* **Step 3: Save it** On **Settings**, set the **Name** and **Description** that new devices get, leave **Enabled** on and click **Save**. ### API **API call:** `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateproductprofileresource)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/autoprovisions/meters" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "config": { "mode": "pattern", "pattern": "^meter_[0-9]{6}$", "type": "meter", "group": "plant_a" } }' ``` `config.project` adds the new devices to a [project](https://docs.thinger.io/platform/projects.md). ### CLI ```bash thinger product profile autoprovision create YOUR_PRODUCT meters \ -s enabled=true \ -s config.mode=pattern \ -s 'config.pattern=^meter_[0-9]{6}$' \ -s config.type=meter \ -s config.group=plant_a ``` Each `-s key=value` sets a field of the entry, and dots nest. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-profile-autoprovision-create). ### AI **Prompt for an AI agent:** > Make the product YOUR_PRODUCT create any device whose ID is meter_ followed by six digits, in the asset type meter and the group plant_a. The agent uses `thinger_resource_create` with the `product_profile_autoprovision` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Limits - The pattern is a regular expression on the device ID. Anchor it with `^` and `$`, and keep it narrow: any ID that matches creates a device in your account. - A device created this way counts like any other device: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). - A rule only works while it and the product are enabled. Disabling it does not remove the devices it created. ## Related pages - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [Assets](https://docs.thinger.io/platform/assets.md): Classify devices by asset type and asset group, share properties with every device of a type or group, and see them on a map. --- Source: https://docs.thinger.io/platform/products/script.md # Script > Write the JavaScript functions of a product, inline or from a File Storage folder, and debug them with the real-time script console. The **Product Script** card of a product profile holds the JavaScript functions that the rest of the profile calls: to compute a device resource, to transform a payload or to find the device of a message. The code runs on the platform, once per product, and you follow what it logs in the script console. ## When to use it - To compute the device resources of [virtual devices](https://docs.thinger.io/devices/virtual-devices.md) or to simulate data. - To convert payloads, such as a binary frame or a value in another unit, before they reach a property, a bucket or a flow. - To find the device ID in the messages of a gateway or an external system (a **Device Identifier Resolver**). ## Where the profile calls your functions ![The product script, written inline or loaded from a File Storage, is called by Product Function targets and responses, Payload Processing, the Device Identifier Resolver and placeholders with a function](https://docs.thinger.io/diagrams/product-script-calls.svg) *Where the product script runs* | Where | Setting | The function receives | It returns | |---|---|---|---| | A request or flow target | **Product Function** | The payload of the call | The result of the resource | | An API resource response | **Product Function** | The user, device, resource and product of the call | The response | | Any source, target or response | **Payload Processing** | The payload | The new payload; an empty result skips the write | | An API resource or flow | **Device Identifier Resolver** | The payload | The device ID | | A template | `{{:}}` | The value of the placeholder | Its replacement | Choose **Source Event** as the payload to receive the whole context, with the device ID: **Product Script** ```js // event = { user, device, resource, product, payload } function status(event) { console.log('status called for', event.device); return { device: event.device, ok: true }; } function resolveDevice(payload) { // device ID from the serial number sent by the caller return 'meter_' + payload.serial; } ``` Functions are found by name: declare them with `function name() {}` at the top level. They run synchronously: promises, `async` functions, timers and network requests do not complete. To call an external service, use an **Endpoint Call** target. Return JSON values (objects, arrays, numbers, strings, booleans); a function that throws returns `null`. ## Write the script `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. ### Console **Step 1: Open the Product Script card** Open the product on its **Profile** tab and scroll to the **Product Script** card. **Step 2: Write the code** Leave the storage empty to write the code in the editor. **Add Function** inserts the skeleton of a function that processes a payload. ![Product Script card of the meter product with the resolveDevice and toKw functions in the editor and the Console button](https://docs.thinger.io/screenshots/products-script-editor.webp) *Product Script card* **Step 3: Save it** Click **Save**. The new code takes effect at once. ### API **API call:** `PUT /v1/users/{user}/products/{product}/profile/code` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateprofilecode)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/code" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"code": "function resolveDevice(payload) {\n return \"meter_\" + payload.serial;\n}\n"}' ``` `GET` on the same path returns the current code. ### CLI Write the code in a file, `script.js`, and save it as the script of the product: ```bash thinger product profile code update YOUR_PRODUCT -s "code=$(cat script.js)" ``` `thinger product profile code get YOUR_PRODUCT -f code` prints the current code. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-profile-code). ### AI **Prompt for an AI agent:** > Add a function to the script of the product YOUR_PRODUCT that converts the temperature_f field of a payload to Celsius, and use it in the telemetry bucket. The agent uses `thinger_resource_update` with the `product_profile_code` type, and can read the guide on product code with `thinger_resource_get` and the type `doc`. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Load the script from a File Storage Instead of inline code, the product can run the `index.js` file of a [File Storage](https://docs.thinger.io/platform/file-storages.md), with the modules of its `node_modules` folder. With a folder (`profile.code.path`), it runs `/index.js`, so one storage can hold a whole application: for example, the [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md) in `app/` and the code of each product in `code//`. When a storage is set, the inline code is not used. ### Console In the **Product Script** card, choose the storage and click **Save**. The console sets the storage only: to use a folder of it, set `path` with the API or an agent. ### API **API call:** `PUT /v1/users/{user}/products/{product}/profile/code` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateprofilecode)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/code" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"storage": "fleet_app", "path": "code/meter"}' ``` `path` is relative to the root of the storage; leave it out to use the root. ### CLI ```bash thinger product profile code update YOUR_PRODUCT -s storage=fleet_app -s path=code/meter ``` ### AI **Prompt for an AI agent:** > Make the product YOUR_PRODUCT run the code in the folder code/meter of my fleet_app storage. > **Warning** > > Editing `index.js` in the storage does not reload the script. Save the **Product Script** card, or send the `PUT` again, after you change the files. ## Debug with the script console Click **Console** in the **Product Script** card to open the script console. It shows, as they happen, the messages that your functions log with `console.log`, `console.info`, `console.warn` and `console.error`, each with its time and level: ```text [console] connected to product script console 17:02:57.418 [log] status called for meter_000005 ``` The console shows only what is logged while it is open. From outside the console, the same messages arrive through a WebSocket on `GET /v1/users/{user}/products/{product}/profile/console`: see the [REST API reference](https://docs.thinger.io/reference/rest-api/products.md#product-readprofileconsole). The CLI and the MCP tools cannot open it. ## Limits - Inline code has no access to the file system. Code loaded from a storage reads only the files of its own storage. - The `storage` must exist, and `path` cannot leave it (`..` is refused). A `path` without a `storage` is refused. - Global variables keep their values between calls, but they are reset whenever the profile is saved. Keep the state that matters in a device property. - Functions run without a time limit: keep them short. ## Related pages - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [API resources](https://docs.thinger.io/platform/products/api-resources.md): Add device resources to every device of a product, so dashboards, the API and agents can call HTTP, MQTT and virtual devices like IOTMP ones. - [File Storages](https://docs.thinger.io/platform/file-storages.md): Keep files on your Thinger.io instance, edit them online, serve them over HTTP and use them from dashboards, apps and product code. - [Virtual devices](https://docs.thinger.io/devices/virtual-devices.md): Create devices without hardware whose device resources are computed on the platform, such as a weather station that reads a public weather API. --- Source: https://docs.thinger.io/platform/products/dashboard.md # Dashboard > Design one dashboard for a product and show it on every device of the product, with the data of the device being viewed. The **Dashboard** tab of a product holds a dashboard that every device of the product shows in its own **Dashboard** tab. You design it once, with the widgets of a regular [dashboard](https://docs.thinger.io/platform/dashboards.md) or as a [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md), and each device fills it with its own data. ![One product dashboard is shown in the Dashboard tab of every device of the product with its own data, unless a device has its own dashboard](https://docs.thinger.io/diagrams/product-dashboard.svg) *One dashboard for the whole fleet* ## When to use it - To give every device of a fleet the same screen, without building one dashboard per device. - To show the data that the product keeps for each device, with **From Device Bucket** widgets. - To show a dashboard app that receives the device being viewed as its subject. ## Design the product dashboard `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. ### Console **Step 1: Open the Dashboard tab** Open the product and go to its **Dashboard** tab. The editor works as in **Dashboards**. **Step 2: Choose a device to preview** Choose one of the devices of the product in the selector at the top. The widgets show its data while you edit; on each device, they show the data of that device instead. **Step 3: Add the widgets** Add widgets that read device resources, device properties or **From Device Bucket** data of the preview device, and save the dashboard. ![Product dashboard of env_sensor in edit mode, previewing the office_climate device](https://docs.thinger.io/screenshots/products-dashboard-editor.webp) *Product dashboard in edit mode* ### API The product dashboard is the property `dashboard` of the product. Read it with: **API call:** `GET /v1/users/{user}/products/{product}/properties/{property}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-readproperty)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties/dashboard" \ -H "Authorization: Bearer YOUR_TOKEN" ``` Write it with `PUT` on the same path. For a dashboard app, its value points to the app: `{"value": {"source": "url", "url": "/v1/users/YOUR_USER/storages/YOUR_STORAGE/files/"}}`. ### CLI Publish a dashboard app as the dashboard of the product: ```bash thinger dashboard publish dist --storage meter_app --to product:YOUR_PRODUCT ``` `thinger product property get YOUR_PRODUCT dashboard` reads the current one, and `thinger product property set YOUR_PRODUCT dashboard` writes its value. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-dashboard-publish). ### AI **Prompt for an AI agent:** > Publish the app in ./dist as the dashboard of every device of the product YOUR_PRODUCT. The agent uses `thinger_resource_call` with the type `dashboard` and the action `publish`, with the destination `{type: "product", id: "YOUR_PRODUCT"}`. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Change the dashboard of one device A device can have its own dashboard instead of the one of its product: edit it from the **Dashboard** tab of the device. To keep users from changing it, restrict the `dashboard` property with the permissions of [product properties](https://docs.thinger.io/platform/products/properties.md). ## Limits - The product dashboard shows only what the viewer may read. Project members need access to the device, and to the File Storage of an HTML widget or a dashboard app. - A dashboard app in a public storage receives the session token of whoever opens it: see [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md). ## Related pages - [Dashboards](https://docs.thinger.io/platform/dashboards.md): Build dashboards with widgets that show and control your device data, organize them in tabs and share them with a link. - [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md): Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. - [Buckets](https://docs.thinger.io/platform/products/buckets.md): Store the data of every device of a product in Data Buckets defined once in the product profile, shared or one per device. --- Source: https://docs.thinger.io/platform/products/services.md # Services > Reach the web interfaces and remote desktops of the devices of a product from the console, through the device connection, without opening ports. The **Services** tab of a product publishes a web interface or a remote desktop that runs on, or next to, each device of the product. The console opens it through the IOTMP connection of the device, so you reach it without a public IP, a VPN or open ports on the device network. ![The console reaches a service on the device, or on another machine of its network, through the outgoing connection of the device, without open ports or a VPN](https://docs.thinger.io/diagrams/product-services-tunnel.svg) *Product services through the device connection* ## When to use it - To open the local web interface of a gateway, a PLC or a router, such as Node-RED on port 1880. - To control the desktop of an industrial PC or a panel over VNC. The device must be connected over IOTMP, for example with the [Linux client](https://docs.thinger.io/devices/linux.md). The target address is seen from the device: `127.0.0.1` is the device itself, and another address reaches a machine of its local network. ## Add a service `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_PRODUCT` is the product ID. ### Console **Step 1: Open the Services tab** Open the product, go to its **Services** tab and click **Add**. **Step 2: Set the target** Set the **Service Identifier** and choose the **Service Type**: **Web Service** or **VNC Remote Desktop**. On the configuration tab, set the **Target Hostname**, the **Target Port** and, if the target uses TLS, **SSL/TLS**. For VNC, **VNC Settings** sets **View Only Mode**, **Auto Scale**, **Shared Desktop**, the **Compression Level** and the **Image Quality**. ![New Service modal of a product with a Web Service that targets 127.0.0.1 on port 1880](https://docs.thinger.io/screenshots/products-services-web.webp) *Web Service of a product* **Step 3: Set the security and save** On **Security**, turn on **IP Filtering** and set the **Timeout Minutes** if you need them. On **Settings**, set the **Name** shown in the device menu, leave **Enabled** on and click **Create**. ### API **API call:** `PUT /v1/users/{user}/products/{product}/services/{service}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateservices)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/services/node_red" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "type": "web", "name": "Node-RED", "enabled": true, "target": { "address": "127.0.0.1", "port": 1880, "secure": false } }' ``` `"type": "vnc"` adds a `vnc` object with `viewonly`, `scale`, `shared`, `compression` and `quality`. `GET .../services` lists them. ### CLI ```bash thinger product service create YOUR_PRODUCT node_red \ -n Node-RED \ -s type=web \ -s enabled=true \ -s target.address=127.0.0.1 \ -s target.port=1880 \ -s target.secure=false ``` `thinger product service list YOUR_PRODUCT` lists them. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-product-service). ### AI **Prompt for an AI agent:** > Add a web service called Node-RED to the product YOUR_PRODUCT that opens port 1880 of each device. The agent uses `thinger_resource_create` with the `product_service` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Open a service Each enabled service appears as an entry in the menu of every device of the product, with the **Name** of the service (a VNC service without a name shows as `Desktop:` followed by its ID). Click it to open the web interface or the desktop inside the console. Opening a web service or a remote desktop needs its own permission, so you can grant it to some project members only. ## Limits - Services work only with IOTMP devices, while they are connected. - The target must be reachable from the device. - Removing a service, or disabling it, removes its entry from the devices. ## Related pages - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [Linux](https://docs.thinger.io/devices/linux.md): Build the Thinger.io IOTMP client for Linux, connect a Raspberry Pi or any Linux computer, and run it as a service with remote terminal and files. - [Remote tools](https://docs.thinger.io/devices/remote-tools.md): Open a shell, browse files and read the log of a connected device from the Thinger.io console, without VPNs or open ports. --- Source: https://docs.thinger.io/platform/projects.md # Projects > Group devices, dashboards and other resources in a project and share it with other accounts, with roles that set what each member can do. A project groups resources of any type (devices, dashboards, Data Buckets, alarms, file storages…) so you can share them with other accounts and show them together. Each member of the project gets permissions from roles you define, and only sees the resources of the project. ![The owner account puts some of its resources in a project; each member gets project roles, global roles and its own allow and deny permissions, and sees only the resources of the project](https://docs.thinger.io/diagrams/project-sharing.svg) *How a project is shared* ## When to use it - To give a customer access to their own devices and dashboards, and nothing else in your account. - To let a technician of one site operate the devices of that site only. - To organize a large account by installation or client, each project with its own home dashboard. - To receive the devices of a [claim](https://docs.thinger.io/platform/toolbox/claims.md): claimed resources join a project shared with the claiming account. ## Create a project `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Projects** Go to **Projects** and click **Add Project** (or **Create a new Project** if you have none yet). **Step 2: Fill in the form** Set the **Project ID** (letters, numbers and underscores), the **Project name** and an optional **Project description**, and click **Add Project**. ![Add Project form with the project ID, the name and the description filled in](https://docs.thinger.io/screenshots/projects-add-form.webp) *Add a project* The project opens on its **Members** tab. The other tabs are **Project Roles**, **Dashboard** and, in the dropdown, **Inspector** (the events of the project) and **Settings**. ### API **API call:** `POST /v1/users/{user}/projects` ([reference](https://docs.thinger.io/reference/rest-api/projects.md#project-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/projects" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"project": "plant_madrid", "name": "Madrid plant", "description": "Devices and dashboards of the Madrid plant"}' ``` The answer includes `config.limit_bucket_access: true`: see [Limit bucket data to the project](#limit-bucket-data-to-the-project). `YOUR_TOKEN` is an access token with permission to create projects. ### CLI ```bash thinger project create plant_madrid -n "Madrid plant" -d "Devices and dashboards of the Madrid plant" ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-project). ### AI **Prompt for an AI agent:** > Create a project called plant_madrid for the devices and dashboards of the Madrid plant. The agent uses `thinger_resource_create` with the `project` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Add resources to a project A resource can belong to several projects. A resource you create while a project is open in the console joins that project automatically. ### Console In the list of any section, such as **Devices** or **Dashboards**, select the resources, open the context menu and choose **Set Projects**. Pick the projects and click **Save**. The action is not available while a project is open. ### API Send the full list of projects of the resource, each as `owner@project`. The list replaces the previous one, and `[]` removes the resource from every project. **API call:** `PUT /v1/users/{user}/devices/{device}/projects` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-updateprojects)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/projects" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '["YOUR_USER@plant_madrid"]' ``` The same call exists for buckets, dashboards, endpoints, alarms, file storages, products, asset types and groups, tokens, claims and syncs. ### CLI ```bash thinger device update YOUR_DEVICE --projects YOUR_USER@plant_madrid ``` `--projects` takes the full list, comma-separated, and replaces the previous one. The `update` command of the other resources takes the same option, and `create` sets the projects of a new resource. ### AI **Prompt for an AI agent:** > Add YOUR_DEVICE and the dashboard of the Madrid plant to the plant_madrid project. The agent sets the `projects` field of each resource with `thinger_resource_update`. ## Define roles A role is a named set of permissions: the actions it allows (**Allow**) and the ones it denies (**Deny**), per resource type, for any resource or for specific ones. There are no built-in roles: create the ones you need, such as `viewer` or `operator`. - **Project Roles** belong to one project. - **Global Roles**, in **Projects > Global Roles**, belong to your account and can be assigned to members of any of your projects. ### Console Open the project, go to **Project Roles** and click **Add Role**. Set the **Role Id**, leave **Enabled** on, add permissions to **Allow** and **Deny** (choose the resource type, any or specific resources, and any or specific actions) and click **Add Role**. ![Add Role form of the plant_madrid project with one Allow permission: read the properties of any device](https://docs.thinger.io/screenshots/projects-role-form.webp) *Add a project role* ### API **API call:** `POST /v1/users/{user}/projects/{project}/roles` ([reference](https://docs.thinger.io/reference/rest-api/projects.md#project-createrole)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/projects/plant_madrid/roles" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"role": "viewer", "enabled": true, "allow": {"Device": ["ReadDeviceProperty", "ListDeviceProperties"]}}' ``` Global roles use `POST /v1/users/{user}/roles` with the same body. A trailing `*` in an action name matches every action that starts with it. ### CLI ```bash thinger project role create plant_madrid viewer -s enabled=true \ -s 'allow.Device=["ReadDeviceProperty", "ListDeviceProperties"]' ``` Global roles use `thinger role create` with the same options. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-project-role). ### AI **Prompt for an AI agent:** > Create a viewer role in the plant_madrid project that can only read the properties of its devices. The agent uses the `project_role` type, or `role` for global roles. ## Add members A member is an account the project is shared with. Its permissions are the sum of its own **Allow** and **Deny**, its **Project Roles** and its **Global Roles**, and a **Deny** wins over an **Allow**; a disabled member has none. The project then appears in the member's own **Projects** list, and the member opens it from **Select Project** in the header of the console. ### Console **Step 1: Open the members** Open the project, go to **Members** and click **Add Member**. **Step 2: Choose the account** With **Existing User** on, type the **Username** of the account. With it off, set a **Username**, an **Email** and an optional **Password** (leave it blank to let the user set their own) to create a new account for the member. **Step 3: Set the permissions** Leave **Enabled** on, and turn on **Hide Menu** to show the member only the project dashboard. In **Member Permissions**, choose **Global Roles** and **Project Roles**, optionally restrict the member to some **Project Groups** (asset groups), and add extra **Allow** or **Deny** permissions. Click **Add Member**. ![Add Member form of the plant_madrid project with the existing user laura_ops and the viewer project role](https://docs.thinger.io/screenshots/projects-member-form.webp) *Add a project member* ### API **API call:** `POST /v1/users/{user}/projects/{project}/members` ([reference](https://docs.thinger.io/reference/rest-api/projects.md#project-createmember)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/projects/plant_madrid/members" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"member": "jane", "enabled": true, "roles": ["viewer"], "groups": ["madrid_plant"]}' ``` The account must exist, unless you add `account` with an `email` (and optionally a `password`): the server then creates a verified account with the `member` role, and this project as the one it opens at sign-in. ### CLI ```bash thinger project member create plant_madrid jane -s enabled=true -s 'roles=["viewer"]' -s 'groups=["madrid_plant"]' ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-project-member). ### AI **Prompt for an AI agent:** > Share the plant_madrid project with the user jane, with the viewer role, limited to the madrid_plant group. The agent uses the `project_member` type, with the project in `ids`. Accounts with the `member` role, created this way or by an administrator in [User Accounts](https://docs.thinger.io/administration/user-accounts.md), work only inside the projects shared with them. ## Work inside a project The lists of the console have a **Project** column with the projects of each resource. It is hidden while a project is selected in **Select Project**, because the list then shows only that project. A member, or an application that acts for one, calls the REST API of the owner's resources with the owner's account in the path and the project in `?project=`, with the member's own token. The member's account works in the path too: the server uses the owner of the project. **API call:** `GET /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md)) ```bash curl "https://YOUR_SERVER/v1/users/OWNER_USER/devices?project=plant_madrid" \ -H "Authorization: Bearer YOUR_TOKEN" ``` `OWNER_USER` is the account that owns the project and `plant_madrid` its Project ID. Calls to a resource outside the project, or beyond the permissions of the member, are refused. The `project` field of each resource lists the projects it belongs to. A [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md) opened in a project adds the parameter on its own. ## Limit bucket data to the project A Data Bucket in a project holds data of many devices. With **Limit Bucket Data** on, members of the project read only the records of the devices that belong to the project, and get nothing for other devices. It is on by default for new projects (`config.limit_bucket_access`), and you can turn it off in **Settings > Advanced Options**. The filter uses the `device` tag of the bucket records: buckets without that tag are not filtered. See [Data Buckets](https://docs.thinger.io/platform/data-buckets.md). ## Receive events of the project Members and access tokens of a project can subscribe to real-time [events](https://docs.thinger.io/reference/events.md) with `GET /v2/users/{user}/events?project=plant_madrid`, always limited to the project: - device state changes and property updates of devices of the project; - Data Bucket writes, filtered by a device or a bucket of the project; - alarm executions and alarm instances of the project. Other events are refused. A token created inside a project only works with that project: see [Access Tokens](https://docs.thinger.io/platform/access-tokens.md). ### Inspector The **Inspector** tab of the project shows the changes to the project itself as they happen: its settings, members, roles and properties (`project_update`, `project_member_create`, `project_role_update`…). It does not show the events of the devices and buckets of the project: watch them in the **Inspector** of each device or bucket, or subscribe to the events above. The same inspector is on devices, Data Buckets, products, alarms, claims, proxies and plugins: - The first button shows whether it is receiving events (green) or not (red); click it to connect or disconnect. - **Events** chooses which kinds of events to show, with the number selected. - **Pause** stops the list without losing the connection, and **Resume** continues. **Clear** empties it. ![Event Inspector of the plant_madrid project, connected, with 12 events selected and a project_update event whose data is the project with its config, created time and description](https://docs.thinger.io/screenshots/projects-inspector.webp) *A project_update event in the Inspector of the project* ## Show a project dashboard The **Dashboard** tab sets the home page of the project. When a project is open, its name replaces **Statistics** at the top of the menu and opens that dashboard. It can be a widget dashboard or a [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md), which receives the project as its context. ## Limits - The **Project ID** cannot change after you create the project. - Members are accounts of the same instance. A project cannot be shared with accounts of another instance or of the free Cloud server. - Deleting a project removes its members, roles and properties, and takes its resources out of the project; the resources themselves are kept. When a member deletes a shared project, only their membership is removed. - The number of projects depends on your plan: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Claims](https://docs.thinger.io/platform/toolbox/claims.md): Let other accounts claim your devices and dashboards with a link, a QR code or a claim code, and get them in a project shared with them. - [Access Tokens](https://docs.thinger.io/platform/access-tokens.md): Create tokens with scoped permissions to call the Thinger.io REST API from scripts, apps and agents, and make them expire. - [Permissions](https://docs.thinger.io/ai/permissions.md): What an AI agent is allowed to do in your Thinger.io account, how to limit it with an access token, and how to use it safely. - [Projects](https://docs.thinger.io/reference/rest-api/projects.md): REST API reference for Projects: manage projects and their members, roles and properties. 27 operations. --- Source: https://docs.thinger.io/platform/toolbox.md # Toolbox > Syncs and Claims, the tools to coordinate concurrent work on your devices and to share devices with other accounts through a project. The **Toolbox** menu of the console groups two tools that work across the rest of the platform rather than as resources of their own: syncs, to coordinate concurrent work, and claims, to share devices with other accounts through a project. | Tool | What it does | Use it when | |---|---|---| | **Syncs** | Shared semaphores with a number of slots and a default timeout. A device or an API client takes slots with a lock before a task and releases them when it ends. | Many devices or clients compete for something that only a few of them should use at the same time, such as a firmware download or a shared pump. | | **Claims** | A link, QR code or claim code that another account redeems to get some of your devices, and other resources, in a project shared with it. | You ship devices to customers and each one must reach the account of whoever installs it. | Both entries are in **Toolbox** in the main menu of the console. The menu appears to users allowed to list syncs, and each entry to users allowed to list its resources: inside a [project](https://docs.thinger.io/platform/projects.md), members see them only if their role grants those permissions. ## Learn more - [Syncs](https://docs.thinger.io/platform/toolbox/syncs.md): Coordinate devices and API clients with shared semaphores, so only a set number of them use a resource or run a task at the same time. - [Claims](https://docs.thinger.io/platform/toolbox/claims.md): Let other accounts claim your devices and dashboards with a link, a QR code or a claim code, and get them in a project shared with them. - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. --- Source: https://docs.thinger.io/platform/toolbox/syncs.md # Syncs > Coordinate devices and API clients with shared semaphores, so only a set number of them use a resource or run a task at the same time. A sync is a shared semaphore: it has a number of slots, and devices or API clients take some of them with a lock before they start a task and release them when they finish. When all the slots are taken, new locks fail until one is released or expires. ## When to use it - To let only a few devices download a firmware update at the same time, so they do not saturate the network or the server. - To make sure that only one controller drives a shared actuator, such as a pump or a gate. - To keep two API clients or backend jobs from working on the same task at once. ## Create a sync `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Syncs** Go to **Toolbox > Syncs** and click **Add Sync**. **Step 2: Fill in the form** Set the **Sync Identifier**, the **Name** and an optional **Description**. In **Configuration**, leave **Enabled** on, set **Slots Available** to the number of locks that can be held at the same time, and set the **Default Timeout** in seconds (`0` keeps each lock until it is released). ![Add Sync form with one slot available and a default timeout of 120 seconds](https://docs.thinger.io/screenshots/syncs-add-form.webp) *Add a sync* **Step 3: Save it** Click **Add Sync**. The sync opens on its **Settings** tab. ### API **API call:** `POST /v1/users/{user}/syncs` ([reference](https://docs.thinger.io/reference/rest-api/syncs.md#sync-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/syncs" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"sync": "dosing_pump", "name": "Dosing pump", "enabled": true, "config": {"available": 1, "timeout": 120}}' ``` `config.available` is the number of slots and `config.timeout` the default lifetime of a lock, in seconds. `YOUR_TOKEN` is an access token with permission to create syncs. ### CLI ```bash thinger sync create dosing_pump -n "Dosing pump" -s enabled=true -s config.available=1 -s config.timeout=120 ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-sync). ### AI **Prompt for an AI agent:** > Create a sync called dosing_pump with one slot and a default timeout of two minutes, so only one controller can dose at a time. The agent uses `thinger_resource_create` with the `sync` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Take and release a lock A lock takes one slot by default, or the number you set in `slots`. It lasts the default timeout of the sync unless you set another `timeout`, and it gets a random ID if you do not give one. Delete the lock to release its slots. ### Console The console does not take locks. Open the sync on its **Locks** tab to see the locks currently held, with their **Slots**, **Created** and **Expire** dates, and delete a lock to free its slots. ![Locks tab of the dosing_pump sync with the lock of Controller 1, one slot, and Now as its creation and expiration](https://docs.thinger.io/screenshots/syncs-locks.webp) *Locks of a sync* ### API **API call:** `POST /v1/users/{user}/syncs/{sync}/locks` ([reference](https://docs.thinger.io/reference/rest-api/syncs.md#sync-createlock)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/syncs/dosing_pump/locks" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"lock": "controller_1", "name": "Controller 1"}' ``` The answer includes the `expire` date of the lock, in milliseconds. When the slots are not enough, the call fails with `insufficient slots available`. **API call:** `DELETE /v1/users/{user}/syncs/{sync}/locks/{lock}` ([reference](https://docs.thinger.io/reference/rest-api/syncs.md#sync-deletelock)) ```bash curl -X DELETE "https://YOUR_SERVER/v1/users/YOUR_USER/syncs/dosing_pump/locks/controller_1" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger sync lock create dosing_pump controller_1 -n "Controller 1" thinger sync lock delete dosing_pump controller_1 -y ``` `-s slots=2` and `-s timeout=300` set the slots and the lifetime of the lock. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-sync-lock). ### AI **Prompt for an AI agent:** > Take a lock called controller_1 on the dosing_pump sync, and release it when I tell you the dosing has finished. The agent uses `thinger_resource_create` and `thinger_resource_delete` with the `sync_lock` type and the lock in `ids`, such as `{"sync": "dosing_pump", "lock": "controller_1"}`. IOTMP devices can take and release locks themselves: the Linux client of the IOTMP library has `lock_sync` and `unlock_sync`, which return whether the call succeeded. ## Limits - A lock fails when the sync is disabled (`requested sync is disabled`), when its slots are not enough (`insufficient slots available`) or when a lock with the same ID is already held (`slot already reserved`). - A sync with **Slots Available** set to `0` refuses every lock. - Locks cannot be renewed or extended: only their `name` and `description` can change. To hold a slot longer, release the lock and take it again, or set a longer `timeout`. - An expired lock is removed shortly after its `expire` date, not at the exact second. - Deleting a sync deletes its locks. - The number of syncs depends on your plan: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Toolbox](https://docs.thinger.io/platform/toolbox.md): Syncs and Claims, the tools to coordinate concurrent work on your devices and to share devices with other accounts through a project. - [OTA updates](https://docs.thinger.io/devices/ota.md): Update the firmware of your devices over their Thinger.io connection from Visual Studio Code, one device or a whole product at a time. - [Syncs](https://docs.thinger.io/reference/rest-api/syncs.md): REST API reference for Syncs: manage syncs and their locks. 13 operations. - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. --- Source: https://docs.thinger.io/platform/toolbox/claims.md # Claims > Let other accounts claim your devices and dashboards with a link, a QR code or a claim code, and get them in a project shared with them. A claim is a list of your resources, such as devices and dashboards, with a code that another account can redeem. When someone claims it, the resources are added to a project you share with that account, so they can use them with the permissions of the project. The resources stay in your account: a claim shares them, it does not transfer them. ## When to use it - You make devices for customers: you provision them first and print a QR code on each box, so every customer claims their own device. - You hand a kit of resources, such as a device and its dashboard, to a new user in one step. - You want claimed devices to be added at the same time to a project of your own, to supervise them. To compare claims with adding devices by hand or with Auto Provision, see [Provisioning](https://docs.thinger.io/devices/provisioning.md). ## How a claim works **Step 1: You create the claim** You choose the resources it shares and how many times it can be claimed. The claim gets a **Claim Code**, a **Claim URL** and a **Claim QR**. **Step 2: The other account opens it** They open the URL, scan the QR code or type the code in the console. If they are not signed in, the console asks them to log in or, where public sign-up is enabled, to create an account. **Step 3: They review and claim** The console shows the resources of the claim and asks for a **Target Project**: one of the projects you share with their account. When they confirm, the resources join that project. **Step 4: They configure the devices** If the product of a device defines property forms, the last screen offers to configure each device. See [Products > Properties](https://docs.thinger.io/platform/products/properties.md). The target project must already exist and be one you own and share with the claiming account. On instances with public sign-up for project members, the sign-up creates that project for each new user: see [Brands](https://docs.thinger.io/administration/brands.md). ## Create a claim `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open Claims** Go to **Toolbox > Claims** and click **Add Claim**. **Step 2: Fill in the form** Set the **Claim Identifier**, which is also the claim code, the **Name** and an optional **Description**. In **Configuration**, leave **Enabled** on and set **Max Claims** (`1` for a single use, `0` or empty for no limit). **Step 3: Add the resources** In **Claim Resources**, click **Add**, choose the **Resource Type** and the **Resources**, and click **Ok**. Repeat for each type. ![Add Claim form with the claim identifier, the name, a maximum of one claim and two claim resources: a device and a dashboard](https://docs.thinger.io/screenshots/claims-add-form.webp) *Add a claim* **Step 4: Set the advanced options** Optionally, in **Advanced Options**, choose the **Claim Domain** used in the claim URL, **Additional Projects** that also receive the resources, and **Additional Members** with their **Members Roles**, who join the target project to supervise it. **Step 5: Save it** Click **Add Claim**. Open the claim again to copy its **Claim Code**, **Claim URL** and **Claim QR** from **Claim Details**. ### API **API call:** `POST /v1/users/{user}/claims` ([reference](https://docs.thinger.io/reference/rest-api/claims.md#claim-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/claims" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "claim": "KIT0001", "name": "Starter kit 0001", "enabled": true, "config": { "max_claims": 1, "resources": [ {"type": "device", "identifiers": ["YOUR_DEVICE"]} ] } }' ``` The claim ID is the claim code, and it must be unique on the whole instance. The claim URL is `https://YOUR_SERVER/console/claim/KIT0001`, or the same path on the domain set in `config.domain`. Optional fields add `projects`, `members` and `members_roles`. `YOUR_TOKEN` is an access token with permission to create claims. ### CLI ```bash thinger claim create KIT0001 -n "Starter kit 0001" -s enabled=true -s config.max_claims=1 \ -s 'config.resources=[{"type": "device", "identifiers": ["YOUR_DEVICE"]}]' ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-claim). ### AI **Prompt for an AI agent:** > Create a single-use claim called KIT0001 that shares the device YOUR_DEVICE, and give me its claim URL. The agent uses `thinger_resource_create` with the `claim` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Claim resources This is what the other account does. It needs to be signed in, and the target project must be a project the claim owner shares with it. ### Console Open the claim URL, or click **Request Claim** in the header of the console, which appears inside a project. Type the **Claim Code**, click **Next**, check the resources, choose the **Target Project** and confirm. The last step shows **Claim process completed!** and, for devices with property forms, a link to configure them. ### API Check what a claim contains before claiming it: **API call:** `GET /v1/claims/{code}` ([reference](https://docs.thinger.io/reference/rest-api/claims.md#claim-read)) ```bash curl "https://YOUR_SERVER/v1/claims/KIT0001" \ -H "Authorization: Bearer YOUR_TOKEN" ``` Then claim it into a project: **API call:** `POST /v1/claims` ([reference](https://docs.thinger.io/reference/rest-api/claims.md#claim-request)) ```bash curl -X POST "https://YOUR_SERVER/v1/claims" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"code": "KIT0001", "project": "jane_workspace"}' ``` Here `YOUR_TOKEN` is a token of the account that claims, and `jane_workspace` the ID of the target project. ### CLI The CLI has no command to redeem a claim, but `thinger api` sends the same calls. Sign in with the account that claims: ```bash thinger api /v1/claims/KIT0001 thinger api /v1/claims -s code=KIT0001 -s project=jane_workspace ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-api). ### AI The MCP tools manage the claims of your own account, but do not redeem a claim of another account. Use the console or the API. Each claim is recorded in the claim, with the user, the date and the project: the claim list shows **Total Claims** and **Last Claim**. Every completed claim emits the `claim_completed` [event](https://docs.thinger.io/reference/events.md), which you can follow in the **Inspector** tab of the claim. ## Limits - A claim fails when it is disabled, when it has reached **Max Claims**, when the claiming account is the owner, when the target project is not one the owner shares with that account, or when one of its resources no longer exists. - Claims do not expire. Disable or delete the claim to stop it. - There is no unclaim. To take the resources back, remove the project from each resource, or remove the member from the project: see [Projects](https://docs.thinger.io/platform/projects.md). - The number of claims depends on your plan: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md): Compare the three ways to add devices to Thinger.io - by hand, with Auto Provision when they first connect, and with claims that hand them to other accounts. - [Projects](https://docs.thinger.io/platform/projects.md): Group devices, dashboards and other resources in a project and share it with other accounts, with roles that set what each member can do. - [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md): Let a product create its devices when they first connect or are first called, with an ID pattern, an asset type, an asset group and a project. - [Claims](https://docs.thinger.io/reference/rest-api/claims.md): REST API reference for Claims: configure claims and request the claim of a device. 10 operations. --- Source: https://docs.thinger.io/platform/properties.md # Properties > Store configuration and state as named JSON values on devices, products, asset types and groups, projects and your account, and read them from anywhere. A property is a named JSON value stored on a resource: a configuration a device reads when it starts, a threshold, a location, the contact of a site. Properties stay on the platform when the device is offline, and devices, dashboards, products, scripts and agents can read and write them. ## When to use it - To keep the configuration of a device, such as its sampling interval, and change it without touching the firmware. - To share a value with many devices at once, on their asset type, asset group or product. - To keep the last state a device reported, such as its firmware version or its location. - To store data about a site, a customer or a project that dashboards show. ## Where properties live | Resource | Where to edit them | Learn more | |---|---|---| | Device | **Properties** tab of the device | [Devices](https://docs.thinger.io/platform/devices.md#store-properties) | | Asset type and asset group | **Properties** tab of the type or group | [Assets](https://docs.thinger.io/platform/assets.md#share-properties-with-a-type-or-group) | | Product | **Properties** tab of the product | [Products](https://docs.thinger.io/platform/products.md) | | Project | REST API, MCP | [Projects](https://docs.thinger.io/platform/projects.md) | | Plugin | REST API, MCP; usually its configuration | [Plugins](https://docs.thinger.io/plugins.md) | | Your account | **Account > Profile > Properties** | [Account](https://docs.thinger.io/platform/account.md) | The properties of a product are not the same as the **Properties** card of its profile: that card defines properties that the product writes on each of its devices, from their data. See [Products > Properties](https://docs.thinger.io/platform/products/properties.md). ## Inheritance A device reads a property from the first level that has it: the device itself, then its asset type, its asset group and its product. Set a value on the product, the type or the group to give it to all their devices, and on a device to override it for that device only. The value is replaced as a whole, not merged. In the **Properties** list of a device, the **Source** column shows where an inherited value comes from, and the API adds a `source` field to inherited properties. ## Add or replace a property A property has an ID (letters, numbers, `_` and `-`), a JSON `value` and, optionally, a `name` and a `description`. Writing a property that already exists replaces its value. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console Open the resource, go to its **Properties** tab and click **Add**. Set the **Property Identifier** and the **Property Value** (any JSON: a number, a string, an object or an array), and save. A property called `location` shows a map where you can search an address; it fills in the coordinates and the timezone. ![Property dialog with the identifier and a JSON object as value](https://docs.thinger.io/screenshots/properties-add-modal.webp) *Add a property with a JSON value* ### API **API call:** `POST /v3/users/{user}/devices/{device}/properties` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-createproperty)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"property": "config", "name": "Configuration", "value": {"interval": 60, "threshold": 30}}' ``` Other resources have the same calls on their own path: `/v1/users/{user}/types/{type}/properties`, `/groups/{group}/properties`, `/products/{product}/properties`, `/projects/{project}/properties`, `/plugins/{plugin}/properties`, and `/v1/users/{user}/properties` for your account. `PUT` on `.../properties/{property}` with `{"value": ...}` replaces the value. ### CLI ```bash thinger device property set YOUR_DEVICE config '{"interval": 60, "threshold": 30}' ``` `thinger device property get YOUR_DEVICE config` reads it back, with the value under `value`, and `thinger device property list YOUR_DEVICE` lists all of them. Other resources have the same `property list`, `get`, `set` and `delete` commands: `thinger product property`, `thinger asset type property`, `thinger asset group property`, `thinger project property`, `thinger plugin property`, and `thinger property` for your account. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-property-set). ### AI **Prompt for an AI agent:** > Set the config property of YOUR_DEVICE to an interval of 60 seconds and a threshold of 30. The agent uses `thinger_resource_create` or `thinger_resource_update` with the type of the resource: `device_property`, `asset_type_property`, `asset_group_property`, `product_property`, `project_property`, `plugin_property` or `property` for your account. ## Change part of a value To change some fields of an object and keep the rest, merge them into the value instead of replacing it. ### Console The console edits the whole value: open the property, change the fields you need and save. If the product defines a form for the property, the console shows the form instead of the JSON. ### API **API call:** `PATCH /v3/users/{user}/devices/{device}/properties/{property}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-patchproperty)) ```bash curl -X PATCH "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/config" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"value": {"threshold": 25}}' ``` The other fields of `value`, such as `interval`, are kept. Dot keys work too: `{"value.threshold": 25}`. ### CLI ```bash thinger device property update YOUR_DEVICE config -s value.threshold=25 --merge ``` Without `--merge`, the update replaces the whole value. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-device-property-update). ### AI **Prompt for an AI agent:** > Change only the threshold of the config property of YOUR_DEVICE to 25 and keep the other fields. The agent uses `thinger_resource_update` with `merge: true`. ## Use properties from devices and dashboards - **Devices**: the Arduino library reads and writes the properties of its own device with `get_property` and `set_property`. See [Arduino coding](https://docs.thinger.io/devices/arduino/coding.md). HTTP devices fill properties with the data they send through a property of their product: see [HTTP devices](https://docs.thinger.io/devices/http.md). - **Dashboards**: widgets can show and edit properties, and dashboards can use them as placeholders. See [Dashboards](https://docs.thinger.io/platform/dashboards.md). - **Products**: product properties can be filled from device data, have forms and limit what project members see. See [Products > Properties](https://docs.thinger.io/platform/products/properties.md). - **Events**: every change emits an event, such as `device_property_update` or `product_property_create`. See [Events](https://docs.thinger.io/reference/events.md). ## Properties with a meaning Some property IDs are read by the platform: | Property | Used for | |---|---| | `location` | The position of a device, as `lat` and `lon`. Maps show it, and writing it checks the [geofences](https://docs.thinger.io/platform/geofences.md). | | `geofences` | The geofences of a device, asset type, asset group or product. | | `mapConfig` | The map view saved with the geofences. | | `dashboard` | The dashboard of a device, product, asset type, asset group or project. | ## Limits - The property ID uses letters, numbers, `_` and `-`, and cannot change. - An inherited value is changed where it is defined. To change it for one device only, create a property with the same ID on the device. - Plan limits are not listed here: see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Devices](https://docs.thinger.io/platform/devices.md): Register devices, check their connection status, store properties, organize them with labels and watch them live from the console. - [Assets](https://docs.thinger.io/platform/assets.md): Classify devices by asset type and asset group, share properties with every device of a type or group, and see them on a map. - [Properties](https://docs.thinger.io/platform/products/properties.md): Fill the properties of every device of a product from its resources, topics, events or streams, and give them a default value and a form. - [Geofences](https://docs.thinger.io/platform/geofences.md): Draw areas on a map for a device, an asset type or an asset group, and get events or call endpoints when devices enter, leave or stay in them. --- Source: https://docs.thinger.io/platform/geofences.md # Geofences > Draw areas on a map for a device, an asset type or an asset group, and get events or call endpoints when devices enter, leave or stay in them. A geofence is an area on a map: a polygon, a rectangle or a circle. When the location of a device changes, the platform checks it against the geofences of the device and emits an event for each area it enters or leaves, or stays inside or outside. Each event can also call an [endpoint](https://docs.thinger.io/platform/endpoints.md). ## When to use it - To get an email or a Telegram message when a vehicle leaves its depot or reaches a customer. - To record in a Data Bucket when each asset enters and leaves each site. - To keep the current zone of every device of a fleet as a property. ## How geofences work Geofences are stored in the `geofences` property, as a GeoJSON `FeatureCollection`. You can define them on a device, an asset type, an asset group or a product. A device uses the first collection it finds, in this order: its own, its asset type, its asset group, its product. Collections are not merged: a device with its own geofences ignores those of its type, group and product. The check runs whenever the location of the device changes: - when its `location` property is written, from the console, the API, the device, a product property or a flow; - when an HTTP device sends a location to its [callback](https://docs.thinger.io/devices/http.md#http-callback-deprecated), which is deprecated. With a product, store the location in the `location` property: see [Store the location](https://docs.thinger.io/devices/http.md#store-the-location). The new position is compared with the previous one. In one update, the platform emits exits before entries, so a device that moves from one zone to another leaves the first one before it enters the second. Each event, `device_geofence_event`, carries the device, its `latitude` and `longitude`, the zone (`geofence` with its name, `geofence_id`, and `geofence_properties` with your own fields of the zone), the `geofence_event` (`onEnter`, `onExit`, `whileInside` or `whileOutside`), the endpoint called, if any, and the `product`, `asset_type` and `asset_group` of the device. See [Events](https://docs.thinger.io/reference/events.md). ## Draw geofences `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. ### Console **Step 1: Open the Geofences tab** Open a device, an asset type or an asset group (**Assets > Types** or **Assets > Groups**) and go to its **Geofences** tab. Products have no tab: write their `geofences` property with the API. **Step 2: Draw the areas** Turn on the switch of the **Geofences** panel to edit. The drawing buttons appear at the top of the map: pan, polygon, rectangle and circle. Draw the areas, and drag their points to adjust them. If the device inherits its geofences from a type, group or product, the console asks before it creates a copy on the device. ![Geofences tab of an asset group in edit mode, with the drawing buttons, a polygon and a circle on the map and the actions table](https://docs.thinger.io/screenshots/geofences-editor.webp) *Geofences of an asset group in edit mode* **Step 3: Set the actions** In **Geofences Actions**, give each area a **Name**, choose the endpoint to call **On Enter**, **On Exit**, **While Inside** and **While Outside**, pick its **Color** and turn it on or off with **Enabled**. Click **Save**. ### API Write the `geofences` property. Coordinates are `[longitude, latitude]`, as in GeoJSON. A circle is a `Point` with a `radius` in meters. **API call:** `POST /v3/users/{user}/devices/{device}/properties` ([reference](https://docs.thinger.io/reference/rest-api/devices.md#device-createproperty)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "property": "geofences", "value": { "type": "FeatureCollection", "features": [ { "type": "Feature", "id": "warehouse", "properties": { "name": "Warehouse", "onEnter": "", "onExit": "notify_exit", "enabled": true, "customer": "acme" }, "geometry": { "type": "Polygon", "coordinates": [[[-3.71, 40.41], [-3.70, 40.41], [-3.70, 40.42], [-3.71, 40.42], [-3.71, 40.41]]] } }, { "type": "Feature", "properties": { "name": "Depot", "radius": 300, "onEnter": "", "enabled": true }, "geometry": { "type": "Point", "coordinates": [-3.60, 40.40] } } ] } }' ``` Asset types, asset groups and products have the same call on their own path (`/v1/users/{user}/types/{type}/properties`, `/groups/{group}/properties`, `/products/{product}/properties`). ### CLI Write the property of a device, with the GeoJSON in a file: ```bash thinger device property set YOUR_DEVICE geofences "$(cat geofences.json)" ``` For a product, an asset type or an asset group, use `thinger product property set`, `thinger asset type property set` or `thinger asset group property set`. ### AI **Prompt for an AI agent:** > Add a geofence called Depot to YOUR_DEVICE: a circle of 300 meters around latitude 40.40, longitude -3.60, that emits an event when the device enters it. The agent writes the `geofences` property with the `device_property`, `asset_type_property`, `asset_group_property` or `product_property` type. ## Choose the events of each zone The keys `onEnter`, `onExit`, `whileInside` and `whileOutside` in the properties of a zone decide which events it emits: | Value of the key | Result | |---|---| | An endpoint ID | Emits the event and calls the endpoint with the event data. | | `""` (empty) | Emits the event without calling any endpoint. | | Key missing | No event of that kind for this zone. | `whileInside` and `whileOutside` are emitted on every location update, not only on changes. The zone ID is the `id` of the feature, or `properties.id`, or else its `name`. Any other field you add to the properties of the zone, such as `customer`, travels in `geofence_properties`. > **Warning** > > When you save from the console, an action left empty is removed from the zone, so it emits no event of that kind. To get an event without calling an endpoint, set the key to `""` in the property. ## React to geofence events - **Endpoints**: set the endpoint of each action, as above. - **Products**: a product flow or bucket whose source is the device event `device_geofence_event` keeps a history of entries and exits, or writes the current zone to a property. See [Products > Flows](https://docs.thinger.io/platform/products/flows.md). - **Real-time**: the console session can subscribe to `device_geofence_event` over the events WebSocket. Access tokens cannot: see [Events](https://docs.thinger.io/reference/events.md). ## See geofences on a map The **Overview** of a device draws its geofences. The **Overview** of an asset type or group shows them with **Show Geofences**, and the map widgets of a dashboard can show them too: see [Assets](https://docs.thinger.io/platform/assets.md) and [Dashboards](https://docs.thinger.io/platform/dashboards.md). ## Limits - Polygons use only their outer boundary: holes are ignored. An invalid polygon is skipped. - Changing or removing a zone emits no events: a device inside a removed zone gets no `onExit`. - The location must be a latitude and a longitude (`lat` and `lon`, `lng`, or `latitude` and `longitude`). ## Related pages - [Properties](https://docs.thinger.io/platform/properties.md): Store configuration and state as named JSON values on devices, products, asset types and groups, projects and your account, and read them from anywhere. - [Assets](https://docs.thinger.io/platform/assets.md): Classify devices by asset type and asset group, share properties with every device of a type or group, and see them on a map. - [Endpoints](https://docs.thinger.io/platform/endpoints.md): Configure outgoing integrations, such as emails, HTTP requests and Telegram messages, that devices, alarms, product flows and the API can call. - [Events](https://docs.thinger.io/reference/events.md): Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. --- Source: https://docs.thinger.io/platform/account.md # Account > Your user account in the console, with its public profile, its own properties and the security of your sign-in. The **Account** menu of the console holds the settings of your own user account: the **Profile** other users see, the **Properties** stored on the account and the **Security** of your sign-in. Everything else you create (devices, buckets, dashboards) belongs to the account too, but is managed from its own menu. | Menu entry | What you set there | Learn more | |---|---|---| | **Account > Profile** | Your picture, name, website, company and location, and the account properties. | [Profile](#profile) | | **Account > Security** | Your password, multi-factor authentication and passkeys. | [Security](https://docs.thinger.io/platform/account/security.md) | ## Profile **Account > Profile** has two tabs: - **Profile**: the **Picture** (PNG, JPEG or WebP, shown in a circle; 256 × 256 pixels recommended), the **Name** other users see, a **URL**, your **Company** and your **Location**. The **Email** is shown but cannot be changed. Click **Save Profile** to keep the changes. - **Properties**: JSON values stored on the account itself rather than on a device or a product, for settings that apply to the whole account. They work like the properties of any other resource: see [Properties](https://docs.thinger.io/platform/properties.md). ![Profile tab of the account with the picture, the name, the URL, the company and the location filled in](https://docs.thinger.io/screenshots/account-profile.webp) *Profile tab of the account* The profile can also be read and changed with the REST API, with `GET` and `PUT /v1/users/{user}/profile` (fields `name`, `url`, `company`, `location` and `picture` as a base64 data URL). See the [REST API reference](https://docs.thinger.io/reference/rest-api/users.md#user-updateprofile). The account username and email are set when the account is created and do not change. On a private instance, the administrator creates and manages accounts in [User Accounts](https://docs.thinger.io/administration/user-accounts.md). ## Learn more - [Security](https://docs.thinger.io/platform/account/security.md): Protect your account with a password, passkeys, an authenticator app, security keys and backup codes, from Account > Security in the console. - [Properties](https://docs.thinger.io/platform/properties.md): Store configuration and state as named JSON values on devices, products, asset types and groups, projects and your account, and read them from anywhere. - [User Accounts](https://docs.thinger.io/administration/user-accounts.md): Create, edit, disable and delete the user accounts of your Thinger.io instance, choose their role and set their limits. --- Source: https://docs.thinger.io/platform/account/security.md # Security > Protect your account with a password, passkeys, an authenticator app, security keys and backup codes, from Account > Security in the console. **Account > Security** controls how you sign in to the console: your password, the passkeys that replace it, the second factor that protects it (an authenticator app or security keys) and the identity providers linked to your account. ## When to use it - To change your password, or to set one if you signed up with an identity provider. - To sign in without a password, with the fingerprint or face recognition of your device or a security key. - To ask for a second factor every time someone signs in with your password. ## Sign-in methods The **Sign-in Methods** form shows how you can sign in: | Section | What it shows | |---|---| | **Email** | Your **Primary Address**, tagged **Verified** or **Pending**. | | **Password** | The form to change or set your password. | | **Passkeys** | Your passkeys, with their name, the date they were added and the last time they were used. Shown only if your browser supports passkeys. | | **Connected Accounts** | The identity providers linked to your account, if any. | ![Sign-in Methods form with the verified email, the password form and the Passkeys section, with no passkey added yet](https://docs.thinger.io/screenshots/security-sign-in-methods.webp) *Sign-in Methods* ## Change your password ### Console In **Password**, type the **Current Password**, the **New Password** and the same again in **Confirm Password**, and click **Update Password**. If your account has no password yet, the console says so, asks only for the new one and the button reads **Set Password**: from then on you can also sign in with your username and password. ### API **API call:** `PUT /v1/users/{user}/password` ([reference](https://docs.thinger.io/reference/rest-api/users.md#user-updatepassword)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/password" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"current": "my-current-password", "new": "my-new-password"}' ``` `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. `YOUR_TOKEN` is a token of your own session; send `current` empty if the account has no password. A wrong current password returns `403`. ### CLI The CLI cannot change your password. Use the console. ### AI Agents cannot change your password: the MCP tools do not manage account security. Use the console. If you forgot your password, use **Forgot password?** on the sign-in page to receive a reset link by email. ## Sign in with a passkey A passkey lets you sign in without a password, with the biometrics of your device (fingerprint, face) or a security key. Signing in with a passkey does not ask for a second factor. **Step 1: Add a passkey** In **Passkeys**, type a name for it in **Add Passkey** (for example, the name of your laptop or phone) and click **Add Passkey**. Your browser or operating system asks you to confirm with your fingerprint, your face, your device PIN or a security key. **Step 2: Sign in with it** On the sign-in page, click **Sign in with Passkey** and confirm on your device. To remove a passkey, click **Remove** next to it. Passkeys are registered from the console; the REST API has the matching calls (`/v1/users/{user}/passkeys`), but the CLI and the MCP tools do not manage them. ## Turn on two-factor authentication Two-factor authentication asks for a second step after your password. It does not apply when you sign in with a passkey or through an identity provider. The **Two-Factor Authentication** form offers two methods; you can use both. ### Authenticator app **Step 1: Start the setup** In **Authenticator App**, click **Enable Authenticator App**. **Step 2: Scan the QR code** Scan the QR code with an authenticator app (Google Authenticator, Authy or similar), or type the code shown under **Or enter the code manually**. Click **Next**. ![Scan QR step of the authenticator app setup, with the QR code and the secret key](https://docs.thinger.io/screenshots/security-totp-setup.webp) *Scan QR step of the authenticator setup* **Step 3: Verify the code** Type the 6-digit code the app shows and click **Verify and Enable**. **Step 4: Save the backup codes** The console shows your backup codes once. Keep them with **Copy Codes** or **Print** in a safe place, and click **Done**. When it is on, the section shows how many backup codes remain. **Disable Authenticator App** turns it off and deletes the backup codes. ### Security keys In **Security Keys**, type a name in **Add Security Key** (for example, the model of the key) and click **Add Security Key**, then touch the key when your browser asks. Remove a key with **Remove** next to it. ### Backup codes Each backup code works once, instead of a code of the authenticator app, if you lose your phone. The console does not generate new codes: disable the authenticator app and enable it again to get a new set. With the API, `POST /v1/users/{user}/mfa/totp/backup-codes` with a current code of the app replaces them. See the [REST API reference](https://docs.thinger.io/reference/rest-api/users.md#user-createtotpbackupcodesbackup-code). ## Sign in with two-factor authentication After your username and password, the console asks for the second factor: - With an authenticator app, type the 6-digit code and click **Verify**. If you do not have the app, click **Use a backup code instead** and type one of your backup codes. - With a security key, click **Use Passkey** and touch the key. - With both, choose the method first. Repeated failed attempts are blocked for a while, both for passwords and for codes. ## Password sign-in disabled An instance can be set to accept only federated sign-in, through identity providers, and passkeys (the `allow_password` setting, for the whole instance or per domain). Then the sign-in page has no password form, and accounts sign in with the buttons of their identity providers or with a passkey. The administrator sets it: see [Identity Providers](https://docs.thinger.io/administration/identity-providers.md) and [Brands](https://docs.thinger.io/administration/brands.md). An administrator can also require two-factor authentication for password sign-in. If you have no second factor configured, sign in with a passkey or an identity provider, or ask your administrator. ## Connected accounts If you signed in with an identity provider, it appears in **Connected Accounts** with the date it was linked. Click **Remove** to unlink it. You can only unlink an identity if you have a password or another connected account, so you do not lose access. ## Limits - The email address cannot be changed from the console. - The console does not show active sessions or sign-in history. - Changing your password does not sign out your other sessions. ## Related pages - [Account](https://docs.thinger.io/platform/account.md): Your user account in the console, with its public profile, its own properties and the security of your sign-in. - [Identity Providers](https://docs.thinger.io/administration/identity-providers.md): Let users sign in to your instance with your company's single sign-on (SSO) over OpenID Connect, such as Microsoft Entra ID, Google or Auth0. - [User Accounts](https://docs.thinger.io/administration/user-accounts.md): Create, edit, disable and delete the user accounts of your Thinger.io instance, choose their role and set their limits. - [User Accounts](https://docs.thinger.io/reference/rest-api/users.md): REST API reference for User Accounts: manage user accounts and their profile, password, email, timezone, multi-factor authentication and passkeys. 40 operations. --- Source: https://docs.thinger.io/plugins.md # Plugins > Add device integrations, network connectors, monitoring tools and development environments to your Thinger.io account. **Plan:** Not available on free Cloud Plugins add ready-made applications and integrations to your Thinger.io account: device templates, connectors for LoRaWAN and Sigfox networks, monitoring tools, development environments and infrastructure services. You install them from the console and they run next to your account, with access only to the resources you grant them. ## When to use plugins - To connect a device or a network that already has a plugin, instead of writing its data model, dashboards and payload processing yourself. - To run a tool on top of your data without hosting it, such as Node-RED, Grafana or a code editor. - To start a project from a template that creates its devices, buckets and dashboards for you. ## How plugins work ![A plugin is installed from the Marketplace in a chosen version, Thinger.io creates the resources it needs, the plugin runs next to the account and is managed from My Plugins, and its web interface opens from the console or through public access](https://docs.thinger.io/diagrams/plugin-lifecycle.svg) *How a plugin works* Each plugin is published in the **Marketplace** of the console, with its documentation, its changelog and its versions. When you install one, Thinger.io creates the resources it needs in your account (for example access tokens, buckets or dashboards). From then on the plugin appears under **My Plugins**, where you can start, stop, upgrade or remove it, read its logs and open a shell in it. Some plugins publish a web interface. It opens from the console for your account, and you can make it reachable from outside with the plugin's public access setting. The documentation of every plugin is in this section, generated from the [thinger-io/plugins](https://github.com/thinger-io/plugins) repository. ## Browse the catalog - [Devices](https://docs.thinger.io/plugins/devices.md): off-the-shelf devices and sensors, such as the [Shelly Plug S](https://docs.thinger.io/plugins/shelly-plug-s.md). - [Connectivity](https://docs.thinger.io/plugins/connectivity.md): network servers and platforms, such as [The Things Stack](https://docs.thinger.io/plugins/ttn.md) and [Sigfox](https://docs.thinger.io/plugins/sigfox.md). - [Monitoring](https://docs.thinger.io/plugins/monitoring.md): metrics and alerting, such as [Prometheus](https://docs.thinger.io/plugins/prometheus.md). - [Development](https://docs.thinger.io/plugins/development.md): tools such as [Node-RED](https://docs.thinger.io/plugins/node-red.md) and [Visual Studio Code](https://docs.thinger.io/plugins/vscode.md). - [Infrastructure](https://docs.thinger.io/plugins/infrastructure.md): services such as [SFTPGo](https://docs.thinger.io/plugins/sftpgo.md). - [Templates](https://docs.thinger.io/plugins/templates.md): projects that create their own resources. ## Next steps - [Find and install a plugin](https://docs.thinger.io/plugins/marketplace.md) from the **Marketplace**. - [Manage your installed plugins](https://docs.thinger.io/plugins/management.md): start, stop, upgrade, logs and public access. --- Source: https://docs.thinger.io/plugins/marketplace.md # Marketplace > Find a plugin in the Marketplace of the Thinger.io console and install it in your account. **Plan:** Not available on free Cloud The **Marketplace** lists every plugin you can install in your account, grouped by category. From it you open a plugin, read its documentation and install the version you choose. ## When to use it - To look for an integration for a device or a network before building your own. - To install a tool such as Node-RED or Grafana in your account. - To check which plugins have a newer version than the one you installed. ## Find a plugin 1. Go to **Plugins**. The page opens on the **Marketplace**. 2. Pick a category under **Marketplace**: **All**, **Devices**, **Connectivity**, **Monitoring**, **Development**, **Infrastructure** or **Templates**. The number next to each one is how many plugins it has. 3. To search by name, type in **Search plugins...** at the top of the list. Each card shows the plugin name and description. Plugins you already have are marked **Installed**, and plugins that are no longer maintained are marked **Deprecated**. ![Plugin Marketplace with the Devices category selected and the device plugins of the catalog](https://docs.thinger.io/screenshots/marketplace-list.webp) *Device plugins in the Marketplace* Under **My Plugins** you find the plugins of your account: **Installed**, **Updates** (installed plugins with a newer version) and **Local**. ## Install a plugin 1. Click the plugin card. The plugin page shows its **Readme** and **ChangeLog**, the **Latest Version** and a link to the **Plugin Repository**. 2. Click **Install**. 3. In the dialog, choose the **Plugin Version**. **Latest Releases** are the published versions; **Development Versions** are for testing. 4. Review the **Access Tokens** and **Resources** the plugin creates in your account. Under **Options** you can set a prefix and a suffix for the identifiers of those resources, for example to install a second copy for testing. 5. Confirm the dialog. The plugin is installed in your account. Its page now shows the **Installed Version** and the actions to manage it. ![Install dialog of the Node-RED plugin with the plugin version, its access token and its Docker image](https://docs.thinger.io/screenshots/marketplace-install-dialog.webp) *Install dialog of a plugin* To list the plugins of your account from the REST API, see [List plugins](https://docs.thinger.io/reference/rest-api/plugins.md#plugin-list) in the API reference. ## Deprecated plugins A deprecated plugin shows a warning on its page with the reason and, when there is one, the plugin that replaces it. Prefer the replacement for new installations. ## Related pages - [Manage your installed plugins](https://docs.thinger.io/plugins/management.md) - [Plugin catalog by category](https://docs.thinger.io/plugins/devices.md) --- Source: https://docs.thinger.io/plugins/management.md # Manage plugins > Start, stop, upgrade and remove the plugins of your Thinger.io account, read their logs, open a shell and set their public access. **Plan:** Not available on free Cloud Every installed plugin has its own page in the console, with the actions to control it and tabs for its documentation, its logs, a shell and its settings. Open it from **Plugins** > **My Plugins** > **Installed** and click the plugin card. ## When to use it - To stop a plugin you do not use, or restart one after changing its configuration. - To upgrade a plugin to a newer version. - To find out why a plugin does not work, from its logs or a shell. - To publish the web interface of a plugin outside the console. ## Control a plugin The buttons at the top of the plugin page act on the plugin. Each one is only enabled when it applies to the current state. | Button | What it does | |---|---| | **Install** | Installs the plugin. See [Install a plugin](https://docs.thinger.io/plugins/marketplace.md#install-a-plugin). | | **Upgrade** | Installs another version over the current one. The dialog asks for the **Plugin Version**. Stop the plugin first. | | **Start** | Starts a stopped plugin. | | **Stop** | Stops a running plugin. | | **Kill** | Stops a running plugin at once, without waiting for it to finish. Use it when **Stop** does not work. | | **Restart** | Stops and starts a running plugin. | | **Pause** | Pauses a running plugin. | | **Resume** | Resumes a paused plugin. | | **Remove** | Removes the plugin from your account, after a confirmation. Stop the plugin first. | ![Plugin page of Node-RED, not installed yet: Install enabled and the Upgrade, Start, Stop, Kill, Restart, Pause, Resume and Remove buttons disabled, and the Readme tab](https://docs.thinger.io/screenshots/management-actions.webp) *Plugin page with its actions* The tags above the buttons show the **Latest Version** and the **Installed Version**. When the installed version is older, its tag shows a red warning icon: use **Upgrade** to update it. **Plugins** > **My Plugins** > **Updates** lists every plugin with a newer version. To change the state of a plugin from the REST API, see [Manage plugin state](https://docs.thinger.io/reference/rest-api/plugins.md#plugin-managestate) in the API reference. ## Read the logs Open the **Logs** tab. It shows the output of the plugin, so you can check that it started and see its errors. ## Run commands in a shell Open the **Shell** tab to get a terminal inside the running plugin. Use it to inspect its files or run its own commands. ## Set public access Some plugins publish a web interface. By default it is only available to you from the console. 1. Open the **Settings** tab. 2. Under **Plugin Access**, turn on **Public Access**. 3. Copy the **URL** shown below. Anyone with this URL can reach the plugin interface, so turn it on only for plugins that have their own login or that are meant to be public. ## Related pages - [Find and install a plugin](https://docs.thinger.io/plugins/marketplace.md) - [Plugin catalog](https://docs.thinger.io/plugins.md) --- Source: https://docs.thinger.io/plugins/devices.md # Devices > Plugins that connect off-the-shelf devices and sensors to Thinger.io, with their data model and dashboards. Plugins that connect off-the-shelf devices and sensors to Thinger.io, with their data model and dashboards. | Icon | Plugin | Description | | --- | --- | --- | | ![Comet Tx5xx and Tx6xx](https://docs.thinger.io/plugins/icons/comet-tx5xx-tx6xx.png) | [Comet Tx5xx and Tx6xx](https://docs.thinger.io/plugins/comet-tx5xx-tx6xx.md) | Integration of Comet Tx6xx and Tx5xx Series | | ![Dragino LHT65N](https://docs.thinger.io/plugins/icons/dragino-lht65n.png) | [Dragino LHT65N](https://docs.thinger.io/plugins/dragino-lht65n.md) | Remote LoRaWAN temperature and humidity sensor | | ![Dragino LT-22222-L](https://docs.thinger.io/plugins/icons/dragino-lt22222l.png) | [Dragino LT-22222-L](https://docs.thinger.io/plugins/dragino-lt22222l.md) | Dragino LT-22222-L integration with Thinger.io | | ![EMU Professional II](https://docs.thinger.io/plugins/icons/emu-emu-prof-ii.png) | [EMU Professional II](https://docs.thinger.io/plugins/emu-emu-prof-ii.md) | 3-phase energy meter with MID B+D approval for billing purpose. Connection: Direct (100A) or indirect (CT /5 and /1A). Internal clock. External or internal antenna. | | ![ESP32-Paxcounter](https://docs.thinger.io/plugins/icons/opensource-esp32-paxcounter.png) | [ESP32-Paxcounter](https://docs.thinger.io/plugins/opensource-esp32-paxcounter.md) | The ESP32-Paxcounter has sensors for battery, GPS, altitude, temperature, humidity, barometer, pm2.5, and pm10. It is an ESP32 MCU-based device for metering passenger flows in real-time. It counts how many mobile devices are around by scanning WiFi and Bl | | | [IMBuildings Comfort Sensor](https://docs.thinger.io/plugins/imbuildings-imbuildings-comfort-sensor.md) | Sensor for monitoring Indoor Air Quality | | ![Milesight AM102](https://docs.thinger.io/plugins/icons/milesight-iot-am102.png) | [Milesight AM102](https://docs.thinger.io/plugins/milesight-iot-am102.md) | Milesight AM102 2-in-1 IAQ Sensor for temperature and humidity monitoring with E-ink display | | ![Milesight AM103](https://docs.thinger.io/plugins/icons/milesight-am103.png) | [Milesight AM103](https://docs.thinger.io/plugins/milesight-am103.md) | Milesight AM103 device template for integrating into Thinger.io | | ![Milesight CT10X](https://docs.thinger.io/plugins/icons/milesight-ct10x.png) | [Milesight CT10X](https://docs.thinger.io/plugins/milesight-ct10x.md) | Compact transformer for real-time electrical current monitoring | | ![Minol Zenner EDC Communication Module](https://docs.thinger.io/plugins/icons/minol-zenner-edc-communication-module.png) | [Minol Zenner EDC Communication Module](https://docs.thinger.io/plugins/minol-zenner-edc-communication-module.md) | The EDC communication module is an add-on module for water meters for secure remote reading and for integrating water meters into smart metering systems | | ![Shelly 1L](https://docs.thinger.io/plugins/icons/shelly-1l.png) | [Shelly 1L](https://docs.thinger.io/plugins/shelly-1l.md) | Shelly 1L with Thinger.io | | ![Shelly EM](https://docs.thinger.io/plugins/icons/shelly-em.png) | [Shelly EM](https://docs.thinger.io/plugins/shelly-em.md) | Shelly EM with Thinger.io | | ![Shelly Plug S](https://docs.thinger.io/plugins/icons/shelly-plug-s.jpg) | [Shelly Plug S](https://docs.thinger.io/plugins/shelly-plug-s.md) | Shelly Plug S | | ![Shelly Plus 1PM](https://docs.thinger.io/plugins/icons/shelly-plus-1pm.png) | [Shelly Plus 1PM](https://docs.thinger.io/plugins/shelly-plus-1pm.md) | Shelly Plus 1PM with Thinger.io | | ![Siemens LOGO!](https://docs.thinger.io/plugins/icons/siemens-logo.svg) | [Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo.md) | Siemens LOGO! integration with Thinger.io | | ![Teltonika Eye](https://docs.thinger.io/plugins/icons/teltonika-eye.png) | [Teltonika Eye](https://docs.thinger.io/plugins/teltonika-eye.md) | Decoder and preconfiguration for Teltonika Eye devices | | ![Teltonika Telematics](https://docs.thinger.io/plugins/icons/teltonika-telematics.png) | [Teltonika Telematics](https://docs.thinger.io/plugins/teltonika-telematics.md) | Decoder and preconfiguration for Teltonika GPS Telematics devices | | ![WIKA PEW-1000](https://docs.thinger.io/plugins/icons/wika-pew1000.png) | [WIKA PEW-1000](https://docs.thinger.io/plugins/wika-pew1000.md) | Wireless pressure sensor | | ![WIKA PGW23-100](https://docs.thinger.io/plugins/icons/wika-pgw23-100.jpg) | [WIKA PGW23-100](https://docs.thinger.io/plugins/wika-pgw23-100.md) | Bourdon tube pressure gauge with wireless transmission | | ![Yobiiq EM2101](https://docs.thinger.io/plugins/icons/yobiiq-em2101.png) | [Yobiiq EM2101](https://docs.thinger.io/plugins/yobiiq-em2101.md) | The YOBIIQ iQ Electricity EM2101 is a smart electricity meter with LoRaWAN® connectivity | --- Source: https://docs.thinger.io/plugins/comet-tx5xx-tx6xx.md # Comet Tx5xx and Tx6xx > Integration of Comet Tx6xx and Tx5xx Series | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/comet-tx5xx-tx6xx](https://github.com/thinger-io/plugins/tree/main/comet-tx5xx-tx6xx) | ![Comet TX5xx/TX6xx](https://docs.thinger.io/plugins/comet-tx5xx-tx6xx/assets/comet-tx5xx-tx6xx.png) A Thinger.io plugin that seamlessly ingests SOAP XML data coming from Comet Tx5xx / Tx6xx dataloggers (temperature, humidity, CO₂ and/or pressure) and converts it into structured JSON records stored in a Data Bucket. The plugin provides an HTTPS endpoint, automatic device provisioning, data parsing in Node JS, and ready-to-use dashboards and alarms. ## Thinger.io and Plugin Name Integration Integrating Comet dataloggers with Thinger.io turns raw sensor frames into actionable IoT data: 1. Zero‑touch onboarding – every new logger becomes a Thinger Device the first time it reports. 2. Unified data model – the Node JS parser normalises both CO₂‑capable and Pressure‑only frames, distinguishing between firmware v1.0 & v1.1 XML versions. 3. Dashboards & Tools out‑of‑the‑box – visualise temperature, humidity, CO₂, pressure and alarm LEDs. 4. Fully serverless inside Thinger.io – no extra VPS or middleware required; everything runs in the Node‑RED and File Storage plugins shipped with the platform. ## Requirements | Component | Minimum version | Notes | |-----------|-----------------|-------| | Thinger.io instance | 6.5.4-developer or newer | Must support **Plugins** and **Proxy Forwarders** | | Node-RED plugin | latest | Enabled in Thinger.io and reachable internally on port 1880 | | `node-red-contrib-http-custom-port` | latest | Allows HTTP listeners on custom ports (4444 by default) | | Comet Tx5xx / Tx6xx logger | any SOAP-capable firmware | Device must be configured to POST data to `http://your-host:4444/` | | External TCP/UDP reachability | Port **4444** (or chosen) | Forwarded to Node-RED via Thinger **Proxy Forwarder** | ## Get Started ### Installation 1. **Create a Proxy Forwarder** — In *Plugins → Proxy Forwarders* add a rule: * **External Port**: `4444` * **Internal Port**: `4444` * **Target Plugin**: `Node-RED` 2. **Enable Node-RED** — If not already running, start the Node-RED plugin. 3. **Install extra palette** — Inside Node-RED click **Hamburger → Manage Palette → Install** and add `node-red-contrib-http-custom-port`. 4. **Import the flow** — Create a new workspace, click **Import**, paste the following *Data Forwarder* JSON: ```json [ { "id": "14cbd731707c799d", "type": "tab", "label": "Data Forwarder", "disabled": false, "info": "", "env": [] }, { "id": "07593d6ab65d04d0", "type": "function", "z": "14cbd731707c799d", "name": "URL getter", "func": "let xml = (msg.payload || \"\").toString('utf8').trim();\n\nlet user = env.get(\"THINGER_USER\");\nlet host = env.get(\"THINGER_HOST\");\n\n// In case the Product or Resource Name were to be\n// modified, the following URL would have to be updated\n// accordingly\nlet url = \"https://\" + host + \"/v1/users/\" + user + \"/products/comet_tx5xx_tx6xx/resources/comet_data_resource\"\n\nmsg.payload = xml;\nmsg.url = url;\n\nreturn msg;\n", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 610, "y": 160, "wires": [["9b19493f4a133187", "f1770c1b8556b09b"]] }, { "id": "f1770c1b8556b09b", "type": "http response", "z": "14cbd731707c799d", "name": "OK", "statusCode": "200", "headers": {}, "x": 770, "y": 200, "wires": [] }, { "id": "c8355bc6f75b8ff6", "type": "node-red-contrib-http-custom-port", "z": "14cbd731707c799d", "name": "HTTP request", "url": "/", "method": "post", "upload": false, "swaggerDoc": "", "port": "4444", "x": 430, "y": 160, "wires": [["07593d6ab65d04d0"]] }, { "id": "9b19493f4a133187", "type": "http request", "z": "14cbd731707c799d", "name": "", "method": "POST", "ret": "txt", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "bearer", "senderr": false, "headers": [ { "keyType": "other", "keyValue": "application", "valueType": "other", "valueValue": "xml" } ], "x": 790, "y": 120, "wires": [[]] } ] ``` 5. Finally, enter the node "http-request", select "Use authentication", select "Bearer authentication" and paste `${THINGER_TOKEN_NODE_RED_PLUGIN}` in Token. Then press "Done" 6. Press "Deploy" to start Node RED instance. ### Usage 1. Configure each Comet logger's **SOAP destination** to `https:///4444/`. 2. Node-RED receives the POST request, forwards raw XML to the Product API. 3. The Node JS script parses and normalises the frame; Thinger auto-provisions (device-id = `comet_` by default) and writes data to the bucket. 4. Build dashboards or set alarms in the usual Thinger UI. ## Additional Resources - [Documentation](https://www.cometsystem.es/productos/reg-t6640) ## Changelog #### 1.0.0 - 2025-02-04 - Initial version --- Source: https://docs.thinger.io/plugins/dragino-lht65n.md # Dragino LHT65N > Remote LoRaWAN temperature and humidity sensor | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/dragino-lht65n](https://github.com/thinger-io/plugins/tree/main/dragino-lht65n) | The Dragino LHT65N is a long-range LoRaWAN® temperature and humidity sensor designed for non-invasive, real-time monitoring of environmental variables in industrial, commercial, and smart building applications. The LHT65N integrates a precision SHT20 sensor and supports connectors for optional external sensors (DS18B20, interrupt sensors, illuminance, etc.), enabling seamless integration into Thinger.io for dashboards, alerts, and historical data analytics. ## **Integrating the LHT65N with Thinger.io** Integrating the LHT65N with Thinger.io provides: Real-time environmental monitoring: Internal temperature, relative humidity, battery voltage, and device status with configurable sampling intervals. Automated alarms: Temperature, humidity, and battery threshold detection for proactive maintenance and fault prevention. IoT dashboards: Stream data to Thinger.io for visualization, logging, analysis, and notifications. Flexible deployment: Support for multiple frequency bands (EU868, US915, AU915, AS923, CN470, KR920, IN865, EU433) and configurable external sensors. ### **Typical Use Cases:** - Energy management and environmental optimization in smart buildings. - Monitoring environmental conditions in warehouses, data centers, and technical rooms. - Temperature and humidity control in cold chain and logistics. - Precision agriculture and automated irrigation systems. - Predictive maintenance and early fault detection through environmental pattern analysis. - Integration into IoT platforms for dashboards, historical analysis, and automated notifications. ## **Requirements** * LoRaWAN Network Server (LNS): Required to receive sensor data and forward it to Thinger.io. Supported servers include The Things Stack, Chirpstack, Loriot, or other LoRaWAN-compliant LNS. * Deploy a LoRaWAN plugin in Thinger.io: [The Things Stack, Chirpstack and Loriot.](https://docs.thinger.io/lpwan/the-things-stack) ## **Get Started** ### **Configuration** 1. Provide device identifiers and communication parameters. 2. Configure LoRaWAN options as applicable. 3. Save and enable the plugin. ### **Usage** Once configured, the LHT65N data becomes available as live resources within Thinger.io. Users can: * Instantly view measurements through dashboards, including real-time temperature, humidity, and battery status. * Store time-series data in buckets for historical analysis. * Create alerts for thresholds or anomalies. * Send downlink commands to the device (change transmission interval, retrieve stored records, request device configuration). * Integrate measurements with automation workflows and external services. * Export data to CSV for analysis in external tools. ## **Additional Resources** * [Dragino LHT65N User Manual v1.3](https://www.dragino.com/downloads/downloads/LHT65/UserManual/LHT65_Temperature_Humidity_Sensor_UserManual_v1.3.pdf) * [Thinger.io LoRaWAN Documentation](https://docs.thinger.io/lpwan) * [Thinger.io Dashboards Guide](https://docs.thinger.io/dashboards) * [Dragino LHT65N Product Page](https://www.dragino.com/products/lora-lorawan-end-node/item/151-lht65.html) * [Thinger.io Community Forum](https://community.thinger.io/) * [Dragino Support](https://claude.ai/chat/support@dragino.com) ## Changelog #### 1.0.0 - 2025-11-26 - Initial version --- Source: https://docs.thinger.io/plugins/dragino-lt22222l.md # Dragino LT-22222-L > Dragino LT-22222-L integration with Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.1.2 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/dragino-lt22222l](https://github.com/thinger-io/plugins/tree/main/dragino-lt22222l) | ![Dragino LT-22222-L](https://docs.thinger.io/plugins/dragino-lt22222l/assets/dragino-lt22222l.png) The Dragino LT series I/O Modules are Long Range LoRa I/O Controller. It contains different I/O Interfaces such as: analog current Input, analog voltage input, relay output, digital input and digital output etc. The LT I/O Modules are designed to simplify the installation of I/O monitoring. ## Thinger.io Integration ## Requirements A LoRaWAN server is required to communicate the Dragino LT-22222-L into Thinger.io, some options are: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) Alongside, the corresponding plugin for the selected LoRaWAN server needs to be installed in your Thinger.io instance. ## Get Started ### Installation Look for the plugin in the [Thinger.io Plugin Store](https://plugins.thinger.io/) and install it in your Thinger.io instance. Once the plugin is installed a new Product will be created for this device. ### Configuration The Product is already preconfigured, check that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or change it to your desire. ### Usage Start sending uplinks for autoprovisioning devices and buckets. This product also provides a predefined dashboard and downlinks. ## Additional Resources Dragino resources can be found at: - [Documentation](https://www.dragino.com/products/lora-lorawan-end-node/item/156-lt-22222-l.html) ## Changelog #### [1.1.2] - 2025-08-27 ##### Fix - Fixed issue with downlink endpoint. #### [1.1.1] - 2025-08-27 ##### Add - Added marketplace integration and updated documentation #### [1.1.0] - 2025-08-20 ##### Fix - Fixed integration with the new LNS Thinger plugin uplink standard format #### [1.0.0] - 2025-07-02 - Initial version --- Source: https://docs.thinger.io/plugins/emu-emu-prof-ii.md # EMU Professional II > 3-phase energy meter with MID B+D approval for billing purpose. Connection: Direct (100A) or indirect (CT /5 and /1A). Internal clock. External or internal antenna. | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/emu-emu-prof-ii](https://github.com/thinger-io/plugins/tree/main/emu-emu-prof-ii) | The EMU Professional II LoRa is a multifunctional 3-phase energy meter that combines precise measurements and LoRaWAN IoT connectivity. Designed for DIN rail mounting, this device features MID B+D approval for billing purposes, making it suitable for commercial and industrial energy management applications. It supports both direct connection up to 100A and indirect connection via CT /5 and /1A. The meter includes an internal clock and offers options for external or internal antenna configurations. ## Features - **3-phase energy monitoring**: Comprehensive measurement of energy, power, voltage, and current - **MID B+D approved**: Certified for billing and legal metering purposes - **Flexible connection**: Direct connection (100A) or indirect via current transformers (CT /5 and /1A) - **LoRaWAN connectivity**: Built-in LoRa interface for wireless data transmission - **Class C operation**: Always ready to receive for two-way communication (falls back to Class A on incompatible networks) - **DIN rail mounting**: Easy installation in electrical panels - **Configurable S0 pulse output**: For active or reactive energy monitoring - **Internal clock**: Accurate time-stamping of measurements - **Antenna options**: Support for internal or external antenna configurations ## Technical Specifications - **Enclosure**: IP51 - **Dimensions**: 90 x 91 x 72 mm - **Operating temperature**: -25°C to 70°C - **LoRaWAN frequency band**: EU 863-870 MHz - **Device class**: Class C (Class A compatible) - **Transmission power**: 14 dBm - **Measured parameters**: Energy, power, voltage, current ## Thinger.io Integration The Professional II LoRa integrates seamlessly with Thinger.io through LoRaWAN network servers, enabling real-time energy monitoring, data visualization, and remote meter management. ## Requirements A LoRaWAN server is required to communicate the Professional II LoRa into Thinger.io, some options are: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) Alongside, the corresponding plugin for the selected LoRaWAN server needs to be installed in your Thinger.io instance. ## Get Started ### Installation Look for the plugin in the [Thinger.io Plugin Store](https://docs.thinger.io/plugins.md) and install it in your Thinger.io instance. Once the plugin is installed a new Product will be created for this device. ### Configuration The Product is already preconfigured, check that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or change it to your desire. ### Usage Start sending uplinks for autoprovisioning devices and buckets. This product also provides a predefined dashboard and downlinks. ## Use Cases - Commercial and residential energy billing - Industrial energy management - Building automation systems - Energy consumption monitoring and optimization - Demand response applications - Sub-metering in multi-tenant buildings - Renewable energy integration monitoring ## Additional Resources EMU resources can be found at: - [EMU Official Website](https://www.emuag.com/power-meter/emu-professional-ii-lora/) - [Product Information](https://www.emu-metering.com/emu-professional-ii-3-5-lora/P21A000LO) - [Device Repository](https://www.thethingsnetwork.org/device-repository/devices/emu/emu-prof-ii/) - [Thinger docs](https://docs.thinger.io) ## Changelog #### 1.0.0 - 2026-01-27 - First version of plugin --- Source: https://docs.thinger.io/plugins/opensource-esp32-paxcounter.md # ESP32-Paxcounter > The ESP32-Paxcounter has sensors for battery, GPS, altitude, temperature, humidity, barometer, pm2.5, and pm10. It is an ESP32 MCU-based device for metering passenger flows in real-time. It counts how many mobile devices are around by scanning WiFi and Bl | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/opensource-esp32-paxcounter](https://github.com/thinger-io/plugins/tree/main/opensource-esp32-paxcounter) | The ESP32-Paxcounter is an ESP32 MCU-based device for metering passenger flows in real-time. It counts how many mobile devices are around by scanning WiFi and Bluetooth signals in the air, providing an estimation of how many people are present. The device is designed with privacy in mind—it does not persistently store MAC addresses or perform any fingerprinting on scanned devices. The captured data is transmitted over a public or private LoRaWAN® radio network. ## Features - **Passenger Flow Metering**: Detects WiFi and Bluetooth signals from mobile devices to estimate crowd density - **Privacy-Focused Design**: No MAC address storage or device fingerprinting; GDPR compliant - **Multiple Sensors Support**: Battery monitoring, GPS, altitude, temperature, humidity, barometer, PM2.5, and PM10 - **Environmental Sensors**: Compatible with Bosch BMP180/BME280/BME680/BMP280 (I2C) and SDS011 particulate matter sensor (serial) - **GPS Integration**: Serial NMEA GPS and I2C LoPy GPS support for location tracking - **Real Time Clock**: Maxim DS3231 (I2C) support for accurate timestamping - **Multiple Data Transfer Options**: LoRaWAN, MQTT over TCP/IP, local SD-card storage, or serial (SPI) interface - **OTA Updates**: Firmware can update over-the-air via WiFi after initial LoRaWAN join - **Power Saving Mode**: Deep sleep capability for battery-powered deployments - **Clock Sync**: DCF77 and IF482 time telegram output for wall clock synchronization ## Supported Hardware The ESP32-Paxcounter firmware supports various ESP32 LoRa boards including: - TTGO LoRa32 V2/V2.1 - TTGO T-BEAM V1.0/V1.1 - Heltec WiFi LoRa 32 - LoPy/LoPy4/FiPy Custom boards can be configured using the generic.h hal file with tailored pin mappings. ## Use Cases - Public transport passenger flow monitoring - Museum and exhibition visitor counting - Event attendance tracking - Smart city crowd density estimation - Retail foot traffic analysis ## Thinger.io Integration ### Requirements A LoRaWAN server is required to connect the ESP32-Paxcounter to Thinger.io. Some options are: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) The corresponding plugin for the selected LoRaWAN server needs to be installed in your Thinger.io instance. ### Get Started #### Installation Look for the plugin in the [Thinger.io Plugin Store](https://docs.thinger.io/plugins.md) and install it in your Thinger.io instance. Once the plugin is installed, a new Product will be created for this device. #### Configuration The Product is already preconfigured. Check that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or change it to your preference. #### Usage Start sending uplinks for autoprovisioning devices and buckets. This product also provides a predefined dashboard for visualizing passenger counts and sensor data. ## Additional Resources ESP32-Paxcounter resources can be found at: - [GitHub Repository](https://github.com/cyberman54/ESP32-Paxcounter) - [Official Documentation](https://cyberman54.github.io/ESP32-Paxcounter/) - [Hardware Configuration](https://cyberman54.github.io/ESP32-Paxcounter/hardware/) - [The Things Network Device Repository](https://www.thethingsnetwork.org/device-repository/devices/opensource/esp32-paxcounter/) - [Thinger.io Documentation](https://docs.thinger.io) ## Changelog #### 1.0.0 - 2026-01-26 - First version of plugin --- Source: https://docs.thinger.io/plugins/imbuildings-imbuildings-comfort-sensor.md # IMBuildings Comfort Sensor > Sensor for monitoring Indoor Air Quality | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/imbuildings-imbuildings-comfort-sensor](https://github.com/thinger-io/plugins/tree/main/imbuildings-imbuildings-comfort-sensor) | The Adeunis COMFORT is a LoRaWAN IoT sensor designed for monitoring Indoor Air Quality in smart buildings. It measures room temperature and humidity, enabling optimization of ambient comfort and energy savings. The sensor is a 4-in-1 product featuring temperature, humidity, an alarm button, and a dry contact input, with over 15 years of battery autonomy depending on configuration. ## Features - **Temperature Measurement**: Range -20°C to +50°C with ±0.3°C accuracy (5°C to 50°C range) - **Humidity Measurement**: Range 0% to 100% RH with ±2% RH accuracy (20% to 80% RH range) - **Resolution**: 0.1°C and 0.1% RH - **Alarm Button**: Integrated button for event detection and alert triggering - **Dry Contact Input**: Digital input to detect state changes - **Data Transmission**: Periodic and/or event-triggered modes - **Threshold Alerts**: Configurable high and low threshold monitoring with alarm repetition - **Configuration**: Local via USB-C or NFC, remote via LoRaWAN downlinks - **Battery Life**: Over 15 years (SF7, 1 transmission per hour) ## Specifications | Parameter | Value | |-----------|-------| | Dimensions | 111 x 61 x 40 mm | | Weight | 102g | | Protection Rating | IP20 (Indoor use) | | Operating Temperature | -20°C to +60°C | | Frequency Band | EU863-870 MHz | | LoRaWAN Class | Class A (OTAA) | | Transmit Power | +14 dBm | | Maximum Range | 15 km | ## Use Cases - Smart building climate monitoring - Office and commercial building HVAC optimization - Social and collective housing energy management - School and university indoor environment monitoring - Hospital and healthcare facility comfort control - Hotel room climate management - Industrial facility environmental monitoring - Mold prevention through humidity tracking ## Thinger.io Integration ### Requirements A LoRaWAN server is required to communicate the Comfort Sensor with Thinger.io. Supported options include: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) The corresponding plugin for the selected LoRaWAN server must be installed in your Thinger.io instance. ### Get Started #### Installation Look for the plugin in the [Thinger.io Plugin Store](https://docs.thinger.io/plugins.md) and install it in your Thinger.io instance. Once the plugin is installed, a new Product will be created for this device. #### Configuration The Product is already preconfigured. Verify that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or modify it as needed. #### Usage Start sending uplinks for automatic provisioning of devices and buckets. This product also provides a predefined dashboard and downlink capabilities. ## Additional Resources - [Adeunis COMFORT Product Page](https://www.adeunis.com/en/produit/comfort-temperature-humidity-2-2/) - [ZENNER IoT Shop - Comfort Sensor](https://iot.zenner.shop/en/LoRa-Room-sensor-T-H-Comfort-ARF8275A/171258) - [Thinger.io Documentation](https://docs.thinger.io) ## Changelog #### 1.0.0 - 2026-01-26 - First version of plugin --- Source: https://docs.thinger.io/plugins/milesight-iot-am102.md # Milesight AM102 > Milesight AM102 2-in-1 IAQ Sensor for temperature and humidity monitoring with E-ink display | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/milesight-iot-am102](https://github.com/thinger-io/plugins/tree/main/milesight-iot-am102) | The Milesight AM102 is a compact indoor ambience monitoring sensor designed for measurement of temperature and humidity. These data are displayed on the E-ink screen in real-time, allowing users to quantify the indoor environment and comfort levels. The device is ideal for building automation, smart offices, and environmental monitoring applications. ## Thinger.io Integration This product enables automatic device provisioning and data visualization for Milesight AM102 sensors through Thinger.io's IoT platform. ## Requirements A LoRaWAN server is required to communicate the Milesight AM102 into Thinger.io, some options are: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) Alongside, the corresponding plugin for the selected LoRaWAN server needs to be installed in your Thinger.io instance. ## Get Started ### Installation Look for the plugin in the [Thinger.io Plugin Store](https://ma.thinger.io/) and install it in your Thinger.io instance. Once the plugin is installed a new Product will be created for this device. ### Configuration The Product is already preconfigured, check that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or change it to your desire. ### Usage Start sending uplinks for autoprovisioning devices and buckets. This product also provides a predefined dashboard and downlinks. ## Additional Resources Milesight resources can be found at: - [Milesight Official Website](https://www.milesight.com/) - [Thinger docs](https://docs.thinger.io) ## Changelog #### 1.0.0 - 2026-01-15 - First version of plugin --- Source: https://docs.thinger.io/plugins/milesight-am103.md # Milesight AM103 > Milesight AM103 device template for integrating into Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/milesight-am103](https://github.com/thinger-io/plugins/tree/main/milesight-am103) | M103/AM103L is a compact IAQ sensor for detecting CO2 concentration, humidity and temperature accurately and economically. ## Thinger.io Integration ## Requirements A LoRaWAN server is required to communicate the Milesight AM103 into Thinger.io, some options are: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) Alongside, the corresponding plugin for the selected LoRaWAN server needs to be installed in your Thinger.io instance. ## Get Started ### Installation ![Milesight AM103 Plugin Installation into Thinger.io](https://docs.thinger.io/plugins/milesight-am103/assets/plugin-install.png) Once the plugin is installed a new Product will be created for this device. ### Configuration The Product is already preconfigured, check that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or change it to your desire. ### Usage Start sending uplinks for autoprovisioning devices and buckets. This product also provides a predefined dashboard and downlinks. ## Additional Resources Milesight resources can be found at: - [Documentation](https://www.milesight.com/iot/product/lorawan-sensor/am103-am103l) ## Changelog #### 1.0.0 - 2025-02-04 - Initial version --- Source: https://docs.thinger.io/plugins/milesight-ct10x.md # Milesight CT10X > Compact transformer for real-time electrical current monitoring | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/milesight-ct10x](https://github.com/thinger-io/plugins/tree/main/milesight-ct10x) | ![Milesight Smart Current Transformer](https://docs.thinger.io/plugins/milesight-ct10x/assets/milesight-sct.png) **This plugin is exclusively compatible with Milesight CT Series models CT101, CT103, and CT105.** The Milesight Smart Current Transformer is a high-precision AC measurement device designed for real-time current monitoring in industrial and commercial environments. Its compact design, fast installation, and accurate sensing capabilities make it ideal for load analysis, equipment protection, and energy-efficiency applications. The Thinger.io plugin enables seamless integration of CT data for cloud visualization and automated processing. ## Thinger.io and Milesight Current Transformer Integration Integrating the CT Series with Thinger.io provides unified device connectivity, structured data ingestion, and advanced analytics. Users can access real-time current measurements, create dashboards, and configure alerts for overloads or abnormal consumption. The plugin enhances energy-monitoring workflows by enabling historical storage, automated reporting, and interoperability with external systems through Thinger.io’s API and integration tools. ## Requirements - LoRaWAN Network Server (LNS): Required to receive sensor data and forward it to Thinger.io. Supported servers include TTN, Loriot, Chipstark, or other compatible LNS. - Deploy a LoRaWAN plugin in Thinger.io:[The Things Stack, Chipstark and Loriot.](https://docs.thinger.io/lpwan/the-things-stack) ## Get Started ### Configuration 1. Provide device identifiers and communication parameters. 2. Configure LoRaWAN options as applicable. 3. Save and enable the plugin. ### Usage - Once configured, the CT data becomes available as live resources within Thinger.io. Users can: - Instantly view measurements through the prebuilt dashboard, including real-time current values and device status. - Store time-series data in buckets for historical analysis. - Create alerts for thresholds or anomalies. - Integrate measurements with automation workflows and external services. ## Additional Resources - [Milesight CT Series Product Page](https://www.milesight.com/iot/smart-current-transformer-ads) - [CT Series decoders](https://github.com/Milesight-IoT/SensorDecoders/tree/main/ct-series) - [Thinger.io Community Forum](https://community.thinger.io/) ## Changelog #### 1.0.0 - 2025-11-26 - Initial version --- Source: https://docs.thinger.io/plugins/minol-zenner-edc-communication-module.md # Minol Zenner EDC Communication Module > The EDC communication module is an add-on module for water meters for secure remote reading and for integrating water meters into smart metering systems | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/minol-zenner-edc-communication-module](https://github.com/thinger-io/plugins/tree/main/minol-zenner-edc-communication-module) | The EDC (Electronic Data Capture) communication module is an add-on module manufactured by ZENNER for water meters, enabling secure remote reading and integration into smart metering AMR/AMI systems. The module is designed for non-reactive, electronic pulse detection of ZENNER water meters equipped with a modulator disc. ## Features - Non-reactive electronic pulse detection via modulator disc technology - LoRaWAN® radio interface (EU868 MHz band) - Wireless M-Bus interface option (EN 13757-4) - Long-life battery with up to 15 years of operation - Battery status monitoring - IP68 protection rating - Operating temperature range: -15°C to +55°C - Built-in data logger with storage capacity: - Annual due date values: max. 16 - Monthly values: 18 (plus 18 semi-monthly values) - Daily values: 96 - Quarter hour values: 96 - Configuration via infrared interface, ZENNER IrCombiHead, MinoConnect universal interface (USB/Bluetooth), MSS software, or ZENNER Device Manager Basic app - Compliant with EC directive 2014/32/EU (Measuring Instrument Directive) ## Compatible Water Meters The EDC module is compatible with ZENNER water meters equipped with AMR/AMI modulator disc, including: - EKTD/ETWD Single-Jet Meters (cold and hot water) - MTKD-S Multi-Jet Water Meters - RTKD Positive Displacement Meters with dry dial and d-register ## Thinger.io Integration ### Requirements A LoRaWAN server is required to connect the EDC Communication Module to Thinger.io. Supported options include: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) The corresponding plugin for the selected LoRaWAN server must be installed in your Thinger.io instance. ### Get Started #### Installation Search for the plugin in the [Thinger.io Plugin Store](https://docs.thinger.io/plugins.md) and install it in your Thinger.io instance. Once the plugin is installed, a new Product will be created for this device. #### Configuration The Product is preconfigured. Verify that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or adjust it as needed. #### Usage Begin sending uplinks to automatically provision devices and data buckets. This product also provides a predefined dashboard and downlink capabilities. ## Additional Resources - [ZENNER EDC Product Page](https://zenner.com/products/sys_edc_communication_module-2/) - [The Things Network Device Repository](https://www.thethingsnetwork.org/device-repository/devices/minol-zenner/edc-communication-module/) - [Brunata ZENNER EDC Documentation](https://brunata.com/products/network/zenner-edc-communication-module-with-lorawan-radio-interface/) - [Thinger.io Documentation](https://docs.thinger.io) ## Changelog #### 1.0.0 - 2026-01-27 - First version of plugin --- Source: https://docs.thinger.io/plugins/shelly-1l.md # Shelly 1L > Shelly 1L with Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/shelly-1l](https://github.com/thinger-io/plugins/tree/main/shelly-1l) | The Shelly 1L is a small and compact Wi-Fi smart switch that enables you to control your lights, appliances, or any other electrical device remotely. ## Key Features - Compact design: The Shelly 1L has a small size, which makes it easy to fit in any electrical box and behind a switch or power socket, without blocking other outlets. - Remote control: You can control your electrical devices remotely using the Shelly Cloud app on your smartphone or tablet. The app enables you to switch your devices on and off, set schedules, and monitor energy usage. - Voice control: The Shelly 1L is compatible with Amazon Alexa, Google Home, and Apple HomeKit, so you can control your devices using voice commands. - Energy monitoring: The Shelly 1L has an energy monitoring feature that allows you to track the energy usage of your devices, so you can make informed decisions about your energy consumption. - Overload protection: The Shelly 1L has built-in overload protection to prevent damage to your devices in case of a power surge. ## Technical Specifications - Power supply: 110-240V AC, 50/60Hz - Maximum load: 16A/3500W (resistive) - Wireless connectivity: Wi-Fi 802.11 b/g/n (2.4 GHz) - Dimensions: 41mm x 36mm x 17mm - Operating temperature: -40°C to +40°C - Operating humidity: 5% to 95% non-condensing - Certification: CE, RoHS ![Shelly 1L](https://docs.thinger.io/plugins/shelly-1l/assets/shelly-1l.png) ## Changelog #### 1.0.0 - 2023-03-31 - First version of plugin --- Source: https://docs.thinger.io/plugins/shelly-em.md # Shelly EM > Shelly EM with Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/shelly-em](https://github.com/thinger-io/plugins/tree/main/shelly-em) | Shelly EM is a Wi-Fi-operated energy meter with contactor control. It allows you to simultaneously monitor the consumption of any home appliances, electric circuits, and office equipment (lights, power lines, security systems, heating, cooling, etc.) in 2 circuits on the same phase or individually. Shelly EM is perfect for measuring solar energy production, monitoring household consumption, and controlling heavier-load appliances. Checkout the official documentation of the Shelly EM at this [link](https://shelly-api-docs.shelly.cloud/gen1/#shelly-em) ## Key Features - Compact design: The Shelly EM has a small size, which makes it easy to fit in any electrical box and behind a switch or power socket, without blocking other outlets. - Power Monitoring: Shelly EM monitors monophase electrical systems with up to 2 points simultaneously. - Contactor control: Shelly EM has an integrated relay with a rated current of 2A per output for contactor control. ## Technical Specifications - Power supply: Power supply AC 110-230V ±10%, 50/60Hz - Contactor contro: Yes – Shelly EM has an integrated relay with a rated current of 2A per output for contactor control - Overload protection: No - Maximum load: 16A/3500W (resistive) - Wireless connectivity: Wi-Fi 802.11 b/g/n (2.4 GHz) - Radiofrequency: 2400 – 2500 MHz - Dimensions: 39mm x 36mm x 17 mm - Operating temperature: -0 to + 40 °C ![Shelly EM](https://docs.thinger.io/plugins/shelly-em/assets/shelly-em-clamp-50a.png) ## Changelog #### 1.0.0 - 2023-10-09 - First version of plugin --- Source: https://docs.thinger.io/plugins/shelly-plug-s.md # Shelly Plug S > Shelly Plug S | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.1 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/shelly-plug-s](https://github.com/thinger-io/plugins/tree/main/shelly-plug-s) | Shelly Plug can automatically monitor and control lighting, heating and any other connected electrical appliance at home, no matter where you are. When an electric appliance, or a lamp, is plugged into Shelly Plug, you can switch it on and off through the Shelly Cloud app at any time and anywhere. ## Features - No HUB required. - With Shelly Plug S you can control a wide range of devices and appliances. - Shelly Plug S has an integrated precise power meter. - It can be integrated to work with all other Shelly devices. - Compatible with Android, iOS, Amazon Alexa, Google Assistant, and home automation servers using MQTT, CoAP, and REST API. - Easily make your Arduino project live and usable in your automation project. ## Technical Specifications - Power supply: 110-230V AC, 50/60Hz - Maximum load: 10A - Wireless connectivity: Wi-Fi 802.11 b/g/n (2.4 GHz) - Dimensions: 46mm x 69mm - Operating temperature: -10°C to +50°C - Certification: CE ![Shelly Plug S](https://docs.thinger.io/plugins/shelly-plug-s/assets/shelly-plug-s.jpg) ## Changelog #### 1.0.0 - 2023-03-31 - First version of plugin --- Source: https://docs.thinger.io/plugins/shelly-plus-1pm.md # Shelly Plus 1PM > Shelly Plus 1PM with Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 2.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/shelly-plus-1pm](https://github.com/thinger-io/plugins/tree/main/shelly-plus-1pm) | Shelly Plus 1PM is a Wi-Fi enabled smart switch designed for efficient control of your home's electrical appliances. With power metering capabilities, it provides real-time energy consumption tracking and seamless integration with various smart home ecosystems. ## Key Features - Real-time power consumption monitoring - Overload and overtemperature protection - Wide range of input voltages (110-240V AC) - Compatible with Amazon Alexa, Google Assistant, and other smart home platforms - Secure and encrypted communication ## Technical Specifications - Input voltage: 110-240V AC, 50/60Hz - Max load: 16A (resistive) - Wi-Fi: 802.11 b/g/n (2.4 GHz) - Power metering accuracy: ±0.5% - Operating temperature: -10°C to +40°C - Dimensions: 42mm x 36mm x 17mm - Enclosure: UL94V-0 flame retardant polymer ![Shelly Plus 1PM](https://docs.thinger.io/plugins/shelly-plus-1pm/assets/shelly-plus-1pm.png) ## Changelog #### 2.0.0 - 2023-07-13 ##### Added - Support for Shelly Gen2 Protocol #### 1.0.0 - 2023-03-31 - First version of plugin for Shelly Gen1 Protocol --- Source: https://docs.thinger.io/plugins/siemens-logo.md # Siemens LOGO! > Siemens LOGO! integration with Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0-1 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/siemens-logo](https://github.com/thinger-io/plugins/tree/main/siemens-logo) | ![Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/logo-plc.svg) Siemens LOGO! is a highly versatile logic module known for its simplicity, flexibility, and reliability. Widely used in industrial automation, building control, and various other applications, Siemens LOGO! allows for easy implementation of control tasks without requiring extensive programming knowledge. ## Thinger.io and Siemens LOGO! integration Integrating Siemens LOGO! with Thinger.io can significantly enhance its capabilities by enabling remote monitoring, control, and automation of LOGO!-based systems. This integration empowers users to access, visualize, and manage LOGO! data remotely through Thinger.io platform, enabling real-time monitoring, data analysis, and automation of LOGO!-based applications. > **Info: Siemens LOGO! minimum requirements** > > Siemens LOGO! 8.4 or later is required to use this plugin, as it supports open MQTT communication. [More info](https://support.industry.siemens.com/cs/document/109826554/sales-release-for-logo!-8-4-basic-devices-and-logo!-soft-comfort-v8-4-?dti=0) > Siemens LOGO! Soft Comfort V8.4 or later is required to configure the MQTT communication. [More info](https://support.industry.siemens.com/cs/document/109826553/download-and-installation-instructions-for-logo!-soft-comfort-upgrade-v8-4?dti=0) The plugin provides a first step to be able to integrate a fleet of Siemens LOGO! controllers, while allowing the ad-hoc configuration that best suits the user's needs. It provides the following settings: - A **device_information** property, that will be used to set the device information manually (firmware version, serial number, etc). - A **shadow** property, that will be used to store the current state of the device. - A **siemens_logo** data bucket, that will be used to store the data sent by the Siemens LOGO! controller. - An **up** and **down** device resources, to control the Siemens LOGO! controller. - An **autoprovision** rule, that will be used to create the device in the Thinger.io platform automatically. - Basic **product functions** to parse the shadow of the device and handling sending commands to the Siemens LOGO! controller. - A preconfigured **dashboard** to visualize relevant data of each Siemens LOGO! controller. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/12_product_profile_1.png) ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/13_product_profile_2.png) ## Get Started After installing the Siemens LOGO! Plugin, it is time to configure the device to connect to Thinger.io platform. The following steps will guide you through the process: #### Connect Siemens LOGO! to the Internet Ensure that your Siemens LOGO! device is connected to the Internet, either through an Ethernet connection or a compatible IoT module. #### Set the Device Time Set the time and date on the Siemens LOGO! through the menu `Tools -> Transfer -> Set Time...`. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/1_time_settings.png) #### Configure MQTT Communication Configure the Siemens LOGO! device to communicate with Thinger.io platform using MQTT protocol. You will need to provide the MQTT broker address, port, username, and password. Go to the menu option `Tools -> Transfer -> Cloud settings -> Cloud connection settings` and configure the settings as shown below: 1. In the new dialog that appears on screen, check the `Active Cloud Access`. Then, click on `Register object`. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/3_cloud_settings_2.png) 2. Select the `Type of cloud` as `MQTT` and click on `Next`. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/4_cloud_settings_3.png) 3. Now set the broker URL, port, device id, username, and device password. * Broker URL: domain name of the instance of Thinger.io. If you use the Community Console, the URL should be `backend.thinger.io`. If you use a private instance use your own URL. * Port: 8883 is recommended over 1883. * Device ID: Identifier that we will give to the device in the Thinger.io platform and which must be unique. The current autoprovision rule is to start with 'logo-', which can be followed by the serial number of the device for example. * Username: Username of the Thinger.io platform that will own the device resource in the system. * Device Password: Password of the device the Thinger.io platform will use to authenticate the device. It will be configured on the platform on autoprovision. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/5_cloud_settings_4.png) 4. In this next step, we will select for `Authenticacion Type` the option `Unilateral TLS`. The certificate CA de broker uses can be download from this [link](https://letsencrypt.org/certificates/), specifically the pem certificate `ISRG Root X1`, valid until 2023-06-04. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/6_certificate.png) ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/7_cloud_settings_5.png) 5. In the next dialog screen we will configure the MQTT topics in which the Siemens LOGO! publishes and is subscribed. * Publish topic: topic where the LOGO! will send data to be read form the Thinger.io Cloud platform. We suggest the following structure: `logo//tx` * Subscribe to topic: topic where the LOGO! will receive data sent by the Thinger.io Cloud platform. We suggest the following structure: `logo//rx` ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/8_cloud_settings_6.png) 6. After a few seconds, the device will autoprovision itself on Thinger.io Platform. You can check the device status on the Thinger.io Console. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/9_cloud_settings_7.png) ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/10_thinger_settings_1.png) ### Configure Data Exchange Configure the data registers in the Siemens LOGO! device that you want to exchange with Thinger.io platform. * In the following image, the two registers will be sent to the publish topic (`logo//tx`) configured in the previous step, when their value changes. * To send data from the platform to the controller, the register must be set with `write permissions`. In this case the register M1. ![Time Settings in Soft Comfort software for Siemens LOGO!](https://docs.thinger.io/plugins/siemens-logo/assets/11_cloud_settings_8.png) By following all these steps the plugin will be fully configured, and it is time to begin the configuration of the Product for your own project requirements. ### Remote Configuration In order to configure the Siemens LOGO! remotely, a Thinger.io [Linux Client](https://docs.thinger.io/linux) is required to be installed in the same LAN as the device. By leveraging the [proxies features](https://docs.thinger.io/business-features/proxies), it is possible to open a remote tunnel from the Siemens Soft Comfort software to the Siemens LOGO! through the Thinger.io platform. If there are any questions regarding this configuration, we'd be happy to help you. Please reach out to us through the [Thinger.io Community](https://community.thinger.io/) or the [Thinger.io Support](https://thinger.io/support/). ## Additional Resources There are several resources available with both the Siemens LOGO! and Thinger.io Platform that can help you get started with your project: * [Siemens LOGO! System Manual](https://support.industry.siemens.com/cs/document/109826499/logo!?dti=0) * [Siemens LOGO! Support Forum](https://support.industry.siemens.com/forum/es/en/conf/65/) * [Thinger.io Products Documentation](https://docs.thinger.io/business-features/products) ## Changelog All notable changes to this project will be documented in this file. #### 1.0.0-1 - 2025-05-21 Initial version --- Source: https://docs.thinger.io/plugins/teltonika-eye.md # Teltonika Eye > Decoder and preconfiguration for Teltonika Eye devices | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/teltonika-eye](https://github.com/thinger-io/plugins/tree/main/teltonika-eye) | The Teltonika Eye Plugin for Thinger.io enables the integration of Teltonika's Eye devices, Beacon and Sensor, with the Thinger.io Platform. ## Thinger.io and Teltonika Eye Integration Monitor and track your fleet within Thinger.io ## Requirements The Teltonika Telematics Plugin needs to be installed in the Platform, as the telematics devices will send the data of the Teltonika Eye to the Thinger.io Platform. The Teltonika Eye may be configured to send beacons in Eddystone or iBeacon protocols. ## Get Started ### Installation First install this plugin through the Plugin Management Interface. More information [here](https://docs.thinger.io/plugins/management.md#install-and-deploy-an-existent-plugin). ### Configuration It is required to enable the Teltonika Eye endpoint within Thinger.io so as the Telematics devices can send the received Eye data. Go into the Teltonika Telematics product and enable the `teltonika_eye` endpoint. The Teltonika Eye Product, has an autoprovision feature, disabled by default, that will autoprovision in the platform the received BLE beacons, however the Telematics device may receive beacons from non Teltonika devices, and autoprovision other kind of devices. The devices can be manually provisioned by the Eddystone or iBeacon ids. ### Usage Detail how to use the plugin after configuration. Include examples, best practices, and troubleshooting tips. ## Additional Resources Provide any additional resources, documents, or links to external sites that can help users understand or utilize the plugin better. - [Teltonika Eye Beacon Documentation](https://wiki.teltonika-gps.com/view/EYE_BEACON_/_BTSID1) - [Teltonika Eye Beacon Configuration](https://wiki.teltonika-gps.com/view/Configuring_EYE_beacons) - [Teltonika Eye Beacon Get Started](https://wiki.teltonika-gps.com/view/How_to_start_with_FMB_devices_and_Beacons%3F) - [Start with FMB devices and Beacons](https://wiki.teltonika-gps.com/view/How_to_start_with_FMB_devices_and_Beacons%3F) - [Teltonika Support Forum](https://community.teltonika.lt/) - [Thinger.io Community](https://community.thinger.io/) ## FAQ Include a section for frequently asked questions to address common issues or queries. ## Changelog #### 1.0.0 - 2025-02-20 - Initial version --- Source: https://docs.thinger.io/plugins/teltonika-telematics.md # Teltonika Telematics > Decoder and preconfiguration for Teltonika GPS Telematics devices | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/teltonika-telematics](https://github.com/thinger-io/plugins/tree/main/teltonika-telematics) | ![Teltonika Telematics](https://docs.thinger.io/plugins/teltonika-telematics/assets/teltonika_telematics.png) The Teltonika Telematics Plugin for Thinger.io enables the integration of Teltonika's GPS tracking devices with the Thinger.io Platform. This plugin facilitates real-time monitoring, data visualization, and management of your Teltonika devices within the Thinger.io ecosystem. ## Thinger.io and Teltonika Telematics Integration Integrating Teltonika Telematics devices with Thinger.io offers a robust solution for fleet management, asset tracking, and remote monitoring. Key features include: - **Real-Time Data Monitoring**: Access live data from your Teltonika devices, including location, speed, and sensor information. - **Custom Dashboards**: Visualize device data through customizable dashboards, enabling quick insights and informed decision-making. - **Geofencing Capabilities**: Set up geofences to receive alerts when devices enter or exit predefined areas. - **Historical Data Analysis**: Store and analyze historical data to identify patterns and optimize operations. - **Automated Alerts**: Configure notifications for specific events, such as excessive speed or unauthorized movement. Potential use cases encompass: - **Fleet Management**: Monitor vehicle locations, routes, and statuses to enhance efficiency and reduce operational costs. - **Asset Tracking**: Keep track of valuable assets in transit to prevent loss and ensure timely deliveries. - **Remote Equipment Monitoring**: Oversee machinery and equipment in remote locations to detect issues promptly and schedule maintenance. ## Get Started ### Installation First install this plugin through the Plugin Management Interface. More information [here](https://docs.thinger.io/plugins/management.md#install-and-deploy-an-existent-plugin). Afterwards create some generic certificates with the following commands, configuring it with your own details and setting your thinger user in the Common Name field (see image for example): ``` openssl req -x509 -newkey rsa:4096 -keyout private.pem.key -out cert.pem.crt -sha256 -days 9125 -nodes ``` !['certificate_creation.png'](https://docs.thinger.io/plugins/teltonika-telematics/assets/certificate_creation.png) ### Configuration The configuration of this devices require both creation of resources in the Thinger.io Platform and configuring the Teltonika Device. #### Teltonika Configurator The teltonika device needs to be configured with its own [Teltonika Configurator Software Management Tool](https://wiki.teltonika-gps.com/view/Teltonika_Configurator). Once the device is connected, the following changes need to be done: - In the `Security Tab`, upload the device certificates. !['teltonika_configurator_security.png'](https://docs.thinger.io/plugins/teltonika-telematics/assets/teltonika_configurator_security.png) - In the `GPRS Tab`, set the Server Settings box with your Thinger.io instance domain, the Port `8883`, Protocol `MQTT` and TLS Encryption `TLS/DTLS`. Then in the MQTT Settings box, select `AWS IoT Custom` and leave the default settings as shown in the image. !['teltonika_configurator_gprs.png'](https://docs.thinger.io/plugins/teltonika-telematics/assets/teltonika_configurator_gprs.png) After that, copy the device IMEI from the status page, as it will be the device Id in Thinger.io. !['teltonika_configurator_status.png'](https://docs.thinger.io/plugins/teltonika-telematics/assets/teltonika_configurator_status.png) After the configuration is done, make sure to reboot the device. #### Thinger.io Platform Create a new device through the `Devices` menu, of type HTTP, the Id the IMEI of the device and assign it to the product `Teltonika Telematics`. At this point assign it random credentials, they will not be used in favor of the certificates. !['teltonika_mqtt_device.png'](https://docs.thinger.io/plugins/teltonika-telematics/assets/teltonika_mqtt_device.png) ### Usage This plugin will autoprovision its required buckets and save the data in `Teltonika Telematics Data` and in case it receives beacon data in `Teltonika Telematics Beacon`. When a bluetooth beacon of a Teltonika Eye Beacon is uploaded from the device, and endpoint in Thinger.io will be called. If the product corresponding to this Teltonika Eye Beacon is installed, this Eye Beacon will autoprovision itself in the platform. This endpoint will be disabled by default, and will need to be enabled if the Teltonika Eye Plugin is installed. The decoder is found in a File Storage in Thinger.io of name `Teltonika Decoder`. Any differences in the preconfigured AVL list can be changed or added in the file `devices/fmbxxx.js` installed Teltonika Decoder storage. ## Additional Resources Checkout these resources to further understand how the data is decoded, as well as any other required configuration. - [Teltonika Data Sending Protocols](https://wiki.teltonika-gps.com/view/Teltonika_Data_Sending_Protocols) - [Teltonika AVL Data Sending Parameters](https://wiki.teltonika-gps.com/view/Template:Teltonika_Data_Sending_Parameters_ID) - [Configuring Eye Beacons](https://wiki.teltonika-gps.com/view/Configuring_EYE_beacons) - [Start with FMB devices and Beacons](https://wiki.teltonika-gps.com/view/How_to_start_with_FMB_devices_and_Beacons%3F) - [Teltonika Support Forum](https://community.teltonika.lt/) - [Thinger.io Community](https://community.thinger.io/) ## Changelog #### 1.0.0 - 2025-02-18 - Initial version --- Source: https://docs.thinger.io/plugins/wika-pew1000.md # WIKA PEW-1000 > Wireless pressure sensor | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.1.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/wika-pew1000](https://github.com/thinger-io/plugins/tree/main/wika-pew1000) | The WIKA PEW‑1000 is a compact, wireless pressure sensor designed for remote monitoring of gases and liquids. It features LoRaWAN® wireless connectivity and Bluetooth® for local configuration. Built for industrial use, it offers long battery life, robust environmental protection, and high-accuracy pressure readings. ## Thinger.io Integration To integrate the WIKA PEW‑1000 with Thinger.io, you will need a LoRaWAN Network Server (LNS) with it's corresponding Thinger.io plugin. ## Requirements A LoRaWAN server is required to communicate the WIKA PEW‑1000 with Thinger.io. Supported options include: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) Additionally, the corresponding Thinger.io plugin for the selected LoRaWAN server must be installed. ## Get Started ### Installation Look for the plugin in the [Thinger.io Plugin Store](https://plugins.thinger.io/) and install it in your Thinger.io instance. Once the plugin is installed a new Product will be created for this device. ### Configuration The Product is preconfigured to support auto-provisioning. Make sure the provisioning prefix matches the configuration used in your LoRaWAN server plugin. You may change this prefix if needed. If using Bluetooth® for local setup, ensure the device is configured to use LoRaWAN and the appropriate AppEUI/AppKey are set correctly. ## Usage Begin sending uplink frames from the PEW‑1000. Devices and data buckets will be auto-provisioned in your Thinger.io account. This plugin also includes: - A prebuilt dashboard for data visualization. - Support for downlink commands to remotely configure the sensor. ## Features Overview - **Wireless Protocols**: - LoRaWAN® for long-range communication. - Bluetooth® for local configuration. - **Sensor Capabilities**: - High-accuracy pressure and temperature measurement. - Battery status and technical diagnostics. - Smart alarm triggering based on threshold or slope. - **Remote Configuration** via Downlinks: - Sampling and transmission interval. - Alarm thresholds and hysteresis. - Reset to factory defaults. - Battery indicator reset. - **Power**: - Replaceable battery with up to 10 years of lifetime (depending on transmission interval and environment). - **Rugged Design**: - IP65-rated enclosure for outdoor and industrial use. ## Additional Resources WIKA official resources and documentation: - [PEW‑1000 Product Page](https://www.wika.com/en-us/pew_1000.WIKA) - [PEW‑1000 Operating Manual (PDF)](https://www.wika.com/media/Operating-instructions/Operating-instructions/Pressure/Pressure-sensors/sd_pew_1000_en_co.pdf) - [PEW‑1000 + PEW‑1200 Bluetooth® Configuration Guide](https://www.wika.nl/upload/SD_PEW_1000_PEW_1200_en_113765.pdf) ## Changelog #### 1.1.0 - 2025-08-21 ##### Fix - Fixed support for other LNS plugins by parsing uplinks to match thinger.io format #### 1.0.0 - 2025-02-04 - Initial version --- Source: https://docs.thinger.io/plugins/wika-pgw23-100.md # WIKA PGW23-100 > Bourdon tube pressure gauge with wireless transmission | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.1 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/wika-pgw23-100](https://github.com/thinger-io/plugins/tree/main/wika-pgw23-100) | ![WIKA PGW-23-100](https://docs.thinger.io/plugins/wika-pgw23-100/assets/wika-pgw23-100.jpg) The WIKA PGW23-100 is a hybrid IIoT pressure gauge: it combines a mechanical on-site Bourdon tube display with wireless LoRaWAN® communication for remote monitoring. It is designed for process-industry applications where you want both local indication and centralized data collection. ## Thinger.io Integration This plugin allows you to integrate PGW23-100 devices into Thinger.io via a LoRaWAN Network Server (LNS) and the corresponding Thinger.io LoRaWAN plugin. ## Requirements A LoRaWAN server is required to communicate the WIKA PGW-23-100 with Thinger.io. Supported options include: - [The Things Stack](https://www.thethingsindustries.com/stack/) - [LORIOT](https://loriot.io/) - [ChirpStack](https://www.chirpstack.io/) Additionally, the corresponding Thinger.io plugin for the selected LoRaWAN server must be installed. ## Get Started ### Installation Look for the plugin in the [Thinger.io Plugin Store](https://plugins.thinger.io/) and install it in your Thinger.io instance. Once the plugin is installed a new Product will be created for this device. ### Configuration The Product is preconfigured to support auto-provisioning. Make sure the provisioning prefix matches the configuration used in your LoRaWAN server plugin. You may change this prefix if needed. If using Bluetooth® for local setup, ensure the device is configured to use LoRaWAN and the appropriate AppEUI/AppKey are set correctly. ## Usage Begin sending uplink frames from the PGW-23-100. Devices and data buckets will be auto-provisioned in your Thinger.io account. This plugin also includes: - A prebuilt dashboard for data visualization. - Preconfigured data buckets for storing sensor readings. - Support for downlink commands to remotely configure the sensor. ## Features Overview - **Wireless Protocols**: - LoRaWAN® for long-range communication. - NFC for easy device commissioning and configuration. - **Sensor Capabilities**: - High-accuracy pressure and temperature measurement. - Battery status and technical diagnostics. - Smart alarm triggering based on threshold or slope. - **Remote Configuration** via Downlinks: - Sampling and transmission interval. - Alarm thresholds and hysteresis. - Reset to factory defaults. - Battery indicator reset. - **Power**: - Replaceable battery with up to 10 years of lifetime (depending on transmission interval and environment). ## Additional Resources WIKA official resources and documentation: - [WIKA PGW-23-100 Product Page](https://www.wika.com/es-es/pgw23_100_pgw26_100.WIKA) - [WIKA PGW-23-100 Configuration Guide](https://www.wika.com/media/Operating-instructions/Additional-operating-instructions/Non-Ex/ai_lora_mioty_en_de_fr_es.pdf) ## Changelog #### 1.0.1 - 2025-10-23 ##### Fix - Corrected Marketplace Product image. #### 1.0.0 - 2025-10-08 - Initial version --- Source: https://docs.thinger.io/plugins/yobiiq-em2101.md # Yobiiq EM2101 > The YOBIIQ iQ Electricity EM2101 is a smart electricity meter with LoRaWAN® connectivity | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Devices](https://docs.thinger.io/plugins/devices.md) | Thinger.io | MIT | [thinger-io/plugins/yobiiq-em2101](https://github.com/thinger-io/plugins/tree/main/yobiiq-em2101) | The YOBIIQ iQ Electricity EM2101 is a certified single-phase smart electricity meter with LoRaWAN connectivity and a built-in safety relay. It allows precise monitoring and control of energy consumption, recording measurements such as voltage, current, frequency, active power, power factor, and active energy, while enabling remote management via LoRaWAN networks. ## Thinger.io and EM2101 Integration Integrating the EM2101 with Thinger.io provides real-time monitoring, automated energy management, and actionable insights into power consumption. Key benefits include: **Remote Control:** Operate the internal relay remotely to shut off or switch on power based on configurable thresholds. **Comprehensive Data Collection:** Record and transmit energy metrics in real time, enabling efficient energy management and billing systems. **Resilient Logging:** Local data logging ensures no data is lost even if the network is temporarily unavailable. **Flexible Configuration:** Configure up to 10 different uplink ports with custom intervals and measurement parameters. **LoRaWAN Network:** Requires a LoRaWAN-compatible gateway or network server to transmit data to Thinger.io. **Use Cases:** Residential, commercial, and industrial energy monitoring, smart metering, and building automation systems. ## Get Started ### Requirements - LoRaWAN Network Server (LNS): Required to receive sensor data and forward it to Thinger.io. Supported servers include TTN, Loriot, Chipstark, or other compatible LNS. - Deploy a LoraWan plugin in Thinger.io: [The Things Stack, Chipstark and Loriot.](https://docs.thinger.io/lpwan/the-things-stack) ### Configuration - The EM2101 plugin comes with pre-configured dashboards for real-time monitoring of voltage, current, active power, and energy. - Configure uplink intervals, thresholds, and notifications directly in the Thinger.io console if needed. ### Usage 1. Visualize real-time measurements using Thinger.io dashboards. 2. Set automated alerts or actions when thresholds are exceeded. 3. Troubleshoot by checking device logs or verifying LoRaWAN connectivity through Thinger.io. ## Additional Resources [EM2101 Datasheet](https://yobiiq.com/products/electricity-meters/iq-em2101-electricity-meter/) [YOBIIQ Decoders GitHub Repository](https://github.com/Yobiiq-BV/yobiiq-decoders) ## Changelog #### 1.0.0 - 2025-11-26 - Initial version --- Source: https://docs.thinger.io/plugins/connectivity.md # Connectivity > Plugins that bring data into Thinger.io from network servers and other platforms, such as LoRaWAN and Sigfox. Plugins that bring data into Thinger.io from network servers and other platforms, such as LoRaWAN and Sigfox. | Icon | Plugin | Description | | --- | --- | --- | | ![ChirpStack](https://docs.thinger.io/plugins/icons/chirpstack.png) | [ChirpStack](https://docs.thinger.io/plugins/chirpstack.md) | Chirpstack Integration | | ![HTTP Device](https://docs.thinger.io/plugins/icons/http-device.png) | [HTTP Device](https://docs.thinger.io/plugins/http-device.md) | HTTP Devices Integration | | ![LORIOT](https://docs.thinger.io/plugins/icons/loriot.png) | [LORIOT](https://docs.thinger.io/plugins/loriot.md) | LORIOT Integration | | ![Sigfox](https://docs.thinger.io/plugins/icons/sigfox.png) | [Sigfox](https://docs.thinger.io/plugins/sigfox.md) | Sigfox Integration | | ![The Things Stack](https://docs.thinger.io/plugins/icons/ttn.png) | [The Things Stack](https://docs.thinger.io/plugins/ttn.md) | The Things Stack Integration | | ![The Things Stack](https://docs.thinger.io/plugins/icons/ttn-stack.png) | [The Things Stack](https://docs.thinger.io/plugins/ttn-stack.md) **Deprecated** | The Things Stack Integration | --- Source: https://docs.thinger.io/plugins/chirpstack.md # ChirpStack > Chirpstack Integration | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.1.1 | [Connectivity](https://docs.thinger.io/plugins/connectivity.md) | Thinger.io | MIT | [thinger-io/plugins/chirpstack](https://github.com/thinger-io/plugins/tree/main/chirpstack) | ![ChirpStack logo](https://docs.thinger.io/plugins/chirpstack/assets/chirpstack-logo.png) ChirpStack is a flexible, open-source LoRaWAN® Network Server that allows organisations to deploy and operate their own private or public IoT networks with full control over infrastructure and data. It is widely used by companies, research institutions, and communities looking for reliable large-scale LoRaWAN deployments without vendor lock-in. With Thinger.io, ChirpStack users can easily extend their networks by adding powerful tools for storing, analysing, and visualising device data in real time. This integration helps transform raw LoRaWAN traffic into actionable insights, dashboards, and long-term records. The plugin bridges ChirpStack with Thinger.io through the **Products** feature, enabling automatic device and bucket provisioning, as well as flexible uplink and downlink processing pipelines that can be fully customised to the needs of each project. --- ## Getting Started > **Prerequisite** > Devices within the selected ChirpStack Application must be **homogeneous**—same type and model—so that autoprovision can assign the correct product template. 1. **Install the plugin** inside your Thinger.io account. See the guide [**“How to install a plugin”**](https://docs.thinger.io/plugins/management.md) on the Marketplace if you are not familiar with the process. --- ## Plugin Configuration Open the plugin settings page. In the **Applications** table click **Add +** and fill in: | Field | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Application Name** | Must match **exactly** the Application ID defined in ChirpStack. The plugin uses this value to correctly associate uplinks and downlinks with the right application. | | **Device ID Prefix** | Prefix used when generating the device identifier; the Device EUI is appended automatically. Required for autoprovision of devices in Thinger.io. | | **Access Token** | API token generated in ChirpStack to allow secure communication with the Network Server. This is required to authenticate all requests. | | **Server URL** | The base URL of your ChirpStack instance. Since ChirpStack is self-hosted, you must provide the public or private endpoint where your server is running. | | **Port** | The gRPC service port exposed by ChirpStack (default is `8080`). If you are running ChirpStack behind a reverse proxy, make sure this port is accessible or properly forwarded. | | **Enabled** | Toggles the application integration on or off. | ![Add application modal in ChirpStack Thinger.io Plugin](https://docs.thinger.io/plugins/chirpstack/assets/add_application.png) Unlike TTN or LORIOT, ChirpStack must be deployed and managed by the user. The plugin backend communicates with ChirpStack using gRPC (HTTP/2), which provides efficient and real-time interaction but also requires that the gRPC service port is reachable by Thinger.io. In most cases, you will need to either: - Expose the correct gRPC port on your ChirpStack instance, or - Configure your reverse proxy (e.g., Nginx, Traefik, etc.) to support HTTP/2 + grpc_pass. Since ChirpStack is self-hosted, network accessibility is critical. In our tests we verified connectivity by forwarding the gRPC port from the router directly to the ChirpStack server, ensuring uplinks and downlinks were processed correctly. ## ChirpStack Webhook Configuration Log in to the ChirpStack Application Server and select the target Application. Navigate to Integrations → Add Integration and choose the generic HTTP integration (since there is no specific Thinger.io template available yet). Complete the form with the values provided by the Thinger.io plugin: ![ChirpStack HTTP Webhook Settings for Thinger.io integration](https://docs.thinger.io/plugins/chirpstack/assets/chirpstack_webhook.png) | Field | Value | | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Event endpoint URL(s)** | Copy the value shown in the plugin under **Endpoint Base URL for Uplinks**. ChirpStack will send all application traffic (uplinks, join events, acknowledgements) to this endpoint. | | **Headers** | Add a new header with key **Authorization** and value equal to the **ChirpStack API Token** provided in the plugin settings page. | After saving, uplink traffic will start appearing in the plugin Logs panel. At this point the devices may still be unrecognised; autoprovision occurs once a matching Device Template is installed or created. More details on HTTP integrations can be found in the [ChirpStack documentation](https://www.chirpstack.io/docs/). --- ## Device Templates Device templates define: * The expected data structure for an specific thinger product * Uplink / downlink processing scripts * Default dashboards, device properties and data buckets ### Install a Device Template Search the Marketplace for a template that matches your device model. If none exists, you can [create your own template](https://docs.thinger.io/products). Notice that, in Thinger.io, a **Product** is a template that defines the structure and behaviour of a device and can also be installed as a plugin. > **Info: Important** > > Ensure the template **autoprovision prefix** matches the **Device ID Prefix** configured in the plugin. --- ## Changelog #### [1.1.1] - 2025-12-03 ##### Add - Added support for enabling/disabling individual applications in the backend - Improved Inspector messages - Auto completion for application edition in the plugin configuration page ###### Fix - Fixed multiple application selection bug in the plugin configuration page - Fixed edition of existing plugin applications #### [1.1.0] - 2025-11-15 ##### Added - Added User events Queue in Chirpstack Backend - Significantly improved error handling and reporting - Cleaner visualization with tabs for different plugin configuration sections ##### Fix - Fixed issue with HTTP code 200 response handling #### [1.0.0] - 2025-06-30 ##### Added - Created a new version of chirpstack integration plugin [1.0.0]: https://github.com/thinger-io/plugins/ --- Source: https://docs.thinger.io/plugins/http-device.md # HTTP Device > HTTP Devices Integration | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.1.1 | [Connectivity](https://docs.thinger.io/plugins/connectivity.md) | Thinger.io | MIT | [thinger-io/plugins/http-device](https://github.com/thinger-io/plugins/tree/main/http-device) | ![HTTP Device logo](https://docs.thinger.io/plugins/http-device/assets/http-device-logo.png) This plugin is specially useful for fleets of generic devices that can make HTTP requests. In a single HTTP request done by the device, this plugin can auto-provision the device and the data bucket if it does not exist. Moreover, it allows processing request/response payloads to process the information before it is stored in the data bucket, or before it is received by the device. ## Plugin features * Support for multiple device types or profiles * Automatic device and bucket provisioning for new devices. * Configurable default device timeout. * Configurable device and bucket prefixes. * Configurable device and bucket asset type and group. * Support por defining custom request/response data processing on NodeJS. * Payload Processing workbench. ## Changelog #### [1.1.1] - 2024-03-22 ##### Fixed - Auto provision bucket is set true as default - Assign project to provisioned failing device provisioning #### [1.1.0] - 2024-02-15 ##### Added - Support for setting Project and Product on auto-provisioned devices & buckets - Support for device and bucket separately - Support for configuring a preexisting bucket for device write callback ##### Security - Updated axios to version 1.6.7 - Updated express to version 4.18.2 - Updated vm2 to version 3.9.19 #### [1.0.2] - 2023-02-21 ##### Fixed - Ensure provided device type is available instead of using default settings #### [1.0.1] - 2023-02-20 ##### Fixed - Make sure Thinger server is running before starting service [1.1.1]: https://github.com/thinger-io/plugins/compare/http-device/v1.1.0...http-device/v1.1.1 [1.1.0]: https://github.com/thinger-io/plugins/compare/http-device/v1.0.2...http-device/v1.1.0 [1.0.2]: https://github.com/thinger-io/plugins/tree/http-device/v1.0.2 --- Source: https://docs.thinger.io/plugins/loriot.md # LORIOT > LORIOT Integration | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 2.1.1 | [Connectivity](https://docs.thinger.io/plugins/connectivity.md) | Thinger.io | MIT | [thinger-io/plugins/loriot](https://github.com/thinger-io/plugins/tree/main/loriot) | ![LORIOT logo](https://docs.thinger.io/plugins/loriot/assets/loriot-logo.png) LORIOT is a LoRaWAN Network solution that simplifies the deployment of large IoT applications over a collaborative Internet of Things network that spans many countries around the world. From Thinger.io we wanted to offer an improved integration to LORIOT users by providing easy-to-configure tools for storing, analyzing, and showing device data in a simple way. This plugins integrates LORIOT messages into Thinger.io platform through the Products feature, allowing the autoprovisioning of devices and data buckets, and the definition of custom uplink and downlink processing functions, as well as the processing of uplink and downlink payloads. ## Getting Started This plugin requires that devices in LORIOT applications to be of homogeneous type, that is, being of the same type and model, in order to handle autoprovision. The first step is to install the plugin in your Thinger.io account ([How to install a plugin](https://docs.thinger.io/plugins/management.md#install-and-deploy-an-existent-plugin)). ![LORIOT in Thinger.io Marketplace](https://docs.thinger.io/plugins/loriot/assets/loriot_plugin_marketplace.png) ### Plugin Configuration After installing this plugin, access the plugin configuration page and on the Applications table click on `Add +` to create a new application. You will need to provide the following information: - **Application Name**: An optional friendly name for the application. - **Device Id Prefix**: A prefix to be used for the device identifiers. The plugin will automatically append the device EUI to this prefix to create the device identifier. This prefix is necessary for the device autoprovision features. - **LORIOT Access Token**: The LORIOT Application Access Token. Please refer to the [LORIOT Access Token documentation](https://docs.loriot.io/space/NMS/6031583/Access+Tokens) to learn how to obtain this token. ![Add application modal in LORIOT Thinger.io Plugin](https://docs.thinger.io/plugins/loriot/assets/add_application.png) Don't close the plugin configuration page yet, you will need to configure the LORIOT Webhook to send the device data to Thinger.io. ![LORIOT Thinger.io Plugin Settings](https://docs.thinger.io/plugins/loriot/assets/loriot_plugin.png) ### LORIOT Webhook Configuration To integrate LORIOT with Thinger.io, you need to configure a Webhook in LORIOT to send the device data to Thinger.io. To do this, follow these steps: 1. Access the LORIOT platform and go to the `Applications` section. Select the application you want to integrate with Thinger.io. 2. In the application configuration, go to `Output` and click on `Add new output`. 3. Select `HTTP Push` as the output type and fill out the configuration with the seetings found in the plugin configuration page: ![LORIOT Webhook Settings for Thinger.io integration](https://docs.thinger.io/plugins/loriot/assets/loriot_webhook_settings.png) If you [check the logs](https://docs.thinger.io/plugins/management.md#analyzing-the-logs) in the LORIOT Thinger.io Plugin, you should see the messages being received from LORIOT. However, the devices are not yet provisioned in Thinger.io, so the messages are being discarded. Currently only device uplink messages and downlink confirmations are supported, meaning that gateway messages will not be processed. More information on LORIOT Application Output can be found in the [LORIOT documentation](https://docs.loriot.io/space/NMS/6033171/Application+Outputs). ### Device Templates Device templates define the device data structure and the processing functions for uplink and downlink messages, as well as dashboards and data buckets. #### Install a Device Template In Thinger.io device templates are also plugins, checkout the Plugins Marketplace to find the device template that fits your device. In case you cannot find a device template for your device, you can create your own device template, please refer to section [Create Your Own Device Template](#create-your-own-device-template). ![AM103 Marketplace plugin](https://docs.thinger.io/plugins/loriot/assets/am103_plugin.png) Once installed, in Products you'll see your new installed device templates. By default the device templates have a predefined prefix, make sure to change it to match the prefix you used when creating the LORIOT application in the plugin. ![AM103 Product profile](https://docs.thinger.io/plugins/loriot/assets/am103_product_profile.png) #### Create your own Device Template You can create your own device template through the Products feature, refer to the [Thinger.io documentation](https://docs.thinger.io/products) to learn how to create a new product. ## LORIOT Documentation Please refer to the [LORIOT documentation](https://docs.loriot.io/) for more information about the LORIOT platform. ## Changelog #### [2.1.1] - 2025-12-03 ##### Add - Added support for enabling/disabling individual applications in the backend - Improved Inspector messages #### [2.1.0] - 2025-11-18 ##### Add - Changed visual style of plugin sections in order to improve readability - Significantly improved error handling and logging for uplink parsing issues #### [2.0.0] - 2025-08-11 ##### Fix - Fixed support for other LNS plugins by parsing uplinks to match thinger.io format #### [1.1.0] - 2025-05-07 ##### Added - Added support for downlink messages ##### Fix - Fixed application logging when printing multiple parameters #### [1.0.0] - 2025-02-04 ##### Added - Created loriot integration plugin [1.1.0]: https://github.com/thinger-io/plugins/compare/loriot/v1.0.0...loriot/v1.1.0 [1.0.0]: https://github.com/thinger-io/plugins/tree/loriot/v1.0.0 --- Source: https://docs.thinger.io/plugins/sigfox.md # Sigfox > Sigfox Integration | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.4.1 | [Connectivity](https://docs.thinger.io/plugins/connectivity.md) | Thinger.io | MIT | [thinger-io/plugins/sigfox](https://github.com/thinger-io/plugins/tree/main/sigfox) | ![Sigfox logo](https://docs.thinger.io/plugins/sigfox/assets/sigfox-logo.png) ![Sigfox diagram with Thinger.io integration](https://docs.thinger.io/plugins/sigfox/assets/sigfox-diagram.png) This plugin is an interface for using Sigfox HTTP Callback feature in an optimized way, providing features to easily integrate these devices with Thinger.io Platform, such as automatic device and storage provisioning and both uplink and downlink cloud processing. ## Plugin Features * Automatic device and bucket provisioning for every new device that is included in the same Sigfox "Device Type". * Store Sigfox device metadata: device location, signal quality, hardware serial, etc. * Store device data automatically in data buckets so it can be easily used from the console. * Custom **uplink data processing with NodeJS,** for both `payload_raw` or `payload_fields` . * Support for **defining custom downlink** **callbacks** in NodeJS, so it is possible to configure downlink data in an user-friendly format (JSON), and then convert it to `payload_raw` or `payload_fields`, as required by TTN network. ## Sigfox Concepts For a better understanding of the following sections, here is described some basic Sigfox concepts: * Device: It is a hardware device with an official Sigfox interface. * Gateway: It is Sigfox infrastructure hardware interface that basically receives messages from multiple edge devices and pushes them to Sigfox server over IP communication. These gateways are exclusively property of Sigfox company. * Uplink: It is a data flow which represents messages sent from a device to the sigfox cloud. There are two different uplink processes: unidirectional uplink (single data communication from the device to Sigfox network) and bidirectional uplink, that also allows to Sigfox system sending a Downlink to the device. * Downlink: It is a data flow which represents messages sent from the Sigfox cloud to a device. * Device Type: It is a concept that defines a group of devices of the same type, normally sending the same kind of data both in uplink and downlink). > **Info** > > Learn how to configure Sigfox Callback to send data to Thinger.io platform [**here**](https://docs.thinger.io/lpwan/sigfox#creating-sigfox-callback) ## Plugin Configuration In this section it is described the different interfaces that can be used to configure the Sigfox plugin. ### Applications Every Sigfox "Device Type" that is integrated over this plugin, should define a new profile in Thinger.io plugin, with the same identifier as defined in Sigfox Platform. Note that each Sigfox Device Type defined in this way will allow to customize the plugin behaviour for that kind of devices. ![Sigfox GUI application settings](https://docs.thinger.io/plugins/sigfox/assets/application-settings.png) It is possible to create as many Device Types profiles as required. To configure a new profile, just select the id from the Device Types dropdown, and then navigate to the other plugin sections. > **Warning** > > Always create the Device Type with the same identifier as defined in Sigfox cloud. ### Callback Config The uplink behaviour allows to configure how the plugin will react on new information received from Sigfox. ![Sigfox GUI callback configuration](https://docs.thinger.io/plugins/sigfox/assets/callback-configuration.png) The configurable parameters are the following: * **Auto provision resources:** Enable or disable automatic resource provisioning while receiving messages for non created devices of the same Sigfox "Device Type". * **Device connection timeout:** When creating a new device, establish the device connection timeout in minutes, so the platform can consider the device as disconnected after a fixed time without receiving a message. * **Device identifier prefix:** When creating a new device, create it with a custom prefix + the original device id. * **Bucket identifier prefix:** When creating a new data bucket associated to the device, create it with a custom prefix + the original device id. * **Update device location:** Use the location provided in the gateways information to update thee current device location. * **Initialize downlink data:** When creating a new device, initialize a custom downlink data, that can be modified and processed in further downlink requests. ### Payload Processing In this section it is possible to configure the payload processors that will transformate the raw data received from Sigfox payload in an uplink message, or the payload that is going to be sent in a downlink message fron Thinger.io Platform to Sigfox Clous The interface provides a code editor for NodeJS, where it is possible to define the `uplink` and `downlink`processors. It is also possible to test the code by providing a sample input data both for `uplink` and `downlink`. ![Sigfox GUI payload processing](https://docs.thinger.io/plugins/sigfox/assets/payload-processing.png) In the following, there is information about the uplink and downlink methods. #### Uplink The uplink method will be called when a device sends a new message through the network. Depending on the configuration done in the Sigfox network, this function can receive two different inputs: * **Base64 String**: If the Sigfox Device Type define a Custom payload format, this method will receive the raw payload encoded in base64. In this case, it will be necessary to write a function to transform this base64 data to a JSON object. * **JSON Object:**The output of this method must be always a JSON object containing the information that is necessary to be used by the platform. In the following, there is an uplink method that converts base64 data into a JSON object with `temperature` and `humidity` parsed from the binary data. ```javascript /* convert a base64 payload to a JSON object that can be used by Thinger.io */ module.exports.uplink = function(payload){ const buffer = Buffer.from(payload.data, 'hex'); payload.temperature = buffer.readInt16LE(0)/100.0; payload.humidity = buffer.readInt16LE(2)/100.0; return payload; }; ``` > **Info** > > The uplink method must always return a JSON object. #### Downlink The downlink method will be only called when the Sigfox device uplinks a bidirectional mesage to Sigfox Cloud. In this case, Thinger.io server will answer to the callback message that contains your custom Downlink payload in hexadecimal codification. Check out the next sections for more details. This function will receive different inputs depending on how the plugin is called over its REST API. * **JSON Object**: If the downlink call is done for a Thinger.io device that defines a `downlink` property (that is automatically initialized if `Initialize Downlink Data` is configured in the plugin), this method will receive the JSON content of this property. It usually consists on a user-friendly device configuration that should be later encoded to binary in base64. * **JSON Object**: If the plugin downlink request contains a JSON payload in the POST call, this function will receive this payload instead of the one configured in the device `downlink` property. The output of this method will be a **Base64 String** with the binary information that is going to be sent to Sigfox network. > **Warning** > > When working with Downlink processes the`Initialize Downlink Data`parameter must be initialized with any data otherwise the processing of the downlink payload will fail Example of a downlink method converting a JSON device configuration into base64 as required by Sigfox: ```javascript /* convert a JSON object with the device configuration in a base64 string expected by Sigfox Cloud */ module.exports.downlink = function(payload){ let bytes = []; bytes[0] = payload.enabled ? 1 : 0; bytes[1] = payload.frequency; bytes[2] = payload.threshold; return Buffer.from(bytes).toString('hex'); }; ``` > **Info** > > Use the interface tester to see if your code is correctly procesing the payloads. ## Sigfox Cloud Configuration After getting Thinger.io Plugin ready for receiving data, the next step is to configure the Sigfox Backend for pushing messages on it. This process has been simplified by the "Sigfox Integration" section of the plugin settings menu, that automatically builds the **HTTP query** and the **Authorization token** that needs to be included into Sigfox Callbacks Manager: ![Sigfox GUI webhook settings](https://docs.thinger.io/plugins/sigfox/assets/webhook-settings.png) Note that Sigfox Cloud provides three different API, depending on the kind of interaction that it's going to be created, Thinger.io Platform allows integrating with all of them: Uplink, Advanced Data and Downlink callback type. Each callback configuration can be created to work with a single device or over all the devices that belongs to the same Device Type. These are all the parameters that needs to be configured when creating a new callback: * Callback Type: to define the callback behaviour. * Custom Payload Config: (optional) to define how the device's message is going to be decoded. * Url Pattern: place here the autogenerated Thinger.io URL pattern * HTTP Method: POST for Uplink or GET for Downlink process. * Authorization Header: must contain the autogenerated authorization to provide Sigfox Cloud the permission to send data to Thinger.io. * Body: Configurable message payload with the specified content type. ### Basic Uplink Integration This callback configuration is the most common one, it just send devices data to Thinger.io in an unidirectional way to be stored, aggregate and show. ![Sigfox Cloud callbacks settings](https://docs.thinger.io/plugins/sigfox/assets/sigfox-cloud-callbacks.png) ### Uplink with computed location (Data Advanced) This callback configuration allows to retrieve additional information, such as geolocation, and infrastructure metadata like the computed over the different base stations which received the messages. However, working with this callback requires a delay of approximately 30s. ![Sigfox Cloud callbacks settings](https://docs.thinger.io/plugins/sigfox/assets/sigfox-cloud-callbacks_2.png) ### Uplink & Downlink Finally, selecting DATA/BIDIR Callback, it is possible to send uplink messages to configure Sigfox Cloud to send data to Thinger.io and waits for a downlink message that can be sent to the device in order to make any configuration or remote controlling processes. downlink payload processing ![Sigfox Cloud callbacks settings](https://docs.thinger.io/plugins/sigfox/assets/sigfox-cloud-callbacks_3.png) The configuration of the Downlink message payload can be made in Thinger.io Platform, using the Callback Config section of Sigfox Plugin or modifying each individual Downlink device property in the device dashboard: ![Sigfox GUI callbacks configuration downlink](https://docs.thinger.io/plugins/sigfox/assets/callback-configuration-downlink.png) > **Tip** > > It is mandatory to send the device in the callback payload. Other optional values are signal or location information extracted from Sigfox. ```json { "device" : "{device}", "snr" : {snr}, "rssi" : {rssi}, "station": "{station}", "latitude": {lat}, "longitude": {lng}, "temperature" : {customData#temp}, "humidity" : {customData#hum} } ``` ## Using platform features with Sigfox devices congratulations now you can retrieve data from all your Sigfox devices into Thinger.io platform and benefit from all its management, analysis and representation features to create amazing IoT projects in a very simple way. Here you have some basics about thinger.io capacities for Sigfox devices: ### Checking device status As these devices are not real-time connected to the platform, it is hard to know if everything is running well in the long term, specially in large devices networks. But thanks to the timeout feature that is configurable using the "device connection timeout" of the plugin callback configuration menu, it is possible to know if a device is sending data in proper time frame or if otherwise it has stopped working due to any problem by checking the "device status" that is available at its dashboard. ![Checking Sigfox device status and location with Thinger.io](https://docs.thinger.io/plugins/sigfox/assets/device-dashboard.png) It is also possible to check the status of a large amount of devices from the device list, but note that this page is not showing real-time data so it is necessary to refresh it to know the current status. ### Storing data in scalable buckets One of the most used features of Thigner.io is the data buckets, which allows storing thousands of data in a scalable and easy way. The integration with sigfox through this new plugin allows to store data after the payload has been processed instead of storing it in raw or constraint format. ![Storing Sigfox data in scalable Buckets](https://docs.thinger.io/plugins/sigfox/assets/sigfox-bucket.png) Once stored in a data bucket, it is possible to work with these data points by downloading them in CSV and creating widgets to show data in customizable dashboards that can be easily shared with colleagues or customers. ![Showing IoT data with Thinger.io Dashboards](https://docs.thinger.io/plugins/sigfox/assets/thinger-dashboard.png) ### Sending Data to Third Parties with Endpoints Thinger.io is part of a large ecosystem of technologies and platforms that enable you to get the most value from your data. That's why we have an Endpoint tool that allows you to forward data from any device to third party platforms and use other internet services to send emails, telegram messages, dump data on google spreadsheets, so almost any Internet service. ### Combine with other Plugins at thinger.io we continue to work to extend the platform's integration capabilities with technologies that can help create more advanced IoT projects in the easiest way. We have other plugins such as NodeRED that allow working with IoT data in almost unlimited ways, such as creating alerts on the data, geofencing, reporting, etc. ![Sigfox device callback endpoint](https://docs.thinger.io/plugins/sigfox/assets/device-callback.png) ## Plugin Development Details ### Uplink Data Flow In this section it is described how the uplink data flow works, from its source in the Sigfox network, to its final destination in Thinger.io. ![Sigfox uplink dataflow with Thinger.io integration](https://docs.thinger.io/plugins/sigfox/assets/uplink-dataflow.png) In the following subsections are described the elements shown in the figure. #### Sigfox Uplink Callback When Sigfox receives a message from any device, it automatically checks its configured integrations to forward them the information received. This plugin is integrated over HTTP, so, the Sigfox network will issue an HTTP request to the Thinger.io plugin on new messages. #### Sigfox Plugin Thinger.io plugin receives data from Sigfox network in a JSON format. The callback includes several fields of information, such as `app_id`, `dev_id`, `donwlink_url`, `metadata`, or the actual payload information sent by LoRa devices on `payload_fields` or `payload_raw` fields, depending on the Payload formats configured in the Sigfox application. Here is an example of the raw information received by the plugin: ```javascript { "temperature" : {customData#temp}, "humidity" : {customData#hum} "data" : {data} } ``` Once this information is received by the plugin, it is processed in order to execute the following actions in Thinger.io: 1. Auto provision new device and its associated data bucket if the device does not exists on the platform. It is based on the `dev_id` field. 2. Call device callback that will actually push processed data to its associated data bucket, but could do any other action like forwarding data to other endpoints. #### Uplink Processor This plugin allows to configure custom code for processing incoming data. The information sent by Sigfox devices is normally encoded in small binary payloads that cannot be directly used for representation, as they should not contain tags, JSON, ascii text, etc., in order to minimize transmission time. So, it is required to process the data sent by devices in some point of the cloud. This plugin also allows to create custom decoders if necessary. The advantage of using the Thinger.io payload processing (if necessary), is that it is using NodeJS runtime instead of plain Javascript, so it is possible to use NodeJS modules like Buffer, that simplifies the condig of the processing functions. Internaly, payload processors are precompiled after its configuration in the plugin, and executed with the payload data received from Sigfox. The output from this function (if it gets executed), is then transmitted to the next final step, which is the device callback. #### Device Callback The last step of this plugin is to call the device callback in Thinger.io. This plugin auto provision new Sigfox devices as HTTP devices. HTTP devices inside Thinger.io are generic devices that can push data over REST API methods. Thinger.io will be responsable of taking input data and perform different configurable actions with it, like change the device state to connected/disconnected; write provided data to a configured data bucket; send this information to other services over an endpoint; store the provided information as a device property; or return data from one of the device properties. In this case, the plugin interacts with the platform over such REST interface, pushing data received from Sigfox, and processed by the custom uplink method. By default, the plugin initializes an HTTP device to write to a data bucket that is also automatically created. So, every message sent by a Sigfox device, will write finally write to a specific data bucket. As shown in the following picture: ![Sigfox device callback settings in Thinger.io](https://docs.thinger.io/plugins/sigfox/assets/device-callback-settings.png) After the device callback is done, it will appear as a connected device, showing also its location if it was configured in the plugin options. ## Vendor Integrations ### Simple Hardware #### Downlinks [SimpleHw](https://simplehw.eu/) device settings are stored in downlink registers as values and changing these values will change the settings and also device behavior. Register values can be changed via downlink over the air and up to 4 register values can be changed with one downlink - 4 bytes are **register pointers** from 0x00 to 0xFF and 4 bytes are **register values** from 0x00 to 0xFF for a total of **8 bytes** (sigfox downlink limit). More details [here](https://simplehw.atlassian.net/wiki/spaces/DOC/pages/23396404/API+6+Downlink+Information#Chaining-multiple-downlink-payloads). So, it is possible to update up to 0xFF registers from any device, at any moment by using downlinks. However, updating more than 4 registers involves several downlink requests where different registers at downloaded at each time. With the Sigfox plugin extension it is possible to create the required flows to update any amount of registers by using the chaining feature from [SimpleHw](https://simplehw.eu/) devices. The following code is a template with a set of features to correctly work with [SimpleHw](https://simplehw.eu/) devices: * Downlink sequence processing to affect how the device behaves: If the received register bytes are ascending from left to right, the device will automatically request another downlink. * Acknowledgement from devices is processed to confirm that downlinks has been received correctly in the device. * Selective register downlink synchronization based on register changes and confirmed registers. ```javascript /// state object to handle per-device registers and its acks let state = {}; // confirm downlink is received on the device state function confirmDownlink(device){ if(!state.hasOwnProperty(device)) return; // get elements to ack let toAck = state[device].toAck; if(toAck===undefined) return; // initialize acks if not already defined if(state[device].ack===undefined) state[device].ack = {}; // update acknowledged for(let key in toAck){ state[device].ack[key] = toAck[key]; } // clear pending elements delete state[device].toAck; } // selects the registers that are required to send function getRegistersToSend(device, target){ if(!state.hasOwnProperty(device)) return target; let current = state[device].ack; if(!current) return target; let modified = {}; for (var key in target) { if(!current.hasOwnProperty(key)){ modified[key] = target[key]; }else if(current[key]!==target[key]){ modified[key] = target[key]; } } return modified; } // convert JSON device downlink data to register configuration function getRegistersConfig(payload){ // should return an object with register number & its value let example = { "2c" : 3, "aa" : 217, "3f" : 99, "0c" : 1 } return example; } // uplink method definition module.exports.uplink = function(payload, meta){ let deviceId = meta.device; // acks to downlink if(payload==="15"|| payload==="16"){ confirmDownlink(deviceId); // return undefined so nothing is stored in bucket return undefined; } // normal payload procesing here // ... return payload; }; // downlink method definition module.exports.downlink = function(payload, meta){ let deviceId = meta.device; // get device registers let deviceRegisters = getRegistersConfig(payload); let changedRegisters = getRegistersToSend(deviceId, deviceRegisters); // compute registers to send and its order let registers = Object.keys(changedRegisters); if(registers.length>4){ // ascending -> device will request more registers = registers.sort().slice(0,4); }else{ // desdencing -> no more downlinks registers = registers.sort().reverse(); } // init toAck state on device if(!state.hasOwnProperty(deviceId)) state[deviceId] = {}; state[deviceId].toAck = {}; // generate downlink output let bytes = [], written = 0; registers.forEach(function(v) { // write register number and its value bytes[written++] = parseInt(v, 16); bytes[written++] = changedRegisters[v]; // add register to pending ack state[deviceId].toAck[v] = changedRegisters[v]; }); // convert buffer to hex for sigfox processing return Buffer.from(bytes).toString('hex'); }; ``` ## Changelog #### [1.4.1] - 2024-01-23 ##### Fixed - Autoprovisioning not setting callback ##### Security - Updated axios to version 1.6.5 - Updated express to version 4.18.2 - Updated vm2 to version 3.9.19 #### [1.4.0] - 2023-07-10 ##### Added - Support for setting endpoint in autoprovisioned device callback ##### Security - Resolve all isues with dependencies with opened CVEs #### [1.3.0] - 2023-03-29 ##### Added - Support for setting Project on auto-provisioned devices & buckets - Changelog ##### Fixed - Ensure provided Sigfox device type is available instead of using default settings - Make sure Thinger server is running before starting service [1.4.1]: https://github.com/thinger-io/plugins/compare/sigfox/v1.4.0...sigfox/v1.4.1 [1.4.0]: https://github.com/thinger-io/plugins/compare/sigfox/v1.3.0...sigfox/v1.4.0 [1.3.0]: https://github.com/thinger-io/plugins/tree/sigfox/v1.3.0 --- Source: https://docs.thinger.io/plugins/ttn.md # The Things Stack > The Things Stack Integration | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 2.1.2 | [Connectivity](https://docs.thinger.io/plugins/connectivity.md) | Thinger.io | MIT | [thinger-io/plugins/ttn](https://github.com/thinger-io/plugins/tree/main/ttn) | ![The Things Network logo](https://docs.thinger.io/plugins/ttn/assets/ttn-logo.png) The Things Network (TTN) is an open, community‑driven LoRaWAN® network that simplifies the deployment of large‑scale IoT solutions across the globe. From Thinger.io we aim to provide TTN users with seamless integration tools for storing, analysing and visualising device data. This plugin brings TTN traffic into Thinger.io through the **Products** feature, enabling automatic provisioning of devices and data buckets, together with fully customisable uplink and downlink processing logic. > **Warning** > > Please note that implementations made with versions higher than 2.0.0 of this plugin are not compatible with previous implementations. ## Getting Started > **Prerequisite** > Devices within the selected TTN Application must be **homogeneous**—same type and model—so that autoprovision can assign the correct product template. 1. **Install the plugin** inside your Thinger.io account. See the guide **“How to install a plugin”** on the Marketplace if you are not familiar with the process. --- ## Plugin Configuration Open the plugin settings page. In the **Applications** table click **Add +** and fill in: | Field | Description | | ----- | ----------- | | **Application Name** | Must match **exactly** the Application ID defined in the TTN Console. The plugin uses this value to route outgoing requests to the correct TTN application. | | **Device ID Prefix** | Prefix used when generating the device identifier; the Device EUI is appended automatically. Required for autoprovision. | ![Add application modal in TTN Thinger.io Plugin](https://docs.thinger.io/plugins/ttn/assets/add_application.png) Keep this page open—you will need the **Webhook URL** and the **TTN TOKEN** generated by the plugin in the next step. --- ## TTN Webhook Configuration 1. Log in to the **TTN Console** and select the target **Application**. 2. Navigate to **Integrations → Webhooks** and click **Add Webhooks**. 3. Choose **Thinger.io Template** and complete the form with the values shown in your plugin: ![TTN Webhook Settings for Thinger.io integration](https://docs.thinger.io/plugins/ttn/assets/thinger_webhook.png) | Template Field | Value | |-----------|-----------------| | **Webhook ID** | `Your prefered webhook id` | | **Thinger.io instance** | `Your thinger.io instance domain e.g. acme.thinger.io or console.thinger.io` | | **Thinger.io user** | `Your thinger.io username` | | **Authoritation Header** | `Your thinger.io TTN API TOKEN` | | **Plugin Endpoint** | `Plugin endpoint (leave default value if using this plugin)` | > **Tip** > > You can find your **TTN API TOKEN** in the plugin settings page, under the **TTN API TOKEN** field, > just click the "copy" button and paste it into the **Authoritation Header** field in the TTN Console. ![TTN Webhook Settings for Thinger.io integration](https://docs.thinger.io/plugins/ttn/assets/ttn_api_token.png) After saving, uplink traffic will appear in the plugin **Logs** panel. At this point the devices may still be unrecognised; autoprovision occurs once a matching **Device Template** is installed or created. > Currently only **device uplinks** and **downlink confirmations** are handled. Gateway status messages are ignored. More details on Webhooks can be found in the [The Things Stack documentation](https://www.thethingsindustries.com/docs/integrations/webhooks/). --- ## Device Templates Device templates define: * The expected data structure for an specific thinger product * Uplink / downlink processing scripts * Default dashboards, device properties and data buckets ### Install a Device Template Search the Marketplace for a template that matches your device model. If none exists, you can [create your own template](https://docs.thinger.io/products). Notice that, in Thinger.io, a **Product** is a template that defines the structure and behaviour of a device and can also be installed as a plugin. > **Info: Important** > > Ensure the template **autoprovision prefix** matches the **Device ID Prefix** configured in the plugin. --- ## TTN Documentation For more information about The Things Network and The Things Stack, please refer to the [official documentation](https://www.thethingsindustries.com/docs/). --- ## Changelog #### [2.1.2] - 2025-11-27 ##### Add - Added support for enabling/disabling individual applications in the backend - Improved Inspector messages - Auto completion for application edition in the plugin configuration page ##### Fix - Fixed multiple application selection bug in the plugin configuration page - Fixed edition of existing plugin applications #### [2.1.1] - 2025-11-13 ##### Add - Changed visual style of plugin sections in order to improve readability - Significantly improved error handling and logging for uplink parsing issues #### [2.1.0] - 2025-11-12 ##### Add - Real Live Data Inspector for Thinger.io TTN Plugin - Improved Uplink Parser with support for custom payload formats ##### Fix - Fixed visual bug for small height screens in the plugin page. #### [2.0.2] - 2025-11-11 ##### Add - Added better error handling for malformed uplinks in Thinger.io standard parser #### [2.0.1] - 2025-11-10 ##### Fix - Fixed Bug in Thinger.io standard uplink parser #### [2.0.0] - 2025-08-11 ##### Fix - Fixed support for other LNS plugins by parsing uplinks to match thinger.io format #### [1.0.0] - 2025-06-30 ##### Added - Created a new version of ttn integration plugin [1.0.0]: https://github.com/thinger-io/plugins/ --- Source: https://docs.thinger.io/plugins/ttn-stack.md # The Things Stack (deprecated) > The Things Stack Integration > **Warning: Deprecated plugin** > > This plugin is no longer maintained. Use [The Things Stack](https://docs.thinger.io/plugins/ttn.md) instead. | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.2.1 | [Connectivity](https://docs.thinger.io/plugins/connectivity.md) | Thinger.io | MIT | [thinger-io/plugins/ttn-stack](https://github.com/thinger-io/plugins/tree/main/ttn-stack) | ![TTS diagrams and integration with Thinger.io](https://docs.thinger.io/plugins/ttn-stack/assets/tts-diagram.png) The Things Network is a LoRaWAN Network solution that simplifies the deployment of large IoT applications over a collaborative Internet of Things network that spans many countries around the world. From thinger.io we wanted to offer an improved integration to The Things Stack users by providing easy-to-configure tools for storing, analyzing, and showing device data in a simple way. This plugin allows retrieving The Things Stack webhook messages to enhance the integration with some interesting features such as: * Uplink data payload processing * Downlink data payload processing * Automatic device and data buckets provisioning ## Plugin Features - [x] Automatic device and bucket provisioning for new devices is included in The Things Stack application. It is no required additional configuration to start working with The Things Stack data inside Thinger.io. - [x] Store device metadata based on The Things Stack information, like device location, signal quality, hardware serial, etc. - [x] Store device data automatically in data buckets so it can be easily used from the console. - [x] Provide support for defining custom uplink callbacks on Node.js to process `payload_raw` or `payload_fields` provided by The Things Stack Integration. - [x] Provide support for defining custom downlink callbacks on Node.js, so it is possible to configure downlink data in a user-friendly format (JSON), and then convert it to `payload_raw` or `payload_fields`, as required by The Things Stack network. ## The Things Stack Concepts For a better understanding of the following sections, here is described some basic The Things Stack concepts: * **Device**: It is a hardware device with a LoRa interface. * **Gateway**: It is a hardware device with both LoRa and Internet connectivity. It basically receives LoRa messages from multiple devices and pushes them to The Things Stack network over the Internet. * **Uplink**: It is a data flow that represents messages sent from a device to The Things Stack network * **Downlink**: It is a data flow that represents messages sent from The Things Stack network to a device. * **Application**: It is a concept that defines a group of devices of the same type, normally sending the same kind of data both in uplink and downlink). * **Integration**: It is a way of pushing device data outside The Things Stack network, i.e., sending messages to other platforms like Thinger.io. ## Plugin Configuration This section describes the different interfaces that can be used to configure The Things Stack plugin. ### Integrating The Things Stack Applications The first step to perform the integration is to create a new plugin configuration. It is possible to create multiple configuration profiles with custom behavior for each application deployed in The Things Stack. To create a new application profile, just type the application ID and press the green Add Application button. Note that the ID must be exactly the same identifier defined in The Things Stack application. ![TTS plugin web ui application configuration](https://docs.thinger.io/plugins/ttn-stack/assets/application-configuration.png) The `Application Id` dropdown allows to select and configure a particular application profile, but if the "default" profile is selected, the configuration will be applied to all the applications integrated with the plugin. > **Warning** > > Always create applications with the same application identifier as defined in The Things Stack. ### Uplink Settings ![TTS plugin web ui uplink settings](https://docs.thinger.io/plugins/ttn-stack/assets/uplink-settings.png) As shown in the image above, the parameters can be used to configure the plugin's behavior: * **Auto provision resources:** Enable or disable automatic resource provisioning while receiving messages for non-created devices. * **Device Connection Timeout:** When creating a new device, establish the device connection timeout in minutes, so the platform can consider the device as disconnected after a fixed time without receiving a message. * **Device Identifier Prefix:** When creating a new device, create it with a custom prefix + the original device id. * **Bucket Identifier Prefix:** When creating a new data bucket associated to the device, create it with a custom prefix + the original device id. * **Assign Asset Type:** Associate the auto-provisioned device and bucket with a given Asset Type. * **Assign Asset Group:** Associate the auto-provisioned device and bucket with a given Asset Group. * **Update device location:** Use the location provided in the gateways information to update de current device location. * **Initialize Downlink Data:** When creating a new device, initialize a custom downlink data, that can be modified and processed in further downlink requests. ### Downlink Settings The Things Stack Downlink processes can be configured from Thinger.io in order to select the behavior in some parameters as shown below: ![tts plugin web ui downlink settings](https://docs.thinger.io/plugins/ttn-stack/assets/downlink-settings.png) * **Confirmed Downlink:** Set to enabled if downlink messages must be confirmed by the device. * **Push To Downlink Queue:** Enable to push downlink messages instead of replace previous ones. * **Downlink Priority:** Specify the downlink priority. ### Payload Processing This tab is used to configure the payload data treatment in order to transform from binary payload received from The Things Stack webhook into user-friendly variables and the Downlink JSON into a binary buffer that will be transmitted to The Things Stack. The interface provides a code editor for Node.js scripts, where it is possible to define the codification / decodification processes and also provides a testing tool that allows to verify the behavior of both `uplink` and `downlink` processes. ![tts plugin web ui payload processing](https://docs.thinger.io/plugins/ttn-stack/assets/payload-processing.png) The following sections provide additional information about how to configure the uplink and downlink methods. #### Uplink The uplink method will be called after a gateway sends a new message over The Things Stack network. Depending on the configuration done in The Things Stackapplication, this function will receive different inputs: * **Base64 String**: If The Things Stack application defines `Custom Javascript Formatter` for the payload but does not provide a decoder function, this method will receive the raw payload encoded in base64. In this case, it will be necessary to write a function to transform this base64 data to a JSON object. * **JSON Object from Cayene LPP**: If The Things Stack application defines a `Cayene LPP` payload formatter, The Things Stack will automatically convert the binary data to a JSON object that can be used directly by the platform. In this case, it is not necessary to define a custom uplink method unless you want to do some extra processing like incorporating calculated fields. * **JSON Object from Custom Decoder:** If The Things Stack application defines `Custom Javascript Formatter`for the payload and provides a decoder function, this function will receive the output from The Things Stack function. In this case, creating a custom uplink method will be redundant, so create the function in The Things Stack, or in the plugin. The output of this method must be always a JSON object containing the information that is necessary to be used by the platform. In the following, there is an uplink method that converts base64 data into a JSON object with `temperature` and `humidity` parsed from the binary data. ```javascript /* convert a base64 payload to a JSON object that can be used by Thinger.io */ module.exports.uplink = function(payload){ const buffer = Buffer.from(payload, 'base64'); let processed = {}; processed.temperature = buffer.readInt16LE(0)/100.0; processed.humidity = buffer.readInt16LE(2)/100.0; return processed; }; ``` > **Info** > > The uplink method must always return a JSON object. #### Downlink The downlink method will be called before the plugin issues a downlink request to The Things Stack. To issue a downlink request to The Things Stack, this plugin must receive an HTTP POST call, indicating the Thinger.io device identifier, and it will automatically issue the request to the required The Things Stack endpoint and its specific protocol. Check out the next sections for more details. This function will receive different inputs depending on how the plugin is called over its REST API. * **JSON Object**: If the downlink call is done for a Thinger.io device that defines a `downlink` property (that is automatically initialized if `Initialize Downlink Data` is configured in the plugin), this method will receive the JSON content of this property. It usually consists on a user-friendly device configuration that should be later encoded to binary in base64. * **JSON Object**: If the plugin downlink request contains a JSON payload in the POST call, this function will receive this payload instead of the one configured in the device `downlink` property. The output of this method should be one of the following: * **Base64 String**: With binary information that can be sent directly to The Things Stack network. It is required if your The Things Stack application is not defining a converter. * **JSON Object**: Either if The Things Stack application provides a converter for your payloads, this method can return a JSON object that will be accesible in the converter method. In this case, creating a custom downlink method will be redundant, so create the funtion in The Things Stack, or in the plugin. Or, if the f_port needs to be customized, the dedicated `f_port` to use for the downlink may be specified by having the input message be `{ "f_port": 1, "payload": " **Info** > > The downlink method should return a base64 string if The Things Stack application does not define a converter. ## The Things Stack Console Configuration ### Uplink Configuration The last tab of the plugin configuration interface is called "Webhook settings", it has been created to help the developers to complete the integration in The Things Stack Console, by providing all the information required to set up the webhook profile. ![tts plugin web ui webhook settings](https://docs.thinger.io/plugins/ttn-stack/assets/webhook-settings.png) > **Info** > > Note that the REST API does not define the application ID, this parameter will be checked by the plugin software to manage the payload according to the configuration. To create a new webhook integration follow the next steps in The Things Stack web console: 1. Select the Application to be integrated. 2. In the main menu open the "Integrations" section and click the "Webhooks" option. The webhooks list will be shown. ![tts plugin web ui webhook settings](https://docs.thinger.io/plugins/ttn-stack/assets/webhook-integration.png) 3\. Clicking the `+Add webhook` blue button in the right top corner of the interface allows choosing between different webhooks integration templates. Select Thinger.io template. Then, configure the webhook only requires filling the form with the information provided by Thinger.io "webhook settings" tab and selecting JSON webhook format. ![the Things Stack webhook template for Thinger.io](https://docs.thinger.io/plugins/ttn-stack/assets/webhook-integration-settings.png) > **Info** > > Note that the Authorization header must be set up using the access token including the "Bearer" command ### Downlink Configuration As part of the webhook template, the Download API key is automatically created, so no further configuration is required. ## Executing Downlink Processes Thinger.io's The Things Stack plugin has been prepared to automatically manage to send downlink messages to The Things Stack server, this system takes the data from the device downlink property, autogenerated during device provisioning, and inserts it as a response to the next HTTP request from the system. In this way, we can create device configuration and control processes just by modifying the value of this property by means of a Dashboard widget, Node-RED, or direct API integration. To create a new downlink process make sure to follow the next steps: 1. [Configure the plugin's downlink settings at Thinger.io](#downlink-settings) 2. Write a codification script if required using the plugin's "downlink payload processing" 3. Modify the value of the property to launch the execution of the downlink process After this, the plugin will execute the payload processing and send it in response of the next The Things Stack API request to your server. It is possible to follow the trace of this communication by accessing the plugin's log and going to `Plugins>Plugin profile>Logs`. ## Monitor Your Data There are multiple ways to view the data sent by the device in [Thinger.io](https://thinger.io/). As long as the uplink messages are being sent by The Things Stack, the raw data will be available in the [Thinger.io](https://thinger.io/) **Data Bucket** configured or auto-provisioned by the [The Things Stack Plugin](https://docs.thinger.io/plugins/ttn-stack.md), without any further configuration. ![Thinger.io data bucket showing raw data sent by The Things Stack device](https://docs.thinger.io/plugins/ttn-stack/assets/data_bucket.png) Nevertheless, it is recommended to create a [Dashboard](https://docs.thinger.io/features/dashboards) in [Thinger.io](https://thinger.io/) to be able to view the data in a more comprehensive way. ![Thinger.io dashobard showing data form The Things Stack device](https://docs.thinger.io/plugins/ttn-stack/assets/data-dashboard.png) ## Changelog #### [1.2.1] - 2024-03-22 ##### Fixed - Auto provision bucket is set true as default - Assign project to provisioned failing device provisioning #### [1.2.0] - 2024-03-08 ##### Added - Support for autoprovision device and bucket separately - Support for configuring a preexisting bucket for device write callback ##### Security - Updated axios to version 1.6.7 - Updated express to version 4.18.2 - Updated vm2 to version 3.9.19 #### [1.1.0] - 2024-02-06 ##### Added - Support for setting Project and Product on auto-provisioned devices & buckets - f\_port of downlink may be configured by sending it in the downlink body #### [1.0.4] - 2023-02-21 ##### Fixed - Ensure provided device type is available instead of using default settings #### [1.0.3] - 2023-02-20 ##### Fixed - Make sure Thinger server is running before starting service [1.2.1]: https://github.com/thinger-io/plugins/compare/ttn-stack/v1.2.0...ttn-stack/v1.2.1 [1.2.0]: https://github.com/thinger-io/plugins/compare/ttn-stack/v1.1.0...ttn-stack/v1.2.0 [1.1.0]: https://github.com/thinger-io/plugins/compare/ttn-stack/v1.0.4...ttn-stack/v1.1.0 [1.0.4]: https://github.com/thinger-io/plugins/compare/ttn-stack/v1.0.3...ttn-stack/v1.0.4 [1.0.3]: https://github.com/thinger-io/plugins/tree/ttn-stack/v1.0.3 --- Source: https://docs.thinger.io/plugins/monitoring.md # Monitoring > Plugins for metrics, time series and alerting tools that run next to your Thinger.io account. Plugins for metrics, time series and alerting tools that run next to your Thinger.io account. | Icon | Plugin | Description | | --- | --- | --- | | ![Alertmanager](https://docs.thinger.io/plugins/icons/alertmanager.svg) | [Alertmanager](https://docs.thinger.io/plugins/alertmanager.md) | Integration of Alertmanager with Thinger.io | | ![Grafana](https://docs.thinger.io/plugins/icons/grafana.svg) | [Grafana](https://docs.thinger.io/plugins/grafana.md) **Deprecated** | Grafana integration for Thinger.io | | ![InfluxDB2](https://docs.thinger.io/plugins/icons/influxdb2.svg) | [InfluxDB2](https://docs.thinger.io/plugins/influxdb2.md) **Deprecated** | InfluxDB2 Plugin | | ![Prometheus](https://docs.thinger.io/plugins/icons/prometheus.svg) | [Prometheus](https://docs.thinger.io/plugins/prometheus.md) | Integration of Prometheus with Thinger.io | | ![Prometheus Exporter](https://docs.thinger.io/plugins/icons/prometheus-exporter.svg) | [Prometheus Exporter](https://docs.thinger.io/plugins/prometheus-exporter.md) | Export Thinger's resource status in a Prometheus format | --- Source: https://docs.thinger.io/plugins/alertmanager.md # Alertmanager > Integration of Alertmanager with Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 0.26.0-1 | [Monitoring](https://docs.thinger.io/plugins/monitoring.md) | Thinger.io | MIT | [thinger-io/plugins/alertmanager](https://github.com/thinger-io/plugins/tree/main/alertmanager) | ![Prometheus logo](https://docs.thinger.io/plugins/alertmanager/assets/prometheus-logo.svg) The Alertmanager handles alerts sent by clients applications such as Prometheus server. More information in their [official documentation](https://prometheus.io/docs/alerting/latest/alertmanager/). ## Get Started This plugins requires the existence of the [Prometheus plugin](https://docs.thinger.io/plugins/prometheus.md), as it will create a new file storage called 'Prometheus Settings'. This file storage contains a template of the configuration in order to scrape the [Prometheus Exporter Plugin](https://docs.thinger.io/plugins/prometheus-exporter.md) endpoint. The installation of the Alertmanager plugin will add the `alertmanager.yml` configuration file as well as an example alert rule for Prometheus. In order for the connection to take place, edit the `prometheus.yml` file by introducing your details and selecting your desired configuration. ![Prometheus alerts showcasing and alert over a metric devices disconnected greater than 5](https://docs.thinger.io/plugins/alertmanager/assets/prometheus-alerts.png) ![Alertmanager dashboard showcasing and alert over a metric devices disconnected greater than 5](https://docs.thinger.io/plugins/alertmanager/assets/alertmanager.png) ## Official Documentation The Prometheus documentation offers extensive information on how to configure the alertmanger in case you require further details on what is provided by default. You can find how to configure Alermanager at [this link](https://prometheus.io/docs/alerting/latest/configuration/) and how to create alerting rules [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/). More details regarding the configuration of Prometheus at [this link](https://prometheus.io/docs/prometheus/latest/configuration/configuration/). > **Info** > > Any configuration change in `prometheus.yml` or `rules.yml` requires a > restart of the Prometheus plugin, and any change to `alertmanager.yml` > requires a restart of the Alertmanager plugin. ## Changelog #### 0.26.0-1 - 2023-08-30 ##### Added - Create and upload Alertmanager plugin --- Source: https://docs.thinger.io/plugins/grafana.md # Grafana (deprecated) > Grafana integration for Thinger.io > **Warning: Deprecated plugin** > > This plugin requires InfluxDB as backend which is no longer available in new instances. | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 11.3.0-1 | [Monitoring](https://docs.thinger.io/plugins/monitoring.md) | Thinger.io | MIT | [thinger-io/plugins/grafana](https://github.com/thinger-io/plugins/tree/main/grafana) | ![Grafana logo](https://docs.thinger.io/plugins/grafana/assets/grafana-logo.svg) Grafana is a powerful and versatile open-source platform designed to streamline the monitoring and observability of your metrics, regardless of their storage location. With Grafana, you can effortlessly query, visualize, set up alerts, and gain deep insights into your data, fostering a data-driven culture within your team. ![Grafana dashboard inside thinger.io](https://docs.thinger.io/plugins/grafana/assets/dashboard.png) ## Key Features ### 1. Visualize Your Metrics with Ease Grafana offers a blazing-fast and flexible client-side graphing capability with a myriad of customization options. The platform also supports a wide range of panel plugins, providing you with numerous ways to visualize metrics and logs exactly as you need them. ### 2. Dynamic and Reusable Dashboards Create dynamic and reusable dashboards using template variables, which appear as convenient dropdowns at the top of the dashboard. This allows you to easily manipulate and interact with your data, enhancing your dashboard's usability and adaptability. ### 3. Explore Your Data Effortlessly Grafana empowers you to explore your data through ad-hoc queries and dynamic drilldowns. Compare different time ranges, queries, and data sources side by side, gaining valuable insights and trends from your data with ease. ### 4. Seamless Transition from Metrics to Logs Experience the seamless magic of switching between metrics and logs, with preserved label filters. Whether you need to search through all your logs or stream them live, Grafana has you covered, providing a unified monitoring experience. ### 5. Powerful Alerting Mechanism Stay on top of your most critical metrics by visually defining alert rules. Grafana continuously evaluates these rules and ensures timely notifications to systems like Slack, PagerDuty, VictorOps, and OpsGenie. ### 6. Mix and Match Data Sources With Grafana, you can effortlessly mix different data sources within the same graph. This includes support for custom data sources, allowing you to tailor your monitoring setup according to your specific needs. ## About thinger.io and Grafana Integration ![Diagram showing thinger.io and Grafana integration](https://docs.thinger.io/plugins/grafana/assets/integration.png) The integration of thinger.io with Grafana introduces an immensely valuable toolset for thinger.io users, enabling them to elevate their dashboards to a professional level, conduct intricate analytics in a scalable manner, and embark on collaborative visualization projects with fellow developers on their team. This seamless integration leverages the strengths of each component to create a powerful infrastructure, where thinger.io serves as a centralized hub for device administration and management. Here's how the integration works: First, data from devices is efficiently stored using a time series data store. thinger.io acts as a facilitator, managing and organizing this data behind the scenes. Then, Grafana takes center stage, extracting the time series data and transforming it into visually compelling representations. The result is a highly effective and user-friendly monitoring and observability solution. With this integration, users gain the ability to harness the full potential of both thinger.io and Grafana, unlocking new possibilities for data exploration, analysis, and visualization. Whether you need to fine-tune your IoT projects or collaborate with your team to drive data-driven decisions, this integration empowers you to do so with unparalleled efficiency and ease. Begin your journey with the thinger.io and Grafana integration today and experience the true power of data-driven insights and control. Empower your projects, elevate your dashboards, and unleash the full potential of your IoT infrastructure. Unsure if Grafana is for you? Watch Grafana in action on [play.grafana.org](https://play.grafana.org/)! [Starting with Grafana Plugin](https://docs.thinger.io/plugins/grafana/get-started.md) ## Official Documentation The Grafana documentation is available at [grafana.com/docs](https://grafana.com/docs/grafana/latest/getting-started/). ## Changelog #### 11.3.0-1 - 2023-11-11 - Bumped Grafana version to 11.3.0 #### 9.3.11-1 - 2023-04-12 - Bumped Grafana version to 9.3.11 #### 8.5.4-1 - 2022-06-21 - Bumped Grafana version to 8.5.4 - Added configuration for InfluxDB2-Flux backend - Added default configuration for InfluxDB2-InfluxQL backend #### 8.3.4 - 2022-05-17 - Bumped Grafana version to 8.3.4 #### 8.0.6 - 2021-07-15 - Updated Grafana version to 8.0.6. - Fixed 404 not found problems with old Grafana install #### 7.0.6 - 2020-07-13 - Initial Grafana plugin --- Source: https://docs.thinger.io/plugins/grafana/get-started.md # Getting Started with Grafana Plugin > Getting Started with Grafana Plugin. Part of the documentation of the Grafana plugin. After completing the standard plugin deployment process ([as explained here](https://docs.thinger.io/plugins/management.md)), the Grafana plugin requires a few additional steps to work seamlessly with thinger.io devices' data. In the following sections, we'll guide you through the login process and how to configure the plugin effectively. First Login ## First Login > **Info** > > Perform initial login using your thinger.io account username and password 'admin' Upon installing the plugin, perform the initial login using your thinger.io account username and the password `admin`. After the first login, the system will prompt you to change the password to a custom one. Once done, you'll gain access to the Grafana workspace, offering a variety of options. ![Grafana login prompt](https://docs.thinger.io/plugins/grafana/assets/login.png) ## Adding a Datasource The connection between Thinger.io data and the Grafana plugin is established by adding the buckets database as a `new data source` for Grafana. By default, the configuration for the database is set up with names InfluxDB2-Flux and InfluxDB2-InfluxQL, requiring no further action. > **Info** > > For better performance, it is recommended to use the InfluxQL backend unless you require specific features available only with Flux. ![Grafana backends configuration](https://docs.thinger.io/plugins/grafana/assets/influxdb-datasource.png) However, if needed, you can configure additional data sources. For more information, check [this link](https://grafana.com/docs/grafana/latest/datasources/). --- Source: https://docs.thinger.io/plugins/grafana/working-with-grafana.md # Working with Grafana > Working with Grafana. Part of the documentation of the Grafana plugin. ## Creating a New Dashboard Once the data source is set up, the most common way to work with Grafana is by creating a new dashboard for data representation. Click on the "+" button in the Grafana main menu and select "New Dashboard". This opens an empty dashboard ready to be configured with custom layout and representation panels. Click on "+Add new panel" to open the panel configuration context, organized in two sections: * **Panel Configuration**: Choose the type of graph to be used, such as time series charts, and explore various options for legends, axes, and more. ![Grafana panel configuration](https://docs.thinger.io/plugins/grafana/assets/panel_configuration.png) * **Data Configuration in InfluxQL**: Select the data source (InfluxDB2-InfluxQL in our example), a data bucket profile from Thinger.io, and specific variables for the panel. ![Data Configuration in influxQL](https://docs.thinger.io/plugins/grafana/assets/data_configuration_influxql.png) * **Data Configuration in Flux**: Select the data source (InfluxDB2-Flux in our example) and write the desired data using [Flux syntax](https://docs.influxdata.com/influxdb/v2.6/query-data/get-started/) ![Data Configuration in Flux](https://docs.thinger.io/plugins/grafana/assets/data_configuration_flux.png) * **Transform data**: Filter or aggregate device data using different tools before displaying it in the panel. * **Automatic Alerts**: Configure the graph to generate real-time alerts based on evaluated variables. ## Adding New Widget Types Grafana is highly flexible, allowing users to add new panels and retrieve them from different repositories. These panels are developed by the Grafana team and community contributors, enabling rapid growth. To add new elements in the Thinger.io Grafana Plugin, use the command console of the local Docker container where Grafana is running. Execute the appropriate CLI installation command obtained from the [official Grafana plugin repository](https://grafana.com/grafana/plugins). ## Share Grafana Projects Publicly Grafana can be configured to create collaborative working groups for sharing resources with read-only or editing privileges. This feature is valuable for creating visualization interfaces for customers. To implement this: 1. Go to the "Permissions" section of the dashboard you want to share and click the blue "Add permission" button. 2. Select the user or team with whom you want to share the dashboard. 3. Choose the desired privileges to grant. ![Grafana dashboard permissions](https://docs.thinger.io/plugins/grafana/assets/permissions.png) However, when Grafana is running as a Thinger.io plugin, it is neccesary to give public access to the plugin as explained in the sercion "Giving Public Access" at the [managing plugins page](https://docs.thinger.io/plugins/management.md) --- Source: https://docs.thinger.io/plugins/influxdb2.md # InfluxDB2 (deprecated) > InfluxDB2 Plugin > **Warning: Deprecated plugin** > > InfluxDB is no longer the default time series database. This plugin may not work with your instance. | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.0 | [Monitoring](https://docs.thinger.io/plugins/monitoring.md) | Thinger.io | MIT | [thinger-io/plugins/influxdb2](https://github.com/thinger-io/plugins/tree/main/influxdb2) | ![InfluxDB logo](https://docs.thinger.io/plugins/influxdb2/assets/influxdb.svg) InfluxDB is an open source time series platform. This includes APIs for storing and querying data, processing it in the background for ETL or monitoring and alerting purposes, user dashboards, and visualizing and exploring the data and more. InfluxDB is the default database backend for Thinger.io. This plugin allows direct access to the underlying installation and the user buckets for custom queries, dashboards, or alerts. ![Influxdb login page integrated in Thinger.io Platform](https://docs.thinger.io/plugins/influxdb2/assets/login_page.jpeg) ## Requirements - This plugin requires an instance with support for creating Proxies. Check your host admin in case of doubt. - Proxies can be only initialized by admins. If a regular tenant (developer role) requires this plugin, please, ensure the admin also has this plugin installed to enable the required proxy. ## Resources initialization This plugin initializes the following resources - TCP Proxy from 8087 (secure) to localhost at 8086. ## Get Started After the plugin is installed, click on the InfluxDB2 plugin and access the interface with you regular Thinger.io username and password. Note: If the username and password does not work, please, change your Thinger.io password account. ## Changelog #### 1.0.0 - 2022-06-28 - Initial InfluxDB2 plugin --- Source: https://docs.thinger.io/plugins/prometheus.md # Prometheus > Integration of Prometheus with Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 2.46.0-1 | [Monitoring](https://docs.thinger.io/plugins/monitoring.md) | Thinger.io | MIT | [thinger-io/plugins/prometheus](https://github.com/thinger-io/plugins/tree/main/prometheus) | ![Prometheus logo](https://docs.thinger.io/plugins/prometheus/assets/prometheus-logo.svg) Prometheus is an open-source monitoring system and time series database that allows you to collect and store metrics about your infrastructure and applications, and provides a powerful query language called PromQL that you can use to analyze and graph these metrics. Prometheus also provides a range of other features, including alerting, graphing, and visualization. One of the key features of Prometheus is its ability to scrape data from targets using a simple HTTP-based protocol. This means that you can easily configure Prometheus to monitor your infrastructure, in this case Thinger.io. By utilizing both the [Prometheus Exporter Plugin](https://marketplace.thinger.io/plugins/prometheus_exporter/) and the Prometheus Server Plugin, you gain the ability to assess the status of Thinger.io and its resources through database queries. Moreover, this integration extends its functionality to enable monitoring of external systems. ## Get Started When installing the Prometheus Plugin, a new file storage is created called 'Prometheus Settings'. This file storage contains a template of the configuration in order to scrape the [Prometheus Exporter Plugin](https://docs.thinger.io/plugins/prometheus-exporter.md) endpoint. In order for the connection to take place, edit the file by introducing your details and restart the plugin. This file can also be used to configure external systems scraping. > **Info** > > Check out also the [Alertmanager plugin](https://docs.thinger.io/plugins/alertmanager.md) ![Prometheus integration showing a query over devices_total in Thinger.io](https://docs.thinger.io/plugins/prometheus/assets/query.png) ## Integration with Grafana Grafana provides native support for Prometheus, therefore, we can configure a connection between the two plugins. > **Info** > > Refer to the [Grafana plugin page](https://docs.thinger.io/plugins/grafana.md) if you need more details on how to get started Once grafana in installed and logged in, you may go to 'Settings'->'Data sources'. Click on `Add data source` and click on 'Prometheus'. The data to configure the Prometheus as data source you'll need: - URL: http://<thinger\_user>-prometheus:9090/users/<thinger\_user>/plugins/prometheus And thats it, you may start now creating dashboard in grafana with prometheus as the backend. ![Prometheus integration showing a devices_total dashboard in Grafana](https://docs.thinger.io/plugins/prometheus/assets/grafana-dashboard.png) ## Official Documentation The Prometheus documentation is available at [prometheus.io/docs](https://prometheus.io/docs/introduction/overview/). More details regarding the configuration of Prometheus at [this link](https://prometheus.io/docs/prometheus/latest/configuration/configuration/). > **Info** > > Any configuration change in `prometheus.yml` requires a restart of the Prometheus plugin. ## Changelog #### 2.46.0-1 - 2023-08-31 - Create and upload Prometheus plugin --- Source: https://docs.thinger.io/plugins/prometheus-exporter.md # Prometheus Exporter > Export Thinger's resource status in a Prometheus format | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.2.1 | [Monitoring](https://docs.thinger.io/plugins/monitoring.md) | Thinger.io | MIT | [thinger-io/plugins/prometheus-exporter](https://github.com/thinger-io/plugins/tree/main/prometheus-exporter) | ![Prometheus logo](https://docs.thinger.io/plugins/prometheus-exporter/assets/prometheus-logo.svg) The Thinger.io Prometheus Exporter plugin is designed to facilitate the monitoring of your Thinger.io resources. It allows you to expose metrics in Prometheus formats through a dedicated endpoint. This exporter provides you with the flexibility to define and configure metrics according to your requirements. It supports dynamic value extraction from three available backends: - Thinger.io Database - Data Buckets (Coming soon) - Thinger.io API (Coming soon) ## Getting Started To start out with this plugin, the Default application might be used or a new one created, by selecting `New Application...` in the dropdown. To create a metric, click on the `+Add` button in the right top corner of the metrics table, where a modal form will open. Here you can find an example for a metric that tracks the total of devices with their status: - Name: devices\_total - Help string: number of devices - Labels: status **Script** - Type: Gauge - Backend: Thinger.io Database - Source: ```js const connected = db.collection('devices').countDocuments({ "enabled": true, "connection.active": { "$eq": true }}); const disconnected = db.collection('devices').countDocuments({ "enabled": true, "connection.active": { "$eq": false }}); const disabled = db.collection('devices').countDocuments({ "enabled": false}); const values = await Promise.all([connected, disconnected, disabled]); metric.set({ status: 'connected'}, values[0]); metric.set({ status: 'disconnected'}, values[1]); metric.set({ status: 'disabled'}, values[2]); ``` Each metric can be tested out individually, and once validated and saved, the full application endpoint can be queried, through the `Endpoint Settings` tab, where all needed configuration to create a Prometheus scrape job can be found. ![](https://docs.thinger.io/plugins/prometheus-exporter/assets/prometheus-exporter.png) For each application there are some settings that can be configured: - **Cache**: Enable and set a timeout cache for the metrics endpoint. - **Asynchronous Queries**: Enable or disable the Asynchronous queries for the metrics. - **Enable**: Enable or disable the metrics endpoint for the application. ![](https://docs.thinger.io/plugins/prometheus-exporter/assets/settings.png) ## Additional Resources Given that the plugin is based and developed with Prometheus in mind, you may refer to [Prometheus official documentation](https://prometheus.io/docs/introduction/overview/), and more specifically to the [Data Model](https://prometheus.io/docs/concepts/data_model/). Metrics are configured using the unofficial Prometheus client for Node.js, coded through the gui of the plugin. Also, the [Prometheus Server Plugin](https://docs.thinger.io/plugins/prometheus.md) is available within Thinger.io. ## Changelog #### [1.2.1] - 2024-05-28 ##### Fixed - Asynchronous settings not saving in already created applications #### [1.2.0] - 2024-05-27 ##### Added - Added cache for metrics endpoints - Added retrieval of metrics sequentially or in parallel #### [1.1.1] - 2024-04-02 ##### Fixed - Frontend failing with new Thinger.io console version >6.0.0 ##### Removed - Influxdb dependencies #### [1.1.0] - 2023-06-20 ##### Added - Logging added for each endpoint and individual query with timestamp and performance #### [1.0.0] - 2023-04-04 - First version of plugin with access to Thinger.io Database [1.2.1]: https://github.com/thinger-io/plugins/compare/prometheus-exporter/v1.2.0...prometheus-exporter/v1.2.1 [1.2.0]: https://github.com/thinger-io/plugins/compare/prometheus-exporter/v1.1.1...prometheus-exporter/v1.2.0 [1.1.1]: https://github.com/thinger-io/plugins/compare/prometheus-exporter/v1.1.0...prometheus-exporter/v1.1.1 [1.1.0]: https://github.com/thinger-io/plugins/compare/prometheus-exporter/v1.0.0...prometheus-exporter/v1.1.0 [1.0.0]: https://github.com/thinger-io/plugins/tree/prometheus-exporter/v1.0.0 --- Source: https://docs.thinger.io/plugins/development.md # Development > Plugins with development environments and low-code tools that work with your Thinger.io data. Plugins with development environments and low-code tools that work with your Thinger.io data. | Icon | Plugin | Description | | --- | --- | --- | | ![Jupyter Minimal](https://docs.thinger.io/plugins/icons/jupyter-minimal.svg) | [Jupyter Minimal](https://docs.thinger.io/plugins/jupyter-minimal.md) | Jupyter Notebook Minimal | | ![Jupyter R](https://docs.thinger.io/plugins/icons/jupyter-r.svg) | [Jupyter R](https://docs.thinger.io/plugins/jupyter-r.md) | Jupyter Plugin for Thinger.io | | ![Jupyter TensorFlow](https://docs.thinger.io/plugins/icons/jupyter-tensorflow.svg) | [Jupyter TensorFlow](https://docs.thinger.io/plugins/jupyter-tensorflow.md) | Jupyter Plugin for Thinger.io | | ![Node-RED](https://docs.thinger.io/plugins/icons/node-red.svg) | [Node-RED](https://docs.thinger.io/plugins/node-red.md) | Node-RED integration for Thinger.io | | ![RStudio](https://docs.thinger.io/plugins/icons/rstudio.png) | [RStudio](https://docs.thinger.io/plugins/rstudio.md) | RStudio Plugin for Thinger.io | | ![VS Code](https://docs.thinger.io/plugins/icons/vscode.png) | [VS Code](https://docs.thinger.io/plugins/vscode.md) | VS Code Plugin for Thinger.io | --- Source: https://docs.thinger.io/plugins/jupyter-minimal.md # Jupyter Minimal > Jupyter Notebook Minimal | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 3.10.10-1 | [Development](https://docs.thinger.io/plugins/development.md) | Thinger.io | MIT | [thinger-io/plugins/jupyter-minimal](https://github.com/thinger-io/plugins/tree/main/jupyter-minimal) | ![Jupyter logo](https://docs.thinger.io/plugins/jupyter-minimal/assets/jupyter_image.svg) Thinger.io plugin for running Jupyter Minimal version on the Cloud, integrating with Thinger.io file storages. ## Features - Have your Notebook where your data is, providing a unified management and data access - Delegate the execution of the code and algorithms to a cloud environment - Develop in a stable environment ## Technical Features This version integrates the following technology: - Python3 Runtime - git - TeX Live for document conversion. More details in what this plugins includes can be found [here](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-minimal-notebook) ## Screenshots ![Mockup of Jupyter Notebook integrated within Thinger.io](https://docs.thinger.io/plugins/jupyter-minimal/assets/jupyter-thinger.png) ## Changelog All notable changes to this project will be documented in this file. #### 3.10.10-1 - 2023-03-23 ##### Added - Updated mount points to separate config and user data ##### Changed - Bumped to image 3.10.10 #### 3.10.9-2 - 2023-03-23 ##### Fix - Name was set to description and viceversa #### 3.10.9-1 - 2023-03-23 ##### Added - First publication of plugin --- Source: https://docs.thinger.io/plugins/jupyter-r.md # Jupyter R > Jupyter Plugin for Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 4.2.3-3 | [Development](https://docs.thinger.io/plugins/development.md) | Thinger.io | MIT | [thinger-io/plugins/jupyter-r](https://github.com/thinger-io/plugins/tree/main/jupyter-r) | ![Jupyter logo](https://docs.thinger.io/plugins/jupyter-r/assets/jupyter_image.svg) Thinger.io plugin for running Jupyter R version on the Cloud, integrating with Thinger.io file storages. ## Features - Have your Notebook where your data is, providing a unified management and data access - Delegate the execution of the code and algorithms to a cloud environment - Develop in a stable environment ## Technical Features This version integrates the following technology: - R interpreter - Python3 Runtime - git - TeX Live for document conversion. More details in what this plugins includes can be found [here](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-r-notebook) ## Screenshots ![Mockup of Jupyter Notebook integrated within Thinger.io](https://docs.thinger.io/plugins/jupyter-r/assets/jupyter-thinger.png) ## Changelog All notable changes to this project will be documented in this file. #### 4.2.3-3 - 2023-03-29 ##### Added - Updated mount points to separate config and user data #### 4.2.3-2 - 2023-03-23 ##### Changed - Changed description in plugin.json #### 4.2.3-1 - 2023-03-23 ##### Added - First publication of plugin --- Source: https://docs.thinger.io/plugins/jupyter-tensorflow.md # Jupyter TensorFlow > Jupyter Plugin for Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 2.11.0-5 | [Development](https://docs.thinger.io/plugins/development.md) | Thinger.io | MIT | [thinger-io/plugins/jupyter-tensorflow](https://github.com/thinger-io/plugins/tree/main/jupyter-tensorflow) | ![Jupyter logo](https://docs.thinger.io/plugins/jupyter-tensorflow/assets/jupyter_image.svg) Thinger.io plugin for running Jupyter TensorFlow version on the Cloud, integrating with Thinger.io file storages. ## Features - Have your Notebook where your data is, providing a unified management and data access - Delegate the execution of the code and algorithms to a cloud environment - Develop in a stable environment ## Technical Features This version integrates the following technology: - TensorFlow machine learning library - Popular packages from the scientific Python ecosystem - Python3 Runtime - git - TeX Live for document conversion. More details in what this plugins includes can be found [here](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-tensorflow-notebook) ## Screenshots ![Mockup of Jupyter Notebook integrated within Thinger.io](https://docs.thinger.io/plugins/jupyter-tensorflow/assets/jupyter-thinger.png) ## Changelog All notable changes to this project will be documented in this file. #### 2.11.0-2 - 2023-03-23 ##### Changed - Improved description in plugin.json #### 2.11.0-1 - 2023-03-23 ##### Added - First publication of plugin --- Source: https://docs.thinger.io/plugins/node-red.md # Node-RED > Node-RED integration for Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.9.2-1 | [Development](https://docs.thinger.io/plugins/development.md) | Thinger.io | MIT | [thinger-io/plugins/node-red](https://github.com/thinger-io/plugins/tree/main/node-red) | Node-RED is an Open Source project created by IBM to provide the Rule Engines market of a simple but powerful framework with an easy to use graphical programing interface, and a huge users community that has made more than 2.000 contributions. This technology begins especially useful for IoT projects, to process and analyze data or create rules to automate behaviors in response to events produced by the IoT devices measures. It can also be used as an MQTT broker or to show data in customizable dashboards. However, its greatest potential is obtained when used in combination with an IoT platform like [Thinger.io](https://thinger.io/), leaving one in charge of data acquisition, storage, and device management and the other one for processing, automation, etc. ![Thinger.io web console with Node-RED plugin and ad-hoc nodes](https://docs.thinger.io/plugins/node-red/assets/laptop.png) ## Thinger.io and Node-RED integration We have made a great effort to simplify the integration between Thinger.io and Node-RED, which is materialized in the following elements: * A **contribution to Node-RED** repositories, called "node-red-contrib-thinger" that contains some nodes that has been specifically created to simplify the integration of Node-RED flows with Thinger.io features, allowing to interact with the IoT platform in the next ways: - Iterate over the assets from the Thinger.io Platform (asset iterator node). - Create buckets when an event occurs (bucket create node). - Read from data buckets (bucket read node). - Writing to data buckets (bucket write node). - Export data from buckets (bucket export node). - Calling devices callbacks with autoprovisioning (device callback node). - Creating any type of devices (device create node). - Reading a device resource when an event occurs (device read node). - Subscribing to device resources at a given interval (device stream node). - Sending data to a connected device (device write node). - Calling endpoints (endpoint call node). - Reading properties of devices, types or groups (property read node). - Writing and modifying properties of devices, types or groups (property write node). - Detecting different events of devices, buckets, endpoints and others (server events node). - Reading file contents of file storages (read storage node). - Writing new files or appending o existing files in file storages (write storage node). * A **Node-RED Plugin** that allows deploying Node-RED server into the same host as Thinger.io IoT platform instance, running 24x7 without any kind of limitation. This way the problem of hosting the node-RED on another machine disappears ## Introduction to Node-RED Concepts Node-RED is a development tool with two basic components: a "flow editor" that consists of a graphical programming tool that can be launched over any web-browser and a backend with the rule engine server that is able to execute the flows. This system is really easy to learn and to use, however, there are some concepts that you should know before starting to work with it: ### Nodes The "Nodes" are the basic building blocks for creating flows. Each node contains its own configuration form and specific behavior, that can be accessed by double-clicking the block once it has been introduced in the web editor canvas. There are a few basic types of nodes: #### **Inject Nodes** ![Inject node image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-inject.png) This node allows to automatically start a flow when an event is triggered, at regular intervals defined in the properties form or manually over the web editor. The message sent by these nodes has the payload and topic properties set. **Function, Change, Switch Nodes** ![Function node image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-function.png) Node-RED counts with some nodes that allows working with the flow's payload using pre-configured tools or coding their behavior in JavaScript functions that can be created within the editor using a rich text editor. With this proposal, these nodes are provided with both input and output connectors. **Output and Debug Nodes** ![Debug node image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-debug.png) These nodes only have an input connector that allows extracting data from the flow to third parties, files, or debugs console in the web editor. ### Palette The web editor contains a graphical list with all the available nodes that can be found in a Node-RED server, called "palette". in order to provide simple access when creating a flow. You can extend your palette just using the "palette manager" situated at Node-RED's main menu, in which you can find more than 2.000 additional nodes for your server that have been created by both Node-RED developers and by community contributors. ### Flows A flow is represented as a tab within the editor workspace and is the main way to organize nodes. Each flow can have a name, and a description that is displayed in the [Information sidebar](https://nodered.org/docs/user-guide/editor/sidebar/info). All of the nodes in a specific flow can access the same [flow-scoped context](https://nodered.org/docs/user-guide/context). The flow editor makes it easy to wire together flows using the wide range of nodes in the palette. Flows can be then deployed to the runtime just clicking into "debloy" button: ![Deploy flow button in Node-RED](https://docs.thinger.io/plugins/node-red/assets/button-deploy.png) ### Debug Console Is a section of the right slide bar that provides a structured view of the messages that are being sent by the debug nodes, making it easier to explore the performance of the execution. Alongside each message, the debug sidebar includes information about the time the message was received and which Debug node sent it. Clicking on the source node id will reveal that node within the workspace. > **Info: Node-RED documentation** > > You can find additional documentation about the use of this tool in Node-RED's official website: [https://nodered.org/docs/user-guide/editor/workspace/](https://nodered.org/docs/user-guide/editor/workspace/) ## Starting with Thinger.io Nodes In this section, it is described **how to configure Node-RED** "Thinger.io Nodes" to start working with any particular Thinger.io server, that could be your own instance or the public one that is hosted on "https://api.thinger.io" and it is also necessary to provide an authorization to allow Node-RED to work with your Thinger.io account. To make this configuration, just drag any Thinger.io Node to the canvas and open its properties form, then go to the last input, called "Server " and click into the edition button, which will open the Thinger-Server configuration menu. ![Node-RED node configuration form](https://docs.thinger.io/plugins/node-red/assets/node-form.png) This form allows you to introduce the credentials of the specific Thinger.io instance address and authorization that is going to receive your Node-RED requests. However, it is important to take care of the next considerations in order to make a proper configuration: > **Tip** > > * If you are using Node-RED in a Thinger.io Plugin and you want to work with the same Thinger.io server that is hosting the plugin, it is only necessary to include `$(THINGER_HOST)` into "Host" box and `$(THINGER_TOKEN_NODE_RED_PLUGIN)` in the "Token" box, then you can disable SSL communication, as all messages are going to run into the same computer. * if you want to use a different Thinger.io Server or you aren't running Node-RED from a plugin, it will be necessary to **include its URL or IP Address** in the "Host" box and also a Thinger.io **Access Token with Admin-Access** privileges in the "Token" box, finally, SSL would be preferable in this case. ![Node-RED server node configuration form](https://docs.thinger.io/plugins/node-red/assets/node-server-configuration.png) ## Thinger.io Nodes As it was explained in the beginning, this plugin has two purposes: Host a Node-RED server instance together with Thinger.io IoT server and improve their integration by including a set of custom nodes to simplify the extraction of data from Thinger.io IoT devices or calling other platform features. The next list contains a complete description of each node and its properties configuration: ### Asset Iterator ![Asset iterator node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-asset-iterator.png) It is a **Function** Node that iterates over all the desired assets avaible on Thinger.io Platform given a filter. It is able to receive a JSON from Node-RED flow and automatically query the backend. This node is useful to execute operations over multiple assets at the same time. The configuration of this Node requires introducing of at least the `Asset`. There will be as many output messages as assets retrieved, each containing the information to only one asset. ### Bucket Create ![Bucket create node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-bucket-create.png) It is a **Function** Node that creates a Data Bucket into a Thinger.io Platform. It is able to receive a JSON from Node-RED flow and automatically create the Bucket, so results quite useful to implement scalable and on demand data storage to any project. The configuration of this Node requires introducing of at least the `Bucket ID` and `Data Source`, but allows the introduction of the same fields from the Thinger.io `Add Bucket` operation. It is important to make proper management of the node, as if it is run in a loop may create an infinite number of buckets. The output message will contain the result and details of the operation. ### Bucket Export ![Bucket export node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-bucket-export.png) It is a **Function** Node that executes a Thinger.io Data Bucket export operation and waits until the data is ready to be downloaded, returning the download file URL or the contents as desired. It is useful to extract data from Thinger.io for further analysis, storage or forwarding to other services. The configuration of this Node requires introducing of at least the `Bucket ID`, `Export Type`, `Data Range`, and `Timestamp Format`. The input for this Node is a triggered event and the output will be a JSON format message with the download URL or the contents of the exported data. ### Bucket Read ![Bucket read node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-bucket-read.png) It is a **Function** Node that retrieves data from a specific Thinger.io Data Bucket when an injection Node requires it. It is useful to get data from buckets with a Node-RED programmed sampling interval. To configure this node just include the `Bucket ID`, `Filter` and `Sorting` into the node parameters form. The input for this Node is a triggered event and the output will be a JSON format message with the buckets stored data. ### Bucket Write ![Bucket write node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-bucket-write.png) It is an **Output** Node that allows to store data into the Thinger.io Data Bucket. It is able to receive a JSON from Node-RED flow and automatically create an entry into the Bucket, so results quite useful to implement scalable data storage to any project. The configuration of this Node just requires introducing the `Bucket ID`, however, it is important to make proper management of the input JSON in order to store the right data. It is strongly recommended to filter the JSON keys using a "Change" Node and check the result with a "Debug" Node to be sure about the data that we are sending. ### Device Callback ![Device callback node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-device-callback.png) It is a **Function** Node that calls an HTTP device callback in order to send a message or retrieve what the device has configured in its callback. If the device does not exist it will manage the auto provisioning of a new device and data bucket. It is useful to get auto provision new devices based of different events save its data from the beginning. To configure this node just include the `Device ID` into the node parameters form or through an input message. The input for this Node is a triggered event and the output will be a JSON format message with the device callback response if any. ### Device Create ![Device create node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-device-create.png) It is a **Function** Node that creates a Device into the Thinger.io Platform. It is able to receive a JSON from Node-RED flow and automatically create the Device, so results quite useful to implement scalable and on demand device creation to any project. The configuration of this Node requires introducing of at least the `Bucket ID`, `Type` and `Credentials` if applicable. However, allows the introduction of the same fields from the Thinger.io `Add Device` operation. It is important to make proper management of the node, as if it is run in a loop may create an infinite number of devices. The output message will contain the result and details of the operation. ### Device Read ![Device read node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-device-read.png) It is a **Function** Node that retrieves data from a specific Thinger.io device resource when an injection Node requires it. It is useful to get data from devices with a Node-RED programmed sampling interval. To configure this node just include the `Device ID`and the `Resource Name` into the node parameters form. The input for this Node is a triggered event and the output will be a JSON format message with the device resource variables. ### Device Stream ![Device stream node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-device-stream.png) It is an **Injection** Node that retrieves data from a specific Thinger.io Device Resource on regular defined interval expressed in seconds into the properties form. To configure this node just include the `Device ID`and the `Resource Name` into the node parameters form. The output of this node will be a JSON with the real-time Device Resource data that was defined in the properties form. ### Device Write ![Device write node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-device-write.png) It is a **Function** Node that allows sending data to a Thinger.io connected Device. It is able to receive a JSON from Node-RED flow and automatically send it to other devices in real-time. So results quite useful to implement scalable device communication for any project. The configuration of this Node just requires introducing the `Device ID` and the `Resource ID` , however, it is important to make proper management of the input JSON in order to store the right data. It is strongly recommended to filter the JSON keys using a "Change" Node and check the result with a "Debug" Node to be sure about the data that we are sending. ### Endpoint Call ![Endpoint call node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-endpoint-call.png) It is a **Function** Node that allows calling the execution of a Thinger.io endpoint profile. It is able to receive a JSON that can be introduced in the endpoint in order to use that data in an e-mail or send it to third parties, so it is quite useful to create notifications or to integrating an IoT project with other systems. The configuration of this Node just requires introducing the `Endpoint ID`, however, it is important to make a proper management of the input JSON in order to send the right data. It is strongly recommended to filter the JSON keys using a "Change" Node and check the result with a "Debug" Node to be sure about the data that we are sending. ### Property Read ![Property read node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-property-read.png) It is a **Function** Node that retrieves data from a specific Thinger.io device, type or group property when an injection Node requires it. It is useful to get data from assets with a Node-RED programmed sampling interval. To configure this node just include the `Asset Type`, `Asset ID`and `Property Name` into the node parameters form. The input for this Node is a triggered event and the output will be a JSON format message with the asset's property value. ### Property Write ![Property write node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-property-write.png) It is a **Function** Node that writes data into a specific Thinger.io device, type or group property when an injection Node requires it. It is useful to save data into assets in order to manage different configurations and act accordingly. To configure this node just include the `Asset Type`, `Asset ID`and `Property Name` into the node parameters form. The input for this Node is a triggered event and the output will be a JSON format message with the operation's result and details. ### Storage Read ![Storage read node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-storage-read.png) It is a **Function** Node that reads any file saved in a Thinger.io storage and returns it to Node-RED. It is able to read any file, returning the string representation for text files (plain, csv, json, ...) or a Buffer otherwise. Useful for retrieving and treating information or being able to pass the info to third party nodes. The configuration of the node requires only the `Storage ID`, as it is able to read recursively. If a `file path` is passed it will read the file content, or its details, as desired. The input for this Node is a triggered event and the output will be a JSON format message with the operation's result and details. ### Storage Write ![Storage write node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-storage-write.png) It is an **Output** Node that allows to store data into the Thinger.io File Storage. It is able to receive a payload from Node-RED flow and automatically save or append into a file in the Storage, so results quite useful to implement scalable file storage to any project. The configuration of this Node just requires introducing the `Storage ID`, however, it is important to make proper management of the input in order to store the right data. ### Server Events ![Server events node from Thinger.io image of Node-RED](https://docs.thinger.io/plugins/node-red/assets/node-server-events.png) It is an **Inject** Node that allows triggering in real-time any event that takes places in Thinger.io IoT Server over all existing assets, like device, types, groups or buckets. Some events contain also additional filter fields to filter from. The configuration of each type requires to include the ID of the element that wants to be supervised. It is also possible to monitor every element leaving the identifier field empty. When any of these events is triggered, this Node is able to inject a JSON in the flow with the identifier of the Bucket, Device, or Endpoint that has produced the event along with the relevant data. > **Tip** > > If you need further technical information, you can find all the details for each node in Node-RED help dialog. ## Useful Example Flows In this section, you can find our own cookbook with some useful flows that you can use to get the maximum benefit from this integration #### Device Disconnection Alert Using the "Device Status Change" property of the Server Event Node, it is possible to detect the disconnection of any device of your IoT network and execute a flow in Node-RED to notify the incidence using an endpoint sending an email for example. > **Warning** > > [Learn how to create an email endpoint here. ](https://docs.thinger.io/features/endpoints-1#email-endpoint) The next flow uses two Thinger.io Nodes, the first one is triggering the Device Disconnection Server Event that will throw a JSON formatted message with the device ID, the status and the timestamp of the change. The second Node allows calling the Endpoint profile to send the alert with the device information JSON attached so it is possible to custom the message to easily identify the problem. ![On device state change call DisconnectionAlert endpoint](https://docs.thinger.io/plugins/node-red/assets/flow-device-disconnection-alert.png) This flow can be easily imported into your Node-RED workspace using the next JSON: ```json [{"id":"d577ba5d.a271b8","type":"tab","label":"Device Disconnection Alert","disabled":false,"info":""},{"id":"b5b501a2.a5287","type":"server-events","z":"d577ba5d.a271b8","name":"","asset":"","event":"device_state_change","filter":"","filters":{"state":"disconnected"},"bucket":"","device":"","endpoint":"","state":"disconnected","server":"ec0dd4b1ef5aa9a8","x":231,"y":158.99999809265137,"wires":[["6fd24968.0dc1b8"]]},{"id":"6fd24968.0dc1b8","type":"endpoint-call","z":"d577ba5d.a271b8","name":"","endpoint":"DisconnectionAlert","server":"ec0dd4b1ef5aa9a8","x":481,"y":158.99999809265137,"wires":[[]]},{"id":"ec0dd4b1ef5aa9a8","type":"thinger-server","host":"$(THINGER_HOST)","name":"local","ssl":false}] ``` Note that, the `Device ID` parameter of the Server Event Node is empty, in order to monitor the status of every device in our network. The green indicator under this Node represents the connection status between Node-RED and Thinger.io server. #### MQTT to Thinger.io MQTT is an extended communication protocol in IoT that works on top of the TCP/IP protocol suite. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited. The next flow allows sending data from a device hosted by NodeRED MQTT Server to the REST API Callback of a Thinger.io HTTP device, in order to store, analyze an show that information with Thinger.io features. > **Info** > > [Learn how to work with Thinger.io HTTP device callback here](https://docs.thinger.io/http-devices) ![From MQTT Topic to device callback](https://docs.thinger.io/plugins/node-red/assets/flow-mqtt-to-thinger.png) This flow can be easily imported into your Node-RED workspace using the next JSON: ```json [{"id":"a3d8dc1f.2ef57","type":"tab","label":"MQTT to Thinger.io","disabled":false,"info":""},{"id":"ce84849f.8d4278","type":"mqtt in","z":"a3d8dc1f.2ef57","name":"MQTT Device","topic":"Device","qos":"2","datatype":"json","broker":"79cc5157a4c20036","nl":false,"rap":false,"inputs":0,"x":193.0000114440918,"y":139.99999332427979,"wires":[["af229fc2.2759a"]]},{"id":"af229fc2.2759a","type":"function","z":"a3d8dc1f.2ef57","name":"Json Creator","func":"msg.payload = {\"temperatura1\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":352.9999771118164,"y":139.99999332427979,"wires":[["14bff97cb9a4beca"]]},{"id":"da89c2c1.ce839","type":"debug","z":"a3d8dc1f.2ef57","name":"Check Result","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":750,"y":140,"wires":[]},{"id":"14bff97cb9a4beca","type":"device-callback","z":"a3d8dc1f.2ef57","name":"","device":"temperature sensor","body":"","server":"ec0dd4b1ef5aa9a8","x":550,"y":140,"wires":[["da89c2c1.ce839"]]},{"id":"79cc5157a4c20036","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"ec0dd4b1ef5aa9a8","type":"thinger-server","host":"$(THINGER_HOST)","name":"local","ssl":false}] ``` Note that his is an easy example that only retrieves data from just one MQTT device, however it is possible to create complex integrations #### GPS Geofences Geofencing is an interesting IoT use case, with many applications in asset management, fleets or package tracking. The next flow shows how to monitor the location of any device to create an alert when it leaves an area specified with a Geofence Node. ![When device outside geofence call alert endpoint](https://docs.thinger.io/plugins/node-red/assets/flow-gps-geofences.png) Creating this integration with the "device\_location" property, it is possible to integrate any kind of device including Thinger.io Software Clients, Sigfox, TTN or even HTTP devices in a very simple way. > **Info** > > [Learn how to create an email endpoint here. ](https://docs.thinger.io/console#email-endpoint) This flow can be easily imported into your Node-RED workspace using the next JSON: ```json [{"id":"5f747490.ef8edc","type":"tab","label":"GPS Geofences","disabled":false,"info":""},{"id":"207937f8.10dc48","type":"server-events","z":"5f747490.ef8edc","name":"","asset":"","event":"device_callback_call","filter":"","filters":{},"bucket":"","device":"","endpoint":"","state":"","server":"ec0dd4b1ef5aa9a8","x":158.60000228881836,"y":264.00000381469727,"wires":[["8f3dd8cd.71e4e8","56adf62.4aa1108"]]},{"id":"553ff10.2e60c1","type":"geofence","z":"5f747490.ef8edc","name":"","mode":"polyline","inside":"false","rad":0,"points":[{"latitude":39.89203705190782,"longitude":-3.8814695924520493},{"latitude":40.06041580712444,"longitude":-3.507934436202049},{"latitude":40.09404176311921,"longitude":-3.0025633424520493},{"latitude":41.14474248673421,"longitude":-3.5299070924520493},{"latitude":40.253538217286675,"longitude":-4.628539904952049},{"latitude":40.102445657515226,"longitude":-3.771606311202049}],"centre":{},"floor":"","ceiling":"","worldmap":false,"outputs":1,"x":573.0000076293945,"y":265.0000276565552,"wires":[["be251c21.6d6e3","233f843b.94472c"]]},{"id":"be251c21.6d6e3","type":"endpoint-call","z":"5f747490.ef8edc","name":"","endpoint":"alert","server":"ec0dd4b1ef5aa9a8","x":771.6000595092773,"y":266.0000286102295,"wires":[[]]},{"id":"8f3dd8cd.71e4e8","type":"debug","z":"5f747490.ef8edc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":399.6000061035156,"y":346.00000762939453,"wires":[]},{"id":"233f843b.94472c","type":"debug","z":"5f747490.ef8edc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790.6000366210938,"y":347.0000057220459,"wires":[]},{"id":"56adf62.4aa1108","type":"change","z":"5f747490.ef8edc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":389.6000061035156,"y":265.00000381469727,"wires":[["553ff10.2e60c1"]]},{"id":"ec0dd4b1ef5aa9a8","type":"thinger-server","host":"$(THINGER_HOST)","name":"local","ssl":false}] ``` #### Modify Incoming data In some situations it is required to change the unit or metric of any variable, it is now possible to make this transformations before store data in a data bucket by use this Node-RED flow: ![Receive device callback, convert units and store](https://docs.thinger.io/plugins/node-red/assets/flow-modify-incoming-data.png) The configuration is quite simple, fist node retrieves the measurement of any device to be modified by the "function" node, that contains the codification that has been included below, and finally the "bucket write" node allows storing the transformed data. The codification of the function node is: ```javascript msg.payload = {"KW":msg.payload.payload.wats/1000}; msg.topic=msg.payload.device; return msg; ``` The next json contains this flow in order to be imported: ```json [{"id":"bcfa644f1bf43d03","type":"tab","label":"Modify Incoming data","disabled":false,"info":""},{"id":"3310aff0318c010d","type":"server-events","z":"bcfa644f1bf43d03","name":"","asset":"","event":"device_callback_call","filter":"","filters":{},"bucket":"","device":"","endpoint":"","state":"","server":"ec0dd4b1ef5aa9a8","x":290,"y":140,"wires":[["d50d939aa230b928"]]},{"id":"d50d939aa230b928","type":"function","z":"bcfa644f1bf43d03","name":"W to KW","func":"msg.payload = {\"KW\":msg.payload.payload.wats/1000};\nmsg.id=msg.payload.device;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":140,"wires":[["f6cc88d04b1b8cf8"]]},{"id":"f6cc88d04b1b8cf8","type":"bucket-write","z":"bcfa644f1bf43d03","name":"","bucket":"","value":"","server":"ec0dd4b1ef5aa9a8","x":650,"y":140,"wires":[]},{"id":"ec0dd4b1ef5aa9a8","type":"thinger-server","host":"$(THINGER_HOST)","name":"local","ssl":false}] ``` #### Device creation With the "Device create" and "Bucket create" nodes it is possible to create multiple devices, with the same or different credentials, types or groups; and create buckets associated to the recently created devices. ![Creation of devices and assignment of buckets](https://docs.thinger.io/plugins/node-red/assets/flow-device-creation.png) This flow can be easily imported into your Node-RED workspace using the next JSON: ```json [{"id":"a4b9f2e08c15ad79","type":"tab","label":"Device creation","disabled":false,"info":"","env":[]},{"id":"507f1a24287e53e2","type":"function","z":"a4b9f2e08c15ad79","name":"loop - 10 devices","func":"let device = msg.device;\n\nfor (let i= 0; i < 10; i++) {\n msg.device = `${device}_${i}`;\n msg.name = `${device} ${i}`;\n msg.description = \"Device auto generated from Node-RED flow\";\n node.send(msg);\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":220,"wires":[["752ee26eb02bed51"]]},{"id":"415e0ad528c64866","type":"inject","z":"a4b9f2e08c15ad79","name":"inject device name","props":[{"p":"device","v":"climastick","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":270,"y":220,"wires":[["507f1a24287e53e2"]]},{"id":"752ee26eb02bed51","type":"device-create","z":"a4b9f2e08c15ad79","name":"","deviceType":"Generic","deviceId":"","deviceCredentials":"&Xzi3LlG&lyaoyO2","deviceName":"","description":"","assetType":"temperature","assetGroup":"house","server":"ec0dd4b1ef5aa9a8","x":690,"y":220,"wires":[["e1da854b042efd77"]]},{"id":"69d16e383e46acd9","type":"debug","z":"a4b9f2e08c15ad79","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":715,"y":300,"wires":[],"l":false},{"id":"3be83c6bcc65f1cb","type":"comment","z":"a4b9f2e08c15ad79","name":"Create 10 device and assign a bucket to all of them","info":"This node creates 10 devices in Thinger.io Platform, in this case climasticks, from 0 to 9; all of them with the same credentials, type and group. Also, 10 buckets are created with the date source being the devices created.\n\n### Device create node\nThe device id, name and description are passed as input to the device create node, while the credentials, type and group is configured through the device create node dialog.\n\n### Bucket create node\nThe id, bucket name and description are passed as input to the bucket create node, as well as the extra source (the device in this case) for the data source.\nThe source (device), resource, update interval and asset type and group are configured through the bucket create node dialog.","x":350,"y":160,"wires":[]},{"id":"05af9a7c2958e6c6","type":"bucket-create","z":"a4b9f2e08c15ad79","name":"","bucketId":"","bucket":"","description":"","enabled":true,"source":"device","extraSource":"","resource":"temperature","update":"interval","interval":"1m","assetType":"temperature","assetGroup":"house","server":"ec0dd4b1ef5aa9a8","x":570,"y":300,"wires":[["69d16e383e46acd9"]]},{"id":"e1da854b042efd77","type":"change","z":"a4b9f2e08c15ad79","name":"Reorder message to create bucket","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"id","pt":"msg","to":"device","tot":"msg"},{"t":"move","p":"name","pt":"msg","to":"bucket","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":300,"wires":[["05af9a7c2958e6c6"]]},{"id":"ec0dd4b1ef5aa9a8","type":"thinger-server","host":"$(THINGER_HOST)","name":"local","ssl":false}] ``` > **Info** > > Learn how to create devices [here](https://docs.thinger.io/features/devices-administration), and data buckets [here](https://docs.thinger.io/features/buckets) ## Changelog All notable changes to this project will be documented in this file. #### 1.9.2-1 - 2025-07-28 ##### Changed - Bumped node-red-contrib-thinger to 1.9.2 - Bumped Node-RED to version 4.0.9 #### 1.9.1-1 - 2025-02-25 ##### Changed - Bumped node-red-contrib-thinger to 1.9.1 #### 1.9.0-1 - 2024-11-01 ##### Changed - Bumped Node-RED to version 4.0.5 - Bumped node-red-contrib-thinger to 1.9.0 #### 1.8.0-1 - 2024-07-30 ##### Changed - Bumped node-red-contrib-thinger to 1.8.0 - Bumped Node-RED to version 4.0.2 with Node.js 20 #### 1.7.6-1 - 2024-05-23 ##### Changed - Bumped node-red-contrib-thinger to 1.7.6 #### 1.7.5-1 - 2024-05-22 ##### Changed - Bumped node-red-contrib-thinger to 1.7.5 #### 1.7.4-1 - 2024-04-12 ##### Changed - Bumped node-red-contrib-thinger to 1.7.4 #### 1.7.3-1 - 2024-04-12 ##### Changed - Bumped node-red-contrib-thinger to 1.7.3 - Bumped Node-RED to version 3.1.9 #### 1.7.2-1 - 2024-04-11 ##### Changed - Bumped node-red-contrib-thinger to 1.7.2 - Bumped Node-RED to version 3.1.8 #### 1.7.1-1 - 2024-03-12 ##### Changed - Bumped node-red-contrib-thinger to 1.7.1 #### 1.7.0-1 - 2024-03-11 ##### Changed - Bumped node-red-contrib-thinger to 1.7.0 - Bumped Node-RED to version 3.1.6 #### 1.6.3-1 - 2024-01-03 ##### Changed - Bumped node-red-contrib-thinger to 1.6.3 #### 1.6.2-1 - 2023-12-27 ##### Changed - node-red-contrib-thinger with Node.js version 18 - Bumped node-red-contrib-thinger to 1.6.2 #### 1.6.1-2 - 2023-11-30 ##### Changed - node-red-contrib-thinger with Node.js version 18 #### 1.6.1-1 - 2023-11-30 ##### Changed - Bumped node-red-contrib-thinger to 1.6.1 - Downgrade Node.js to version 16 #### 1.6.0-1 - 2023-11-29 ##### Changed - Bumped node-red-contrib-thinger to 1.6.0 - Bumped Node.js to version 18 #### 1.5.1-1 - 2023-11-24 ##### Changed - Bumped node-red-contrib-thinger to 1.5.1 #### 1.5.0-1 - 2023-11-15 ##### Changed - Bumped node-red to 3.1.0 - Bumped node-red-contrib-thinger to 1.5.0 #### 1.4.3-1 - 2023-02-09 ##### Changed - Bumped node-red-contrib-thinger to 1.4.3 #### 1.4.2 - 2023-02-01 ##### Changed - Bumped node-red-contrib-thinger to 1.4.2 #### 1.4.1 - 2022-09-05 ##### Changed - Bumped node-red to 3.0.2 - Bumped node-red-contrib-thinger to 1.4.1 #### 1.4.0 - 2022-07-27 ##### Changed - Bumped node-red to 3.0.1 - Bumped node-red-contrib-thinger to 1.4.0 - Updated Node.js to version 16 #### 1.3.2 - 2022-03-14 ##### Changed - Bumped node-red-contrib-thinger to 1.3.2 #### 1.3.1 - 2022-02-01 ##### Changed - Bumped node-red-contrib-thinger to 1.3.1 - Bumped Node-RED version to 2.1.6 #### 1.3.0 - 2021-12-22 ##### Changed - Bumped node-red-contrib-thinger to 1.3.0 #### 1.2.3 - 2021-11-24 ##### Changed - Bumped node-red-contrib-thinger to 1.2.3 - Set module version in dockerfile to avoid docker image layer caching #### 1.2.2 - 2021-11-23 ##### Changed - Bumped node-red-contrib-thinger to 1.2.2 #### 1.2.1 - 2021-11-22 ##### Changed - Bumped node-red-contrib-thinger to 1.2.1 #### 1.2.0 - 2021-11-22 ##### Changed - Updated Node-RED version to 2.1.3 - Updated Node.js to version 14 - Bumped node-red-contrib-thinger to 1.2.0 #### 1.1.0 - 2021-09-14 ##### Changed - Updated Node-RED version to 2.0.6 - Updated Node.js to version 14 - Installation from npm instead of repository #### 1.0.2 - 2020-07-10 ##### Changed - Updated Node-Red version to 12 ##### Fixed - Fixed events node to properly register filters for buckets and endpoints --- Source: https://docs.thinger.io/plugins/rstudio.md # RStudio > RStudio Plugin for Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 4.4.0-1 | [Development](https://docs.thinger.io/plugins/development.md) | Thinger.io | MIT | [thinger-io/plugins/rstudio](https://github.com/thinger-io/plugins/tree/main/rstudio) | ![RStudio logo](https://docs.thinger.io/plugins/rstudio/assets/rstudio-logo.svg) RStudio® is an integrated development environment (IDE) for R, a programming language for statistical computing and graphics. The RStudio Web IDE plugin provides a web-based RStudio Server instance that can be accessed from the Thinger.io console. Integrating RStudio with Thinger.io can greatly benefit data scientists, IoT developers, and researchers who need to analyze and visualize IoT data effectively. This integration empowers professionals across various domains to make data-driven decisions and optimize their IoT solutions. ![Thinger.io web console with Node-RED plugin and ad-hoc nodes](https://docs.thinger.io/plugins/rstudio/assets/screen-front.png) ## Thinger.io and RStudio integration RStudio can be used alongside Thinger.io for various related tasks: - Data Analysis: RStudio provides powerful tools for data analysis and visualization, making it ideal for analyzing the data collected from IoT devices connected to Thinger.io - Statistical Modeling: With RStudio, you can perform statistical modeling and machine learning tasks on IoT data to derive insights, detect patterns, and make predictions. - Integration: RStudio can be integrated with Thinger.io APIs to directly access and manipulate IoT data within R environment, enabling seamless integration of IoT data into your R-based workflows. - Automated Reporting: You can automate the generation of reports and summaries based on IoT data using RMarkdown in RStudio. This feature enables the creation of customized reports that can be automatically generated and shared at regular intervals. Overall, RStudio Plugin complements Thinger.io by providing advanced data analysis, visualization, and modeling capabilities, empowering users to derive valuable insights from IoT data collected and managed through Thinger.io platform. ## Get Started After installing the RStudio Web IDE Plugin, to start making requests to Thinger.io API, the following environment variables are available: - THINGER_HOST - THINGER_USER - THINGER_TOKEN_RSTUDIO_PLUGIN With these environment variables, you can make requests to Thinger.io API using httr2 package in R. Install httr2 package to make HTTP requests to Thinger.io API, in this case to list all the buckets of a user: ```r TOKEN <- Sys.getenv("THINGER_TOKEN_RSTUDIO_PLUGIN") USER <- Sys.getenv("THINGER_USER") HOST <- Sys.getenv("THINGER_HOST") library(httr2) req <- request(paste("https://",HOST,"/v1/users/",USER,"/buckets", sep="")) |> req_auth_bearer_token(TOKEN) resp <- req_perform(req) resp ``` ## Additional Resources You may refer to the official website of R for additional resources and documentation: [R](https://www.r-project.org/), as well as the official website of RStudio for more information on RStudio IDE: [RStudio](https://www.rstudio.com/). ## Changelog #### 4.4.0-1 - 2024-06-12 - Initial version --- Source: https://docs.thinger.io/plugins/vscode.md # VS Code > VS Code Plugin for Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 4.89.1-1 | [Development](https://docs.thinger.io/plugins/development.md) | Thinger.io | MIT | [thinger-io/plugins/vscode](https://github.com/thinger-io/plugins/tree/main/vscode) | ![Thinger.io web console with VS Code plugin and OTA upload](https://docs.thinger.io/plugins/vscode/assets/laptop-mockup.png) The Thinger.io VS Code Plugin enables users to edit software files on the cloud using a fully-featured Integrated Development Environment (IDE) powered by Visual Studio Code (VS Code). This plugin also facilitates the coding of complete software and allows Over-The-Air (OTA) updates for microcontrollers directly from the cloud. ## About Thinger.io and VS Code integration Thinger.io cloud platform offers a VS Code plugin based on Code-Server. This integration allows you to seamlessly edit any file uploaded into Thinger.io using a powerful IDE. Additionally, you can conveniently update microcontrollers via OTA directly from the cloud. The plugin comes pre-installed with the complete setup of PlatformIO and the [Thinger.io extension](https://marketplace.visualstudio.com/items?itemName=thinger-io.thinger-io), making it effortless to get started with your projects. ![VS Code OTA update for ESP32](https://docs.thinger.io/plugins/vscode/assets/iot-ota.gif) Furthermore, when accessing the [File Storages](https://docs.thinger.io/file-system) in Thinger.io's web console, the platform detects the presence of VS Code and adds a convenient shortcut to open the storage inside the VS Code Plugin. ![VS Code file storage shortcut](https://docs.thinger.io/plugins/vscode/assets/storage-shortcut.png) > **Info** > > Please note that the Thinger.io VS Code Plugin is available only for premium > Thinger.io servers, from Medium subscription and upwards. You can check > [**this link**](https://thinger.io/pricing) to create your own instance within minutes. ## OTA Support The plugin supports OTA updates for a wide range of devices. For the latest information on OTA programming, please refer to the [OTA Programming page](https://docs.thinger.io/extended-features/ota). To utilize OTA updates, it is necessary to initially upload an OTA compatible firmware to a device using a native IDE with options available for [Arduino IDE](https://docs.thinger.io/sdk-setup/arduino-ide) or [Visual Studio Code](https://docs.thinger.io/sdk-setup/visual-studio-code). ## Changelog #### 4.89.1-1 - 2024-06-05 ##### Changed - Bumped to code-server version 4.89.1 - Bumped platformio extension to 3.3.3 - Bumped thinger.io extension to 1.1.0 #### 4.14.1-2 - 2023-08-23 ##### Changed - Marginally reduce the limit of memory to be able to run #### 4.14.1-1 - 2023-07-26 ##### Added - Preinstallation of platformio-ide and thinger-io extension - Default settings for Thinger.io extension configuration ##### Changed - Bumped to code-server version 4.14.1 #### 4.11.0-3 - 2023-03-31 - Updated deprecated mod for code-server #### 4.11.0-2 - 2023-03-29 - Updated mount points for storages #### 4.11.0-1 - 2023-03-28 - Bumped code-server to version 4.11.0 #### 4.6.0-1 - 2022-08-26 - Downsized resource memory to 3.75GB - Bumped to code-server version 4.6.0 --- Source: https://docs.thinger.io/plugins/infrastructure.md # Infrastructure > Plugins that add infrastructure services to your Thinger.io account, such as file transfer or a container registry. Plugins that add infrastructure services to your Thinger.io account, such as file transfer or a container registry. | Icon | Plugin | Description | | --- | --- | --- | | ![Docker Registry](https://docs.thinger.io/plugins/icons/docker-registry.svg) | [Docker Registry](https://docs.thinger.io/plugins/docker-registry.md) | A Registry for images build in Thinger.io | | ![SFTPGo](https://docs.thinger.io/plugins/icons/sftpgo.png) | [SFTPGo](https://docs.thinger.io/plugins/sftpgo.md) | SFTPGo Plugin | --- Source: https://docs.thinger.io/plugins/docker-registry.md # Docker Registry > A Registry for images build in Thinger.io | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 2.8.1-1 | [Infrastructure](https://docs.thinger.io/plugins/infrastructure.md) | Thinger.io | MIT | [thinger-io/plugins/docker-registry](https://github.com/thinger-io/plugins/tree/main/docker-registry) | ![Docker Registry logo](https://docs.thinger.io/plugins/docker-registry/assets/docker-registry-logo.svg) Thinger.io plugin for running a Docker Registry in order to be able to upload and persist images of ML Models. More details in what this plugins includes can be found [here](https://github.com/distribution/distribution) ## Changelog #### 2.8.1-1 - 2023-03-23 ##### Added - First publication of plugin --- Source: https://docs.thinger.io/plugins/sftpgo.md # SFTPGo > SFTPGo Plugin | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 2.5.4-1 | [Infrastructure](https://docs.thinger.io/plugins/infrastructure.md) | Thinger.io | MIT | [thinger-io/plugins/sftpgo](https://github.com/thinger-io/plugins/tree/main/sftpgo) | ![SFTPGo logo](https://docs.thinger.io/plugins/sftpgo/assets/sftpgo-logo.png) [SFTPGo](https://sftpgo.com/) extends capabilities of File Storages, adding support for SFTP, FTP and FTPS with individual user management. With this plugin you can leverage Thinger.io file storage backends for exchanging and storing files on the platform. ## Get Started SFTPGo has two different Web UIs, separated by admin and client users. To access them, as usually after installation, a new option will appear under the Plugins section on the left toolbar to acess SFTPGo. When loaded, the WebClient will appear, but before being able to login with a user, we should login with the admin. ![SFTPGo WebClient marking how to access the WebAdmin](https://docs.thinger.io/plugins/sftpgo/assets/webclient-login.png) Click on the WebAdmin link and enter as username and password your Thinger.io username. ![SFTPGo WebAdmin login](https://docs.thinger.io/plugins/sftpgo/assets/webadmin-login.png) > **Info: Important** > > It is highly recommended to change the admin password to the same of the Thinger.io account or to one of your choice. ## Creating Users Just after a login in with the admin user, the users management menu appears. In this menu, users for transfering data may be created by following two different approaches for their shared data. ### Use a subdirectory of a common file storage When installing this plugin, a new file storage was created in Thinger.io with the id 'sftpgo\_data', this storage may be used for SFTPGo backups and users data, so no home directory will need to be specified when creating the user, and any new files added will be added under the file storage 'sftpgo\_data', in the path `/data/`. We can then upload an example file and if we go to said file storage we will see the file structure. ![File storage screen when using a common storage for data in SFTPGo](https://docs.thinger.io/plugins/sftpgo/assets/sftpgo-common-storage.png) ### User an already created file storage When creating a user to share the files of an already existing file storage, the home directory of the new user needs to be specified. All storages will be mounted in `/srv/sftpgo/`, and to that path we would need to append the id of our storage. Example in the below screen. ![SFTPGo Add user with dedicated storage](https://docs.thinger.io/plugins/sftpgo/assets/sftpgo-dedicated-storage.png) ## Establish a Connection ### SFTP SFTP protocol should be the prefered option to use due to various reasons like its security, firewall friendliness and consistency. In order to connect with this protocol, the connection parameters are: - Hostname: hostname of the Thinger.io instance or public IP - Port: 2022 - Credentials: user and password for a created user ### FTP and FTPS > **Warning** > > It is recommended to always use SFTP protocol due to the design challenges of FTP/S For FTP and FTP over TLS (FTPS) the supported connection is in Passive Mode. The upgrade to TLS of the control and data ports may be handled automatically by the FTP client using explicit FTP. > **Tip** > > Currently, only one data connection may be opened simultaneously The connection parameters are: - Hostname: hostname of the Thinger.io instance or public IP - Port: 2021 - Credentials: user and password for a created user On connection with an explicit FTP over TLS, the secure connection will be upgraded on both control and data ports. This plugin only supports the TLS connection over the base domain name of the instance. > **Warning** > > If the TLS connection is not longer able to be established, restart the plugin manually in order for the certificates to reload ## Official Documentation This plugin is based on the software SFTPGo. It's official documentation can be found under the [docs folder](https://github.com/drakkan/sftpgo/tree/main/docs) in its [official repository](https://github.com/drakkan/sftpgo). ## Changelog #### 2.5.4-1 - 2023-10-24 - Initial version --- Source: https://docs.thinger.io/plugins/templates.md # Templates > Plugins that create ready-made Thinger.io resources to start a project from a template. Plugins that create ready-made Thinger.io resources to start a project from a template. | Icon | Plugin | Description | | --- | --- | --- | | ![LoRaWAN Device Template](https://docs.thinger.io/plugins/icons/lorawan-product-template.png) | [LoRaWAN Device Template](https://docs.thinger.io/plugins/lorawan-product-template.md) | Product template for LoRaWAN-driven devices. Preconfigured to work with any LNS Thinger plugin. | --- Source: https://docs.thinger.io/plugins/lorawan-product-template.md # LoRaWAN Device Template > Product template for LoRaWAN-driven devices. Preconfigured to work with any LNS Thinger plugin. | Version | Category | Author | License | Source code | | --- | --- | --- | --- | --- | | 1.0.1 | [Templates](https://docs.thinger.io/plugins/templates.md) | Thinger.io | MIT | [thinger-io/plugins/lorawan-product-template](https://github.com/thinger-io/plugins/tree/main/lorawan-product-template) | ![LoRaWAN logo](https://docs.thinger.io/plugins/lorawan-product-template/assets/lorawan.png) The LoRaWAN Product Template is a foundational framework designed to accelerate the development of LoRaWAN-based IoT products within the Thinger.io ecosystem. It provides a standardized approach to configuring LoRaWAN devices, ensuring seamless integration with any of the supported LoRaWAN Network Servers (LNS) while maintaining complete LNS-agnostic product logic. ## Key Features ### Multi-LNS Support - LORIOT: Full integration with LORIOT network server - The Things Stack: Compatible with TTN/TTS implementations - Chirpstack: Native support for Chirpstack deployments ### LNS-Agnostic Design The template ensures that your product logic remains completely independent of the underlying LNS. This means: - Write your product code once - Deploy across different network servers without modification - Switch LNS providers without code changes - Focus on device behavior, not network integration ### Pre-configured Components - Standard uplink/downlink message handling - Automatic payload decoding pipeline - Device property management ## Documentation and Resources For detailed documentation on how to utilize the LoRaWAN Product Template, please refer to the following resources: - [Thinger.io LoRaWAN Documentation](https://docs.thinger.io/lpwan/the-things-stack) ## Changelog #### [1.0.1] - 2025-07-02 ##### Fixed - Corrected DevEUI lenghth in profile autoprovision. #### [1.0.0] - 2025-07-02 - Initial version --- Source: https://docs.thinger.io/guides.md # Guides > End-to-end recipes that combine devices, Data Buckets, dashboards, alarms and products to solve a complete use case. Each guide takes you from nothing to a working result, using several parts of Thinger.io together. The guides link to the pages of each feature for the details instead of repeating them, so you can follow a guide first and read the reference later. ## End to end - [From an ESP32 to a dashboard](https://docs.thinger.io/guides/esp32-to-dashboard.md): Connect an ESP32, store its temperature in a Data Bucket, plot it on a dashboard and get an email when it goes above a threshold. - [Provision a device fleet](https://docs.thinger.io/guides/fleet-provisioning.md): Define a product with properties, a bucket and a dashboard, and let every unit of your fleet register itself with Auto Provision when it first connects. - [Build a dashboard app](https://docs.thinger.io/guides/dashboard-app.md): Write a small web app with the Dashboard SDK that reads a Data Bucket, publish it to a File Storage and open it as a dashboard of the console. - [Alert on per-device temperature limits](https://docs.thinger.io/guides/per-device-alarm-limits.md): Raise an alarm when a sensor leaves its own temperature range, kept in a property with a default for the product, and email it. ## Product examples Complete [products](https://docs.thinger.io/platform/products.md) for real devices, ready to adapt to your own: - [Shelly Plug S](https://docs.thinger.io/guides/shelly-plug-s.md): Connect a Shelly Plug S smart plug to Thinger.io over MQTT, without reflashing it, and control it with a ready-made product. - [Shelly Plus 1PM](https://docs.thinger.io/guides/shelly-plus-1-pm.md): Connect a Shelly Plus 1PM relay with power metering to Thinger.io over MQTT and switch it, read its status and store its energy readings. - [Kunbus Revolution Pi](https://docs.thinger.io/guides/kunbus-revpi.md): Connect a Kunbus Revolution Pi to Thinger.io with the Linux client and open its terminal, PiCtory and Node-RED from the console. ## Before you start If you have not connected a device yet, start with the [Quick start](https://docs.thinger.io/get-started/quick-start.md) and the [core concepts](https://docs.thinger.io/get-started/concepts.md). The API tabs of the guides need an [access token](https://docs.thinger.io/platform/access-tokens.md), and the CLI tabs need the `thinger` [CLI](https://docs.thinger.io/reference/cli.md). --- Source: https://docs.thinger.io/guides/esp32-to-dashboard.md # From an ESP32 to a dashboard > Connect an ESP32, store its temperature in a Data Bucket, plot it on a dashboard and get an email when it goes above a threshold. In this tutorial you connect an ESP32 to Thinger.io, store its temperature every minute in a Data Bucket, show it on a dashboard and receive an email when it goes above 30 °C. It takes about 30 minutes. ## What you need - A Thinger.io account. On the free Cloud account your server is `iot.thinger.io`; on a private instance, use your own domain wherever this tutorial says `YOUR_SERVER`. - An ESP32 board, a USB data cable and a 2.4 GHz Wi-Fi network. - The Arduino IDE with the ESP32 package and the [Thinger.io Arduino library](https://docs.thinger.io/devices/arduino.md) installed, as in the [Quick start](https://docs.thinger.io/get-started/quick-start.md). - For the API tabs, an [access token](https://docs.thinger.io/platform/access-tokens.md) (`YOUR_TOKEN`) that can create devices, buckets, dashboards, endpoints and alarms. For the CLI tabs, the `thinger` [CLI](https://docs.thinger.io/reference/cli.md) signed in to your account. The tutorial uses the device ID `esp32_climate` and the IDs `climate`, `climate_email` and `climate_hot` for the bucket, the endpoint and the alarm rule. Use your own if you prefer, and keep them consistent. ## Create the device ### Console Go to **Devices** and click **Create a Device**. Choose **IOTMP Device (Thinger.io protocol)**, set the **Device Id** to `esp32_climate`, click **Random** in **Device Credentials** and copy them. Click **Add Device**. See [Devices](https://docs.thinger.io/platform/devices.md) for the other fields. ### API **API call:** `POST /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"device": "esp32_climate", "type": "Generic", "credentials": "change-me-123"}' ``` Replace `change-me-123` with device credentials of your own (at least 6 characters) and keep them for the sketch. ### CLI ```bash thinger device create esp32_climate ``` The command prints random device credentials. Copy them for the sketch. ### AI **Prompt for an AI agent:** > Create an IOTMP device called esp32_climate in my Thinger.io account with random credentials and show me the credentials. ## Program the board **Step 1: Paste the sketch** Create a sketch with this code. Set `YOUR_USER`, set `YOUR_DEVICE` to `esp32_climate`, set `YOUR_TOKEN` to the device credentials, and fill in your Wi-Fi network. The `climate` output resource returns the internal temperature of the ESP32; replace `temperatureRead()` with the reading of your own sensor. ```cpp #define THINGER_SERIAL_DEBUG #include #define USERNAME "YOUR_USER" #define DEVICE_ID "YOUR_DEVICE" #define DEVICE_CREDENTIAL "YOUR_TOKEN" #define WIFI_SSID "wifi-network" #define WIFI_PASSWORD "wifi-password" ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { Serial.begin(115200); thing.add_wifi(WIFI_SSID, WIFI_PASSWORD); // output resource: the internal temperature of the ESP32, in °C // replace temperatureRead() with the reading of your own sensor thing["climate"] >> [](pson& out) { out["temperature"] = temperatureRead(); }; } void loop() { thing.handle(); } ``` **Step 2: Upload it** Choose your board in **Tools > Board** and its port in **Tools > Port**, click **Upload** and open the serial monitor at 115200 baud. It shows `[THINGER] Authenticated`, and the device appears as connected in **Devices**. To learn more about resources, see [Code your device](https://docs.thinger.io/devices/arduino/coding.md). ## Store the readings Create a Data Bucket that reads the `climate` resource every minute. [Data Buckets](https://docs.thinger.io/platform/data-buckets.md) explains the other data sources. ### Console Go to **Data Buckets** and click **Create a Data Bucket**. Set the **Bucket Id** to `climate`, choose **From Device Resource** as the **Data Source**, select `esp32_climate` in **Select Device** and `climate` in **Select Resource**, choose **Sampling Interval** as the **Refresh Mode** with 1 minute, and save. ![Add Bucket form reading the climate resource of the esp32_climate device every minute](https://docs.thinger.io/screenshots/guide-esp32-bucket-form.webp) *Bucket that samples the climate resource every minute* ### API **API call:** `POST /v1/users/{user}/buckets` ([reference](https://docs.thinger.io/reference/rest-api/buckets.md#bucket-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/buckets" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "bucket": "climate", "name": "Climate", "enabled": true, "config": { "source": "device", "device": "esp32_climate", "resource": "climate", "update": "interval", "interval": 60 } }' ``` ### CLI ```bash thinger bucket create climate -n Climate -s enabled=true \ -s config.source=device -s config.device=esp32_climate -s config.resource=climate \ -s config.update=interval -s config.interval=60 ``` Once it has data, read its latest records: ```bash thinger bucket read climate --items 5 ``` ### AI **Prompt for an AI agent:** > Create a data bucket called climate that reads the climate resource of esp32_climate every minute. After two or three minutes, the bucket has one record per minute with `temperature` and `ts`. ## Plot them on a dashboard ### Console Go to **Dashboards**, click **Create a Dashboard**, set the ID `climate` and a name, and open it. Turn on the edit mode, click **Add Widget** and choose a **Time Series Chart** with **From Data Bucket** as the source: bucket `climate`, field `temperature`, the last hour. Save the widget. See [Dashboards](https://docs.thinger.io/platform/dashboards.md) for the other widgets. ![Climate dashboard of esp32_climate with a Time Series Chart of the last 24 hours, a gauge with the current temperature, a chart of the hourly mean of the last 7 days and the last reading](https://docs.thinger.io/screenshots/guide-esp32-dashboard.webp) *The Climate dashboard* ### API The API creates the dashboard; add the chart in the console editor. **API call:** `POST /v1/users/{user}/dashboards` ([reference](https://docs.thinger.io/reference/rest-api/dashboards.md#dashboard-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/dashboards" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"dashboard": "climate", "name": "Climate", "tabs": [{"name": "Main", "icon": "fas fa-tachometer-alt", "widgets": []}]}' ``` ### CLI The CLI creates the dashboard; add the chart in the console editor. ```bash thinger dashboard create climate -n Climate \ -s 'tabs=[{"name": "Main", "icon": "fas fa-tachometer-alt", "widgets": []}]' ``` The CLI and agents can also build the dashboard as a web app instead of a widget layout: see [Build a dashboard app](https://docs.thinger.io/guides/dashboard-app.md). ## Get an email above 30 °C An alarm rule watches the bucket and calls an email endpoint when the temperature goes above 30 °C. First create the endpoint; [Endpoints](https://docs.thinger.io/platform/endpoints.md) covers the other types. ### Console Go to **Endpoints** and click **Create an Endpoint**. Set the **Endpoint Identifier** to `climate_email`, choose **Email** as the **Endpoint Type**, and fill in the **Destination Addresses**, the **Subject** and the **Email body**. Click **Add Endpoint**. ### API **API call:** `POST /v1/users/{user}/endpoints` ([reference](https://docs.thinger.io/reference/rest-api/endpoints.md#endpoint-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/endpoints" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "endpoint": "climate_email", "name": "Climate email", "enabled": true, "type": "email", "config": { "recipient": "you@example.com", "subject": "Temperature alert", "body": "esp32_climate is above 30 °C. Open the Climate dashboard to check it.", "body_type": "text" } }' ``` ### CLI ```bash thinger endpoint create climate_email -n "Climate email" -s enabled=true -s type=email \ -s config.recipient=you@example.com -s 'config.subject=Temperature alert' \ -s 'config.body=esp32_climate is above 30 °C. Open the Climate dashboard to check it.' \ -s config.body_type=text ``` ### AI **Prompt for an AI agent:** > Create an email endpoint called climate_email that sends "Temperature alert" to you@example.com. Then create the alarm rule. [Alarms](https://docs.thinger.io/platform/alarms.md) explains confirmations, reminders and alarm states. ### Console **Step 1: Add the rule** Go to **Alarms**, open the **Rules** tab and click **Add Rule**. Set the **Rule Identifier** to `climate_hot`, a **Name**, the **Severity** and a **Check Interval** of 1 minute, and click **Add Rule**. **Step 2: Set the source and the conditions** In **Data Source**, add **From Data Bucket** with the bucket `climate` and the field `temperature`. In **Activation**, click **Add Condition**, choose **IS ABOVE** `30` with **Immediate** confirmation, and click **Add Notification** to select `climate_email`. In **Normalization**, add the condition **IS BELOW** `28`. Turn on **Enabled** and save. ![The climate_hot alarm rule with its activation condition: climate.temperature above 30](https://docs.thinger.io/screenshots/guide-esp32-alarm-rule.webp) *Activation condition of the climate_hot rule* ### API **API call:** `POST /v1/users/{user}/alarms/rules` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-createrule)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rule": "climate_hot", "name": "Climate too hot", "enabled": true, "config": { "severity": 3, "check_interval": { "value": 1, "magnitude": "minute" }, "data": { "sources": [ { "name": "climate", "source": "bucket", "bucket": { "id": "climate", "mapping": ["temperature"] } } ] }, "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "above", "value": "30" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "type": "endpoint", "id": "climate_email" } ] }, "normalization": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "below", "value": "28" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "type": "none", "notifications": [] } } }' ``` ### CLI Save the JSON body of the API tab as `climate_hot.json` and create the rule from it: ```bash thinger alarm rule create climate_hot --from climate_hot.json ``` ### AI **Prompt for an AI agent:** > Create an alarm rule called climate_hot that checks the climate bucket every minute, notifies the climate_email endpoint when the temperature goes above 30 and clears when it drops below 28. To try it, warm the sensor (or return a value above 30 from the sketch) for a couple of minutes. ## Result The device is online in **Devices**, the `climate` bucket gets a temperature record every minute, and the dashboard plots it. When a reading goes above 30 °C, the next check of the rule raises an alarm in **Alarms > Instances**, and the email arrives at the destination address. When the temperature drops below 28 °C, the alarm clears. ## Next steps - [Provision a device fleet](https://docs.thinger.io/guides/fleet-provisioning.md): Define a product with properties, a bucket and a dashboard, and let every unit of your fleet register itself with Auto Provision when it first connects. - [Build a dashboard app](https://docs.thinger.io/guides/dashboard-app.md): Write a small web app with the Dashboard SDK that reads a Data Bucket, publish it to a File Storage and open it as a dashboard of the console. - [OTA updates](https://docs.thinger.io/devices/ota.md): Update the firmware of your devices over their Thinger.io connection from Visual Studio Code, one device or a whole product at a time. --- Source: https://docs.thinger.io/guides/lorawan-network-server.md # Connect a LoRaWAN network server > Bring the uplinks of a ChirpStack or The Things Stack application into Thinger.io, with devices and a Data Bucket created on the first message. **Plan:** Not available on free Cloud In this tutorial you connect a LoRaWAN application to Thinger.io through a network server plugin. Each sensor of the application becomes a device on its first uplink, and its messages are stored in a Data Bucket. [LoRaWAN](https://docs.thinger.io/devices/lorawan.md) explains how the pieces fit; this page walks through them once, end to end. ## What you need - A Thinger.io private instance. Plugins are not available on the free Cloud account. `YOUR_SERVER` is the hostname of your instance, and `YOUR_USER` your username. - An application on ChirpStack or on The Things Stack (The Things Network or The Things Industries), with devices of a single model. - For ChirpStack, an API token of your ChirpStack server, and its gRPC port reachable from your instance. You can follow the steps without a network server: the last step sends a sample uplink by hand. ## Install the plugins **Step 1: Install the network server plugin** Go to **Plugins > Marketplace**, open the plugin of your network server and click **Install** (see [Install a plugin](https://docs.thinger.io/plugins/marketplace.md#install-a-plugin)): | Network server | Plugin | |---|---| | ChirpStack | [ChirpStack](https://docs.thinger.io/plugins/chirpstack.md) | | The Things Stack | [The Things Stack](https://docs.thinger.io/plugins/ttn.md) | Do not use `ttn-stack`: it is [deprecated](https://docs.thinger.io/plugins/ttn-stack.md). The plugin is installed stopped: on its page, click **Start**. **Step 2: Install the LoRaWAN Device Template** Install the [LoRaWAN Device Template](https://docs.thinger.io/plugins/lorawan-product-template.md) plugin the same way. It creates the product **LoRaWAN Device Template** (`lorawan_device_template`) with: | Part | What it does | |---|---| | `uplink` device resource | Receives each message from the network server plugin, in the [common format](https://docs.thinger.io/devices/lorawan.md#message-format). | | `uplink` property | Keeps the last uplink of each device. The `downlink` device resource reads the network server and the DevEUI from it, and dashboards can show its fields, such as the counter or the battery. | | `downlink` device resource | Sends a downlink through the plugin that delivered the last uplink. See [Send a downlink](https://docs.thinger.io/devices/lorawan.md#send-a-downlink). | | Data Bucket `device_data` | Stores every uplink, after your decoder. | | Auto Provision rule | Creates the device on its first uplink. | If the Marketplace has a plugin for your sensor model, you can install it instead: it creates the same kind of product with the decoder of that sensor. > **Warning** > > Keep the names and the input of the `uplink` and `downlink` device resources as they are. The network server plugins call them by name and with the common format, so a product that changes them stops working with every network server. ## Prepare the product **Step 1: Set the device ID pattern** The plugin names each device with a prefix you choose followed by the DevEUI in uppercase hexadecimal, such as `my_device_70B3D597B0000D15`. Make the product's [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md) pattern match it: the prefix followed by `[0-9A-F]{16}`. ### Console Go to **Products**, open **LoRaWAN Device Template** and edit its Auto Provision rule **Device Pattern ID**. Set the **Device Pattern** to `my_device_[0-9A-F]{16}` and save. ![Auto Provision modal of the LoRaWAN Device Template product with the device pattern my_device_\[0-9A-F\]{16}](https://docs.thinger.io/screenshots/lorawan-guide-autoprovision.webp) *Auto Provision rule of the LoRaWAN Device Template* ### API `YOUR_TOKEN` is an access token of your account. **API call:** `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateproductprofileresource)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/lorawan_device_template/profile/autoprovisions/device_autoprovisioning" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Device Pattern ID", "enabled": true, "config": { "mode": "pattern", "pattern": "my_device_[0-9A-F]{16}" } }' ``` ### CLI ```bash thinger product profile autoprovision update lorawan_device_template device_autoprovisioning \ -s config.mode=pattern -s 'config.pattern=my_device_[0-9A-F]{16}' ``` ### AI **Prompt for an AI agent:** > In the product lorawan_device_template, change the Auto Provision rule device_autoprovisioning so it matches device IDs that start with my_device_ followed by 16 uppercase hexadecimal characters. The agent uses `thinger_resource_update` with the `product_profile_autoprovision` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). **Step 2: Add your decoder** The plugin delivers each uplink with the raw payload in hexadecimal (`payload`), the port (`fPort`), the counter (`fCnt`) and the DevEUI (`deviceEui`). If the network server decodes the payload, it also comes in `decodedPayload`. To store your own fields, edit the function `parseOrDecodeIncomingData` in the product [script](https://docs.thinger.io/platform/products/script.md): the Data Bucket stores what it returns. ## Connect the network server **Step 1: Add the application to the plugin** Open the plugin from the **Plugins** menu, go to **Applications** and click **Add**. ### ChirpStack | Field | Value | |---|---| | **Application Name** | The name of the application in ChirpStack. The plugin matches it with the application name of each uplink. | | **Device Id Prefix** | `my_device_`, the prefix of your Auto Provision pattern. | | **Access Token** | An API token of your ChirpStack server, used to send downlinks. | | **Server URL** | The address of your ChirpStack server, such as `chirpstack.example.com`. | | **Port** | The gRPC port of ChirpStack. The default is `8080`. | | **Enabled** | On. | ### The Things Stack | Field | Value | |---|---| | **Application Name** | The application ID in The Things Stack. | | **Device Id Prefix** | `my_device_`, the prefix of your Auto Provision pattern. | | **Enabled** | On. | **Step 2: Create the integration in the network server** In the plugin, go to **Settings** and copy the **Endpoint Base URL for Uplinks**, which is `https://YOUR_SERVER/users/YOUR_USER/plugins//uplink`, and the API token (**ChirpStack API Token** or **TTN API Token**). Then create the integration in the network server: ### ChirpStack Open the application, go to **Integrations** and add an **HTTP** integration. Set the **Event endpoint URL(s)** to the uplink URL, and add a header with the key `Authorization` and the copied token as its value, `Bearer` included. ### The Things Stack Open the application, go to **Integrations > Webhooks**, click **Add webhook** and choose the **Thinger.io** template. Fill in your instance hostname, your username and the copied token, and keep the default plugin endpoint. **Step 3: Send a test uplink** Without waiting for a sensor, you can post the sample uplink of the ChirpStack plugin, [`uplink_sample.json`](https://github.com/thinger-io/plugins/blob/main/chirpstack/uplink_sample.json), an uplink in the format of ChirpStack. Its application name is `test_app`: use that **Application Name** in the plugin, or change `deviceInfo.applicationName` in the file to yours. Send it with the **ChirpStack API Token** of the plugin settings as `YOUR_TOKEN`: ```bash curl -X POST "https://YOUR_SERVER/users/YOUR_USER/plugins/chirpstack/uplink" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ --data @uplink_sample.json ``` ## Result The device `my_device_70B3D597B0000D15` appears in **Devices**, as an HTTP device of the product **LoRaWAN Device Template**, and the Data Bucket `device_data` stores the uplink with these fields, among others: ```json { "appId": "test_app", "deviceEui": "70B3D597B0000D15", "deviceId": "my_device_70B3D597B0000D15", "fCnt": 5825, "fPort": 1, "payload": "01472309c51c28", "decodedPayload": null, "source": "chirpstack" } ``` The plugin's **Inspector** tab shows the messages as they arrive. The sample has no decoded payload, so `decodedPayload` is `null` and the bucket keeps the raw `payload` until you add your decoder. The device's `uplink` property holds the same object, which the `downlink` device resource needs to [send a downlink](https://docs.thinger.io/devices/lorawan.md#send-a-downlink). When you are done testing, delete the test device from **Devices**. Uninstalling the LoRaWAN Device Template plugin removes its product. ## Next steps - [LoRaWAN](https://docs.thinger.io/devices/lorawan.md): Bring LoRaWAN sensors into Thinger.io through The Things Stack, ChirpStack or LORIOT, with devices created automatically and downlinks. - [Script](https://docs.thinger.io/platform/products/script.md): Write the JavaScript functions of a product, inline or from a File Storage folder, and debug them with the real-time script console. - [Data Buckets](https://docs.thinger.io/platform/data-buckets.md): Store time series data from your devices, read it back with filters and aggregations, and export it to a file. --- Source: https://docs.thinger.io/guides/fleet-provisioning.md # Provision a device fleet > Define a product with properties, a bucket and a dashboard, and let every unit of your fleet register itself with Auto Provision when it first connects. In this tutorial you define a product for a fleet of identical sensors and let each unit create its own device the first time it connects, already inside the product, with its properties, its Data Bucket and its dashboard. You flash the same firmware on every unit; only the device ID and the credentials change. It takes about 30 minutes. ## What you need - A Thinger.io account. On the free Cloud account your server is `iot.thinger.io`; on a private instance, use your own domain wherever this tutorial says `YOUR_SERVER`. - Two or more ESP32 boards (or any board supported by the [Thinger.io Arduino library](https://docs.thinger.io/devices/arduino.md)). - For the API tabs, an [access token](https://docs.thinger.io/platform/access-tokens.md) (`YOUR_TOKEN`) that can create products. For the CLI tabs, the `thinger` [CLI](https://docs.thinger.io/reference/cli.md) signed in to your account. To compare Auto Provision with adding devices by hand or with claims, read [Provisioning at scale](https://docs.thinger.io/devices/provisioning.md) first. ## Create the product The product `env_sensor` has three parts in its profile: a `settings` property with a default value, a `climate` bucket that reads the `climate` resource of each device every minute, and an Auto Provision rule that accepts any device ID made of `sensor_` and 12 hexadecimal digits. [Products](https://docs.thinger.io/platform/products.md) describes every part of a profile. ### Console **Step 1: Add the product** Go to **Products** and click **Create a new Product**. Set the **Product ID** to `env_sensor` and a **Product Name**, and click **Add Product**. The product opens on its **Profile** tab. **Step 2: Add the property** In the **Properties** card, click **Add**, set the identifier `settings` and, on **Default Value**, type `{"threshold": 30}`. Save it. See [Product properties](https://docs.thinger.io/platform/products/properties.md). **Step 3: Add the bucket** In the **Buckets** card, click **Add**, set the identifier `climate` and read the device resource `climate` every 60 seconds. Save it. See [Product buckets](https://docs.thinger.io/platform/products/buckets.md). **Step 4: Add the Auto Provision rule** In the **Auto Provision** card, click **Add** and set the **Provision Identifier** to `units`. Leave the **Provisioning Mode** in **Device Pattern** and type `^sensor_[0-9a-f]{12}$` in **Device Pattern**. On **Settings**, set the **Name** that new devices get, leave **Enabled** on and click **Save**. See [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md). ![Profile of the env_sensor product with the settings property, the climate bucket, the climate API resource and the units Auto Provision rule](https://docs.thinger.io/screenshots/guide-fleet-profile.webp) *Profile of the env_sensor product* ### API Create the product, then save each profile entry: **API call:** `POST /v1/users/{user}/products` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/products" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"product": "env_sensor", "name": "Environment sensor", "enabled": true}' ``` **API call:** `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateproductprofileresource)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/env_sensor/profile/properties/settings" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "Settings", "enabled": true, "default": {"value": {"threshold": 30}}}' curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/env_sensor/profile/buckets/climate" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "Climate", "enabled": true, "data": {"source": "resource", "resource": "climate", "update": "interval", "interval": 60, "magnitude": "second", "payload_type": "source_payload"}}' curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/env_sensor/profile/autoprovisions/units" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "Environment sensor", "enabled": true, "config": {"mode": "pattern", "pattern": "^sensor_[0-9a-f]{12}$"}}' ``` ### CLI Create the product with its whole profile from a JSON document: **env_sensor.json** ```json { "profile": { "properties": { "settings": { "name": "Settings", "enabled": true, "default": { "value": { "threshold": 30 } } } }, "buckets": { "climate": { "name": "Climate", "enabled": true, "data": { "source": "resource", "resource": "climate", "update": "interval", "interval": 60, "magnitude": "second", "payload_type": "source_payload" } } }, "autoprovisions": { "units": { "name": "Environment sensor", "enabled": true, "config": { "mode": "pattern", "pattern": "^sensor_[0-9a-f]{12}$" } } } } } ``` ```bash thinger product create env_sensor -n "Environment sensor" --from env_sensor.json ``` A product created with its whole profile does not create the product property of the default value yet. Save the `settings` entry once more so that devices inherit it: ```bash thinger product profile property update env_sensor settings -s enabled=true ``` ### AI **Prompt for an AI agent:** > Create a product called env_sensor with a settings property whose default value is {"threshold": 30}, a climate bucket that reads the climate resource of each device every 60 seconds, and an Auto Provision rule that creates any device whose ID is sensor_ followed by 12 hexadecimal digits. The agent uses `thinger_resource_create` with the `product` type and the profile entry types. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Add the product dashboard A product dashboard is shown in the **Dashboard** tab of every device of the product, each with its own data. Open the product, go to **Dashboard**, choose one of its devices for the preview once you have one, and add a **Time Series Chart** with **From Device Bucket** as the source, bucket `climate`, field `temperature`. See [Product dashboard](https://docs.thinger.io/platform/products/dashboard.md). ![Product dashboard of env_sensor with a temperature chart of the last 7 days from the climate bucket and the humidity](https://docs.thinger.io/screenshots/guide-fleet-dashboard.webp) *Product dashboard of env_sensor* To use a web app as the product dashboard instead, publish it with `thinger dashboard publish --to product:env_sensor`: see [Build a dashboard app](https://docs.thinger.io/guides/dashboard-app.md). ## Flash the firmware Every unit runs the same sketch. The device ID comes from the MAC address of the board, so it matches the pattern of the rule, and each unit presents its own device credentials. The first connection creates the device with those credentials. ```cpp #define THINGER_SERIAL_DEBUG #include #define USERNAME "YOUR_USER" #define WIFI_SSID "wifi-network" #define WIFI_PASSWORD "wifi-password" ThingerESP32* thing = nullptr; String deviceId; String credentials; void setup() { Serial.begin(115200); // device ID: sensor_ + the 12 hex digits of the MAC address uint64_t mac = ESP.getEfuseMac(); char hex[13]; snprintf(hex, sizeof(hex), "%012llx", mac); deviceId = String("sensor_") + hex; // replace with the per-unit credentials you store in production credentials = String("YOUR_TOKEN-") + hex; thing = new ThingerESP32(USERNAME, deviceId.c_str(), credentials.c_str()); thing->add_wifi(WIFI_SSID, WIFI_PASSWORD); // output resource read by the climate bucket of the product (*thing)["climate"] >> [](pson& out) { out["temperature"] = temperatureRead(); }; Serial.println(deviceId); } void loop() { thing->handle(); } ``` `YOUR_TOKEN` here is a prefix of your own for the device credentials. In production, store unique credentials on each unit when you manufacture it, rather than deriving them from the MAC address, which anyone near the device can read. > **Warning** > > Keep the pattern narrow and anchored with `^` and `$`: any device that connects with a matching ID creates a device in your account. Disable the rule when the fleet is deployed if you do not expect new units. ## Switch the units on Power two units. Within seconds both appear in **Devices**, connected, with the product `env_sensor` and the name set in the rule. ### Console Go to **Devices**: the new devices show the product `env_sensor`. Open one and go to **Properties**: it has `settings` with `{"threshold": 30}`, inherited from the product. After a minute, its **Dashboard** tab shows its own temperature. ### API **API call:** `GET /v1/users/{user}/devices` ([reference](https://docs.thinger.io/reference/rest-api/devices.md)) ```bash curl "https://YOUR_SERVER/v1/users/YOUR_USER/devices" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger device list --search sensor_ thinger device property list YOUR_DEVICE thinger bucket read climate --items 6 ``` `thinger device property list` lists `settings` (and `dashboard`, if the product has one). The bucket records carry a `device` field with the ID of each unit. ### AI **Prompt for an AI agent:** > List the devices of the product env_sensor with their connection status, and show the last temperature of each one from the climate bucket. The product bucket appears in **Data Buckets** when the first device writes to it, and it keeps its data if you later delete the product. ## Result Each unit you switch on registers itself: it appears in **Devices** inside the product `env_sensor`, inherits the `settings` property, writes its temperature to the shared `climate` bucket tagged with its device ID, and shows it in its own **Dashboard** tab. You never created a device by hand. ## Next steps - Update the firmware of the whole fleet with [OTA updates](https://docs.thinger.io/devices/ota.md). - Hand devices over to your customers with [claims](https://docs.thinger.io/platform/toolbox/claims.md). - Group the units by site with [Assets](https://docs.thinger.io/platform/assets.md), and alert on them with [Alarms](https://docs.thinger.io/platform/alarms.md). - [OTA updates](https://docs.thinger.io/devices/ota.md): Update the firmware of your devices over their Thinger.io connection from Visual Studio Code, one device or a whole product at a time. - [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md): Let a product create its devices when they first connect or are first called, with an ID pattern, an asset type, an asset group and a project. - [Assets](https://docs.thinger.io/platform/assets.md): Classify devices by asset type and asset group, share properties with every device of a type or group, and see them on a map. --- Source: https://docs.thinger.io/guides/dashboard-app.md # Build a dashboard app > Write a small web app with the Dashboard SDK that reads a Data Bucket, publish it to a File Storage and open it as a dashboard of the console. In this tutorial you build a web app that lists the latest temperatures of a Data Bucket and updates itself when new records arrive. You publish it to a File Storage and open it as a URL dashboard inside the console. It takes about 20 minutes. The app uses the Dashboard SDK (`@thinger-io/dashboard-sdk`), which needs Thinger.io 7.4 or later. The app never handles credentials: inside the console it receives the session of the person viewing it, so it can read exactly what that person can read. ## What you need - A Thinger.io account. On the free Cloud account your server is `iot.thinger.io`; on a private instance, use your own domain wherever this tutorial says `YOUR_SERVER`. - A Data Bucket with a numeric `temperature` field, such as the `climate` bucket of [From an ESP32 to a dashboard](https://docs.thinger.io/guides/esp32-to-dashboard.md). - Node.js 20 or later, and the `thinger` [CLI](https://docs.thinger.io/reference/cli.md) signed in to your account. ## Create the project **Step 1: Create a Vite project** ```bash npm create vite@latest climate-app -- --template vanilla-ts cd climate-app npm install ``` Any bundler works. `thinger dashboard init` creates a ready-made React or Angular project instead; see [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md). **Step 2: Install the SDK** ```bash npm install @thinger-io/dashboard-sdk ``` **Step 3: Use relative asset URLs** A File Storage serves the app from a folder, so build it with relative URLs: **vite.config.ts** ```ts import { defineConfig } from 'vite'; export default defineConfig({ base: './', }); ``` ## Read the bucket **Step 1: Write the page** Replace `index.html` with a heading, a status line and an empty table: **index.html** ```html Climate

Climate

Connecting…

TimeTemperature (°C)
``` **Step 2: Subscribe to the bucket** Replace `src/main.ts`. The app waits for `Thinger.ready()`, then subscribes to the last 6 hours of the bucket: the callback runs with the records at once and again whenever the bucket is written. **src/main.ts** ```ts import { Thinger } from '@thinger-io/dashboard-sdk'; import './style.css'; const BUCKET = 'climate'; type Reading = { ts: number; temperature: number }; const status = document.querySelector('#status')!; const rows = document.querySelector('#rows')!; function render(data: Reading[]) { rows.replaceChildren( ...data.map((r) => { const tr = document.createElement('tr'); tr.innerHTML = `${new Date(r.ts).toLocaleString()}${r.temperature.toFixed(1)}`; return tr; }), ); status.textContent = `${data.length} readings from the last 6 hours`; } try { await Thinger.ready(); Thinger.buckets.subscribe(BUCKET, { from: '6h', items: 50 }, (data, err) => { if (err) { status.textContent = `Cannot read ${BUCKET}: ${err.message}`; return; } render(data ?? []); }); } catch { status.textContent = 'Open this app from a Thinger.io dashboard.'; } ``` Replace `src/style.css` with your own styles, and delete the other files of the Vite example in `src/`. The [Dashboard SDK reference](https://docs.thinger.io/reference/dashboard-sdk.md) lists every module (devices, buckets, properties, alarms, storages…) and the rules an app follows inside the console, such as hash routing and no `localStorage`. **Step 3: Build it** ```bash npm run build ``` The build is in `dist/`. ## Publish it The app goes to a public [File Storage](https://docs.thinger.io/platform/file-storages.md), and a URL dashboard points at its folder. ### Console The console shows dashboard apps but does not create URL dashboards. Go to **File Storages**, click **Create a File Storage**, create a public storage called `climate_app` and upload the contents of `dist/` to it, keeping the `assets` folder. Then create the dashboard with the API, the CLI or an agent. ### API Upload each file of `dist/` to a public storage named `climate_app` (see [File Storages](https://docs.thinger.io/platform/file-storages.md)), then create the dashboard with `source: "url"` and the folder of the storage, with the trailing slash: **API call:** `POST /v1/users/{user}/dashboards` ([reference](https://docs.thinger.io/reference/rest-api/dashboards.md#dashboard-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/dashboards" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dashboard": "climate_app", "name": "Climate app", "source": "url", "url": "/v1/users/YOUR_USER/storages/climate_app/files/" }' ``` ### CLI ```bash thinger dashboard publish dist --storage climate_app --to dashboard:climate_app --name "Climate app" ``` The command creates the public storage if it is missing, uploads `dist/` and creates the dashboard pointing at it. It prints the console link of the dashboard. Add `--preview` to also get a temporary read-only link that opens the app outside the console. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-dashboard-publish). ### AI **Prompt for an AI agent:** > Publish the dist folder of my climate-app project to a public storage called climate_app and create a dashboard called climate_app that shows it. The agent uses `thinger_resource_call` with the type `dashboard` and the action `publish`. See [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md). To publish a new version, build again and run the same `publish` command: consoles that have the app open load the new files on their next reload. ## Result Go to **Dashboards** and open **Climate app**. The console shows your app in its layout, with the latest temperatures of the bucket, and a new row appears each time the bucket gets a record. ![Climate app dashboard inside the console, with a table of the latest temperature and humidity readings of the climate bucket](https://docs.thinger.io/screenshots/guide-dashboard-app-result.webp) *The Climate app inside the console* If the app shows "Open this app from a Thinger.io dashboard", you opened the storage file directly, without a session: open it from **Dashboards** or with a preview link. ## Next steps - [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md): Every function and type of @thinger-io/dashboard-sdk, the package for dashboards built as web apps, plus how to start, publish and share them. - [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md): Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. - [Provision a device fleet](https://docs.thinger.io/guides/fleet-provisioning.md): Define a product with properties, a bucket and a dashboard, and let every unit of your fleet register itself with Auto Provision when it first connects. --- Source: https://docs.thinger.io/guides/per-device-alarm-limits.md # Alert on per-device temperature limits > Raise an alarm when a sensor leaves its own temperature range, kept in a property with a default for the product, and email it. This guide raises an alarm when a climate sensor leaves its own temperature range. The range lives in a `limits` property: the product holds the default for every sensor, and a sensor that needs another range overrides it. One alarm rule watches every sensor, and an email goes out when an alarm is activated and when it clears. ## Before you start - A product whose devices write a `temperature` field to a Data Bucket tagged with `device`, such as the `env_sensor` product and its `climate` bucket of [Provision a device fleet](https://docs.thinger.io/guides/fleet-provisioning.md). A [product bucket](https://docs.thinger.io/platform/products/buckets.md) with a fixed ID has the tag. This guide uses the sensor `greenhouse_01`. - For the API calls, an [access token](https://docs.thinger.io/platform/access-tokens.md) (`YOUR_TOKEN`) that can manage products, devices, endpoints and alarms. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the domain of your private instance. For the CLI, the `thinger` [CLI](https://docs.thinger.io/reference/cli.md) signed in to your account. ## Steps **Step 1: Set the default range on the product** Give the product a `limits` property with the range of most sensors, `{"min_temp": 5, "max_temp": 30}`. Every device of the product inherits it. In the console, open the product on its **Properties** tab and add it (see [Set a value for every device](https://docs.thinger.io/platform/products/properties.md#set-a-value-for-every-device)), or use the CLI: ```bash thinger product property set env_sensor limits '{"min_temp": 5, "max_temp": 30}' ``` ![Properties tab of a product with the limits property, whose value has max_temp 30 and min_temp 5](https://docs.thinger.io/screenshots/guide-alarm-limits-product-property.webp) *The default range in the Properties tab of the product* **Step 2: Override the range of a sensor** Give `greenhouse_01` its own `limits`, `{"min_temp": 10, "max_temp": 35}`, in the **Properties** tab of the device (see [Properties](https://docs.thinger.io/platform/properties.md)), or with the CLI: ```bash thinger device property set greenhouse_01 limits '{"min_temp": 10, "max_temp": 35}' ``` The device value wins over the product value. Delete it to use the default again. **Step 3: Create the email endpoint** Create the `alarm_email` endpoint of [Send an email](https://docs.thinger.io/platform/alarms/notifications.md#send-an-email). Its subject and body take the rule, the event, the device and the values from the alarm, so it serves this rule and any other. **Step 4: Check what the rule will read** Before you create the rule, read its two sources. The rule ID in the path does not need to exist yet. The `limits` source must return one entry per sensor, with the value of the device or of the product: **API call:** `POST /v1/users/{user}/alarms/rules/{rule}/test-source` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-testrulesourcetest-source)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/climate_range/test-source" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "limits", "source": "device_property", "device_property": {"property": "limits", "product": "env_sensor"}}' ``` Send `{"name": "climate", "source": "bucket", "bucket": {"id": "climate", "mapping": ["temperature"], "group_by": ["device"], "aggregation": {"period": "15m", "type": "mean"}}}` to check the bucket source: one entry per sensor with its mean `temperature`. In the console, the **Test Source** button of each source does the same once the rule exists. **Step 5: Create the rule** The rule reads the 15-minute mean temperature of each sensor and its `limits`, and compares them every 5 minutes: - activation: **IS OUTSIDE RANGE** from `limits.value.min_temp` to `limits.value.max_temp`, in 2 checks in a row; - normalization: **IS WITHIN RANGE** with a margin of 1 degree, for 15 minutes, so a temperature on the limit does not raise and clear the alarm on every check; - the `alarm_email` endpoint on activation and normalization, and a reminder every 4 hours. In the console, go to **Alarms > Rules**, click **Add Rule** and set these values in the form and its tabs (see [Alarm rules](https://docs.thinger.io/platform/alarms/rules.md)). The **Activation** tab holds the condition, the confirmation and the notification: ![Activation tab of the climate_range alarm rule with the condition climate.temperature IS OUTSIDE RANGE from limits.value.min_temp to limits.value.max_temp, a Sequence confirmation of 2 consecutive events and the Alarm email endpoint as notification](https://docs.thinger.io/screenshots/guide-alarm-limits-activation.webp) *Activation of the rule: outside the limits of each sensor, 2 checks in a row* With the API: **API call:** `POST /v1/users/{user}/alarms/rules` ([reference](https://docs.thinger.io/reference/rest-api/alarms.md#alarm-createrule)) ```bash curl -X POST "https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rule": "climate_range", "name": "Temperature out of range", "description": "15-minute mean temperature outside the limits of each sensor", "enabled": true, "config": { "severity": 3, "check_interval": { "value": 5, "magnitude": "minute" }, "data": { "sources": [ { "name": "climate", "source": "bucket", "bucket": { "id": "climate", "mapping": ["temperature"], "group_by": ["device"], "aggregation": { "period": "15m", "type": "mean" } } }, { "name": "limits", "source": "device_property", "device_property": { "property": "limits", "product": "env_sensor" } } ] }, "activation": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "outside", "min": "limits.value.min_temp", "max": "limits.value.max_temp" } ], "confirmation": { "mode": "sequence", "sequence": { "value": 2 } }, "notifications": [ { "type": "endpoint", "id": "alarm_email" } ] }, "normalization": { "conditions": [ { "operator": "and", "type": "value_check", "field": "climate.temperature", "comparison": "inside", "min": "limits.value.min_temp + 1", "max": "limits.value.max_temp - 1" } ], "confirmation": { "mode": "timespan", "timespan": { "value": 15, "magnitude": "minute" } }, "notifications": [ { "type": "endpoint", "id": "alarm_email" } ] }, "reminder": { "type": "interval", "interval": { "value": 4, "magnitude": "hour" }, "notifications": [ { "type": "endpoint", "id": "alarm_email" } ] } } }' ``` **Step 6: Evaluate the rule** Open the rule, go to the **Evaluation** tab and click **Evaluate**. Each sensor appears in one tab, with its temperature and its limits under **Values**: **Activations** for the sensors out of their range now, **Normalizations** for those inside the range with the margin, and **No Action** for those in between. The API does the same with `test-rule` (see [Test a rule](https://docs.thinger.io/platform/alarms/rules.md#test-a-rule)). **Step 7: Send a test email** In the **Activations** or **Normalizations** tab, click **Notification** on a sensor. The `alarm_email` endpoint sends a real email with the values of that sensor. ## Result Every 5 minutes the rule compares each sensor with its own range: `greenhouse_01` raises an alarm below 10 °C or above 35 °C, and the other sensors of the product below 5 °C or above 30 °C. After 2 checks out of range, the alarm appears as **Activated** in **Alarms** and `ops@example.com` receives an email with the subject `[activation] Temperature out of range on Greenhouse 01`. While nobody acknowledges it, a reminder arrives every 4 hours. When the temperature stays 1 degree inside the range for 15 minutes, the alarm is **Cleared** and a `[normalization]` email arrives. To change the range of a sensor, or of every sensor, change the `limits` property: the next check uses the new values, with no change to the rule. ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | **Evaluate** lists every sensor under **Skipped** with `missing data sources` | One of the sources returns nothing for them: the bucket has no `device` tag or the source does not group by it, the sensors wrote nothing in the last 15 minutes, or there is no `limits` property on the device or its product. | Check each source with **Test Source**. | | A sensor is never activated although it is out of range | It is disabled, or it is not in the `env_sensor` product. | The property source only reads enabled devices of the product in its filter. | | **Evaluate** warns that the activation expression failed to initialize | A value, `min` or `max` is a number instead of a string, or is empty. | Write the values as strings: `"30"`, `"limits.value.max_temp"`. | | The alarm is activated but no email arrives | The endpoint is disabled or failed. | Test the endpoint in **Endpoints** and watch its `endpoint_call_response` events. | ## Next steps - [Alarm rules](https://docs.thinger.io/platform/alarms/rules.md): Configure every part of an alarm rule, from data sources and conditions to confirmation and reminders, and test it before you enable it. - [Alarm notifications](https://docs.thinger.io/platform/alarms/notifications.md): What alarm rules send to your endpoints when an alarm activates, clears or reminds, with every field of the payload and email and webhook examples. - [Alarms](https://docs.thinger.io/platform/alarms.md): Define alarm rules that watch bucket data, device properties or connection status, and notify through endpoints when a condition is met. - [Properties](https://docs.thinger.io/platform/properties.md): Store configuration and state as named JSON values on devices, products, asset types and groups, projects and your account, and read them from anywhere. --- Source: https://docs.thinger.io/guides/white-label.md # White-label the console > Offer the Thinger.io console with your logo, colors, hostname and emails, from the brand to the domain and the email templates. **Plan:** Medium plan and above In this tutorial you give the console of your instance your own identity: your logos and colors, your hostname with its certificate, and the emails your users receive. You need to be an administrator of the instance. It takes about 30 minutes, plus the time your DNS takes to propagate. ## What you need - A Thinger.io private instance on the Medium plan or above, and an administrator account on it. `YOUR_SERVER` is the hostname you use today to open the console. - A hostname of your own, such as `iot.example.com`, and access to its DNS. - Your logos as PNG or WebP files. - Optional: an SMTP server or Amazon SES account, if the emails must leave from your own address. ## Create the brand A [brand](https://docs.thinger.io/administration/brands.md) is the look of the console on one hostname. Its ID is that hostname. **Step 1: Add the brand** ### Console Go to **Administration > Brands** and click **Add Brand** (or **Create a Brand** if you have none). Set the **Domain Name** to `iot.example.com`, add a **Description** if you want and click **Add Brand**. ### API `YOUR_TOKEN` is an access token of an administrator. **API call:** `POST /v1/brands` ([reference](https://docs.thinger.io/reference/rest-api/brands.md#brand-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/brands" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "brand": "iot.example.com", "name": "Example IoT", "enabled": true, "config": { "title": "Example IoT Console", "copyright": "© Example Inc.", "style": { "topBar": { "background": "#132533", "color": "#ffffff" } } } }' ``` ### CLI ```bash thinger admin brand create iot.example.com -n "Example IoT" -s enabled=true \ -s 'config.title=Example IoT Console' -s 'config.copyright=© Example Inc.' \ -s 'config.style.topBar.background=#132533' -s 'config.style.topBar.color=#ffffff' ``` ### AI **Prompt for an AI agent:** > Create a brand for iot.example.com with the title Example IoT Console and a dark blue top bar with white text. The agent uses `thinger_resource_create` with the `brand` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). **Step 2: Set the visual identity** Open the brand and fill in its tabs. Save each tab before you move to the next one. | Tab | What to set | |---|---| | **Information** | **Page title**, **Company Name**, **Contact Email**, **Copyright**, and whether the menu shows the **Community Links**. | | **Logos** | **Favicon**, **Platform Logo**, **Menu Logo** and **Menu Icon**. | | **Top Bar** | **Top Bar Background** and **Top Bar Text** colors. | | **Login** | **Background Color** or **Background Image**, and the **Box Location** of the login form. | | **PWA** | Name, colors and icons of the app users can install from the browser. | ![Logos tab of a brand with the favicon, platform logo, menu logo and menu icon](https://docs.thinger.io/screenshots/white-label-brand-logos.webp) *Logos tab of a brand* **Step 3: Decide who can sign up** On **Accounts**, choose whether anyone can sign up on this hostname (**Public Sign-up**), which sign-in methods the login page offers and whether accounts created on other hostnames can sign in here (**Cross Sign-in**). Each option is described in [Accounts on a brand](https://docs.thinger.io/administration/brands.md#accounts-on-a-brand). > **Warning** > > Keep at least one sign-in method that an administrator can use, or nobody can sign in on this hostname. ## Connect your domain A [domain](https://docs.thinger.io/administration/domains.md) makes the hostname reach your instance over HTTPS. The brand applies as soon as the console is opened on that hostname. **Step 1: Point the DNS to your instance** In your DNS provider, create a `CNAME` record from `iot.example.com` to `YOUR_SERVER`, or an `A` record with the public IP address of your instance. Port 80 of the instance must be reachable from the internet, because the certificate is checked over HTTP. **Step 2: Add and verify the domain** ### Console Go to **Administration > Domains** and click **Add Domain** (or **Create a Domain**). Set the **Domain Name** to `iot.example.com` and click **Add Domain**. Open the domain and, in **DNS Configuration**, click **Verify domain**. ### API **API call:** `POST /v1/domains` ([reference](https://docs.thinger.io/reference/rest-api/domains.md#domain-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/domains" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"domain": "iot.example.com"}' ``` **API call:** `POST /v1/domains/{domain}/verify` ([reference](https://docs.thinger.io/reference/rest-api/domains.md#domain-verify)) ```bash curl -X POST "https://YOUR_SERVER/v1/domains/iot.example.com/verify" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger admin domain create iot.example.com thinger admin domain verify iot.example.com ``` ### AI **Prompt for an AI agent:** > Add the domain iot.example.com to my instance and verify it. The agent uses `thinger_resource_create` with the `domain` type and `thinger_resource_call` with its `verify` action. When the certificate is issued, the domain shows **Domain verified**. If verification fails, the console shows the reason; usually the DNS record has not propagated yet. ## Customize the emails The brand also sets the emails the instance sends to the users of this hostname. **Step 1: Edit the templates** Open the brand and go to **Email Templates**. Edit the sender, the subject and the HTML body of **Email Verification**, **Create Password**, **Forgot Password** and **Device Disabled**. Keep the link with the code in each template; the placeholders are listed in [Email templates](https://docs.thinger.io/administration/brands.md#email-templates). Link your logo by its public address, such as `https://iot.example.com/brand/images/dark_logo.png`, because email clients do not load embedded images. **Step 2: Send from your own server** To send from your own address, go to **Email Settings**, turn on **Custom Brand Email** and enter the settings of your SMTP server or Amazon SES. Without it, the emails go out through the mail settings of the instance. **Step 3: Send a test email** On **Email Templates**, click **Test Email**. The instance sends the saved template to your own address. ## Result Opening `https://iot.example.com` shows the login page with your colors and logo, over a valid certificate. After signing in, the menu, the top bar and the page title are yours, and the emails of this hostname arrive with your templates. To go back to the default look, remove the brand in **Administration > Brands**; the domain and its certificate stay. ## Next steps To give your users the mobile app with your brand too, see [White-label app](https://docs.thinger.io/get-started/mobile-app.md#white-label-app). - [Brands](https://docs.thinger.io/administration/brands.md): Give the console your own logos, colors, login page, sign-up rules and emails on each hostname of your instance. - [Domains](https://docs.thinger.io/administration/domains.md): Serve the console and the API of your instance on your own hostname, with a TLS certificate that renews automatically. - [Identity Providers](https://docs.thinger.io/administration/identity-providers.md): Let users sign in to your instance with your company's single sign-on (SSO) over OpenID Connect, such as Microsoft Entra ID, Google or Auth0. --- Source: https://docs.thinger.io/guides/shelly-plug-s.md # Shelly Plug S > Connect a Shelly Plug S smart plug to Thinger.io over MQTT, without reflashing it, and control it with a ready-made product. This guide connects a Shelly Plug S, a Wi-Fi smart plug with power metering, to Thinger.io. The plug speaks MQTT out of the box, so you keep its original firmware: you point it to your instance, and the Shelly Plug S product stores its state, power and energy and lets you switch it on and off. ![Shelly Plug S smart plug, a white plug-in socket with the Shelly logo](https://docs.thinger.io/images/guides/shelly-plug-s.webp) *Shelly Plug S* ## Before you start - A Thinger.io account. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the hostname of your private instance, and `YOUR_USER` is your username. - The [Shelly Plug S](https://docs.thinger.io/plugins/shelly-plug-s.md) plugin, installed from **Plugins > Marketplace**. It creates the product. Plugins are not available on the free Cloud account; there, create the same product by hand with the profile described in [What the product does](#what-the-product-does). - The plug connected to your Wi-Fi network, and its web interface open in a browser. ## Steps **Step 1: Find the device ID** In the web interface of the plug, open **Internet & Security** and then **Advanced - Developer Settings**. ![Main menu of the Shelly Plug S web interface, with the Timer, Weekly schedule, Internet & Security, Safety, Actions and Settings buttons](https://docs.thinger.io/images/guides/shelly-plug-s-web-menu.webp) *Web interface of the plug* The MQTT client ID of the plug is not editable: it shows in the **Will Topic**, such as `shellies/shellyplug-s-C18B12/online`. The part between the slashes, `shellyplug-s-C18B12`, is the ID the device gets in Thinger.io. **Step 2: Point the plug to your instance** On the same screen, enable action execution via MQTT and fill in: | Field | Value | |---|---| | **Username** | `YOUR_USER` | | **Password** | The device credentials you choose for this plug. | | **Server** | `YOUR_SERVER:1883` | ![Advanced - Developer Settings of the Shelly Plug S with MQTT enabled, the username, the password, the server on port 1883 and the Will Topic shellies/shellyplug-s-C18B12/online](https://docs.thinger.io/images/guides/shelly-plug-s-mqtt-settings.webp) *MQTT settings of the plug* Save. Enabling MQTT turns off the connection of the plug to the Shelly cloud. **Step 3: Let the product create the device** The product's [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md) rule accepts any device whose ID matches `shellyplug-s-[0-9A-F]+`. On its first connection, the device is created as an MQTT device of the product, with the password it sent as its device credentials. That first connection is refused; the plug retries and connects on the next attempt. To use other credentials, or a plug with another ID, create the device first as an MQTT device in **Devices** with the plug's client ID as its device ID and the product **Shelly Plug S**. See [MQTT](https://docs.thinger.io/devices/mqtt.md). ## What the product does ![The topics the plug publishes feed the relay and power properties and the three Data Buckets of the product, and the relay API resource publishes the command topic of the plug](https://docs.thinger.io/diagrams/shelly-plug-s-topics.svg) *Shelly Plug S topics to the product* The product listens to the topics the plug publishes, so the device needs no code. The [device topics](https://docs.thinger.io/devices/mqtt.md#topics) use the placeholder `{{device}}` for the device ID. ### Properties | Property | Topic | Payload | |---|---|---| | `relay` | `shellies/{{device}}/relay/0` | `{{payload:toBoolean}}` | | `power` | `shellies/{{device}}/relay/0/power` | `{{payload}}` | The plug reports its relay as the text `on` or `off`. `{{payload:toBoolean}}` passes it through the `toBoolean` function of the product [script](https://docs.thinger.io/platform/products/script.md), so the [property](https://docs.thinger.io/platform/products/properties.md) holds `true` or `false`. ### Data Buckets | Data Bucket | Topic | Payload | |---|---|---| | `shelly_plug_s_power` | `shellies/{{device}}/relay/{{relay}}/{{field=energy\|power}}` | `{{payload:processData}}` | | `shelly_plug_s_temperature` | `shellies/{{device}}/{{field=temperature\|overtemperature}}` | `{{payload}}` | | `shelly_plug_s_announce` | `shellies/announce` | `{{payload}}` | - `{{field=energy|power}}` listens to both topics and stores them in one record, with a field named after each topic: `energy` and `power`. - `{{relay}}` captures the relay number from the topic and stores it as a tag of the record, so you can filter by relay. - `processData` converts the energy, which the plug reports in watt-minutes, to kWh. - The plug publishes its model, firmware version (`fw_ver`), IP address (`ip`) and whether a firmware update is available (`new_fw`) on `shellies/announce`. A [product bucket](https://docs.thinger.io/platform/products/buckets.md) is created with its first message, so the first reading of each topic only creates the bucket and the data starts with the next one. ### Switch the plug The API resource `relay` publishes on `shellies/{{device}}/relay/0/command`, with the payload `{{payload:toOnOff=property.relay}}`. `toOnOff` turns `true` and `false` into the `on` and `off` the plug expects, and `=property.relay` makes the current state of the relay the default value, so a switch in a dashboard or in the device API starts in the right position. #### Console Open the device in **Devices**, go to its API and set the `relay` input to on or off. #### API `YOUR_DEVICE` is the device ID of the plug, and `YOUR_TOKEN` an access token of your account. **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/relay" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d 'false' ``` #### CLI The input is a bare value, so pass it on standard input: ```bash echo false | thinger device resource call YOUR_DEVICE relay --from - ``` #### AI **Prompt for an AI agent:** > Turn off the Shelly plug YOUR_DEVICE. The agent uses `thinger_resource_call` with the type `device_resource` and the action `call` on the `relay` resource. See [MCP tools](https://docs.thinger.io/ai/tools.md). ### Script ```js function toBoolean(value){ return value == "on" ? true : false; } function toOnOff(value){ return value ? "on" : "off"; } function processData(value){ // energy is missing when the plug is off if(!value.energy) value.energy=0; // convert energy from watt-minutes to kWh value.energy = value.energy/60/1000; return value; } ``` To find the topics and payloads of other devices, use the device's events inspector, which shows every MQTT message it publishes, or the vendor's documentation. ## Result The plug appears in **Devices**, connected and assigned to the product. Its `relay` and `power` properties follow the plug, the three Data Buckets fill with its readings, and the product dashboard shows the power switch, the consumption and the temperature. ## Next steps - [MQTT](https://docs.thinger.io/devices/mqtt.md): Connect an MQTT client to the Thinger.io broker, publish and subscribe to topics, and store the messages in a Data Bucket. - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [API resources](https://docs.thinger.io/platform/products/api-resources.md): Add device resources to every device of a product, so dashboards, the API and agents can call HTTP, MQTT and virtual devices like IOTMP ones. --- Source: https://docs.thinger.io/guides/shelly-plus-1-pm.md # Shelly Plus 1PM > Connect a Shelly Plus 1PM relay with power metering to Thinger.io over MQTT and switch it, read its status and store its energy readings. This guide connects a Shelly Plus 1PM, a one-channel Wi-Fi relay with power metering, to Thinger.io over MQTT, keeping its original firmware. The Shelly Plus 1PM product turns its status messages into a property and a Data Bucket, and gives the device API resources to switch the relay and query the device. ![Shelly Plus 1PM, a small square relay module with its screw terminals](https://docs.thinger.io/images/guides/shelly-plus-1pm.webp) *Shelly Plus 1PM* ## Before you start - A Thinger.io account. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the hostname of your private instance, and `YOUR_USER` is your username. - The [Shelly Plus 1PM](https://docs.thinger.io/plugins/shelly-plus-1pm.md) plugin, installed from **Plugins > Marketplace**. It creates the product. Plugins are not available on the free Cloud account; there, create the same product by hand with the profile described in [What the product does](#what-the-product-does). - The relay connected to your Wi-Fi network, with access to its web interface. ## Steps **Step 1: Configure MQTT on the relay** In the web interface of the relay, enable MQTT and set the connection with these values. The names of the settings are those of the Shelly firmware; see the Shelly documentation if your version differs. | Setting | Value | |---|---| | Server | `YOUR_SERVER:1883` | | Client ID | The device ID, such as `shellyplus1pm-441793a50208`: the default client ID of the relay. | | Username | `YOUR_USER` | | Password | The device credentials you choose for this relay. | The relay must publish its switch status, which it does on `/status/switch:0`, and accept commands on `/rpc`. **Step 2: Let the product create the device** The product's [Auto Provision](https://docs.thinger.io/platform/products/auto-provision.md) rule accepts any device whose ID matches `shellyplus1pm-[a-fA-F0-9]+`. On its first connection, the device is created as an MQTT device of the product, with the password it sent as its device credentials. That first connection is refused; the relay connects on its next attempt. To use a different ID, create the device first as an MQTT device in **Devices**, with the product **Shelly Plus 1PM**. See [MQTT](https://docs.thinger.io/devices/mqtt.md). ## What the product does The relay sends its status as JSON on `{{device}}/status/switch:0`. The product keeps it in the [property](https://docs.thinger.io/platform/products/properties.md) `relay` and in the [Data Bucket](https://docs.thinger.io/platform/products/buckets.md) `shelly_plus_1pm_status`, both with the payload `{{payload:statusProcessor}}`. The function `statusProcessor` of the product [script](https://docs.thinger.io/platform/products/script.md) keeps the useful fields and converts the energy from watt-minutes to kWh: ```js function statusProcessor(payload){ return { energy: payload.aenergy.total/60/1000, power: payload.apower, current: payload.current, output: payload.output, temperature: payload.temperature.tC, voltage: payload.voltage }; } ``` ### API resources Each [API resource](https://docs.thinger.io/platform/products/api-resources.md) publishes an RPC request on `{{device}}/rpc`. The relay answers on the topic given in `src` followed by `/rpc`, and the resource returns the `result` of the answer: | API resource | RPC method | Returns | |---|---|---| | `relay` | `Switch.Set` | Nothing. The input is `true` or `false`. | | `status` | `Shelly.GetStatus` | The full status, such as the Wi-Fi IP address. | | `info` | `Shelly.GetDeviceInfo` | Model, firmware version and device ID. | | `config` | `Shelly.GetConfig` | The configuration of the relay. | | `location` | `Shelly.DetectLocation` | The location of the relay, for a map. | | `updates` | `Shelly.CheckForUpdate` | The available firmware updates. | The request of `relay` is: ```json {"src":"{{device}}/switch/set","method":"Switch.Set","params":{"id":0,"on":{{payload=property.relay.output}}}} ``` `=property.relay.output` makes the current state of the relay the default value of the input, so a switch starts in the right position. ## Switch the relay ### Console Open the device in **Devices**, go to its API and set the `relay` input to on or off. ### API `YOUR_DEVICE` is the device ID of the relay, and `YOUR_TOKEN` an access token of your account. **API call:** `POST /v3/users/{user}/devices/{device}/resources/{resource}` ([reference](https://docs.thinger.io/reference/rest-api/devices.md)) ```bash curl -X POST "https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/relay" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d 'false' ``` ### CLI The input is a bare value, so pass it on standard input: ```bash echo false | thinger device resource call YOUR_DEVICE relay --from - ``` ### AI **Prompt for an AI agent:** > Switch off the Shelly relay YOUR_DEVICE. The agent uses `thinger_resource_call` with the type `device_resource` and the action `call` on the `relay` resource. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Result The relay appears in **Devices**, connected and assigned to the product. Its `relay` property holds the output, power, voltage, current, energy and temperature of the last status, the Data Bucket `shelly_plus_1pm_status` keeps every status, and the product dashboard shows the power switch, the consumption and the device information. ## Next steps - [MQTT](https://docs.thinger.io/devices/mqtt.md): Connect an MQTT client to the Thinger.io broker, publish and subscribe to topics, and store the messages in a Data Bucket. - [Products](https://docs.thinger.io/platform/products.md): Define a product once, with its properties, buckets, flows, API resources, script and dashboard, and apply it to a whole fleet of devices. - [Shelly Plug S](https://docs.thinger.io/guides/shelly-plug-s.md): Connect a Shelly Plug S smart plug to Thinger.io over MQTT, without reflashing it, and control it with a ready-made product. --- Source: https://docs.thinger.io/guides/kunbus-revpi.md # Kunbus Revolution Pi > Connect a Kunbus Revolution Pi to Thinger.io with the Linux client and open its terminal, PiCtory and Node-RED from the console. This guide connects a Kunbus Revolution Pi (RevPi) to Thinger.io and makes its local web tools, PiCtory and Node-RED, available from the console. The RevPi is an industrial PC for DIN rail built on the Raspberry Pi Compute Module, and it runs a Raspberry Pi OS image, so it connects with the standard [Linux client](https://docs.thinger.io/devices/linux.md). ![Revolution Pi Connect SE, a grey and orange DIN rail module with two Ethernet ports and USB ports](https://docs.thinger.io/images/guides/revpi-connect-se.webp) *Revolution Pi Connect SE* ## Before you start - A Thinger.io account. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or the hostname of your private instance. - A RevPi with network access and a shell on it (SSH or a local console). ## Steps **Step 1: Connect the RevPi with the Linux client** Create an IOTMP device for the RevPi and install the Linux client on it, as a service, following [Linux](https://docs.thinger.io/devices/linux.md). The device shows as connected in **Devices** when the client starts. **Step 2: Open its terminal** The Linux client gives the device a terminal and a file browser with no extra setup. Open the device and choose **Terminal** in its menu to get a shell on the RevPi. See [Remote tools](https://docs.thinger.io/devices/remote-tools.md). **Step 3: Create a product for your RevPi units** Go to **Products** and create a product for your RevPi units, then assign the device to it. The product holds the services of the next step, so every RevPi of the product gets them. See [Products](https://docs.thinger.io/platform/products.md). **Step 4: Add PiCtory and Node-RED as services** PiCtory, the configuration tool of the RevPi, and Node-RED, which the RevPi includes with the [node-red-contrib-revpi-nodes](https://flows.nodered.org/node/node-red-contrib-revpi-nodes) nodes to read and write its I/O, are web applications that run on the RevPi itself. Expose them as [product services](https://docs.thinger.io/platform/products/services.md): open the product, go to **Services** and click **Add** for each one. | Field | PiCtory | Node-RED | |---|---|---| | **Service Identifier** | `pictory` | `node_red` | | **Service Type** | **Web Service** | **Web Service** | | **Target Hostname** | `127.0.0.1` | `127.0.0.1` | | **Target Port** | `41080` | `1880` | | **SSL/TLS** | Off | Off | | **Name** (on **Settings**) | `PiCtory` | `Node-RED` | `127.0.0.1` is the RevPi itself. The ports are those of a standard RevPi image; if you changed them, use yours. ### Console Fill in the fields of the table in the **New Service** dialog and click **Create**. ![New Service dialog of the revpi product with a Web Service for PiCtory on 127.0.0.1 port 41080](https://docs.thinger.io/screenshots/kunbus-revpi-service-pictory.webp) *Web Service for PiCtory* ### API `YOUR_USER` is your username, `YOUR_TOKEN` an access token of your account, and `revpi` the ID of the product. **API call:** `PUT /v1/users/{user}/products/{product}/services/{service}` ([reference](https://docs.thinger.io/reference/rest-api/products.md#product-updateservices)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/YOUR_USER/products/revpi/services/node_red" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "type": "web", "name": "Node-RED", "enabled": true, "target": { "address": "127.0.0.1", "port": 1880, "secure": false } }' ``` ### CLI ```bash thinger product service create revpi node_red -n Node-RED -s type=web -s enabled=true \ -s target.address=127.0.0.1 -s target.port=1880 -s target.secure=false ``` ### AI **Prompt for an AI agent:** > Add two web services to the product revpi: PiCtory on port 41080 and Node-RED on port 1880 of each device. The agent uses `thinger_resource_create` with the `product_service` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Result The RevPi shows as connected in **Devices**. Its menu has **Terminal**, **Explorer** and two more entries, **PiCtory** and **Node-RED**, which open those tools inside the console without opening any port of the RevPi to the internet. ## Next steps - [Linux](https://docs.thinger.io/devices/linux.md): Build the Thinger.io IOTMP client for Linux, connect a Raspberry Pi or any Linux computer, and run it as a service with remote terminal and files. - [Services](https://docs.thinger.io/platform/products/services.md): Reach the web interfaces and remote desktops of the devices of a product from the console, through the device connection, without opening ports. - [Remote tools](https://docs.thinger.io/devices/remote-tools.md): Open a shell, browse files and read the log of a connected device from the Thinger.io console, without VPNs or open ports. --- Source: https://docs.thinger.io/ai.md # AI and MCP > What an AI agent can do in your Thinger.io account through the MCP server, and where to start. An AI agent connected to Thinger.io can work with your account the way you do in the console: it reads device data, creates and configures resources, and builds dashboards. It connects through the Model Context Protocol (MCP), the standard way for AI clients such as Claude Code, Claude Desktop or Cursor to use external tools. > **Info: Today you connect through the CLI** > > The MCP server runs with the `thinger` CLI: you sign in once with `thinger login`, and your AI client starts `thinger mcp`. See [Connect an AI agent](https://docs.thinger.io/ai/connect.md). ## How it works The MCP server gives the agent a set of [tools](https://docs.thinger.io/ai/tools.md), such as `thinger_resource_list` or `thinger_resource_call`. Each time the agent uses a tool, the server calls the REST API of your Thinger.io server with the access token of your CLI profile. The agent can do exactly what that token allows, nothing more: see [Permissions](https://docs.thinger.io/ai/permissions.md). Most clients ask you to approve a tool call before it runs. Review the calls that change or delete data before you approve them. ## What you can ask an agent **Operate devices.** List devices and their state, read and call device resources, change properties, move devices between products. **Prompt for an AI agent:** > Which of my devices are disconnected right now, and when did each one last connect? **Analyze data.** Query Data Buckets with aggregation, compare devices and explain trends. **Prompt for an AI agent:** > Show me the hourly average temperature that YOUR_DEVICE stored in its Data Bucket over the last 24 hours, and tell me when it went above 30 °C. **Configure the platform.** Create and change products, endpoints, alarm rules, access tokens, asset types and groups, projects and file storages. **Prompt for an AI agent:** > Create an alarm rule that raises a warning when the battery property of any device of the product greenhouse drops below 20, and notifies me by email. **Build dashboards.** Create a dashboard app on the Dashboard SDK, develop it against real data and publish it. See [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md). **Prompt for an AI agent:** > Build a dashboard for YOUR_DEVICE with a chart of its temperature and humidity over the last week, and publish it as the dashboard of the device. **Administer a server.** On a private instance, with an administrator token: user accounts, cluster hosts, custom domains, brands, OAuth2 clients, identity providers and proxies. **Prompt for an AI agent:** > I have pointed the DNS of iot.example.com to the server. Add it as a custom domain and check that it resolves. **Use plugins.** Install, start and stop plugins, and call the API they serve. ## Explore the section - [Connect an AI agent](https://docs.thinger.io/ai/connect.md): Install the thinger CLI, sign in, and connect Claude Code, Claude Desktop or any other MCP client to your Thinger.io account. - [Permissions](https://docs.thinger.io/ai/permissions.md): What an AI agent is allowed to do in your Thinger.io account, how to limit it with an access token, and how to use it safely. - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. - [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md): Ask an AI agent to create a dashboard app on the Dashboard SDK, develop it against your real data and publish it. - [Docs for agents](https://docs.thinger.io/ai/docs-for-agents.md): The Thinger.io documentation in plain markdown for AI agents (llms.txt, llms-full.txt and a .md file per page), and the guides the MCP server serves. --- Source: https://docs.thinger.io/ai/connect.md # Connect an AI agent > Install the thinger CLI, sign in, and connect Claude Code, Claude Desktop or any other MCP client to your Thinger.io account. This guide connects an AI client to your Thinger.io account through the MCP server of the `thinger` CLI. At the end, the agent lists your devices. > **Info: Today you connect through the CLI** > > The MCP server runs on your computer with the `thinger` CLI, and works with any Thinger.io server: the free Cloud account or a private instance. Your AI client starts it with the command `thinger mcp`. ## Before you start - A Thinger.io account. Your server is `YOUR_SERVER`: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. - Node.js 20 or later. Check it with `node --version`. - An MCP client: Claude Code, Claude Desktop, Cursor or any other client that runs local (stdio) MCP servers. ## Steps **Step 1: Install the CLI** ```bash npm install -g @thinger-io/cli ``` Check that it works: ```bash thinger --version ``` **Step 2: Sign in** ```bash thinger login ``` The command asks for the sign-in method and the server, and stores the session in a profile: | Method | What happens | |---|---| | OAuth (browser) | The CLI shows a link and a code, and you approve the access in the browser, signed in to your server. The profile keeps an OAuth session with full access to your account. If the server does not offer it, the CLI says so and lets you choose another method. | | Token | You paste an access token you created in **Access Tokens**. The agent gets only its permissions: see [Permissions](https://docs.thinger.io/ai/permissions.md). | | Username and password | The CLI creates an access token named **Thinger CLI** in your account, with full access, and keeps it. `thinger logout` revokes it. | To sign in without questions, for example with a restricted token: ```bash thinger login --server YOUR_SERVER --username YOUR_USER --token YOUR_TOKEN ``` Here `YOUR_TOKEN` is an access token of your account. A bare host means HTTPS; for plain HTTP or a custom port, give the full URL (`http://YOUR_SERVER:8080`). **Step 3: Add the MCP server to your client** ### Claude Code ```bash claude mcp add thinger -- thinger mcp ``` This adds the server to the current project, only for you. Add `--scope user` to make it available in all your projects, or `--scope project` to share it with the project in a `.mcp.json` file: ```bash claude mcp add --scope user thinger -- thinger mcp ``` ### Claude Desktop In Claude Desktop, open **Settings > Developer** and click **Edit Config**. It opens `claude_desktop_config.json`, in `~/Library/Application Support/Claude/` on macOS and in `%APPDATA%\Claude\` on Windows. Add the server under `mcpServers`: **claude_desktop_config.json** ```json { "mcpServers": { "thinger": { "command": "thinger", "args": ["mcp"] } } } ``` Save the file, then quit Claude Desktop completely and open it again. If the server does not start, **Settings > Developer** shows the error and a **View logs** button. On macOS the log is `~/Library/Logs/Claude/mcp-server-thinger.log`. ### VS Code In VS Code, run **MCP: Add Server** from the Command Palette, or create `.vscode/mcp.json` in your project. VS Code lists its servers under `servers`, not `mcpServers`: **.vscode/mcp.json** ```json { "servers": { "thinger": { "type": "stdio", "command": "thinger", "args": ["mcp"] } } } ``` ### Other clients Any client that runs local MCP servers takes the same definition: the command `thinger` with the argument `mcp`. Cursor (`~/.cursor/mcp.json`, or `.cursor/mcp.json` in a project) and Windsurf (`~/.codeium/windsurf/mcp_config.json`) read it in this form: ```json { "mcpServers": { "thinger": { "command": "thinger", "args": ["mcp"] } } } ``` Codex reads it from `~/.codex/config.toml`: **config.toml** ```toml [mcp_servers.thinger] command = "thinger" args = ["mcp"] ``` For any other client, check in its documentation where it keeps its MCP servers. > **Warning: Without installing the CLI** > > In Claude Code or a CI job you can run the CLI with `npx` instead of installing it: > > ```bash > claude mcp add thinger -- npx -y @thinger-io/cli mcp > ``` > > Desktop apps are more fragile with `npx`: every start goes through npm and its cache, the first start is slow and needs the network, the version changes on its own, and on Windows the client needs `"command": "cmd"` with `"args": ["/c", "npx", "-y", "@thinger-io/cli", "mcp"]`. In Claude Desktop, VS Code, Cursor and other clients, install the CLI and use the `thinger` command. **Step 4: Check the connection** Open a new conversation and ask: **Prompt for an AI agent:** > List the devices of my Thinger.io account and tell me which ones are connected. The agent calls `thinger_resource_list` and answers with your devices. In Claude Code, `/mcp` shows the server as connected. ## Result The agent lists the devices of your account, with the permissions of the token of your profile. Every [MCP tool](https://docs.thinger.io/ai/tools.md) is available to it. ## Use several servers or accounts A profile is one server and one account, with its credentials. The first profile you create is the default, and the MCP server uses it. ```bash thinger profile add staging --no-activate thinger profile list thinger profile use staging ``` - `thinger profile add` signs in to another server or account and saves it as a new profile. The new profile becomes the default unless you pass `--no-activate`. - `thinger profile use` changes the default profile. The MCP server uses the new default from the next tool call. - The agent can use another profile for a single call: every tool takes a `profile` parameter, and `thinger_resource_list` with the type `profile` lists the profiles. Ask, for example: **Prompt for an AI agent:** > Compare the devices of my staging profile with the ones of my default profile and tell me which ones are missing in staging. To start the MCP server with another profile, set `THINGER_PROFILE` in the definition of the server. In Claude Code: ```bash claude mcp add thinger-staging -e THINGER_PROFILE=staging -- thinger mcp ``` Another account on the same server is not a profile: an administrator reaches it with the `user` parameter. See [Permissions](https://docs.thinger.io/ai/permissions.md#act-on-other-accounts). ## Use environment variables in CI Without a saved profile, for example in a CI job, set `THINGER_SERVER` and `THINGER_TOKEN`. They work for every command and for the MCP server: ```bash THINGER_SERVER=YOUR_SERVER THINGER_TOKEN=YOUR_TOKEN thinger mcp ``` - `THINGER_TOKEN` is an access token; `THINGER_SERVER` is its server, a host or a full URL. Set both: a token without a server is an error. - They take the place of the default profile, but not of a profile you name with `--profile` or `THINGER_PROFILE`. - While `THINGER_TOKEN` is set, `thinger login` warns you that the variable overrides the profile you sign in to. Keep the token in the secrets of your CI system, never in the repository. ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | The client cannot start the server | The client does not find `thinger` or `npx` on its path, which happens often with desktop apps. | Use the full path of the command (`which thinger` on macOS and Linux, `where thinger` on Windows), or install Node.js 20 or later. | | The client cannot start the server and its log shows `npm error EACCES` with a path under `~/.npm/_cacache` | The npm cache has files owned by root, usually from an earlier `sudo npm install`. `npx` cannot use it. | Give the cache back to your user with `sudo chown -R $(id -u):$(id -g) ~/.npm`, or install the CLI (`npm install -g @thinger-io/cli`) and use `"command": "thinger"`. | | Every tool fails with `not_configured` | There is no profile. | Run `thinger login`. | | Every tool fails with `unauthorized` and an HTTP 401 | The token of the profile expired or was revoked. | Run `thinger login` again. | | A tool fails with `unauthorized` and `Forbidden` (HTTP 403) | The token is valid but has no permission for that action. Signing in again does not change it. | Add the permission to the token in **Access Tokens**, or sign in with a token that has it. | | The server is not reachable because of its certificate | The server uses a self-signed certificate. | Self-signed certificates are accepted for `localhost`. For other hosts, set `THINGER_INSECURE=1` in the definition of the server, only on test servers. | ## Next steps - [Permissions](https://docs.thinger.io/ai/permissions.md): What an AI agent is allowed to do in your Thinger.io account, how to limit it with an access token, and how to use it safely. - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. - [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md): Ask an AI agent to create a dashboard app on the Dashboard SDK, develop it against your real data and publish it. - [CLI](https://docs.thinger.io/reference/cli.md): Every command and option of the thinger CLI, plus how to install it, sign in, use profiles, script it with JSON output and run its MCP server. --- Source: https://docs.thinger.io/ai/permissions.md # Permissions > What an AI agent is allowed to do in your Thinger.io account, how to limit it with an access token, and how to use it safely. An AI agent connected through the MCP server acts with the access token of your CLI profile: it can do what that token allows, and nothing more. To limit the agent, limit the token. > **Info: Today you connect through the CLI** > > The token is the one the `thinger` CLI keeps in the profile the MCP server uses. See [Connect an AI agent](https://docs.thinger.io/ai/connect.md). ## The token of your profile Every tool call of the agent is a call to the REST API of your server, signed with the token of the profile. The server checks it exactly as it checks any other API call: | How you signed in | Token the agent uses | What the agent can do | |---|---|---| | OAuth (browser) | The OAuth session you approved for the **Thinger CLI** client. | Everything your account can do: the client has full access. | | Username and password | A token named **Thinger CLI** that the CLI creates in your account. | Everything your account can do: the token has full access. | | Token | The access token you gave. | Only what its permissions allow. | | `THINGER_TOKEN` | The access token in the variable. | Only what its permissions allow. | With the browser sign-in, `thinger logout` forgets the session on your computer. The **Thinger CLI** token of the username and password sign-in appears in **Access Tokens** like any other. `thinger logout` revokes it, unless you add `--keep-token`; you can also delete it there, and the agent loses access at once. When the token does not allow a call, the tool fails with the error of the server, and the agent sees it: ```text Error [unauthorized]: Forbidden: the token or the account is not allowed to do this (not authorized). ``` ## Limit an agent with its own token To give an agent less than full access, create an access token with only the permissions it needs, and sign in with it. **Step 1: Create the token** In **Access Tokens**, create a token with the permissions the agent needs: for example, list and read devices and Data Buckets. To limit it to the resources of one project, create the token inside the project. How permissions work is in [Access Tokens](https://docs.thinger.io/platform/access-tokens.md#permissions). **Step 2: Sign in with it in a separate profile** ```bash thinger profile add agent --no-activate --server YOUR_SERVER --username YOUR_USER --token YOUR_TOKEN ``` Here `YOUR_TOKEN` is the token you just created, and `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. **Step 3: Start the MCP server with that profile** ```bash claude mcp add thinger-agent -e THINGER_PROFILE=agent -- thinger mcp ``` With a read-only token, the agent can list and read, and every attempt to create, change or delete fails with `unauthorized`. ## Serve only the tools that read To let an agent explore an account without offering it anything that writes, start the MCP server in read-only mode. In Claude Code: ```bash claude mcp add thinger-read -- thinger mcp --read-only ``` In a JSON configuration, add `"--read-only"` to the `args`, or set `THINGER_MCP_READ_ONLY=1` in its environment. The server then serves `thinger_resource_describe`, `_list`, `_get`, and `_call` with the actions that only read. The tools are a convenience, not a limit of the account: combine read-only mode with a read-only token when the limit matters. See [Read-only mode](https://docs.thinger.io/ai/tools.md#read-only-mode). ## Act on other accounts Most tools take a `user` parameter, and every CLI command takes `-u, --user`: they act on another account of the same server. This only works for an administrator of a private instance, with an administrator token. With any other token the call fails. The administration of the server is also reachable: user accounts, cluster hosts, custom domains, brands, OAuth2 clients, identity providers and proxies. These [resource types](https://docs.thinger.io/ai/tools.md#resource-types) are marked **Administrator** and need an administrator token too. An agent signed in as an administrator can change or delete other people's accounts and the configuration of the whole server: keep that profile for administration tasks only. ## The temporary token of dashboard development When an agent develops a dashboard app, the `dev` action of the `dashboard` type (and `thinger dashboard dev`) creates a temporary token so the app on your computer can call the server. That token: - has **full access** to your account, or to one project when you develop in the context of a project; - appears in **Access Tokens** as **Dashboard dev (temporary)**, with the ID `dashboard_dev` (`dashboard_dev_` and the project when you develop in a project); - lasts 8 hours by default, and is replaced each time you ask for a new link; - travels in the link to the app. The link only opens an app on your computer (`localhost`), unless you allow a remote address with `--allow-remote` (`allow_remote` in the action). Writes made by the app during development are real. Do not share the link. To revoke the token before it expires, delete it in **Access Tokens**. See [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md). The preview links of the `publish` action use a read-only token instead. ## Good practices - **Give the minimum.** Use a token with only the permissions the task needs. Use the username and password sign-in only for work where you trust the agent with everything. - **Use a project as the boundary.** A token created inside a project only reaches the resources of that project. - **Confirm what cannot be undone.** Deleting a resource or overwriting a file of a storage acts at once: the MCP server tells agents to ask before they do it; review those calls before you approve them in your client. Actions with a high impact, such as removing a plugin, restarting a host or replacing every entry of a product profile, first answer with what they would do and act only when the agent calls them again with `confirm: true`. See [Actions that ask first](https://docs.thinger.io/ai/tools.md#actions-that-ask-first). - **Separate production.** Keep production and test servers in different profiles, and do not make the production profile the default. Name it when you mean it (`profile` in the tools, `--profile` in the CLI). - **Revoke what you no longer use.** Delete tokens of agents you stopped using, and run `thinger logout` on computers you leave. ## Related pages - [Access Tokens](https://docs.thinger.io/platform/access-tokens.md): Create tokens with scoped permissions to call the Thinger.io REST API from scripts, apps and agents, and make them expire. - [Connect an AI agent](https://docs.thinger.io/ai/connect.md): Install the thinger CLI, sign in, and connect Claude Code, Claude Desktop or any other MCP client to your Thinger.io account. - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. --- Source: https://docs.thinger.io/ai/tools.md # MCP tools > Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. These are the tools an AI agent gets when you connect it to Thinger.io through the MCP server, and the resource types it can work with. The agent uses them with the permissions of your token: see [Permissions](https://docs.thinger.io/ai/permissions.md). The lists on this page are generated from the MCP server itself. > **Info: Today you connect through the CLI** > > The MCP server runs with the `thinger` CLI (`thinger mcp`), as [Connect an AI agent](https://docs.thinger.io/ai/connect.md) explains. The tools on this page are the ones of the CLI version below. | Package | Version | | --- | --- | | `@thinger-io/cli` | `0.5.1` | | `@thinger-io/cli-core` | `0.5.2` | ## Tools | Tool | Description | Read-only mode | | --- | --- | --- | | [`thinger_resource_describe`](#thinger_resource_describe) | Describes a resource type. | Yes | | [`thinger_resource_list`](#thinger_resource_list) | Lists the records of a type, one JSON record per line with the `ids` to pass back, a page at a time. | Yes | | [`thinger_resource_get`](#thinger_resource_get) | Reads one record as JSON, located by `ids`. | Yes | | [`thinger_resource_create`](#thinger_resource_create) | Creates a record from `body`, with the fields `thinger_resource_describe` shows. | | | [`thinger_resource_update`](#thinger_resource_update) | Updates a resource with the fields in `body` and keeps the fields you leave out. | | | [`thinger_resource_delete`](#thinger_resource_delete) | Deletes the record `ids` locates, or the file of a `storage_file`. | | | [`thinger_resource_clone`](#thinger_resource_clone) | Copies the record `ids` locates under a new ID. | | | [`thinger_resource_call`](#thinger_resource_call) | Runs an action of a resource that is not create, read, update or delete. | Yes | ## How the resource tools work Everything an agent does goes through eight generic tools, `thinger_resource_describe`, `_list`, `_get`, `_create`, `_update`, `_delete`, `_clone` and `_call`. Instead of one tool per resource, each one takes a `type` from the [resource types](#resource-types) table: - `type` names the kind of resource: `device`, `bucket`, `dashboard`, `alarm_rule`… Data and files are types too: `bucket_data` is the time series of a Data Bucket, `storage_file` the files of a file storage and `device_resource` the device resources of a connected device. - `ids` locates one record, with its own ID and the IDs of the resources it hangs from, each under its name: `{"device": "boiler"}` for a device, `{"device": "boiler", "property": "setpoint"}` for one of its properties. The names are the ones of the API of the server (`rule` for an alarm rule, `type` for an asset type); the [types table](#resource-types) lists them for each type. An agent starts with `thinger_resource_describe`: without arguments it lists every type and the concepts of the platform; with a `type`, it shows its IDs, fields, actions and examples, read from the API of your server. Then it lists records to find their IDs, and reads, creates or changes them. Operations that are not create, read, update or delete, such as calling a device resource, verifying a domain or testing an alarm rule, are [actions](#actions) run with `thinger_resource_call`: ```json { "type": "device_resource", "action": "call", "ids": { "device": "YOUR_DEVICE", "resource": "led" }, "body": true } ``` ### Actions that ask first Actions with a high impact do not act on the first call. They answer with what they would do, and the agent runs them by calling again with `confirm: true` in the body. They are marked **Asks first** in the [actions table](#actions): replacing every resource of a product profile at once, removing or killing a plugin, restarting a host or changing its settings, sending a real test notification, and publishing a dashboard app that deletes files. ### Read-only mode `thinger mcp --read-only` serves only what reads: `thinger_resource_describe`, `_list`, `_get`, and `_call` with the actions marked **Read-only**. Use it to let an agent explore an account without changing anything. The token still sets what it can read: see [Permissions](https://docs.thinger.io/ai/permissions.md). ## Common parameters | Parameter | Taken by | Description | |---|---|---| | `profile` | Every tool | Profile of the CLI to use for this call only: another server, or another account with its own credentials. Without it, the tool uses the default profile. See [Profiles](https://docs.thinger.io/ai/connect.md#use-several-servers-or-accounts). | | `user` | Every tool except `thinger_resource_describe` | Account to act on, for an administrator working on someone else's account. With a token that is not an administrator's, the call fails. See [Permissions](https://docs.thinger.io/ai/permissions.md#act-on-other-accounts). | A parameter that a tool does not take is never ignored: the call fails with an `input_error` that names the parameter and lists the ones the tool takes. This way a misspelled argument shows up at once. ## Errors A tool that fails returns an error with a code and a message, written as `Error [code]: message`, for example `Error [not_found]: …`. The codes are the same as in the [JSON output of the CLI](https://docs.thinger.io/reference/cli.md#json-output): `unauthorized`, `not_found`, `already_exists`, `input_error`, `server_error` and the others listed there. A call your token does not allow fails with `unauthorized`: `Error [unauthorized]: Forbidden: the token or the account is not allowed to do this (not authorized).` ## Tool reference ### thinger_resource_describe Describes a resource type: its IDs, its operations and actions, the filter its list takes, and the bodies of create, update, clone and each action, with the schemas and examples of the API of your server and the permission each one needs. Without `type`, it lists every type with a guide to the concepts of the platform: agents start here. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | No | Type to describe. Omit it to list every type. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ### thinger_resource_list Lists the records of a type, one JSON record per line with the `ids` to pass back, a page at a time. Search by ID or name, and filter by product, asset type, asset group, project, labels or any field of the records. On `bucket_data` it reads the time series of a Data Bucket, and on `storage_file` the files of a file storage. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | Resource type. See [Resource types](#resource-types). | | `ids` | object | No | IDs that locate the record and its parents, each under its name, as the [types table](#resource-types) shows: `{"device": "boiler"}`, or `{"device": "boiler", "property": "setpoint"}` for a property of that device. | | `filter` | object | No | Filters as an object, for example `{"product": "greenhouse"}`. A field of the records filters by exact value; nested fields use dots. Alarm instances also filter by state and severity. Types with their own filter, such as `bucket_data` (time range, aggregation, device) or `storage_file` (folder), take only its keys: `thinger_resource_describe` shows them. | | `search` | string | No | Text to look for in IDs and names, partial and case insensitive. | | `count` | number | No | Page size. For `bucket_data`, the number of samples to return. | | `index` | number | No | Position of the first record, to read the next pages. | | `user` | string | No | Account to act on, when it is not yours. Needs an administrator token. Omit it to act on your own account. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ### thinger_resource_get Reads one record as JSON, located by `ids`. Single resources (`device_callback`, `product_profile_code`) take only the IDs of their parent. It also reads a text file of a file storage (`storage_file`) and a guide for agents (`doc`). | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | Resource type. See [Resource types](#resource-types). | | `ids` | object | No | IDs that locate the record and its parents, each under its name, as the [types table](#resource-types) shows: `{"device": "boiler"}`, or `{"device": "boiler", "property": "setpoint"}` for a property of that device. | | `full` | boolean | No | For plugins of the catalog: include the product code and the console dashboard of the plugin. | | `user` | string | No | Account to act on, when it is not yours. Needs an administrator token. Omit it to act on your own account. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ### thinger_resource_create Creates a record from `body`, with the fields `thinger_resource_describe` shows. The ID of the new record goes in `ids` or in the ID field of the body. A `projects` list in the body also adds the new record to those projects. On `bucket_data` it writes samples to a Data Bucket, and on `storage_file` it writes a file. Not served in read-only mode. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | Resource type. See [Resource types](#resource-types). | | `ids` | object | No | IDs that locate the record and its parents, each under its name, as the [types table](#resource-types) shows: `{"device": "boiler"}`, or `{"device": "boiler", "property": "setpoint"}` for a property of that device. | | `body` | object or array | No | Fields of the new record. An array creates several at once, where the type allows it (properties, samples of `bucket_data`). | | `user` | string | No | Account to act on, when it is not yours. Needs an administrator token. Omit it to act on your own account. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ### thinger_resource_update Updates a resource with the fields in `body` and keeps the fields you leave out. Property values are replaced, unless you set `merge`. A `projects` list in the body sets the projects the resource belongs to. On `storage_file` it overwrites the file. Not served in read-only mode. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | Resource type. See [Resource types](#resource-types). | | `ids` | object | No | IDs that locate the record and its parents, each under its name, as the [types table](#resource-types) shows: `{"device": "boiler"}`, or `{"device": "boiler", "property": "setpoint"}` for a property of that device. | | `body` | object | Yes | Fields to change. | | `merge` | boolean | No | Merge the body into the saved value (JSON merge) instead of replacing it. For properties and brands. | | `user` | string | No | Account to act on, when it is not yours. Needs an administrator token. Omit it to act on your own account. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ### thinger_resource_delete Deletes the record `ids` locates, or the file of a `storage_file`. It is immediate and cannot be undone: agents are told to confirm with you first. Not served in read-only mode. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | Resource type. See [Resource types](#resource-types). | | `ids` | object | No | IDs that locate the record and its parents, each under its name, as the [types table](#resource-types) shows: `{"device": "boiler"}`, or `{"device": "boiler", "property": "setpoint"}` for a property of that device. | | `user` | string | No | Account to act on, when it is not yours. Needs an administrator token. Omit it to act on your own account. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ### thinger_resource_clone Copies the record `ids` locates under a new ID. The body holds the new ID in the ID field of the type, for example `{"device": "sensor_02"}`, or `{"rule": "rule_02"}` for an alarm rule, and optionally a new name, description and enabled state. Not served in read-only mode. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | Resource type. See [Resource types](#resource-types). | | `ids` | object | Yes | IDs that locate the record and its parents, each under its name, as the [types table](#resource-types) shows: `{"device": "boiler"}`, or `{"device": "boiler", "property": "setpoint"}` for a property of that device. | | `body` | object | Yes | New ID and the fields to change in the copy. | | `user` | string | No | Account to act on, when it is not yours. Needs an administrator token. Omit it to act on your own account. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ### thinger_resource_call Runs an action of a resource that is not create, read, update or delete: call a device resource, send data as a device, verify a domain, test an alarm rule, run a plugin's API, publish a dashboard app. See [Actions](#actions). Actions with a high impact first answer with what they would do, and act only when called again with `confirm: true` in the body. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `type` | string | Yes | Resource type. Only the types with [actions](#actions). | | `action` | string | Yes | Action name, for example `call` or `verify`. Each type has its own: see [Actions](#actions). | | `ids` | object | No | IDs that locate the record and its parents, each under its name, as the [types table](#resource-types) shows: `{"device": "boiler"}`, or `{"device": "boiler", "property": "setpoint"}` for a property of that device. | | `body` | any | No | Input of the action, when it takes one. `confirm: true` runs an action that [asks first](#actions). | | `query` | object | No | Query parameters of the action, when it takes them: the call of a plugin, the log of a host. | | `user` | string | No | Account to act on, when it is not yours. Needs an administrator token. Omit it to act on your own account. | | `profile` | string | No | CLI profile (server and credentials) for this call only. Omit it to use the default profile. `thinger_resource_list` with type `profile` lists them. | ## Resource types Every type the `thinger_resource_*` tools can reach, with the names of its `ids`, outermost first. The operations name the tool that runs each one: | Operation | Tool | |---|---| | list | `thinger_resource_list` | | get | `thinger_resource_get` | | create | `thinger_resource_create` | | update | `thinger_resource_update` | | merge | `thinger_resource_update` with `merge: true`: merges the body into the saved value. | | delete | `thinger_resource_delete` | | clone | `thinger_resource_clone` | | projects | The `projects` field of a create or update body: the projects the resource belongs to. | Types marked **Administrator** are the administration of the server: they need an administrator token. See [Permissions](https://docs.thinger.io/ai/permissions.md). | Type | Description | `ids` | Operations | Administrator | | --- | --- | --- | --- | --- | | `device` | Devices of the account: IOTMP, MQTT, HTTP and virtual devices. | `device` | list, get, create, update, delete, clone, projects | | | `product` | Products: the shared configuration and profile of a fleet of devices. | `product` | list, get, create, update, delete, clone, projects | | | `bucket` | Data Buckets: time series data. Read and write their data with the type `bucket_data`. | `bucket` | list, get, create, update, delete, clone, projects | | | `dashboard` | Dashboards. Custom ones are apps on the Dashboard SDK, created, developed and published with the `init`, `dev` and `publish` actions. | `dashboard` | list, get, create, update, delete, clone, projects | | | `endpoint` | Endpoints: outgoing HTTP calls, emails and notifications. | `endpoint` | list, get, create, update, delete, clone, projects | | | `storage` | File storages. Their files are the type `storage_file`. | `storage` | list, get, create, update, delete, clone, projects | | | `asset_type` | Asset types: a category of devices, with its own properties. | `type` | list, get, create, update, delete, clone, projects | | | `asset_group` | Asset groups: a set of devices, such as a site, with its own properties. | `group` | list, get, create, update, delete, clone, projects | | | `project` | Projects: group resources of any type to share them or show them together. | `project` | list, get, create, update, delete, clone | | | `token` | Access tokens of the account, with their permissions. | `token` | list, get, create, update, delete, clone, projects | | | `alarm_rule` | Alarm rules: conditions on device or bucket data that raise alarms. | `rule` | list, get, create, update, delete, clone, projects | | | `alarm_instance` | Alarms raised by the rules. Update one to acknowledge, shelve or clear it. | `instance` | list, get, update, delete, projects | | | `claim` | Device claims: codes that let end users take ownership of a device. | `claim` | list, get, create, update, delete, clone, projects | | | `property` | Properties of the account: JSON values stored on the account. | `property` | list, get, create, update, merge, delete, clone | | | `role` | Roles: named sets of permissions for the members of a project. | `role` | list, get, create, update, delete, clone | | | `sync` | Syncs: shared semaphores with slots that devices or scripts take to coordinate. | `sync` | list, get, create, update, delete, clone, projects | | | `plugin` | Plugins installed on the account. Install and control them with their actions; call their API with the `call` action. | `plugin` | list, get | | | `user` | User accounts of the server. | `user` | list, get, create, update, delete | Yes | | `host` | Hosts of the server cluster. | `host` | list, get, create, update, delete | Yes | | `domain` | Custom domains the server answers on. | `domain` | list, get, create, update, delete | Yes | | `brand` | Brands: the look and the email settings of the console on a domain. | `brand` | list, get, create, update, merge, delete | Yes | | `oauth_client` | OAuth2 clients: applications allowed to sign users in against the server. | `oauth_client` | list, get, create, update, delete | Yes | | `identity_provider` | Identity providers: external sign-in for the console (OpenID Connect, OAuth2). | `identity_provider` | list, get, create, update, delete | Yes | | `proxy` | Proxies: services the server exposes through its own address. | `proxy` | list, get, create, update, delete | Yes | | `sync_lock` | Locks of a sync: the slots currently taken. | `sync`, `lock` | list, get, create, update, delete | | | `device_property` | Properties of a device: its structured state, such as configuration or calibration. | `device`, `property` | list, get, create, update, merge, delete, clone | | | `device_token` | Access tokens limited to one device and some of its device resources. | `device`, `token` | list, create, delete | | | `device_bucket` | Data Buckets that hold data of a device (list only). | `device`, `bucket` | list | | | `device_bucket_tag` | Tags of a Data Bucket for one device. | `device`, `bucket`, `tag` | list, get | | | `device_service` | Services a device exposes, such as a web interface or VNC. | `device`, `service` | list, get | | | `device_callback` | HTTP callback of a device: what the server does with the data it receives. | `device` | get, update (single resource of its parent) | | | `product_property` | Properties of a product. | `product`, `property` | list, get, create, update, merge, delete, clone | | | `product_profile_api` | API resources a product adds to its devices. | `product`, `resource` | list, get, create, update, delete | | | `product_profile_bucket` | Data Buckets a product keeps for each of its devices. | `product`, `resource` | list, get, create, update, delete | | | `product_profile_property` | Properties a product writes on each of its devices. | `product`, `resource` | list, get, create, update, delete | | | `product_profile_autoprovision` | Autoprovisioning rules: which connecting devices join the product. | `product`, `resource` | list, get, create, update, delete | | | `product_profile_flow` | Data flows of a product. | `product`, `resource` | list, get, create, update, delete | | | `product_profile_code` | Code of a product: the JavaScript the server runs for its devices. | `product` | get, update (single resource of its parent) | | | `product_service` | Services a product exposes on its devices. | `product`, `service` | list, get, create, update, delete | | | `bucket_tag` | Tags of a Data Bucket and their values. | `bucket`, `tag` | list, get | | | `bucket_export` | Exports of a Data Bucket: files generated from its data. | `bucket`, `file` | list, create, delete | | | `plugin_property` | Properties of a plugin, usually its configuration. | `plugin`, `property` | list, get, create, update, merge, delete, clone | | | `asset_type_property` | Properties of an asset type. | `type`, `property` | list, get, create, update, merge, delete, clone | | | `asset_group_property` | Properties of an asset group. | `group`, `property` | list, get, create, update, merge, delete, clone | | | `project_property` | Properties of a project. | `project`, `property` | list, get, create, update, merge, delete, clone | | | `project_member` | Members a project is shared with, and their roles. | `project`, `member` | list, get, create, update, delete | | | `project_role` | Roles defined in a project. | `project`, `role` | list, get, create, update, delete, clone | | | `bucket_data` | The time series of a Data Bucket: list reads samples (latest, a time range or the last minutes, with optional aggregation and one series per device), create writes samples when its data source accepts writes from the API. | `bucket` | list, create | | | `storage_file` | Files of a file storage, by path: list, read text files, write text or upload files and folders of your computer (binary too), and delete. | `storage`, `file` | list, get, create, update, delete | | | `device_resource` | The device resources a connected device exposes, with their inputs and outputs: the ones its firmware declares and the API resources its product adds. The device must be online. | `device`, `resource` | list | | | `doc` | The guides for agents that come with the CLI: see [Guides](#guides). | `doc` | list, get | | | `profile` | The profiles of the CLI: each one is a server with its own credentials. Another account on the same server is reached with `user`, not with a profile. | `profile` | list | | ## Actions Actions are run with `thinger_resource_call`, giving the `type`, the `action` and, for most of them, the `ids`. Use `thinger_resource_describe` with the type to see the body an action takes. **Read-only** actions are also served in [read-only mode](#read-only-mode); actions that **ask first** need `confirm: true` to act (see [Actions that ask first](#actions-that-ask-first)). | Type | Action | Description | Read-only | Asks first | | --- | --- | --- | --- | --- | | `device` | `stats` | Daily usage of the device over the last month: traffic and calls. | Yes | | | `device` | `send` | Sends data to the server on behalf of an HTTP device, as the device itself would. The server runs the callback configured for the device: write a Data Bucket, set a property or call an endpoint. | | | | `device` | `overview` | Daily usage of all the devices of the account over the last month and, with `locations`, the last known position of each connected device. | Yes | | | `product` | `export` | The product with everything it depends on, as one JSON document, to back it up or recreate it. | Yes | | | `bucket` | `import` | Loads the records of a CSV file already uploaded to a file storage into the Data Bucket. The way to load a long history. | | | | `dashboard` | `init` | Creates a dashboard app: a TypeScript project on the Dashboard SDK from one of the templates of the SDK package (React by default, or Angular), with a `thinger.json` manifest for the `dev` and `publish` actions, and an `AGENTS.md` with the rules of the dashboard frame. | | | | `dashboard` | `dev` | Returns a link that opens the app from its own development server (`npm run dev`, `ng serve`) as a standalone page connected to your server, with a temporary token and the context you choose. The app gets real data and reloads on every change. Each call replaces the token of the previous link. | | | | `dashboard` | `publish` | Uploads the build of an app to a public file storage and points dashboards at it. Both parts are optional: upload a new build, point more dashboards at an app already uploaded, or both. It warns when the SDK of the app needs a newer server, when a newer SDK is on npm, or when a page loads the deprecated `thinger-dashboard.js` script. Deleting the files that are not in the upload (`prune`) asks first. | | Yes | | `endpoint` | `call` | Runs the endpoint with `body` as its payload and returns its answer. | | | | `alarm_rule` | `test_rule` | Evaluates a rule, saved or given in `body`, without raising alarms or sending notifications. | Yes | | | `alarm_rule` | `test_source` | Reads one data source as the rule would. | Yes | | | `alarm_rule` | `test_notification` | Sends the notification of the rule for real, through its endpoints: people receive it. | | Yes | | `alarm_instance` | `stats` | How many alarms there are in each state, without listing them. | Yes | | | `plugin` | `install` | Installs a plugin of the catalog with the settings in `body`. It is installed stopped: start it next. | | | | `plugin` | `upgrade` | Upgrades the plugin to another version, keeping its data. It is left stopped: start it next. | | | | `plugin` | `remove` | Uninstalls the plugin and deletes its files, data and properties. | | Yes | | `plugin` | `start` | Starts the plugin. | | | | `plugin` | `stop` | Stops the plugin. | | | | `plugin` | `restart` | Restarts the plugin. | | | | `plugin` | `pause` | Pauses the plugin. | | | | `plugin` | `unpause` | Resumes a paused plugin. | | | | `plugin` | `kill` | Kills the plugin. | | Yes | | `plugin` | `public` | Makes the web interface of the plugin reachable without signing in. | | | | `plugin` | `private` | Makes the web interface of the plugin require signing in again. | | | | `plugin` | `call` | Calls the API that an installed plugin serves, at a path of its own. What it offers depends on the plugin: see its page in the [plugin catalog](https://docs.thinger.io/plugins.md). | | | | `host` | `logs` | The last lines of the log of the host, as text. | Yes | | | `host` | `restart` | Restarts the host: its devices and users lose the connection meanwhile. | | Yes | | `host` | `read_settings` | Reads the settings of the host. | Yes | | | `host` | `update_settings` | Merges `body` into the settings of the host: keys left out stay, and `null` removes one. It takes effect after the `restart` action. | | Yes | | `domain` | `verify` | Checks that the domain resolves to the server, after you configure its DNS. | | | | `brand` | `test_email` | Sends a test email with the email settings of the brand. | | | | `product_profile_api` | `replace_all` | Replaces every API resource of the product at once with `body`. | | Yes | | `product_profile_api` | `call` | Calls an API resource of a product for the product as a whole, as an external system that feeds data in would. The API resource needs a device resolver in the product code to find the device of each payload. To call it for one device, use the `call` action of `device_resource`. | | | | `product_profile_bucket` | `replace_all` | Replaces every bucket of the product profile at once with `body`. | | Yes | | `product_profile_property` | `replace_all` | Replaces every property of the product profile at once with `body`. | | Yes | | `product_profile_autoprovision` | `replace_all` | Replaces every autoprovisioning rule of the product at once with `body`. | | Yes | | `product_profile_flow` | `replace_all` | Replaces every data flow of the product at once with `body`. | | Yes | | `device_resource` | `call` | Calls a device resource of a connected device and returns its output. With a body it runs the resource with that input; without one it only reads its output. | | | ## Guides The MCP server also serves guides written for agents. They come with the CLI and are offered in two ways, with the same content: - As **MCP resources**, with the URIs below. Clients that support resources let you attach them to a conversation. - As the type **`doc`**: `thinger_resource_list` lists them and `thinger_resource_get` with `ids` `{"doc": "concepts"}` reads one, for agents and clients that only use tools. | Guide | Resource | Content | | --- | --- | --- | | `concepts` | `thinger://concepts` | How projects, devices, products, Data Buckets, asset types and groups, properties, alarms, endpoints, file storages, tokens, dashboards and events relate, and which data source fits each need. | | `product-code` | `thinger://product-code` | The JavaScript a product runs: functions that compute device resources (virtual devices), payload transforms and the device resolver. | | `server-admin` | `thinger://server-admin` | For administrators: host settings and restarts, custom domains and brands, user accounts, OAuth2 clients, identity providers and proxies, with their side effects. | | `dashboard-sdk` | `thinger://dashboard-sdk` | The Dashboard SDK reference: install it, run apps in the console or standalone, routing, context and every call. | | `dashboard-sdk-types` | `thinger://dashboard-sdk-types` | The TypeScript declarations of the Dashboard SDK. | These guides are not the documentation of this site. To give an agent this documentation, see [Docs for agents](https://docs.thinger.io/ai/docs-for-agents.md). ## See also - [Connect an AI agent](https://docs.thinger.io/ai/connect.md) - [Permissions](https://docs.thinger.io/ai/permissions.md) - [CLI](https://docs.thinger.io/reference/cli.md) - [REST API](https://docs.thinger.io/reference/rest-api.md) --- Source: https://docs.thinger.io/ai/dashboards.md # Build dashboards with AI > Ask an AI agent to create a dashboard app on the Dashboard SDK, develop it against your real data and publish it. This guide shows how an AI agent builds a custom dashboard for you: it creates a [dashboard app](https://docs.thinger.io/platform/dashboards/apps.md) on the [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md), runs it against your real data while it works, and publishes it as the dashboard of a device, a product or any other destination. You describe what you want; the agent writes the code. For the same workflow done by hand, step by step, see [Build a dashboard app](https://docs.thinger.io/guides/dashboard-app.md). > **Info: Today you connect through the CLI** > > The agent uses the dashboard tools of the MCP server of the `thinger` CLI. Each tool has a CLI command that does the same: `thinger dashboard init`, `dev` and `publish`. ## Before you start - An agent connected to your account, as in [Connect an AI agent](https://docs.thinger.io/ai/connect.md). The agent must be able to run commands and edit files on your computer, as Claude Code does. - Node.js 20 or later. - Optional: browser tools in the agent (for example, a browser MCP server), so it can open the app, see it and read its console. ## Steps **Step 1: Create the app** **Prompt for an AI agent:** > Create a dashboard app called greenhouse for my device YOUR_DEVICE, with React, and install its dependencies. The agent calls `thinger_resource_call` with the type `dashboard` and the action `init`. It creates a folder with a TypeScript project on the Dashboard SDK, from one of the templates of the SDK package: React by default, or Angular. The folder includes: - `thinger.json`: where the app is published (the file storage and the destinations) and the address of its development server. The next steps read it, so they run without arguments. - `AGENTS.md`, and a `CLAUDE.md` that points to it: the rules of the dashboard frame, for the agents that work on the app. Ask for a GitHub workflow at this step if you want the app published on every push to `main` (see [Publish from CI](#publish-from-ci)). **Step 2: Develop it against your data** **Prompt for an AI agent:** > Start the development server of the greenhouse app, open it with real data from YOUR_DEVICE and add a chart of its temperature and humidity over the last week. Check the browser console for errors. The agent starts the development server of the app (`npm run dev`, or `npm start` in Angular) and runs the `dev` action of the `dashboard` type. It returns a link that opens the app from your computer as a standalone page, connected to your server, in the context you choose: a device, a product, an asset type or group, or a project. The app gets real data and reloads on every change, and its errors appear in the browser console. > **Warning: The link carries a full-access token** > > The link includes a temporary token with full access to your account (or to the project, in a project context). It lasts 8 hours by default, and each new link replaces it. Writes the app makes are real. The link only opens an address on your computer, unless you allow a remote one. See [Permissions](https://docs.thinger.io/ai/permissions.md#the-temporary-token-of-dashboard-development). **Step 3: Publish it** **Prompt for an AI agent:** > Build the greenhouse app and publish it as the dashboard of YOUR_DEVICE. Give me a preview link to share. The agent builds the app and runs the `publish` action of the `dashboard` type. It uploads the build to a public file storage and points the destinations at it: | Destination | Where the app opens | |---|---| | `dashboard` | A dashboard of the **Dashboards** list, created if it does not exist. | | `device`, `product`, `asset_type`, `asset_group`, `project` | The dashboard of that device, product, asset type, asset group or project. The app gets its ID as context. | One app can serve several destinations. With a preview (`--preview` in the CLI), it also returns standalone links to review or share each destination in a browser, with a read-only token. ## Result The dashboard of YOUR_DEVICE opens the app in the console, with its live data. Later changes follow the same path: ask the agent for the change, check it with a new development link, and publish again. ## Rules of the dashboard frame The console shows a dashboard app inside a sandboxed frame. The template and its `AGENTS.md` already follow these rules, but check them when an app works in development and fails once published: - **No `localStorage`, cookies or `` tag.** They work in the development link, outside the frame, and fail once published. Keep state in properties through the SDK. - **Hash routing and relative asset paths**, so the app works from its storage folder. - **The SDK package, not the old script.** Publishing warns when a page loads `thinger-dashboard.js`, the deprecated script build of the SDK. It also warns when the SDK of the app needs a newer server than yours, or when a newer SDK is on npm. The complete list of calls of the SDK is in the [Dashboard SDK reference](https://docs.thinger.io/reference/dashboard-sdk.md), and how dashboard apps are stored and served is in [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md). ## Publish from CI To publish the app on every push, the workflow that the `init` action adds (with `ci`, or `--ci` in the CLI) runs `npx -y @thinger-io/cli dashboard publish` with two settings of the repository: | Setting | Content | |---|---| | `THINGER_SERVER` (variable) | Your server: `YOUR_SERVER`. | | `THINGER_TOKEN` (secret) | An access token allowed to write file storages and dashboards, or the `dashboard` property of the destinations. | Create a token for this only, with those permissions, in **Access Tokens**. The workflow installs the dependencies with `npm ci`, which needs a `package-lock.json`. Run `npm install` in the app (or create it with `install`, `--install` in the CLI) and commit `package-lock.json` before the first push. ## Next steps - [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md): Show a web app from a File Storage as a dashboard of the console, built with the Dashboard SDK, or run it on its own with an access token. - [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md): Every function and type of @thinger-io/dashboard-sdk, the package for dashboards built as web apps, plus how to start, publish and share them. - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. --- Source: https://docs.thinger.io/ai/docs-for-agents.md # Docs for agents > The Thinger.io documentation in plain markdown for AI agents (llms.txt, llms-full.txt and a .md file per page), and the guides the MCP server serves. This documentation is also published in plain markdown, so an AI agent can read it without parsing HTML. The MCP server of the `thinger` CLI adds its own guides for agents. This page lists both and when to use each. ## Documentation files | File | URL | Content | |---|---|---| | `llms.txt` | `https://docs.thinger.io/llms.txt` | Index of every page in the [llms.txt](https://llmstxt.org) format: one line per page with its title, the URL of its `.md` and its description, grouped by section. | | `llms-full.txt` | `https://docs.thinger.io/llms-full.txt` | Every page of `llms.txt`, complete, in one file. Each page starts with a `Source:` line that gives its URL. | | A `.md` per page | `https://docs.thinger.io/.md` | One page in plain markdown. The URL is the address of the page with `.md` at the end: this page is `https://docs.thinger.io/ai/docs-for-agents.md`. | The `.md` version keeps all the content of the page. Tabs become headings, steps become numbered lines in bold, notices become quotes, and the [agent prompts](https://docs.thinger.io/ai.md) become quotes introduced by **Prompt for an AI agent**. Links point to the `.md` version of other pages, so an agent can follow them. ## Give the docs to an agent - **For one topic**, give the agent the `.md` URL of the page, or paste its content. It is the smallest input and the most precise. - **To let the agent find its way**, give it `https://docs.thinger.io/llms.txt`: it reads the index and opens only the pages it needs. - **To load everything at once**, add `https://docs.thinger.io/llms-full.txt` as a source in tools that index documents (a project's knowledge, a RAG index). It is large: prefer `llms.txt` in a conversation. **Prompt for an AI agent:** > Read https://docs.thinger.io/llms.txt, find the page about Data Buckets and explain how to export the data of a bucket to CSV. ## Guides of the MCP server The MCP server of the CLI also serves guides written for agents, with the knowledge they need to work on your account: how the concepts of the platform relate, the code of products, the administration of a server and the Dashboard SDK. They come with the CLI, so they match the tools of its version. | Guide | Content | |---|---| | `concepts` | How devices, products, Data Buckets, properties, alarms, endpoints, file storages, tokens, projects and dashboards relate, and which data source fits each need. | | `product-code` | The JavaScript a product runs. | | `server-admin` | Administration of a server: hosts, domains, brands, user accounts, OAuth2 clients, identity providers and proxies. | | `dashboard-sdk`, `dashboard-sdk-types` | The Dashboard SDK reference and its TypeScript declarations, of the SDK version the app installs (in the `node_modules` of the folder where the agent works), or else of the version that comes with the CLI. | The agent reads them in two ways: - As the type `doc` of the resource tools: `thinger_resource_list` lists the guides and `thinger_resource_get` reads one. The agent decides when to read them. - As **MCP resources** (`thinger://concepts`, `thinger://dashboard-sdk`…), for clients that let you attach resources to a conversation. The full list, with the URI of each resource, is in [MCP tools](https://docs.thinger.io/ai/tools.md#guides). ## Which one to use | You want the agent to… | Use | |---|---| | Work on your account through the MCP server | Nothing: the agent reads the guides of the MCP server when it needs them. | | Answer questions about Thinger.io, or follow a guide of this site | The `.md` page, or `llms.txt` to find it. | | Write firmware, call the REST API or build an integration outside the MCP | The `.md` pages of [Devices](https://docs.thinger.io/devices.md) and the [REST API](https://docs.thinger.io/reference/rest-api.md). | | Build a dashboard app | Both: the agent reads the `dashboard-sdk` guide while it works, and you can point it to [Build dashboards with AI](https://docs.thinger.io/ai/dashboards.md). | ## Related pages - [MCP tools](https://docs.thinger.io/ai/tools.md): Every tool the Thinger.io MCP server offers to AI agents, with its parameters, and every resource type the agents can reach. - [Connect an AI agent](https://docs.thinger.io/ai/connect.md): Install the thinger CLI, sign in, and connect Claude Code, Claude Desktop or any other MCP client to your Thinger.io account. --- Source: https://docs.thinger.io/administration/deployment.md # Deployment > The ways to get a Thinger.io instance, Thinger.io Cloud or on-premise, and which one fits your project. A Thinger.io instance is one server with its console, REST API, device connections and users. You can use the shared free Cloud account, subscribe to a private instance that Thinger.io hosts for you, or run the server on your own infrastructure with an on-premise license. ![Thinger.io Cloud offers the free account on iot.thinger.io and private instances with their own hostname, which Thinger.io runs for you. On-premise runs the same server as Docker containers on your own infrastructure: today with a license for research centers and educational institutions, and soon as a 100% open-source server](https://docs.thinger.io/diagrams/deployment-options.svg) *Deployment options* ## Thinger.io Cloud Thinger.io runs the server and keeps it up to date. - **Free Cloud account**: a shared server at `iot.thinger.io` to learn and prototype. It does not include plugins or the **Administration** features. - **Private instance** (Small, Medium and Large plans): a server only for you, with its own hostname, its own users and the **Administration** menu. You sign up on the [pricing page](https://thinger.io/pricing), and the instance is ready a few minutes later. See [Thinger.io Cloud](https://docs.thinger.io/administration/deployment/cloud.md). ## On-premise The same server runs on your own machines, as Docker containers installed with Docker Compose. You keep the data in your network and take care of the machine, the backups and the updates of the server. Today, Thinger.io grants on-premise licenses to research centers and educational institutions. A 100% open-source Thinger.io server, which anyone will be able to run on their own infrastructure, is coming soon. See [On-premise](https://docs.thinger.io/administration/deployment/on-premise.md). ## Compare the options | | Free Cloud account | Private Cloud instance | On-premise | |---|---|---|---| | Server | Shared, `iot.thinger.io` | Only yours, your own hostname | Your own machines | | Who runs it | Thinger.io | Thinger.io | You | | **Administration** features | Not included | Included, by plan | Included | | How to get it | Sign up at [console.thinger.io/signup](https://console.thinger.io/signup) | [Pricing page](https://thinger.io/pricing) | License for research centers and educational institutions; open-source server coming soon | What each plan includes, and its limits, is on [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Learn more - [Thinger.io Cloud](https://docs.thinger.io/administration/deployment/cloud.md): Subscribe to a private Thinger.io Cloud instance on the pricing page, sign in as its administrator and point your devices to it. - [On-premise](https://docs.thinger.io/administration/deployment/on-premise.md): Install Thinger.io on your own Linux host with Docker Compose and a license token, sign in for the first time and back up its data. - [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md): The Thinger.io plans, the kinds of limits each one sets, and which features of the documentation need a given plan. --- Source: https://docs.thinger.io/administration/deployment/cloud.md # Thinger.io Cloud > Subscribe to a private Thinger.io Cloud instance on the pricing page, sign in as its administrator and point your devices to it. This guide shows how to get a private Thinger.io Cloud instance: a server that Thinger.io hosts and updates only for you, with its own hostname, users and **Administration** menu. ![You choose a plan on thinger.io/pricing, configure the hostname, region, admin email and billing email, and pay at checkout. Thinger.io deploys the server and emails the admin a few minutes later. You open the instance at its hostname, create the admin account with the admin email, and point your devices to the instance with THINGER_SERVER](https://docs.thinger.io/diagrams/cloud-subscription-flow.svg) *From the pricing page to your instance* ## Before you start - Decide which plan you need. What each one includes is on [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md) and on the [pricing page](https://thinger.io/pricing). - Choose the email address of the instance administrator. It does not have to be the billing address. > **Info: Free Cloud account** > > To learn or prototype you don't need an instance: the free Cloud account runs on the shared server `iot.thinger.io`. Sign up at [console.thinger.io/signup](https://console.thinger.io/signup) and follow the [Quick start](https://docs.thinger.io/get-started/quick-start.md). ## Steps **Step 1: Choose a plan** Open [thinger.io/pricing](https://thinger.io/pricing) and pick a plan (Small, Medium or Large), monthly or yearly. **Step 2: Configure the instance** Fill in the instance details: | Field | What it sets | |---|---| | Hostname | The name of your instance. Its address is `.aws.thinger.io`, for example `acme.aws.thinger.io`. It must be free; the form tells you if it is taken. | | Region | Where the server runs. Choose the one closest to your devices and users. | | Admin email | The email of the first administrator of the instance. Only the account created with this email becomes administrator. | | Billing email | Where invoices and subscription emails go. | **Step 3: Pay and wait for the deployment** Complete the payment. Thinger.io creates the server and sends an email to the admin email when it is ready, usually a few minutes later. **Step 4: Create the administrator account** Open `https://.aws.thinger.io`, click **Create an account** and sign up with the admin email. The instance is empty: this first account is its administrator, and it sees the **Administration** menu in the console. ![Sign-up form of a new private instance with the admin email](https://docs.thinger.io/screenshots/cloud-first-signup.webp) *Sign-up form of a new instance* **Step 5: Point your devices to the instance** Your instance hostname is your `YOUR_SERVER`: use it instead of `iot.thinger.io` in the device libraries, the REST API, MQTT and the CLI. With the Arduino library, define it before including the library; without it, the device connects to `iot.thinger.io`: ```cpp #define THINGER_SERVER "acme.aws.thinger.io" #include // ... ``` To use the CLI with the instance, sign in to it: ```bash thinger login --server acme.aws.thinger.io ``` ## Result The console of your instance opens at its own hostname, your administrator account sees the **Administration** menu, and your devices connect to the instance instead of the shared server. ## What you get - A server only for your account and your users, hosted and updated by Thinger.io. - The **Administration** features your plan includes: [User Accounts](https://docs.thinger.io/administration/user-accounts.md), [Cluster Hosts](https://docs.thinger.io/administration/cluster-hosts.md), and, from the Medium plan, [Domains](https://docs.thinger.io/administration/domains.md), [Brands](https://docs.thinger.io/administration/brands.md), [OAuth2 Clients](https://docs.thinger.io/administration/oauth2-clients.md) and [Proxies](https://docs.thinger.io/administration/proxies.md). - [Plugins](https://docs.thinger.io/plugins.md), which the free Cloud account does not include. - The subscription, its invoices and its payment method in **Billing**. See [Billing](https://docs.thinger.io/administration/billing.md). Some limits of a Cloud instance, such as the number of devices or brands, come from the plan and cannot be changed in the server settings. To raise them, change the plan. See [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | The sign-up form rejects the account | The email is not the admin email of the instance. | Sign up with the admin email you entered when you subscribed. | | A device still appears on `iot.thinger.io` | The device does not set the instance hostname. | Set `THINGER_SERVER` (or your client's host) to the instance hostname and flash it again. | ## Next steps - [User Accounts](https://docs.thinger.io/administration/user-accounts.md): Create, edit, disable and delete the user accounts of your Thinger.io instance, choose their role and set their limits. - [Billing](https://docs.thinger.io/administration/billing.md): Manage the subscription of your Thinger.io Cloud instance, its payment method and its invoices from the billing portal. - [Quick start](https://docs.thinger.io/get-started/quick-start.md): Create a free Thinger.io account, connect an ESP32 and read its first value from the console in about 15 minutes. --- Source: https://docs.thinger.io/administration/deployment/on-premise.md # On-premise > Install Thinger.io on your own Linux host with Docker Compose and a license token, sign in for the first time and back up its data. **Plan:** Enterprise This guide shows how to install the Thinger.io server on your own machine with Docker Compose, sign in to it for the first time and point your devices to it. The data, the devices and the users stay in your network. > **Info: Who can install it** > > Today, Thinger.io grants on-premise licenses to research centers and educational institutions. A 100% open-source Thinger.io server, which anyone will be able to run on their own infrastructure, is coming soon. To request a license, [contact Thinger.io](https://thinger.io/contact-us). If you need a server of your own today, a private [Thinger.io Cloud](https://docs.thinger.io/administration/deployment/cloud.md) instance is hosted for you. ![A Linux host with Docker Engine runs the services of the compose file: the Thinger.io server on the host network with ports 80, 443, 1883, 8883 and 25200 to 25206, MongoDB listening on 127.0.0.1 only, and one container per installed plugin. The server data is in /data/thinger and the database in /data/mongodb, on the host disks](https://docs.thinger.io/diagrams/on-premise-anatomy.svg) *What runs on your host* ## Before you start - A license token for the host. Thinger.io issues one token per host, together with the administrator email of the installation. - A Linux machine, physical or virtual, on `x86_64` (amd64) or `arm64`, reachable by your devices and users. Start from a clean host: the server uses the ports listed in [Network ports](#network-ports). - [Docker Engine](https://docs.docker.com/engine/install/) with the [Docker Compose plugin](https://docs.docker.com/compose/install/linux/) (the `docker compose` command). - Disk space for the data of the instance under `/data`. Devices, Data Buckets, files and plugins all live on the machine. How much memory and CPU you need depends mostly on the plugins: see [Size the server](https://docs.thinger.io/administration/cluster-hosts.md#size-the-server). - Optional: a hostname that resolves to the machine, and port 80 reachable from the internet, to get [Let's Encrypt certificates](https://docs.thinger.io/administration/domains.md) instead of the self-signed one. ## Install Run the commands as `root` or with `sudo`, in an empty folder that will keep the compose file, such as `/opt/thinger`. **Step 1: Download the compose file** Download the `docker-compose.yml` of your license. `YOUR_LICENSE_TOKEN` is the license token you received: ```bash curl -f -o docker-compose.yml \ "https://subscriptions.thinger.io/v1/docker-compose.yml?token=YOUR_LICENSE_TOKEN" ``` The file is generated for your license and already contains the token. Check that it was written and starts with the `services` of the stack: ```bash cat docker-compose.yml ``` > **Danger: Keep the license token secret** > > The license token gives access to the configuration of your host. Never share or publish it, nor the `docker-compose.yml` that contains it. Each token is issued for one host: do not reuse it on another machine. **Step 2: Start the services** Pull the images and start every service in the background: ```bash docker compose up -d ``` The first start takes a few minutes, depending on your connection. The services start again on their own after a reboot of the host. **Step 3: Check the installation** List the running containers with their status: ```bash docker ps --format "table {{.Names}}\t{{.Status}}" ``` The `thinger` container is ready when its status shows `(healthy)`. During the first two minutes it shows `(health: starting)`. ``` NAMES STATUS thinger Up 4 minutes (healthy) mongodb Up 4 minutes ``` The server also answers its health check, the same one the container uses: ```bash curl -i http://localhost/v1/server/healthcheck ``` ## Network ports The server listens on these ports of the machine. Open in your firewall the ones your devices and users need: | Port | Use | |---|---| | 80, 443 | Console and REST API over HTTP and HTTPS. Port 80 is also needed to verify [domains](https://docs.thinger.io/administration/domains.md). | | 25200, 25202 | IOTMP devices (Thinger.io libraries), plain and TLS. | | 25204, 25206 | IOTMP version 2, plain and TLS. | | 1883, 8883 | MQTT devices, plain and TLS. | | 50000–51000 | [Proxies](https://docs.thinger.io/administration/proxies.md) without a fixed port. | The database listens on `127.0.0.1:27017` only: it is not reachable from other machines, and it does not need a firewall rule. Every port of the server can be changed in the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md). On Ubuntu, the UFW firewall can block these ports. Allow the ones you use instead of disabling it, for example: ```bash sudo ufw allow 80,443/tcp sudo ufw allow 25200:25206/tcp sudo ufw allow 1883,8883/tcp ``` ## First access An installation starts empty, with public sign-up off: 1. Open `https://YOUR_SERVER`, where `YOUR_SERVER` is the IP address or the hostname of the machine, such as `https://192.168.1.100`. 2. The browser warns that the connection is not private: until you [verify a domain](https://docs.thinger.io/administration/domains.md), the server uses a self-signed certificate. Accept the warning to continue. 3. Click **Create an account** and sign up with the administrator email of your license. It is the only address that can register, and its account becomes administrator. There is no need to confirm the email. 4. Use the **Administration** menu to create the rest of the accounts, or open sign-up in the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md#accounts). ![Sign-up form with the username admin and the administrator email admin@example.com](https://docs.thinger.io/screenshots/on-premise-first-signup.webp) *First sign-up of the administrator* ## Connect devices Devices connect to your installation instead of `iot.thinger.io`. With the Arduino library, define the address before including the library; without it, the device tries the public Cloud server: ```cpp #define THINGER_SERVER "192.168.1.100" #include // ... ``` With MQTT, HTTP, the REST API or the CLI, use the address of your installation as `YOUR_SERVER`. ## Result `docker ps` shows the `thinger` container as `(healthy)`, the console opens at the address of your machine with your administrator account, and your devices connect to your own server. ## What the compose file contains The compose file defines two services. Plugins you install from **Plugins > Marketplace** run as more containers on the same machine, started by the server. | Service | Image | What it does | |---|---|---| | `thinger` | `thinger/server` | The console, the REST API and the IOTMP, MQTT and HTTP device connections. It uses the network of the host, so its ports are the host ports, and it has access to the Docker socket (`/var/run/docker.sock`) to run the plugins. A health check calls `/v1/server/healthcheck` every minute. | | `mongodb` | `mongo:8.0` | The database of the instance: accounts, devices, Data Buckets and the rest of the configuration. Its user and password are generated for your license. | Every service restarts on its own if it stops, and keeps up to 10 log files of 200 KB. Don't edit the license token or the database credentials in the file: the server needs them as they are. ## Where the data is stored Everything the installation stores is in two folders of the host: | Folder | Content | |---|---| | `/data/thinger` | Files of the server: TLS certificates of your domains, plugins and their data, file storages, bucket exports and the geolocation database. | | `/data/mongodb` | The database. | ### Back up an installation Back up both folders together, with the services stopped so that the database files are consistent. From the folder of the compose file: ```bash docker compose stop sudo tar -czf "thinger-backup-$(date +%F).tar.gz" /data/thinger /data/mongodb docker compose start ``` The devices disconnect while the services are stopped and reconnect on their own. To restore, stop the services, replace `/data/thinger` and `/data/mongodb` with the copy, and start them again. Keep a copy of `docker-compose.yml` too, as safely as the license token. ## Who looks after the installation An on-premise installation is yours to run. Updates of the server, backups, monitoring and the day-to-day care of the machine are the responsibility of whoever manages it. That is the trade-off of on-premise: full control of the server and the data, in exchange for running it yourself. If you prefer to leave that to Thinger.io, a private [Thinger.io Cloud](https://docs.thinger.io/administration/deployment/cloud.md) instance comes with the server versions, the backups and the monitoring handled for you. ## Troubleshooting | Symptom | Cause | Fix | |---|---|---| | `curl` fails with error 22, or `docker-compose.yml` contains an error message instead of the services | The license token is empty, unknown or the license is not active. | Check the token, without spaces or line breaks. If it is right, contact Thinger.io. | | `docker compose up -d` fails because a port is already allocated | Another service of the host, such as a web server, uses port 80, 443 or 1883. | Stop that service, or change the port in the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md) after the first start. | | `thinger` stays `(unhealthy)` | The server does not answer on port 80 of the host. | Read its output with `docker logs thinger`, and check that no other service uses port 80. | | The browser cannot open the console | A firewall blocks port 443 or 80, such as UFW on Ubuntu. | Open the ports listed in [Network ports](#network-ports). | | The sign-up form rejects the account | The email is not the administrator email of the license. | Sign up with the administrator email of the license. | | A device still appears on `iot.thinger.io` | The device does not set the address of your installation. | Set `THINGER_SERVER` (or your client's host) and flash it again. | ## Next steps - [Domains](https://docs.thinger.io/administration/domains.md): Serve the console and the API of your instance on your own hostname, with a TLS certificate that renews automatically. - [Cluster Hosts](https://docs.thinger.io/administration/cluster-hosts.md): Watch the connections, CPU, memory and disk of each server of your instance, follow its logs live and restart it. - [Server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md): Every setting of a Thinger.io server in Cluster Hosts, what it changes and how to edit it from the console, the API or an agent. --- Source: https://docs.thinger.io/administration/user-accounts.md # User Accounts > Create, edit, disable and delete the user accounts of your Thinger.io instance, choose their role and set their limits. **User Accounts** lists every account of your instance. As an administrator you create accounts for your users, choose their role, disable or delete them, and set limits per account. You can also open the console as one of them to see what they see. ## When to use it - To give access to your instance to a new developer, customer or operator. - To make an account administrator, or administrator of the accounts of one hostname. - To stop an account from signing in, or to raise or lower its limits. ## Roles ![Four roles: Admin administers every account and the Administration menu; Domain Admin, the accounts whose Domain is one of its hostnames; Developer, its own devices, buckets, dashboards and projects; Project Member, only the projects it is invited to, without the Administration menu. Admins create any account, domain admins manage the accounts of their hostnames, and developers add project members to their projects. Public sign-up and identity providers also create developers or project members, as the Account Role says](https://docs.thinger.io/diagrams/account-roles.svg) *Roles of an instance* | Role | Shown as | What the account can do | |---|---|---| | `admin` | **Admin** | Administers the whole instance: every account and the **Administration** menu. Only administrators create administrators and domain administrators. | | `domain_admin` | **Domain Admin** | Administers the accounts that belong to its domains (the **Domain** field). | | `user` | **Developer** | A regular account with its own devices, buckets, dashboards and other resources. | | `member` | **Project Member** | Works only inside the [projects](https://docs.thinger.io/platform/projects.md) it is invited to, starting in its **Default Project**. It does not see the **Administration** menu. | ## Create an account ### Console **Step 1: Open User Accounts** Go to **Administration > User Accounts** and click **Add User** (or **Create a User Account** if the list is empty). The list shows each account with its email, its domains, its role, whether its email is verified and when it registered; a gray dot marks a disabled account. ![User Accounts list with six accounts: an Admin, a Domain Admin of iot.example.com, three Developers (one disabled, with a gray dot and not verified) and a Project Member, and the eye icon on every account but your own](https://docs.thinger.io/screenshots/user-accounts-list.webp) *User Accounts* **Step 2: Fill in the account** On the **Account** tab, set the **Username**, the **Role** and the **Email**. For a **Project Member**, also choose its **Default Project**. **Step 3: Choose how the password is set** Enter a **Password**, or leave it blank so that the user receives an email to set their own. **Enabled** and **Email Verified** are on by default. Click **Add User**. ![Add User form with username, Developer role and email, and an empty password](https://docs.thinger.io/screenshots/user-accounts-add-form.webp) *Add a user account* ### API `YOUR_SERVER` is the hostname of your instance, and `YOUR_TOKEN` an access token of an administrator. An empty `password` sends the user an email to set it. **API call:** `POST /v1/users` ([reference](https://docs.thinger.io/reference/rest-api/users.md#user-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/users" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "user": "jdoe", "email": "jdoe@example.com", "password": "", "role": "user", "enabled": true, "verified": true }' ``` A project member also needs its default project: `"role": "member", "options": {"project": {"default": "plant_madrid"}}`. ### CLI With the CLI signed in as an administrator: ```bash thinger admin user create jdoe \ -s email=jdoe@example.com \ -s password= \ -s role=user \ -s enabled=true \ -s verified=true ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-user). ### AI **Prompt for an AI agent:** > Create a developer account jdoe with the email jdoe@example.com, and let the user choose their own password. The agent uses `thinger_resource_create` with the `user` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Edit an account Open the account to change its **Role**, **Email**, **Password**, **Enabled** and **Email Verified**. When you edit an account you can also set its **Domain**: the hostnames it belongs to, which decide the [brand](https://docs.thinger.io/administration/brands.md) of its emails and the accounts a domain administrator manages. The **Username** cannot be changed. ### Console Go to **Administration > User Accounts**, click the account, change the fields of its **Account** tab and click **Update User**. ![Account tab of the nina_admin account with the Domain Admin role, iot.example.com as Domain, its email, an empty password and Enabled and Email Verified on](https://docs.thinger.io/screenshots/user-accounts-account-tab.webp) *Account tab of a domain administrator* ### API Send only the fields you change: **API call:** `PUT /v1/users/{user}` ([reference](https://docs.thinger.io/reference/rest-api/users.md#user-update)) ```bash curl -X PUT "https://YOUR_SERVER/v1/users/jdoe" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"host": ["iot.example.com"], "role": "domain_admin"}' ``` ### CLI ```bash thinger admin user update jdoe -s 'host=["iot.example.com"]' -s role=domain_admin ``` ### AI **Prompt for an AI agent:** > Make jdoe the domain administrator of iot.example.com. ## Disable or delete an account Disable an account to stop it from signing in while keeping everything it owns. Delete it to remove it for good. > **Danger: Cannot be undone** > > Deleting an account deletes everything it owns: devices, Data Buckets and their data, dashboards, plugins and files. ### Console To disable an account, open it, turn off **Enabled** and click **Update User**. The list shows a gray dot next to disabled accounts. To delete it, select it in the list, click **Remove** and confirm with **Remove**. ### API To disable it, send `{"enabled": false}` with `PUT /v1/users/{user}`. To delete it: **API call:** `DELETE /v1/users/{user}` ([reference](https://docs.thinger.io/reference/rest-api/users.md#user-delete)) ```bash curl -X DELETE "https://YOUR_SERVER/v1/users/jdoe" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI To disable it: ```bash thinger admin user update jdoe -s enabled=false ``` To delete it (`-y` skips the confirmation): ```bash thinger admin user delete jdoe -y ``` ### AI **Prompt for an AI agent:** > Disable the account jdoe so that it cannot sign in, without deleting anything. An agent asks you to confirm before it deletes an account. ## Set the limits of an account Each account follows the limits of the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md#accounts). The **Limits** tab of an account overrides them for that account: the maximum number of access tokens, buckets, dashboards, devices, endpoints, plugins, projects, project members, alarm rules and instances, syncs, file storages, asset types and asset groups, and the **Bucket Retention**. Leave a field empty (it shows **Default**) to use the server value. ![Limits tab of the carlos_partner account with 50 buckets, 20 dashboards, 500 devices and 2 plugins, and every other limit on Default](https://docs.thinger.io/screenshots/user-accounts-limits-tab.webp) *Limits of an account* With the API, send `limits` with `PUT /v1/users/{user}`: `-1` is unlimited and `0` disables the feature. ```json { "limits": { "devices": { "max_count": 500 }, "buckets": { "max_count": 50 } } } ``` `GET /v1/users/{user}/limits` returns the limits that apply to an account and how many resources it has created. On a Cloud instance, the total that your plan allows still applies; see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## See the console as another user Click the eye icon on a row of the list to open the console as that user, with their permissions; your own account has no eye icon. The top bar then shows the username of that user and a crossed-out eye icon, **Close Impersonation**: click it to return to your own account. Use it to check what a user sees or to help them with a problem. ![Console opened as laura_ops: the top bar shows laura_ops and the crossed-out eye icon of Close Impersonation, highlighted, over the Statistics page of that account](https://docs.thinger.io/screenshots/user-accounts-impersonation.webp) *The console opened as another user* ## Limits - Project members don't have a **Limits** tab: they work with the resources of their projects. - Every account shares the CPU and memory of the instance, and the [plugins](https://docs.thinger.io/plugins.md) each account runs use them the most, Node-RED for example. When you add many accounts or plugins, watch the load of the instance in [Cluster Hosts](https://docs.thinger.io/administration/cluster-hosts.md); the **Limits** tab can cap the plugins of each account. - Project members never see the **Administration** menu. Developers may see it, but only administrators can use it, and domain administrators only for the accounts of their domains. ## Related pages - [User Accounts](https://docs.thinger.io/reference/rest-api/users.md): REST API reference for User Accounts: manage user accounts and their profile, password, email, timezone, multi-factor authentication and passkeys. 40 operations. - [Brands](https://docs.thinger.io/administration/brands.md): Give the console your own logos, colors, login page, sign-up rules and emails on each hostname of your instance. - [Identity Providers](https://docs.thinger.io/administration/identity-providers.md): Let users sign in to your instance with your company's single sign-on (SSO) over OpenID Connect, such as Microsoft Entra ID, Google or Auth0. --- Source: https://docs.thinger.io/administration/cluster-hosts.md # Cluster Hosts > Watch the connections, CPU, memory and disk of each server of your instance, follow its logs live and restart it. **Cluster Hosts** lists the servers that run your instance. Each host shows its load over the last week, its live log, and the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md) it runs with. Hosts register themselves when they start: an instance with a single server has one host, named after the server's hostname. ![Each server of the instance registers itself as a host when it starts. In Administration, Cluster Hosts lists the hosts, and each host has three tabs: Overview with its connections, CPU, RAM and disk, Logs with its live output, and Settings with its configuration. Saved settings apply when the host restarts](https://docs.thinger.io/diagrams/cluster-hosts.svg) *Hosts and their tabs* ## When to use it - To check whether the server is under load: connections, CPU, memory or disk. - To follow what the server is doing while you connect a device or try a setting. - To restart the server after you change its settings. ## Check the status of a host ### Console Go to **Administration > Cluster Hosts** and click the host. The list shows every host of the instance; a single server shows one. ![Cluster Hosts list with one host](https://docs.thinger.io/screenshots/cluster-hosts-list.webp) *Cluster Hosts* The **Overview** tab shows: - The current number of connections: **Total Connections**, **Device Connections**, **HTTP Client**, **HTTP Server**, **WebSocket** and **SSE**. - Charts of the last week, with the 1, 5 and 15 minute averages, and a gauge with the current value, for **Average Server Connections**, **Average CPU Usage**, **Average RAM Usage** and **Average Disk Load**. ![Overview tab of a cluster host with the connection counters, and the charts and gauges of connections, CPU, RAM and disk, still without data](https://docs.thinger.io/screenshots/cluster-hosts-overview.webp) *Overview tab of a host* ### API `YOUR_SERVER` is the hostname of your instance, and `YOUR_TOKEN` an access token of an administrator. List the hosts to get their IDs: **API call:** `GET /v1/hosts` ([reference](https://docs.thinger.io/reference/rest-api/hosts.md)) ```bash curl "https://YOUR_SERVER/v1/hosts" \ -H "Authorization: Bearer YOUR_TOKEN" ``` To check from a monitoring tool that the server answers, call `GET /v1/server/healthcheck`, which needs no token. See [Monitoring](https://docs.thinger.io/administration/monitoring.md). ### CLI With the CLI signed in as an administrator, list the hosts and show one of them: ```bash thinger admin host list thinger admin host get server-1 ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-host). ### AI **Prompt for an AI agent:** > List the hosts of my instance and tell me how they are configured. The agent uses `thinger_resource_list` and `thinger_resource_get` with the `host` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ### What each counter means | Counter | What it counts | |---|---| | **Total Connections** | The sum of the five counters below. | | **Device Connections** | Devices connected to the server now, over any protocol: IOTMP, MQTT or HTTP. | | **HTTP Client** | Outgoing HTTP connections the server opens: [endpoint](https://docs.thinger.io/platform/endpoints.md) calls, requests to [plugins](https://docs.thinger.io/plugins.md), [identity providers](https://docs.thinger.io/administration/identity-providers.md) and other external services. | | **HTTP Server** | Incoming HTTP connections: the console, REST API clients, the CLI and HTTP devices. | | **WebSocket** | Open WebSocket connections, such as consoles that show live data, device terminals or the server log. | | **SSE** | Open Server-Sent Events streams. | | **Average CPU Usage** | Percentage of CPU in use on the machine. It rises with data processing. | | **Average RAM Usage** | Percentage of memory in use on the machine, plugins included. It is usually the first limit you reach. | | **Average Disk Load** | Percentage of the disk space in use. | ## Follow the server logs The log shows the output of the server: connections, errors and the messages of each service. ### Console Open the host and go to the **Logs** tab. Click **Connect** to start receiving new lines live. Use **Search...** to highlight text, **Clear** to empty the view and **Full Screen** to enlarge it. ### API A plain request returns the last lines as text: `lines` sets how many (up to 5000, 200 by default), `timestamps=true` adds the time of each line, and `since` returns only the lines after a unix timestamp, or of the last given seconds. **API call:** `GET /v1/hosts/{host}/logs` ([reference](https://docs.thinger.io/reference/rest-api/hosts.md#host-readlogs)) ```bash curl "https://YOUR_SERVER/v1/hosts/server-1/logs?lines=500×tamps=true" \ -H "Authorization: Bearer YOUR_TOKEN" ``` `server-1` is the host ID, as `GET /v1/hosts` returns it. The same path, opened as a WebSocket, streams the new lines live. ### CLI The CLI reads the last lines; it does not follow them live. ```bash thinger admin host logs server-1 -q lines=500 -q timestamps=true ``` ### AI **Prompt for an AI agent:** > Show me the last 200 lines of the server log and tell me if there are errors. The agent uses `thinger_resource_call` with the `logs` action of the host. ### Read a log line Each line starts with the same fields, followed by the message: ``` 2026-10-17 09:41:07.512 (3612.204s) [worker thread 2 ] system_monitor.cpp:116 INFO| system metrics - cpu: 4.2%, ram: 38.5%, disk: 21.0%, connections: 57, sockets: 61 ``` | Field | Example | Meaning | |---|---|---| | Date and time | `2026-10-17 09:41:07.512` | When the server wrote the line, with milliseconds, in the time zone of the server. | | Uptime | `(3612.204s)` | Seconds since the server started. It goes back to zero after a restart. | | Thread | `[worker thread 2 ]` | The server thread that wrote the line. | | Source | `system_monitor.cpp:116` | Where in the server the message comes from. Include it when you report a problem to support. | | Level | `INFO` | `INFO`, `WARN` for warnings, `ERR` for errors and `FATL` for fatal errors. A number from `1` to `9` marks a detailed message. | | Message | `system metrics - …` | What happened. The server writes a line like this one with its CPU, RAM, disk and connections every minute. | To find problems, search for `ERR` or `WARN`, or for the ID of the device or the user involved. ## Size the server The server alone handles many devices and thousands of data points per second with little load. What makes it grow: - **Plugins.** Each plugin installed by each account runs as its own container on the machine, with its own memory and CPU. They are the main use of RAM: an account costs little on its own, but each of its plugins adds a container. Node-RED is a common example. - **Data processing.** Product scripts, endpoints and high rates of data written to Data Buckets use CPU. - **Connections.** Many devices and users connected at the same time, and consoles with live data open, add connections and memory. Watch **Average RAM Usage** and **Average CPU Usage** over the week. If they stay high, remove the plugins nobody uses, or move to a larger machine: on Thinger.io Cloud, a larger plan (see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md)); on [on-premise](https://docs.thinger.io/administration/deployment/on-premise.md), a host with more memory and CPU. If the disk fills, reduce the retention of your Data Buckets or export and delete old data. ## Restart a host Changes to the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md) apply after a restart. A restart drops every connection for a few seconds or more: devices reconnect on their own, and users see the console reconnect. Plan it for a quiet moment. ### Console Open the host, go to the **Settings** tab, open **Restart Server** and click **Restart Now**. ![Restart Server section of the host settings with the Restart Now button](https://docs.thinger.io/screenshots/cluster-hosts-restart.webp) *Restart Server in the host settings* ### API **API call:** `POST /v1/hosts/{host}/restart` ([reference](https://docs.thinger.io/reference/rest-api/hosts.md#host-updatestaterestart)) ```bash curl -X POST "https://YOUR_SERVER/v1/hosts/server-1/restart" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger admin host restart server-1 ``` It asks for confirmation unless you add `-y`. ### AI **Prompt for an AI agent:** > Restart the server to apply the new settings. An agent asks you to confirm before it restarts a host: the `restart` action of `thinger_resource_call` answers with what it would do, and restarts only when called again with `confirm: true`. ## Limits - The overview keeps the metrics of the last week. - The log shows the server output only; the logs of each plugin are on the plugin page. See [Plugin management](https://docs.thinger.io/plugins/management.md). - Restarting the host of an instance with a single server makes the whole instance unavailable while it starts. ## Related pages - [Server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md): Every setting of a Thinger.io server in Cluster Hosts, what it changes and how to edit it from the console, the API or an agent. - [Monitoring](https://docs.thinger.io/administration/monitoring.md): Watch the health and load of your Thinger.io instance with Cluster Hosts, the health check endpoint and the Prometheus Exporter plugin. - [Cluster Hosts](https://docs.thinger.io/reference/rest-api/hosts.md): REST API reference for Cluster Hosts: manage the cluster hosts of an instance, their settings, logs and restarts. 9 operations. --- Source: https://docs.thinger.io/administration/cluster-hosts/settings.md # Server settings > Every setting of a Thinger.io server in Cluster Hosts, what it changes and how to edit it from the console, the API or an agent. The **Settings** tab of each host in [Cluster Hosts](https://docs.thinger.io/administration/cluster-hosts.md) holds the configuration of the server: its ports, mail, storage, TLS, accounts and security headers. Changes apply after you [restart the host](https://docs.thinger.io/administration/cluster-hosts.md#restart-a-host). ## Change a setting ### Console **Step 1: Open the settings** Go to **Administration > Cluster Hosts**, click the host and open the **Settings** tab. Choose a section in the left menu. **Step 2: Save the section** Change the fields and save the section. Each section is saved on its own. ![Email section of the server settings with SMTP selected](https://docs.thinger.io/screenshots/settings-email.webp) *Email settings with SMTP* **Step 3: Restart the server** Open **Restart Server** and click **Restart Now** to apply the changes. ### API `GET /v1/hosts/{host}/settings` reads the settings; `PUT` merges the body into them: send only the sections you change, and `null` to remove a value and return to the default. Ports are strings. `YOUR_SERVER` is the hostname of your instance, `YOUR_TOKEN` an access token of an administrator, and `server-1` the host ID. **API call:** `PUT /v1/hosts/{host}/settings` ([reference](https://docs.thinger.io/reference/rest-api/hosts.md#host-updatesettings)) ```bash curl -X PUT "https://YOUR_SERVER/v1/hosts/server-1/settings" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"mqtt_server": {"port": "1884", "ssl_port": "8884"}}' ``` Then restart with `POST /v1/hosts/{host}/restart`. ### CLI With the CLI signed in as an administrator, `get-settings` reads the settings and `update-settings` merges the body into them, as the `PUT` does. Ports are strings, so quote them as JSON: ```bash thinger admin host get-settings server-1 thinger admin host update-settings server-1 -s 'mqtt_server={"port": "1884", "ssl_port": "8884"}' ``` Then restart with `thinger admin host restart server-1`. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-host). ### AI **Prompt for an AI agent:** > Configure the server to send its emails through smtp.example.com on port 587 with STARTTLS, from noreply@example.com. Ask me for the SMTP password, and restart the server only after I confirm. The agent uses `thinger_resource_call` with the `read_settings`, `update_settings` and `restart` actions of the host. `update_settings` and `restart` first answer with what they would do, and act only when called again with `confirm: true`. See [MCP tools](https://docs.thinger.io/ai/tools.md). > **Warning** > > A wrong port, mail or sign-in setting can leave devices or users without access after the restart. Note the current value before you change it. On instances installed by Thinger.io, that is every Cloud instance and every [on-premise](https://docs.thinger.io/administration/deployment/on-premise.md) installation with a license, some settings belong to the plan or the license: the limits of accounts, brands, domains and members, the database of the server, plugins and rate limits. They are not shown in the settings, and the API answers `403 Forbidden` if you try to change them; see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## HTTP Server The REST API and the console. Key `http_server`. ![HTTP Server section of the server settings with Enabled on, the listen address 0.0.0.0 and the ports 80 and 443](https://docs.thinger.io/screenshots/settings-http-server.webp) *HTTP Server settings* | Field | Key | Description | |---|---|---| | **Enabled** | `enabled` | Serve the console and the REST API. On by default. | | **Listen Address** | `address` | Address the server listens on, such as `0.0.0.0`. | | **TCP Port** | `port` | HTTP port. Default `"80"`. | | **TLS Port** | `ssl_port` | HTTPS port. Default `"443"`. | > **Danger: Keep the HTTP server enabled** > > With **Enabled** off, after the restart the server does not open its HTTP ports: there is no console and no REST API to turn it on again, and HTTP devices and plugins stop working. To recover the instance, contact Thinger.io support. ## IOTMP Server The device connections of the Thinger.io libraries. Key `thing_server`. ![IOTMP Server section of the server settings with Enabled on, the listen address and the ports 25200 and 25202](https://docs.thinger.io/screenshots/settings-iotmp-server.webp) *IOTMP Server settings* | Field | Key | Description | |---|---|---| | **Enabled** | `enabled` | Accept IOTMP devices. | | **Listen Address** | `address` | Address the server listens on. | | **TCP Port** | `port` | Plain port. Default `"25200"`. | | **TLS Port** | `ssl_port` | TLS port. Default `"25202"`. | | — | `port_v2`, `ssl_port_v2` | Ports of IOTMP version 2, plain and TLS. Defaults `"25204"` and `"25206"`. Only in the API. | ## MQTT Server The MQTT broker for devices. Key `mqtt_server`. ![MQTT Server section of the server settings with Enabled on, the listen address and the ports 1883 and 8883](https://docs.thinger.io/screenshots/settings-mqtt-server.webp) *MQTT Server settings* | Field | Key | Description | |---|---|---| | **Enabled** | `enabled` | Accept MQTT devices. | | **Listen Address** | `address` | Address the broker listens on. | | **TCP Port** | `port` | Plain port. Default `"1883"`. | | **TLS Port** | `ssl_port` | TLS port. Default `"8883"`. | ## Proxies Key `proxies`. ![Proxies section of the server settings with the dynamic port range from 50000 to 51000](https://docs.thinger.io/screenshots/settings-proxies.webp) *Dynamic port range of the proxies* | Field | Key | Description | |---|---|---| | **Port Start** | `dynamic_port_range_start` | First port given to [proxies](https://docs.thinger.io/administration/proxies.md) without a fixed port. Default `50000`. | | **Port End** | `dynamic_port_range_end` | Last port of the range. Default `51000`. | ## Email The mail the server sends (account verification, password reset, account creation, device disabled) when the [brand](https://docs.thinger.io/administration/brands.md) of the hostname has no mail of its own. Key `email`. ![Amazon SES tab of the Email section with the AWS access key ID, an empty secret access key and the region eu-west-1](https://docs.thinger.io/screenshots/settings-email-ses.webp) *Email settings with Amazon SES* | Field | Key | Description | |---|---|---| | **Email Type** | `type` | **None**, **SMTP** (`smtp`) or **Amazon SES** (`ses`). | | **From**, **Name** | `from`, `from_name` | Sender address and name. | | **Host**, **Port** | `smtp.host`, `smtp.port` | SMTP server and port, as a string (`"587"`). | | **Username**, **Password** | `smtp.username`, `smtp.password` | SMTP credentials. | | **SSL/TLS Connection** | `smtp.secure` | On: TLS from the start (usually port 465). Off: the server must offer STARTTLS (usually 587). | | **AWS Access Key ID**, **AWS Secret Access Key**, **Region** | `ses.aws_access_key_id`, `ses.aws_secret_access_key`, `ses.aws_region` | Amazon SES credentials and region. | ## Buckets Where [Data Buckets](https://docs.thinger.io/platform/data-buckets.md) keep their data and where their exports are written. Key `buckets`. ![Buckets section of the server settings: Storage Engine Settings with the General, InfluxDB, DynamoDB and MongoDB tabs and MongoDB as storage engine, and Bucket Export Settings below](https://docs.thinger.io/screenshots/settings-buckets-storage.webp) *Storage engine of the buckets* | Field | Key | Description | |---|---|---| | **Storage Engine** | `storage.default` | Engine of new buckets: **MongoDB** (`mongodb`), **InfluxDB** (`influxdb`) or **DynamoDB** (`dynamodb`). It must be one of the engines the server starts. Keep it set: without a value, the server offers InfluxDB as the default even when it is not started. | | — | `storage.type` | Engines the server starts, as a name or a list, such as `["mongodb", "dynamodb"]`. Default `"mongodb"`. Only in the API. | `GET /v1/server/buckets/backends` returns the engines the server started, its default engine and their retention limits. ### InfluxDB Key `buckets.storage.influxdb`. ![InfluxDB tab of the Storage Engine Settings with influxdb.example.com as host, port 8086, a username and an empty password](https://docs.thinger.io/screenshots/settings-buckets-influxdb.webp) *InfluxDB storage engine* | Field | Key | Description | |---|---|---| | **InfluxDB Host** | `host` | Host of the InfluxDB server. Default `localhost`. | | **InfluxDB Port** | `port` | Port of the InfluxDB server, as a string. Default `"8086"`. | | **InfluxDB Username**, **InfluxDB Password** | `username`, `password` | Stored with the settings. The server does not use them to connect to InfluxDB. | ### DynamoDB Key `buckets.storage.dynamodb`. ![DynamoDB tab of the Storage Engine Settings with Events as table name, the AWS access key ID, an empty secret access key and the region eu-west-1](https://docs.thinger.io/screenshots/settings-buckets-dynamodb.webp) *DynamoDB storage engine* | Field | Key | Description | |---|---|---| | **Table Name** | `table_name` | DynamoDB table that keeps the data of every bucket. Default `Events`. | | **AWS Access Key ID**, **AWS Secret Access Key** | `aws_access_key_id`, `aws_secret_access_key` | AWS credentials with access to the table. | | **Region** | `aws_region` | AWS region of the table, such as `eu-west-1`. | ### MongoDB Key `buckets.storage.mongodb`. ![MongoDB tab of the Storage Engine Settings with the MongoDB URI, an empty Max Retention and 7884000 seconds as Default Retention](https://docs.thinger.io/screenshots/settings-buckets-mongodb.webp) *MongoDB storage engine* | Field | Key | Description | |---|---|---| | **MongoDB URI** | `connection_string` | Stored with the settings, such as `mongodb://localhost:27017`. Data Buckets on MongoDB are kept in the database of the server, not at this URI. | | **Max Retention** | `max_retention` | Longest retention a bucket can have, in seconds. `0` or empty: no limit. | | **Default Retention** | `default_retention` | Retention new buckets get by default, in seconds, such as `7884000` (about three months). | ### Bucket export Where the [exports of Data Buckets](https://docs.thinger.io/platform/data-buckets.md) are written. Key `buckets.export`. ![Filesystem tab of the Bucket Export Settings with exports as Export Path](https://docs.thinger.io/screenshots/settings-buckets-export-filesystem.webp) *Bucket exports to the file system of the server* ![AWS S3 tab of the Bucket Export Settings with the bucket, the access key ID, an empty secret access key and the region](https://docs.thinger.io/screenshots/settings-buckets-export.webp) *Bucket exports to AWS S3* | Field | Key | Description | |---|---|---| | **Export Location** | `type` | **File System** (`filesystem`) or **AWS S3** (`s3`). | | **Export Path** | `filesystem.export_path` | Folder of the server where exports are written, such as `exports`. A relative path is inside the data folder of the server (`/data/thinger` on [on-premise](https://docs.thinger.io/administration/deployment/on-premise.md#where-the-data-is-stored)). | | **Bucket ID** | `s3.bucket_id` | Name of the S3 bucket. | | **AWS Access Key ID**, **AWS Secret Access Key**, **Region** | `s3.aws_access_key_id`, `s3.aws_secret_access_key`, `s3.aws_region` | AWS credentials with write access to the S3 bucket, and its region. | ## SSL Certificates TLS options of every TLS port. Key `ssl`. The certificates of the hostnames are managed in [Domains](https://docs.thinger.io/administration/domains.md). ![SSL Certificates section of the server settings with the cipher list, the prefer server ciphers and legacy protocols switches and the client CA certificates](https://docs.thinger.io/screenshots/settings-ssl.webp) *SSL Certificates settings* | Field | Key | Description | |---|---|---| | **SSL Server Ciphers** | `ssl_ciphers` | OpenSSL cipher list. | | **Server Ciphers** | `ssl_prefer_server_ciphers` | Prefer the server's cipher order. | | **Insecure Protocols** | `ssl_enable_legacy_protocols` | Accept TLS 1.0 and TLS 1.1, for old devices. | | **Client CA Certs** | `client_ca_certs` | PEM certificates of the authorities whose client certificates the server accepts. | ## Accounts Sign-up, sign-in and default limits of the accounts. Key `accounts`. A [brand](https://docs.thinger.io/administration/brands.md#accounts-on-a-brand) can override the sign-up and sign-in options for its hostname. ![Registration tab of the Accounts section with the admin email, example.com as required email domain, password lengths, Public Signup on and the authentication options](https://docs.thinger.io/screenshots/settings-accounts-registration.webp) *Registration settings of the accounts* | Field | Key | Description | |---|---|---| | **Admin Emails** | `admin_emails` | Accounts registered with these emails become administrators. | | **Invalid Email Domains**, **Required Email Domains** | `invalid_email_domains`, `required_email_domains` | Email domains rejected on sign-up, or the only ones accepted. | | **Invalid Usernames** | `invalid_usernames` | Usernames that cannot be registered. | | **Min Password Length**, **Max Password Length** | `min_password_length`, `max_password_length` | Password length rules. Defaults 8 and 48. | | **Public Signup** | `public_sign_up` | Anyone can create an account. **Account Role** sets the role of new accounts: developer (`user`) or project member (`member`). | | **Require email verification** | `require_email_verification` | New accounts must confirm their email. | | **Recaptcha** | `no_robot` | reCAPTCHA on sign-up, with its secret. | | **Password Login**, **Passwordless Login** | `allow_password`, `allow_passwordless` | Sign-in with password, or with passkeys. | | **Require 2FA** | `require_2fa` | Every user must set up a second factor. | | **Federated Login** | `federated_login`, `identity_providers` | Show the [identity providers](https://docs.thinger.io/administration/identity-providers.md) on the login page, all of them or the chosen ones. The **Callback URL** is the one to register at the provider. | | **Limits** tab | `limits` | Default limits of every account: maximum number of access tokens, buckets, dashboards, devices, endpoints, plugins, projects, project members, alarm rules and instances, syncs, file storages, asset types and groups, and bucket retention. `-1` is unlimited and `0` disables the feature. Each account can [override them](https://docs.thinger.io/administration/user-accounts.md#set-the-limits-of-an-account). | ![Limits tab of the Accounts section with the default account limits, all set to -1 (unlimited), and the bucket retention](https://docs.thinger.io/screenshots/settings-accounts-limits.webp) *Default limits of the accounts* Some features are disabled until their limit is raised: projects, project members, domains, brands and identity providers. On a Cloud instance your plan sets them. ## Deployment Security headers and the contact of the instance. Key `deployment`. ![Deployment section of the server settings with the contact email, the Disable Swagger API switch, SAMEORIGIN as X-Frame-Options and an empty Content-Security-Policy](https://docs.thinger.io/screenshots/settings-deployment.webp) *Deployment settings* | Field | Key | Description | |---|---|---| | **Contact Email** | `contact_email` | The account registered with this email becomes administrator. It is also the administrator address in the email templates. | | **Disable Swagger API** | `disable_swagger` | Hide the OpenAPI document at `/v1/server/swagger.json`. | | **X-Frame-Options** | `x_frame_options` | Header that controls who can embed the console in a frame. Default `SAMEORIGIN`. | | **Content-Security-Policy** | `content_security_policy` | Content Security Policy header of the console. | ## Scripting Engine Key `scripting_engine`. ![Scripting Engine section of the server settings with the NodeJS engine enabled](https://docs.thinger.io/screenshots/settings-scripting.webp) *Scripting Engine settings* | Field | Key | Description | |---|---|---| | **Engine** | `nodejs.enabled` | Run the JavaScript code of [products](https://docs.thinger.io/platform/products.md). | ## Restart Server ![Restart Server section of the server settings with the Restart Now button](https://docs.thinger.io/screenshots/settings-restart.webp) *Restart Server* Applies the saved settings. See [Restart a host](https://docs.thinger.io/administration/cluster-hosts.md#restart-a-host). --- Source: https://docs.thinger.io/administration/domains.md # Domains > Serve the console and the API of your instance on your own hostname, with a TLS certificate that renews automatically. **Plan:** Medium plan and above A domain lets your instance answer on a hostname of your own, such as `iot.example.com`. When you verify it, the server gets a Let's Encrypt TLS certificate for that hostname and renews it automatically. Domains are part of the **Administration** menu, available to administrators. ## When to use it - To offer the console to your customers on your company's hostname. - To give each customer or tenant its own hostname, each with its own [brand](https://docs.thinger.io/administration/brands.md). - To connect devices and call the REST API through your own hostname. ## Domains and brands A domain only manages the hostname and its certificate. Its look (logos, colors, login page, emails) is a [brand](https://docs.thinger.io/administration/brands.md) whose ID is the same hostname: there is no other link between the two. To white-label the console on a hostname, create the domain, verify it, and then create a brand with the same hostname. The guide [White-label the console](https://docs.thinger.io/guides/white-label.md) walks through the whole setup. ![A DNS A, AAAA or CNAME record points iot.example.com to the instance. Verify domain asks Let's Encrypt for a certificate, which checks the hostname over HTTP on port 80. The certificate is issued and renews automatically while the record points to the instance. A brand with the same hostname then gives it its logos, login page and emails, and users open https://iot.example.com](https://docs.thinger.io/diagrams/domain-verification.svg) *From the DNS record to a verified domain* ## Prepare the DNS Before you verify a domain, make the hostname reach your instance: - Create an `A` or `AAAA` record with the public IP of your instance, or a `CNAME` record that points to the hostname you already use to open the console (for example, `acme.aws.thinger.io`). No TXT record or verification value is needed. - Port 80 of the instance must be reachable from the internet: Let's Encrypt checks the hostname over HTTP. For `iot.example.com`, the record in the DNS zone of `example.com` looks like one of these: | Name | Type | Value | TTL | |---|---|---|---| | `iot` | `CNAME` | `acme.aws.thinger.io` (the hostname of your instance) | `300` | | `iot` | `A` | `203.0.113.10` (the public IP of your instance) | `300` | The record can take some minutes to propagate, up to its TTL. ## Add a domain ### Console **Step 1: Open Domains** Go to **Administration > Domains** and click **Add Domain** (or **Create a Domain** if you have none yet). **Step 2: Fill in the form** Set the **Domain Name** to your hostname, for example `iot.example.com`. **Name** and **Description** are optional. Click **Add Domain**. The **Domain Name** cannot be changed later: to use another hostname, remove the domain and add a new one. ![Add Domain form with iot.example.com as Domain Name](https://docs.thinger.io/screenshots/domains-add-form.webp) *Add a domain* **Step 3: Verify it** Open the domain. Until it is verified, **DNS Configuration** reminds you to add a `CNAME` or `A` record for the hostname that points to the instance (see [Prepare the DNS](#prepare-the-dns)). Click **Verify Domain**. When the certificate is issued, the console says the domain is verified and available at `https://iot.example.com`. If it fails, it shows the reason (for example, the DNS record does not resolve yet). ![Domain Details of iot.example.com with its description, and in DNS Configuration the notice to add a CNAME or A record pointing to the instance and the Verify Domain button](https://docs.thinger.io/screenshots/domains-dns-configuration.webp) *A domain waiting for verification* ### API `YOUR_SERVER` is the hostname of your instance, and `YOUR_TOKEN` an access token of an administrator. **API call:** `POST /v1/domains` ([reference](https://docs.thinger.io/reference/rest-api/domains.md#domain-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/domains" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"domain": "iot.example.com", "description": "Console for Example customers"}' ``` Then verify it. The call returns the Let's Encrypt error if the certificate cannot be issued. **API call:** `POST /v1/domains/{domain}/verify` ([reference](https://docs.thinger.io/reference/rest-api/domains.md#domain-verify)) ```bash curl -X POST "https://YOUR_SERVER/v1/domains/iot.example.com/verify" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI With the CLI signed in as an administrator, add the domain and then verify it: ```bash thinger admin domain create iot.example.com -d "Console for Example customers" thinger admin domain verify iot.example.com ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-domain). ### AI **Prompt for an AI agent:** > Add the domain iot.example.com to my instance. Tell me which DNS record I have to create, wait until I confirm it is done, and then verify the domain. The agent uses `thinger_resource_create` with the `domain` type and `thinger_resource_call` with its `verify` action. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Domain status **Administration > Domains** shows a dot next to each domain; hover over it to read its status: | Dot | Status | Meaning | |---|---|---| | Gray | Domain not verified | The domain was never verified. | | Red | Domain verification failed | The last verification failed. Open the domain to see why and verify again. | | Green | Domain verified | The certificate is issued. The hostname serves the console over HTTPS. | ![Domains list with dashboards.example.com and iot.example.com, each with the gray dot of a domain not verified, its description and creation time](https://docs.thinger.io/screenshots/domains-list.webp) *Domains and their status* Certificates renew automatically some weeks before they expire, as long as the DNS record keeps pointing to the instance. If you change or remove the record, renewal fails and HTTPS stops working on that hostname when the current certificate expires. ## Remove a domain Removing a domain deletes its certificate at once: the hostname no longer serves the console over HTTPS. Its brand, if any, is not removed. ### Console Go to **Administration > Domains**, select the domain and click **Remove**, then confirm with **Remove**. ### API **API call:** `DELETE /v1/domains/{domain}` ([reference](https://docs.thinger.io/reference/rest-api/domains.md#domain-delete)) ```bash curl -X DELETE "https://YOUR_SERVER/v1/domains/iot.example.com" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger admin domain delete iot.example.com -y ``` `-y` skips the confirmation. ### AI **Prompt for an AI agent:** > Remove the domain iot.example.com from my instance. ## Limits - Each domain is a single hostname, and its name cannot be changed: remove the domain and add it again with the new hostname. Wildcard domains (`*.example.com`) need a DNS challenge and only work on instances hosted by Thinger.io. - Verification needs port 80 open to the internet; instances that are not reachable from the internet cannot verify domains. - The number of domains depends on your plan. See [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Brands](https://docs.thinger.io/administration/brands.md): Give the console your own logos, colors, login page, sign-up rules and emails on each hostname of your instance. - [Domains](https://docs.thinger.io/reference/rest-api/domains.md): REST API reference for Domains: add and verify custom domains for the console. 6 operations. - [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md): The Thinger.io plans, the kinds of limits each one sets, and which features of the documentation need a given plan. --- Source: https://docs.thinger.io/administration/brands.md # Brands > Give the console your own logos, colors, login page, sign-up rules and emails on each hostname of your instance. **Plan:** Medium plan and above A brand is the look and the sign-in behavior of the console on one hostname: logos, colors, page titles, the login page, who can sign up and how, and the emails users receive. Each brand applies to the hostname that is its ID, so one instance can show a different console on each of its [domains](https://docs.thinger.io/administration/domains.md). ## When to use it - To show your company's logo, colors and texts instead of the Thinger.io ones. - To give each customer or tenant its own console on its own hostname. - To change who can sign up, how users sign in, or which emails they get on a hostname. ## Brands and domains The brand ID **is** the hostname, for example `iot.example.com`: the console opened on that hostname uses the brand. A hostname without a brand shows the default Thinger.io look and follows the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md#accounts). For the hostname to work over HTTPS, add it as a [domain](https://docs.thinger.io/administration/domains.md) and verify it. ![One instance serves several hostnames. A request to iot.customer-a.com uses the brand whose ID is iot.customer-a.com, with its logos, colors, login page, emails and account options; iot.customer-b.com uses its own brand; a hostname with no brand, such as the default hostname of the instance, shows the default Thinger.io look and the server settings](https://docs.thinger.io/diagrams/brand-resolution.svg) *One instance, one brand per hostname* The full setup, from DNS to the branded login page, is in [White-label the console](https://docs.thinger.io/guides/white-label.md): ![White-label setup in six steps: add the domain in Administration, Domains; point its DNS record to the instance; verify it so the server gets the Let's Encrypt certificate; create a brand with the same hostname and set its logos, colors and login page; optionally send its emails from your own server; and create the users or open sign-up on that hostname](https://docs.thinger.io/diagrams/white-label-setup.svg) *White-label a hostname, step by step* ## Create a brand ### Console **Step 1: Open Brands** Go to **Administration > Brands** and click **Add Brand** (or **Create a Brand** if you have none yet). The list shows each brand by its name and its hostname. ![Brands list with the brands dashboards.example.com and iot.example.com, their names and descriptions](https://docs.thinger.io/screenshots/brands-list.webp) *Brands* **Step 2: Set the hostname** Set the **Domain Name** to the hostname the brand applies to, for example `iot.example.com`, add an optional **Description** and click **Add Brand**. **Step 3: Customize it** Open the brand and fill in its tabs (see [Brand settings](#brand-settings)). Save each tab. If you edit the brand of the hostname you are browsing, the console changes at once. ![Information tab of the iot.example.com brand with page title, company name and contact email](https://docs.thinger.io/screenshots/brands-information-tab.webp) *Information tab of a brand* ### API `YOUR_SERVER` is the hostname of your instance, and `YOUR_TOKEN` an access token of an administrator. **API call:** `POST /v1/brands` ([reference](https://docs.thinger.io/reference/rest-api/brands.md#brand-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/brands" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "brand": "iot.example.com", "name": "Example IoT", "enabled": true, "config": { "name": "Example", "title": "Example IoT Console", "copyright": "© Example Inc.", "show_community": false, "style": { "topBar": { "background": "#132533", "color": "#ffffff" } }, "login": { "background_color": "#132533", "box_class": "login-center" } } }' ``` To change some settings later, use `PATCH /v1/brands/{brand}`: it merges the body into the stored brand. `PUT` replaces the whole `config` and `email` and deletes the images missing from the new `config`, so send it only with the complete brand. Images (logos, favicon, icons) are sent as `data:image/png;base64,…` or `data:image/webp;base64,…` URLs. ### CLI With the CLI signed in as an administrator, save the body of the API request as `brand.json` and create the brand from it: ```bash thinger admin brand create iot.example.com --from brand.json ``` To change some settings later, `--merge` merges the body into the stored brand, as `PATCH` does: ```bash thinger admin brand update iot.example.com --merge -s config.show_community=true ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-brand). ### AI **Prompt for an AI agent:** > Create a brand for iot.example.com with the title Example IoT Console, a dark blue top bar with white text, and without the community links in the menu. The agent uses `thinger_resource_create` with the `brand` type, and `thinger_resource_update` with `merge` to change it afterwards. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Brand settings The brand page groups its settings in tabs: | Tab | What it sets | |---|---| | **Information** | **Page title**, **Page URL** (where the login logo links), **Meta Description**, **Meta Keywords**, **Share Image** for link previews, **Company Name**, **Contact Email** shown in the support menu, **Copyright**, and whether the menu shows the **Community Links** and the **Server version**. | | **Accounts** | Sign-up and sign-in on this hostname. Each option overrides the [server setting](https://docs.thinger.io/administration/cluster-hosts/settings.md#accounts) of the same name. | | **Scripts** | **Index Scripts**: HTML added to the page head, for example an analytics tag. | | **Login** | **Background Color**, **Background Image**, **Background Style**, **Box Location** (center, left or right) and **Box Style** of the login page. | | **Logos** | **Favicon**, **Platform Logo** (login and public pages, exports), **Menu Logo** and **Menu Icon** (folded menu). See [Logos](#logos). | | **Top Bar** | **Top Bar Background** and **Top Bar Text** colors. | | **PWA** | Name, short name, colors and icons of the installable web app. See [Install the console as an app](#install-the-console-as-an-app). | | **Email Templates** | Sender, subject and HTML body of the **Email Verification**, **Create Password**, **Forgot Password** and **Device Disabled** emails. **Test Email** sends the saved template to your own address. | | **Email Settings** | **Custom Brand Email**: send this hostname's emails through your own SMTP server or Amazon SES instead of the server's mail settings. | Every field is optional. A brand starts with the default Thinger.io values (logos, contact email, community links): replace them, or clear the ones you don't want. Clear **Contact Email** to remove the **Email** entry from the **Support** menu, and turn off **Community Links** to remove **Documentation**, **Community**, **Helpdesk** and **Github Libraries**. ### Scripts **Index Scripts** is HTML that the console adds to the head of its page on this hostname, such as the tag of your analytics tool. It runs for every user of the hostname: add only code you trust. ![Scripts tab of the iot.example.com brand with an analytics script tag of analytics.example.com in Index Scripts](https://docs.thinger.io/screenshots/brands-scripts-tab.webp) *Scripts tab of a brand* ### Login page and top bar The **Login** tab sets the login page: a **Background Color** or a **Background Image** (with its CSS in **Background Style**), where the login box sits (**Box Location**: **Center**, **Left** or **Right**) and the CSS of the box (**Box Style**). The **Top Bar** tab sets the colors of the bar at the top of the console. ![Login tab of the iot.example.com brand with #0f3d38 as Background Color, Left as Box Location and a semi-transparent white Box Style with rounded corners](https://docs.thinger.io/screenshots/brands-login-tab.webp) *Login tab of a brand* ![Top Bar tab of the iot.example.com brand with a green Top Bar Background and a white Top Bar Text](https://docs.thinger.io/screenshots/brands-top-bar-tab.webp) *Top Bar tab of a brand* The console has no preview of a brand: open the hostname of the brand to see the result. ### Logos | Logo | Where it shows | Size | |---|---|---| | **Favicon** | The browser tab. | Up to 128 × 128 pixels. | | **Platform Logo** | The login and sign-up pages, public pages such as shared dashboards, and exports. It usually sits on a light background. | Up to 150 pixels high. | | **Menu Logo** | The top of the main menu, which is dark by default. | Up to 64 pixels high. | | **Menu Icon** | The main menu when it is folded. | Up to 128 × 128 pixels. | In the console you can pick a PNG or JPEG file with **Choose File**: it is scaled down to the size above and stored as PNG. Use logos with a transparent background, a light version for the dark menu and a dark one for the light login page, so they keep their contrast. ![Logos tab of the iot.example.com brand with the Favicon, the Platform Logo, the Menu Logo and the Menu Icon of Example IoT, each with its Choose File button](https://docs.thinger.io/screenshots/brands-logos-tab.webp) *Logos tab of a brand* ### Accounts on a brand | Option | Effect | |---|---| | **Public Sign-up** | Anyone can create an account on this hostname. **Account Role** sets whether new accounts are developers or project members; it also applies to accounts created by an identity provider. | | **Project Owner**, **Member Role** | For project members: each new member gets its own project, ` workspace`, in the account of the **Project Owner** (an administrator or a domain administrator), with the **Member Role** of that account. | | **Limit Bucket Data** | For project members: the new project only shows the bucket data of the devices in the project. The buckets must store a `device` tag. See [Limit bucket data to the project](https://docs.thinger.io/platform/projects.md#limit-bucket-data-to-the-project). | | **Recaptcha** | Asks for a reCAPTCHA on sign-up, with your **Recaptcha Secret**. | | **Password Login**, **Passwordless Login** | Which sign-in methods the login page offers (password, passkeys). If none is enabled, nobody can sign in on this hostname. | | **Cross Sign-in** | When off, only accounts created on this hostname can sign in on it. | | **Require 2FA** | Users must set up a second factor. | | **Federated Login** | Shows the buttons of the [identity providers](https://docs.thinger.io/administration/identity-providers.md) on the login page; **Identity Providers** limits which ones (empty shows all). The **Callback URL** is the one to register at the provider for this hostname. | ![Accounts tab of the iot.example.com brand with Public Sign-up on, Project Member as Account Role, docs as Project Owner, no Member Role and Limit Bucket Data on; Password Login on; and Federated Login on, with an empty Identity Providers list and the Callback URL https://iot.example.com/oauth/callback](https://docs.thinger.io/screenshots/brands-accounts-tab.webp) *Accounts tab of a brand, with sign-up of project members* > **Warning** > > Changing the sign-in options can lock users out of the hostname. Keep at least one sign-in method that an administrator can use. ### Email templates The **Email Templates** tab has one tab per email: **Email Verification**, **Create Password**, **Forgot Password** and **Device Disabled**. Each one has these fields: | Field | What it sets | |---|---| | **From**, **Name** | The sender address and name. Leave them empty to use the ones of the email settings (the brand's own, with **Custom Brand Email**, or the server's). | | **Subject** | The subject of the email. | | **Template** | The HTML body, shown as a preview. **Show Code** opens the HTML editor and **Hide Code** returns to the preview. | **Test Email** sends the saved template to your own address. ![Email Templates tab of the iot.example.com brand on Email Verification, with the sender no-reply@example.com, the name Example IoT, the subject, the preview of the HTML template, and the Test Email and Show Code buttons](https://docs.thinger.io/screenshots/brands-email-templates-tab.webp) *Email Verification template of a brand* Templates are HTML and can use these placeholders: `{{code}}`, `{{user}}`, `{{email}}`, `{{host}}`, `{{admin}}` (the server contact email) and `{{host_url}}`; `{{device}}` in **Device Disabled**. Keep the link of each template: | Template | Link | |---|---| | **Email Verification** | `{{host_url}}/verify_email?code={{code}}` | | **Forgot Password** | `{{host_url}}/password?code={{code}}` | | **Create Password** | `{{host_url}}/create_password?code={{code}}` | Email clients do not load embedded images: link your logo by its public address, `https://iot.example.com/brand/images/dark_logo.png`. ### Email settings By default, the emails of every hostname go out through the [email settings of the server](https://docs.thinger.io/administration/cluster-hosts/settings.md#email). Turn on **Custom Brand Email** in the **Email Settings** tab to send the emails of this hostname through your own server: in **Brand Email Settings**, the **General** tab sets the **Email Type** (**SMTP** or **Amazon SES**) and the default sender, and the **SMTP** and **Amazon SES** tabs hold the server and its credentials. ![Email Settings tab of the iot.example.com brand with Custom Brand Email on and the SMTP tab of Brand Email Settings with the host smtp.example.com, port 587, a username and an empty password](https://docs.thinger.io/screenshots/brands-email-settings-tab.webp) *A brand that sends its emails through its own SMTP server* ## Install the console as an app The console is an installable web app (PWA). On a phone or a computer, users can install it from the browser: it gets an icon on the home screen or in the app list, and it opens in its own window, without the browser bar. On each hostname the app takes the name, colors and icons of the **PWA** tab of its brand. | Field | What it sets | |---|---| | **Name** | The name of the app in the install prompt and the app list. Required. | | **Short Name** | The name under the icon on the home screen, when **Name** is too long. | | **Theme Color** | The color of the title bar or the status bar of the app, and the browser theme color of the console. | | **Background Color** | The background of the splash screen while the app loads. | | **App Icon** | Four PNG icons: 192 × 192 and 512 × 512 pixels, each for the purposes `any` and `maskable`. A `maskable` icon is cropped to a circle or a rounded square by the phone: keep the logo inside its central area. | ![PWA tab of the iot.example.com brand with Example IoT Console as Name, Example IoT as Short Name, the theme and background colors, and the 192 × 192 and 512 × 512 App Icons for the purposes any and maskable](https://docs.thinger.io/screenshots/brands-pwa-tab.webp) *PWA tab of a brand* A brand starts with the default Thinger.io app: change at least the name and the icons. The instance serves the manifest of each hostname at `https://iot.example.com/manifest.webmanifest`; with the API, it is the `config.pwa` object of the brand. To install it: | Device | Steps | |---|---| | Android (Chrome) | Open the console on the hostname, open the browser menu and tap **Add to Home screen** (or **Install app**), then confirm. | | iPhone and iPad (Safari) | Open the console, tap the share button and then **Add to Home Screen**. | | Computer (Chrome or Edge) | Open the console and click the install icon in the address bar. | ![The Chrome menu on Android open over the console, with the Add to Home screen option highlighted](https://docs.thinger.io/images/administration/pwa-android-add-to-home-screen.webp) *Add to Home screen in Chrome for Android* ![An Android home screen with the Thinger.io app icon among the other apps](https://docs.thinger.io/images/administration/pwa-android-home-screen-icon.webp) *The console installed on the home screen* ## Remove a brand Removing a brand returns the hostname to the default look. The domain and its certificate stay. ### Console Go to **Administration > Brands**, select the brand and click **Remove**, then confirm with **Remove**. ### API **API call:** `DELETE /v1/brands/{brand}` ([reference](https://docs.thinger.io/reference/rest-api/brands.md#brand-delete)) ```bash curl -X DELETE "https://YOUR_SERVER/v1/brands/iot.example.com" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### CLI ```bash thinger admin brand delete iot.example.com -y ``` `-y` skips the confirmation. ### AI **Prompt for an AI agent:** > Remove the brand of iot.example.com. ## Limits - A brand is readable without signing in, because the login page needs it. Secrets in it, such as the reCAPTCHA secret or the email password, are only returned to administrators. - Logos and images are stored as PNG or WebP: the console converts the file you pick to PNG, and the API accepts PNG or WebP data URLs. - The number of brands depends on your plan. See [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Domains](https://docs.thinger.io/administration/domains.md): Serve the console and the API of your instance on your own hostname, with a TLS certificate that renews automatically. - [Identity Providers](https://docs.thinger.io/administration/identity-providers.md): Let users sign in to your instance with your company's single sign-on (SSO) over OpenID Connect, such as Microsoft Entra ID, Google or Auth0. - [Brands](https://docs.thinger.io/reference/rest-api/brands.md): REST API reference for Brands: manage the brands of an instance and test their email settings. 7 operations. --- Source: https://docs.thinger.io/administration/oauth2-clients.md # OAuth2 Clients > Register applications that sign users in with your Thinger.io instance over OAuth2 and call the REST API on their behalf. **Plan:** Medium plan and above An OAuth2 client is an application you register on your instance so that it can sign users in with their Thinger.io account and call the REST API on their behalf, without ever seeing their password. The user approves the access on a consent screen of your instance, and the application receives tokens for that user. ## When to use it - To let your own web or mobile app sign users in with their account on your instance. - To connect a third-party service that supports OAuth2 to your users' data. - To sign in to the `thinger` CLI, or another tool without a browser, through the device flow. ## Supported flows ![Authorization code flow in six steps. In the user's browser: your application opens /oauth/authorize on the instance with its client ID; the user signs in and clicks Allow on the consent screen with the client name, logo and prompt; the instance redirects to your redirect URL with a code and the state. From your backend: it exchanges the code at /oauth/token with the client ID and secret, receives access_token, refresh_token and expires_in, and calls the REST API with Authorization: Bearer on behalf of the user](https://docs.thinger.io/diagrams/oauth2-authorization-code.svg) *The authorization code flow* | Flow | How it works | Token request | |---|---|---| | Authorization code | The application sends the user to the instance; the user signs in and approves; the instance redirects back to the application with a `code`, which the application exchanges for tokens. | `grant_type=authorization_code` with `code`, `client_id`, `client_secret` and `redirect_uri` | | Device flow | For tools without a browser. The tool asks for a code, the user opens the instance, enters the code and approves, and the tool polls for the tokens. | `grant_type=urn:ietf:params:oauth:grant-type:device_code` with `device_code` and `client_id` | | Refresh token | The application gets a new access token when the current one expires. | `grant_type=refresh_token` | The endpoints of your instance are: | Endpoint | URL | |---|---| | Authorization | `https://YOUR_SERVER/oauth/authorize` | | Token | `https://YOUR_SERVER/oauth/token` | | Device authorization | `https://YOUR_SERVER/oauth/device/authorize` | | Discovery document | `https://YOUR_SERVER/.well-known/openid-configuration` | `YOUR_SERVER` is the hostname of your instance. Token requests are sent as `application/x-www-form-urlencoded`, with the client credentials in the body. ## Register a client ### Console **Step 1: Open OAuth2 Clients** Go to **Administration > OAuth2 Clients** and click **Add Oauth Client** (or **Create OAuth2 Client** if you have none yet). ![OAuth2 Clients list with field_service_app and reporting_app, their names and descriptions](https://docs.thinger.io/screenshots/oauth2-clients-list.webp) *OAuth2 Clients* **Step 2: Set the client credentials** In **Client Settings**, set the **Client Id** and the **Client Secret** (each has a **Random** button), the **Name** shown on the consent screen and an optional **Description**. Leave **Enabled** on. **Step 3: Add the redirect URLs** In **Redirect URL(s)**, enter the addresses your application receives the user back at, one per line. Each request must use one of them exactly. **Step 4: Describe the access** In **Client Scopes**, add the permissions the application needs, and in **Consent Screen** set the **Prompt** text and the **Client Logo** users see when they approve. Click **Add Oauth Client**. ![Add OAuth2 Client form with client id, name, a redirect URL and a device read scope](https://docs.thinger.io/screenshots/oauth2-clients-add-form.webp) *Add an OAuth2 client* Once saved, the client page keeps the **Client Id** and shows the **Client Secret** hidden: the eye button shows it and the copy button copies it. **Client Integration** gives the **Authorization URI** and the **Access Token URI** to configure in your application, and the **Client Scopes** as text. **Show Authorization** opens the consent screen of the client in a new tab, to check it. ![Details of the field_service_app client: Client Id, hidden Client Secret, name, description, Enabled, two redirect URLs, two scopes for devices and buckets, the consent prompt and logo, and in Client Integration the Authorization URI, the Access Token URI and the client scopes](https://docs.thinger.io/screenshots/oauth2-clients-detail.webp) *A registered OAuth2 client* ### API `YOUR_TOKEN` is an access token of an administrator. `redirect_uri` holds one URL per line. **API call:** `POST /v1/oauth_clients` ([reference](https://docs.thinger.io/reference/rest-api/oauth-clients.md#oauthclient-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/oauth_clients" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "oauth_client": "example_app", "secret": "change-this-long-random-secret", "name": "Example App", "prompt": "Example App wants to read your devices", "enabled": true, "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback", "scope": { "Device": { "*": ["ListDevices", "ReadDeviceStatus"] } } }' ``` ### CLI With the CLI signed in as an administrator, save the body of the API request as `example_app.json` and register the client from it: ```bash thinger admin oauth-client create example_app --from example_app.json ``` The CLI can also sign in through your client with the device flow: `thinger login --oauth --client-id example_app`. See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-oauth-client). ### AI **Prompt for an AI agent:** > Register an OAuth2 client called Example App with the redirect URL https://app.example.com/oauth/callback and a random secret, allowed to list and read devices. The agent uses `thinger_resource_create` with the `oauth_client` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Sign users in with the authorization code flow **Step 1: Send the user to the instance** Open the authorization URL with your client ID, a redirect URL registered on the client, and a random `state` to check on return: ```text https://YOUR_SERVER/oauth/authorize?response_type=code&client_id=example_app&redirect_uri=https://app.example.com/oauth/callback&state=xyz ``` The user signs in, if needed, and sees the consent screen: the client name and prompt, the account that gives access, the client logo next to the user's picture, the **Required permissions**, and the buttons **Deny** and **Allow**. ![Consent screen of Reporting app: the prompt, the account docs, the client logo next to the user avatar, the required permissions Device:*:ListDevices,ReadDevice and the Deny and Allow buttons](https://docs.thinger.io/screenshots/oauth2-clients-consent.webp) *Consent screen of a client* **Step 2: Receive the code** If the user clicks **Allow**, the instance redirects to `https://app.example.com/oauth/callback?code=…&state=xyz`. If the user clicks **Deny**, the redirect carries `error=access_denied` instead. **Step 3: Exchange the code for tokens** From your backend, never from the browser, send the code with the client credentials: ```bash curl -X POST "https://YOUR_SERVER/oauth/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code" \ -d "client_id=example_app" \ -d "client_secret=change-this-long-random-secret" \ -d "code=THE_CODE" \ -d "redirect_uri=https://app.example.com/oauth/callback" ``` The response contains `access_token`, `refresh_token` and `expires_in`. Call the REST API with `Authorization: Bearer `. A code can be used only once. ## The Thinger CLI client Every server has a client named **Thinger CLI**, which the server creates when it starts if it does not exist. The `thinger` CLI uses it for its browser sign-in (`thinger login`, then **OAuth (browser)**), so users can sign in to the CLI and its MCP server without an administrator registering anything. It uses only the device flow, and it gives the CLI full access to the account of the user who approves it. It appears in **Administration > OAuth2 Clients** like any other client. To stop the browser sign-in of the CLI on your server, turn off **Enabled** instead of removing it: a removed client is created again the next time the server starts. Users can still sign in to the CLI with a token or with username and password. ## Change or remove a client Turn off **Enabled** to stop a client: a disabled client can neither authorize users nor get tokens. To remove it, go to **Administration > OAuth2 Clients**, select it and click **Remove**. With the API, use `PUT` or `DELETE /v1/oauth_clients/{oauth_client}`; with an agent, ask it to disable or delete the client. The **Client Id** and the **Client Secret** cannot be edited in the console once the client exists. To rotate a secret, change it with `PUT /v1/oauth_clients/{oauth_client}` and update your application at the same time. ## Limits - The client secret is stored as is and shown to administrators: keep it out of client-side code and treat it as a password. - **Client Scopes** describes the access for your records and the consent screen; the scope of each token is the one the authorization request asks for. - Redirect URLs must match exactly (the comparison ignores case). - The number of OAuth2 clients depends on your plan. See [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [OAuth2 Clients](https://docs.thinger.io/reference/rest-api/oauth-clients.md): REST API reference for OAuth2 Clients: manage the OAuth2 clients registered on an instance. 5 operations. - [Authentication](https://docs.thinger.io/reference/rest-api/authentication.md): REST API reference for Authentication: get access and refresh tokens for an account. The overview of the REST API shows the form-encoded body this operation expects. 1 operation. - [Identity Providers](https://docs.thinger.io/administration/identity-providers.md): Let users sign in to your instance with your company's single sign-on (SSO) over OpenID Connect, such as Microsoft Entra ID, Google or Auth0. --- Source: https://docs.thinger.io/administration/identity-providers.md # Identity Providers > Let users sign in to your instance with your company's single sign-on (SSO) over OpenID Connect, such as Microsoft Entra ID, Google or Auth0. **Plan:** Large plan and above An identity provider lets users sign in to your instance with an external account through OpenID Connect (OIDC): Microsoft Entra ID, Google, Auth0, Keycloak or any other OIDC provider. The login page shows a button for the provider; the user signs in there and comes back to the console, where the account is matched or created. ## When to use it - To use your company's single sign-on (SSO) instead of separate passwords. - To create the accounts of your users automatically the first time they sign in. - To limit sign-in to the email domains of your organization. ## How sign-in works ![The user clicks the provider button on the login page of your instance and is redirected to the identity provider, which asks for the credentials and its own MFA. The provider sends the user back to https://YOUR_SERVER/oauth/callback. The instance checks the ID token, reads the claims and signs the user in to the account linked to that identity or with the same email, or creates an account with Auto Provision. With Match Only and no account, sign-in is refused](https://docs.thinger.io/diagrams/oidc-sign-in.svg) *Sign-in with an OIDC provider* 1. The user clicks the provider button on the login page of your instance. 2. The instance redirects the user to the provider, which asks for their credentials (and its own MFA, if the provider uses it). 3. The provider sends the user back to the **Callback URL** of your instance. 4. The instance checks the ID token and reads the user's claims (username, email, name…). It signs the user in to the account already linked to that identity, or to the account with the same email if **Email Trust Mode** allows it. If there is none, it creates one when **Provisioning Mode** is **Auto Provision**. ## Set up an identity provider **Step 1: Register your instance at the provider** In your provider, create an OIDC application (a "web application" or "regular web app") and add the callback URL of your instance to its allowed redirect or callback URLs: ```text https://YOUR_SERVER/oauth/callback ``` `YOUR_SERVER` is the hostname users open the console on. If you serve a [brand](https://docs.thinger.io/administration/brands.md) on its own hostname, register that hostname's callback too (`https://iot.example.com/oauth/callback`); the **Accounts** tab of the brand shows it. Copy the client ID and the client secret the provider gives you. [Configure your provider](#configure-your-provider) has the steps for Google, Microsoft Entra ID, Auth0, Okta and PingOne. **Step 2: Create the provider on your instance** Follow [Add an identity provider](#add-an-identity-provider) below. **Step 3: Test the connection** Open the provider in **Administration > Identity Providers** and click the test button (the flask icon) in **Domain**. It checks the saved configuration, so save any change first. The test reads the provider's discovery document and keys, and shows **Connection successful**, **Connection with warnings** or **Connection failed**, with the issuer, the endpoints, the number of signing keys and the signing algorithms it found. **Step 4: Show it on the login page** Turn on **Federated Login** in the **Accounts** settings: on the [brand](https://docs.thinger.io/administration/brands.md#accounts-on-a-brand) of the hostname, or in the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md#accounts) for the default hostname. In **Identity Providers**, choose which providers to show; leave it empty to show all the enabled ones. The **Callback URL** below is the one to register at the provider for that hostname. ![Accounts tab of the iot.example.com brand with Public Sign-up on, Project Member as Account Role, docs as Project Owner, no Member Role and Limit Bucket Data on; Password Login on; and Federated Login on, with an empty Identity Providers list and the Callback URL https://iot.example.com/oauth/callback](https://docs.thinger.io/screenshots/brands-accounts-tab.webp) *Federated Login in the Accounts tab of a brand* The login page then shows a button for each provider under **Or continue with**. ## Configure your provider Each provider names its menus differently, but you always do the same: create a web application with your callback URL, copy its client ID and secret, and find its issuer for the **Domain**. Pick your provider: ### Google 1. In the [Google Cloud console](https://console.cloud.google.com/), select or create a project. 2. Go to **Google Auth Platform** and complete **Branding** (the consent screen) if the project has none. In **Audience**, choose **Internal** to allow only the accounts of your Google Workspace, or **External**. 3. In **Clients** (also under **APIs & Services > Credentials > Create credentials > OAuth client ID**), create a client of type **Web application**. 4. In **Authorized redirect URIs**, add `https://YOUR_SERVER/oauth/callback` and click **Create**. 5. Copy the **Client ID** and the **Client secret** from the dialog. | Field | Value | |---|---| | **Domain** | `accounts.google.com` | | **Auth Method** | **Client Secret Post** | | **Email Trust Mode** | **Verify with Claim**: Google sends `email_verified`. | Google sends no `preferred_username`, so new accounts take their username from the part of the email before the `@`. ![New Identity Provider form for Google with accounts.google.com as Domain, an example client ID, an empty client secret, Client Secret Post, the openid, profile and email scopes, Auto Provision for example.com, Verify with Claim and the button text Sign in with Google](https://docs.thinger.io/screenshots/identity-providers-google.webp) *Google as identity provider* ### Microsoft Entra ID 1. In the [Microsoft Entra admin center](https://entra.microsoft.com/), go to **App registrations** and click **New registration**. 2. Enter a name and, in **Supported account types**, choose the accounts of your directory only (single tenant). 3. In **Redirect URI**, choose the **Web** platform, enter `https://YOUR_SERVER/oauth/callback` and click **Register**. 4. On the **Overview** of the application, copy the **Application (client) ID** and the **Directory (tenant) ID**. 5. Go to **Certificates & secrets > Client secrets**, click **New client secret** and copy its **Value** (not the secret ID). The value is shown only once. | Field | Value | |---|---| | **Domain** | `login.microsoftonline.com//v2.0`, with your directory (tenant) ID | | **Auth Method** | **Client Secret Post** | | **Email Trust Mode** | Entra ID does not send `email_verified`. Use **Trust IdP** to link existing accounts by email, if you trust the emails of your directory. | The instance checks that the token comes from the exact issuer of the **Domain**, so use your tenant ID: the multi-tenant `common` and `organizations` endpoints do not work. ![New Identity Provider form for Microsoft Entra ID with login.microsoftonline.com and an example tenant ID as Domain, an example application ID, an empty client secret, Client Secret Post, Auto Provision for example.com, Trust IdP and the button text Sign in with Microsoft](https://docs.thinger.io/screenshots/identity-providers-entra.webp) *Microsoft Entra ID as identity provider* ### Auth0 1. In the [Auth0 Dashboard](https://manage.auth0.com/), go to **Applications > Applications** and click **Create Application**. 2. Choose **Regular Web Applications** and click **Create**. 3. On the **Settings** tab, add `https://YOUR_SERVER/oauth/callback` to **Allowed Callback URLs** and click **Save**. 4. Copy the **Domain**, the **Client ID** and the **Client Secret** from the same tab. | Field | Value | |---|---| | **Domain** | `your-tenant.us.auth0.com`, or your Auth0 custom domain | | **Auth Method** | **Client Secret Post**, the Auth0 default (**Credentials** tab) | | **Email Trust Mode** | **Verify with Claim**: Auth0 sends `email_verified`. | Keep the signing algorithm of the application at **RS256** (**Advanced Settings > OAuth**): tokens signed with HS256 are rejected. ![New Identity Provider form for Auth0 with example.eu.auth0.com as Domain, an example client ID, an empty client secret, Client Secret Post, Auto Provision for any email domain, Verify with Claim and the button text Sign in with Auth0](https://docs.thinger.io/screenshots/identity-providers-auth0.webp) *Auth0 as identity provider* ### Okta 1. In the Okta Admin Console of your organization (`https://your-org-admin.okta.com`), go to **Applications > Applications** and click **Create App Integration**. 2. Choose **OIDC - OpenID Connect** and **Web Application**, and click **Next**. 3. In **Sign-in redirect URIs**, enter `https://YOUR_SERVER/oauth/callback`. 4. In **Assignments**, choose who can use the application, and click **Save**. 5. Copy the **Client ID** and the **Client secret** from the **General** tab. | Field | Value | |---|---| | **Domain** | `your-org.okta.com`, or `your-org.okta.com/oauth2/default` for the default custom authorization server | | **Auth Method** | **Client Secret Basic**, the Okta default | | **Email Trust Mode** | **Verify with Claim**: Okta sends `email_verified`. | Users who are not assigned to the application get an error from Okta when they sign in. ![New Identity Provider form for Okta with example.okta.com as Domain, an example client ID, an empty client secret, Client Secret Basic, Auto Provision for example.com, Verify with Claim and the button text Sign in with Okta](https://docs.thinger.io/screenshots/identity-providers-okta.webp) *Okta as identity provider* ### PingOne 1. In the PingOne admin console, open your environment and go to **Applications > Applications**. Click the add button. 2. Enter a name, choose **OIDC Web App** and click **Save**. 3. On the **Configuration** tab, add `https://YOUR_SERVER/oauth/callback` to **Redirect URIs**. 4. On the **Resources** tab, allow the `openid`, `profile` and `email` scopes. 5. Turn on the application, which PingOne creates disabled. 6. Copy the **Client ID**, the **Client Secret** and the **Environment ID** from the **Overview** or **Configuration** tab. | Field | Value | |---|---| | **Domain** | `auth.pingone.com//as`, with the host of your region (`auth.pingone.eu`, `auth.pingone.ca`, `auth.pingone.asia`) | | **Auth Method** | **Client Secret Basic**, the PingOne default (**Token Endpoint Authentication Method**) | | **Email Trust Mode** | **Verify with Claim**, if your environment sends `email_verified`; otherwise **Trust IdP**. | ![New Identity Provider form for PingOne with auth.pingone.eu and an example environment ID as Domain, an example client ID, an empty client secret, Client Secret Basic, Auto Provision, Verify with Claim and the button text Sign in with PingOne](https://docs.thinger.io/screenshots/identity-providers-pingone.webp) *PingOne as identity provider* ### Other OIDC Any OpenID Connect provider works, such as Keycloak: 1. Register a confidential web client in your provider, with `https://YOUR_SERVER/oauth/callback` as redirect URI. 2. Copy its client ID and client secret. 3. Find its discovery document, `https:///.well-known/openid-configuration`. The **Domain** is the issuer without `https://`, such as `sso.example.com/realms/iot` for a Keycloak realm. 4. Make sure the provider signs ID tokens with RS256, RS384 or RS512. Create the provider and use the connection test to check it. ![New Identity Provider form for a Keycloak realm with sso.example.com/realms/iot as Domain, thinger-console as client ID, an empty client secret, Client Secret Post, Auto Provision for example.com, Trust IdP and the button text Company SSO](https://docs.thinger.io/screenshots/identity-providers-oidc.webp) *A Keycloak realm as identity provider* ## Add an identity provider ### Console Go to **Administration > Identity Providers** and click **Add Identity Provider**. Fill in the form and click **Create Provider**. The list shows each provider with its name, its identifier and its type; a gray dot marks a disabled provider. ![Identity Providers list with six OIDC providers, Company SSO (keycloak), PingOne, Okta, Auth0, Microsoft (entra) and Google, each with the gray dot of a disabled provider](https://docs.thinger.io/screenshots/identity-providers-list.webp) *Identity Providers* | Section | Field | What to enter | |---|---|---| | **Basic Information** | **Identifier** | A unique ID, such as `entra`. It cannot be changed later. | | | **Name** | The name shown to users on the login page. | | | **Description** | Optional, for administrators. | | | **Type** | **OpenID Connect (OIDC)**, the only type. | | | **Enabled** | On, to offer it. | | **OIDC Configuration** | **Domain** | The issuer of the provider, without `https://`: `accounts.google.com`, `login.microsoftonline.com//v2.0` or `your-tenant.us.auth0.com`. | | | **Client ID**, **Client Secret** | The credentials the provider gave you. | | | **Auth Method** | How the instance sends the secret to the provider: **Client Secret Post** (default), **Client Secret Basic** or **None** (public client). | | | **Scopes** | The scopes to request. Default: `openid`, `profile`, `email`, which give every claim the account uses. The list also suggests `address`, `phone`, `groups` and `offline_access`: the instance reads only the claims of **Attribute Mapping** and does not use refresh tokens from the provider, so they add nothing unless your provider needs them to release a claim. | | | **Callback URL** | Read only: the URL to register at the provider. | | **User Provisioning** | **Provisioning Mode** | **Auto Provision** creates an account the first time a user signs in; **Match Only** only lets in users whose account already exists. | | | **Allowed Domains** | With **Auto Provision**, the email domains that can get a new account, such as `example.com`. Empty allows all. It does not apply to accounts that already exist. | | | **Email Trust Mode** | Whether the provider's email links an existing account and counts as verified. **Trust IdP**: always. **Verify with Claim** (default): only if the provider sends `email_verified: true`. **Always Verify**: never; new accounts must verify their email. | | **Display Options** | **Logo** | The icon of the button: a PNG, JPEG or WebP image, scaled down to 64 × 64 pixels and stored as PNG. Use a square logo of at least 64 × 64 pixels so it stays sharp on high-density screens. | | | **Button Text** | The text of the button, such as `Sign in with Microsoft` or `Company SSO`. Empty, it reads "Login with" and the **Name**. | | **Attribute Mapping** | **Username Claim**, **Email Claim**, **Name Claim**… | The claims the account takes its data from. Defaults: `preferred_username`, `email`, `name`, `picture`, `website`, `organization` and `locale`. | ![New Identity Provider form with an OIDC domain, client ID and callback URL](https://docs.thinger.io/screenshots/identity-providers-add-form.webp) *New OIDC identity provider* ### API `YOUR_TOKEN` is an access token of an administrator. Use your provider's real values instead of ``, `` and ``. **API call:** `POST /v1/identity_providers` ([reference](https://docs.thinger.io/reference/rest-api/identity-providers.md#identityprovider-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/identity_providers" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "identity_provider": "entra", "name": "Microsoft", "type": "oidc", "enabled": true, "domain": "login.microsoftonline.com//v2.0", "client_id": "", "client_secret": "", "scopes": ["openid", "profile", "email"], "provisioning": { "mode": "auto_provision", "allowed_domains": ["example.com"], "email_trust_mode": "trust_idp" }, "display": { "button_text": "Sign in with Microsoft" } }' ``` ### CLI With the CLI signed in as an administrator, save the body of the API request as `entra.json`, with your provider's values, and create the identity provider from it: ```bash thinger admin identity-provider create entra --from entra.json ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-identity-provider). ### AI **Prompt for an AI agent:** > Add Microsoft Entra ID as an identity provider for my instance. Ask me for the tenant ID, the client ID and the client secret, create accounts automatically only for example.com emails, and tell me the callback URL I have to register in Entra. The agent uses `thinger_resource_create` with the `identity_provider` type. It asks you for the secrets instead of inventing them. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Accounts created by a provider - With **Auto Provision**, accounts are created even if public sign-up is off. Their role (developer or project member) comes from the **Account Role** of the **Accounts** settings of the brand or the server. - A new account needs an email from the provider. Its username comes from the **Username Claim**, or from the part of the email before the `@` if the provider sends none, without the characters a username cannot have; if the username is taken, a number is added (`jdoe1`). - On each sign-in, the name, website, company and location of the profile are filled in from the claims, only where they are empty. - An account can be linked to several providers. To unlink one, use `DELETE /v1/users/{user}/federated_identities/{identity_provider}`. - Disabling a provider (**Enabled** off) removes its button and stops new sign-ins with it. ## Troubleshooting When a sign-in fails, the login page shows the reason. The most common ones: | Symptom | Cause | Solution | |---|---|---| | The connection test shows **Connection failed** | The **Domain** is wrong, or your instance cannot reach `https:///.well-known/openid-configuration`. | Open that URL in a browser and check the issuer. The provider must be reachable from your instance: check firewalls and proxies. Save the provider before testing again. | | The connection test shows **Connection with warnings** | The provider has no RSA signing keys or signs with an algorithm other than RS256, RS384 or RS512. | Change the signing algorithm of the application at the provider to RS256. | | The provider shows a redirect URI error before signing in | The callback URL is not registered at the provider, or it differs in the hostname or the path. | Register exactly the **Callback URL** of the hostname users open, including `https://`. | | "token exchange failed" | The client ID, the client secret or the **Auth Method** do not match the application at the provider, or the application is disabled there. | Paste the credentials again, switch between **Client Secret Post** and **Client Secret Basic**, and check that the application is enabled. | | "invalid id token" | The token comes from an issuer other than the **Domain** (for example, the Entra ID `common` endpoint) or is signed with an unsupported algorithm. | Use the exact issuer of your tenant or organization and RS256. | | "no matching account found" | **Provisioning Mode** is **Match Only** and no account has the user's email. | Create the account first in [User Accounts](https://docs.thinger.io/administration/user-accounts.md), or switch to **Auto Provision**. | | "email domain not allowed" | The user's email domain is not in **Allowed Domains**. | Add the domain, or leave the list empty. | | "email is required for account creation" | The provider sent no email. | Request the `email` scope and check that the user has an email at the provider, or that **Email Claim** names the right claim. | | "an account with this email already exists" | An account has that email, but **Email Trust Mode** does not allow linking it: **Always Verify**, or **Verify with Claim** without `email_verified`. | Use **Trust IdP** if you trust the provider's emails. | | The account has an empty or wrong username, name or email | The claims have other names at this provider. | Check the claims of the ID token with your provider's token preview or debugger, and set the claim names in **Attribute Mapping**; request the scopes that release them. | | "invalid or expired authentication state" | The user took too long at the provider, or reused an old sign-in page. | Sign in again from the login page, in the same browser. | | The user returns to the login page again and again | The callback is registered for another hostname than the one the user opened, or the hostname is not served over HTTPS. | Register the callback of each hostname users open, and serve it over HTTPS with a verified [domain](https://docs.thinger.io/administration/domains.md). Clear the cookies of the site and try again. | | "your account is disabled" | The account exists but is disabled. | Turn on **Enabled** in [User Accounts](https://docs.thinger.io/administration/user-accounts.md). | ## Limits - Only OpenID Connect providers are supported. - ID tokens must be signed with RS256, RS384 or RS512. - The **Domain** must be the issuer of one tenant or organization: multi-tenant endpoints whose tokens come from another issuer, such as `common` in Entra ID, do not work. - Identity providers are disabled until your plan allows them. On a Cloud instance, they depend on the plan; see [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). - The client secret is a credential: never share it or paste it in public places. ## Related pages - [Brands](https://docs.thinger.io/administration/brands.md): Give the console your own logos, colors, login page, sign-up rules and emails on each hostname of your instance. - [User Accounts](https://docs.thinger.io/administration/user-accounts.md): Create, edit, disable and delete the user accounts of your Thinger.io instance, choose their role and set their limits. - [Identity Providers](https://docs.thinger.io/reference/rest-api/identity-providers.md): REST API reference for Identity Providers: manage the identity providers users can sign in with. 5 operations. --- Source: https://docs.thinger.io/administration/proxies.md # Proxies > Expose a TCP or UDP service, a plugin or a service on a device through a port or a subdomain of your Thinger.io instance. **Plan:** Medium plan and above A proxy opens a port (or a subdomain) on your instance and forwards its traffic to a service: a host the instance can reach, a [plugin](https://docs.thinger.io/plugins.md) running on the instance, or a service on an IOTMP device. Users and devices connect to your instance, and the proxy carries the connection to the target. ## When to use it - To reach the web interface or the API of a plugin, such as a database or a dashboard tool, from outside. - To receive TCP or UDP traffic from devices that cannot use IOTMP, MQTT or HTTP, and pass it to a plugin that decodes it. - To open a service of a device (its local web page, a TCP port) through the device connection, without opening ports in its network. ## Protocols and targets ![A user, tool or device connects to a source port of the instance, optionally with TLS, or to a subdomain of it. The proxy forwards the traffic over TCP, UDP, TCP over IOTMP or HTTP over IOTMP to its target: a host address the instance can reach, a running plugin of an account, or a service on a device through the device's IOTMP connection, without opening ports in its network](https://docs.thinger.io/diagrams/proxy-routing.svg) *How a proxy forwards a connection* | Protocol | Source | Target | |---|---|---| | **TCP** | A port of the instance, optionally with TLS. | A host address or a plugin. | | **UDP** | A port of the instance. | A host address or a plugin. | | **TCP over IOTMP** | A port of the instance, optionally with TLS. | A port on a device, through its IOTMP connection (**Target Username** and **Target Device**). | | **HTTP over IOTMP** | A port or a subdomain of the instance. | An HTTP service on a device, through its IOTMP connection. | With **Subdomain** routing, the proxy is served at `https://.YOUR_SERVER`, where `YOUR_SERVER` is the hostname of your instance; the hostname needs a certificate that covers its subdomains. ![Settings of the gateway_web proxy: HTTP over IOTMP, disabled, Subdomain routing with greenhouse-gw as subdomain, and as target the address localhost on port 80 of the device greenhouse_01 of the user docs](https://docs.thinger.io/screenshots/proxies-http-iotmp.webp) *HTTP over IOTMP proxy on a subdomain, to the web page of a device* ## Create a proxy The proxy starts listening as soon as you save it. ### Console **Step 1: Open Proxies** Go to **Administration > Proxies** and click **Add Proxy** (or **Create a Proxy** if you have none yet). In the list, a green dot marks the enabled proxies and a gray one the disabled ones. ![Proxies list with gateway_web, influxdb_tls, lora_udp and modbus_gateway, all disabled, with their names and descriptions](https://docs.thinger.io/screenshots/proxies-list.webp) *Proxies* **Step 2: Name it and choose the protocol** In **Proxy Settings**, set the **Proxy ID**, the **Proxy name** and an optional **Proxy description**, choose the **Protocol** and leave **Enabled** on. **Step 3: Set the source** In **Source Configuration**, set the **Source Port** users connect to, and turn on **SSL/TLS** to accept TLS connections on it. For **HTTP over IOTMP**, choose **Port** or **Subdomain** routing. **Step 4: Set the target** In **Target Configuration**, choose the **Target Type**: **Host Address** (set the **Target Address**, such as `localhost`) or **Plugin** (choose the user and one of its running plugins). For the IOTMP protocols, set the **Target Username** and the **Target Device**. Set the **Target Port**, turn on **SSL/TLS** if the target expects TLS, and click **Add Proxy**. ![Add Proxy form with a TCP proxy from port 8090 with TLS to a plugin on port 8086](https://docs.thinger.io/screenshots/proxies-add-form.webp) *TCP proxy with TLS to a plugin* The proxy page has a **Settings** tab and an **Inspector** tab that shows the proxy events in real time. ### API `YOUR_TOKEN` is an access token of an administrator. This proxy accepts TLS on port 8090 and forwards it to port 8086 of the `influxdb2` plugin of `YOUR_USER`: **API call:** `POST /v1/proxies` ([reference](https://docs.thinger.io/reference/rest-api/proxies.md#proxy-create)) ```bash curl -X POST "https://YOUR_SERVER/v1/proxies" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "proxy": "influxdb", "name": "InfluxDB", "enabled": true, "config": { "protocol": "tcp", "source": { "port": 8090, "secure": true }, "target": { "type": "plugin", "plugin": { "user": "YOUR_USER", "name": "influxdb2" }, "port": 8086, "secure": false } } }' ``` `protocol` is `tcp`, `udp`, `tcp_iotmp` or `http_iotmp`; a host target uses `"type": "address"` with `address`. When you update a proxy, send its whole `config`: a partial one replaces the stored config. ### CLI With the CLI signed in as an administrator, save the body of the API request as `influxdb.json` and create the proxy from it: ```bash thinger admin proxy create influxdb --from influxdb.json ``` See the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-admin-proxy). ### AI **Prompt for an AI agent:** > Create a TCP proxy on port 8090 with TLS that forwards to port 8086 of my influxdb2 plugin. The agent uses `thinger_resource_create` with the `proxy` type. See [MCP tools](https://docs.thinger.io/ai/tools.md). ## Edit a proxy Go to **Administration > Proxies**, open the proxy, change its fields and click **Update Proxy**. Every field can change except the **Proxy ID** and, for **HTTP over IOTMP**, the **Routing** and the **Subdomain**: to change them, remove the proxy and create it again. With the API, use `PUT /v1/proxies/{proxy}` with the whole `config`. When you save, the proxy starts again with the new configuration. ## Remove a proxy Removing a proxy closes its port at once. Go to **Administration > Proxies**, select it and click **Remove**, or use `DELETE /v1/proxies/{proxy}`. Turn off **Enabled** to stop it without removing it. ## Limits - The source port must be free on the instance: a port already used by another proxy or service does not work. - Proxies without a fixed port take one from the dynamic port range of the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md#proxies). - On instances hosted by Thinger.io, the ports of proxies are opened in the firewall for you. On other servers, open them yourself. - The number of proxies depends on your plan. See [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Plugins](https://docs.thinger.io/plugins.md): Add device integrations, network connectors, monitoring tools and development environments to your Thinger.io account. - [Proxies](https://docs.thinger.io/reference/rest-api/proxies.md): REST API reference for Proxies: manage the proxies that give external access to services of an instance. 5 operations. - [Server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md): Every setting of a Thinger.io server in Cluster Hosts, what it changes and how to edit it from the console, the API or an agent. --- Source: https://docs.thinger.io/administration/billing.md # Billing > Manage the subscription of your Thinger.io Cloud instance, its payment method and its invoices from the billing portal. **Billing** opens the subscription portal of your Thinger.io Cloud instance, where you manage the plan you pay for, the payment method and the invoices. It is in the **Administration** menu of private instances, for administrators. ## When to use it - To update the card or the bank account the subscription is charged to. - To download your invoices. - To change or cancel the subscription of the instance. ## Open the billing portal ### Console **Step 1: Open Billing** In the console of your instance, go to **Administration > Billing**. The billing portal opens in a new tab. ![Main menu of the console with the Administration section: User Accounts, Cluster Hosts, Domains, Brands, OAuth2 Clients, Identity Providers, Proxies and Billing, highlighted](https://docs.thinger.io/screenshots/billing-menu.webp) *Billing in the Administration menu* **Step 2: Sign in with your billing email** Enter the billing email of the subscription. The portal sends a one-time code to that address; enter it to open your subscriptions. You can also open the portal directly at [billing.stripe.com/p/login/00g9D1fN50SIcpOfYY](https://billing.stripe.com/p/login/00g9D1fN50SIcpOfYY). ### API The REST API of the instance does not manage the subscription. Use the billing portal. ### CLI The CLI does not manage the subscription. Use the billing portal. ### AI Agents connected through the MCP cannot manage the subscription. Use the billing portal. ## What you can do in the portal | Task | Where | |---|---| | Change the payment method (card or SEPA direct debit) | **Payment methods** | | See and download invoices | **Invoice history** | | Change the plan | The subscription of the instance | | Cancel the subscription | The subscription of the instance, **Cancel subscription**. The cancellation takes effect at the end of the period already paid. | ## Add-ons Some services are added to a subscription on top of the plan: | Add-on | What it adds | |---|---| | Daily backups | Daily copies of the instance, on the plans that do not include them. | | Priority support | Direct support from the Thinger.io team, besides the community forum. | | White-label mobile app | The Thinger.io mobile app with your colors, logos and icons, and the features you choose to show. | Which plans offer each add-on is on [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). To add one, [contact sales](https://thinger.io/contact-us). ## Limits - The portal manages Thinger.io Cloud subscriptions only. The free Cloud account has nothing to bill, and on-premise is arranged with Thinger.io as part of the Enterprise plan; see [On-premise](https://docs.thinger.io/administration/deployment/on-premise.md). - The billing email can differ from the email of the instance administrator. - What each plan includes is on [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md). ## Related pages - [Thinger.io Cloud](https://docs.thinger.io/administration/deployment/cloud.md): Subscribe to a private Thinger.io Cloud instance on the pricing page, sign in as its administrator and point your devices to it. - [Plans and limits](https://docs.thinger.io/administration/plans-and-limits.md): The Thinger.io plans, the kinds of limits each one sets, and which features of the documentation need a given plan. --- Source: https://docs.thinger.io/administration/monitoring.md # Monitoring > Watch the health and load of your Thinger.io instance with Cluster Hosts, the health check endpoint and the Prometheus Exporter plugin. This guide shows how to keep an eye on your Thinger.io instance: check its load in the console, alert when it stops answering, and export its metrics to your own monitoring tools. ![Four ways to watch an instance: an uptime monitor calls /v1/server/healthcheck, which needs no token, and alerts when it fails or is slow; an administrator checks the load and the output in Cluster Hosts; Prometheus scrapes the metrics endpoint of the Prometheus Exporter plugin and feeds Grafana and Alertmanager; and alarm rules on your devices notify through endpoints when a device goes offline or out of range](https://docs.thinger.io/diagrams/monitoring-options.svg) *Ways to monitor an instance* > **Warning: Server monitoring client discontinued** > > The Thinger.io server monitoring client (`thinger_monitor`) is no longer maintained: do not use it for new installations. Use the options on this page instead. To monitor and manage Linux machines as devices, see [ThinRemote](https://thinremote.io). ## Before you start - An administrator account on a private instance. `YOUR_SERVER` is the hostname of your instance. - For external alerts, an uptime monitoring service or tool that can call a URL. ## Steps **Step 1: Check the load of the server** Go to **Administration > Cluster Hosts**, click the host and open **Overview**. It shows the current connections and a week of CPU, memory, disk and connection averages. The **Logs** tab follows the server output live. See [what each counter means](https://docs.thinger.io/administration/cluster-hosts.md#what-each-counter-means) and [how to size the server](https://docs.thinger.io/administration/cluster-hosts.md#size-the-server). ![Overview tab of a cluster host with the connection counters, and the charts and gauges of connections, CPU, RAM and disk, still without data](https://docs.thinger.io/screenshots/cluster-hosts-overview.webp) *Overview tab of a host* **Step 2: Alert when the server stops answering** Point your uptime monitor at the health check of the instance. It needs no token and answers `200 OK` while the server works: ```bash curl -i "https://YOUR_SERVER/v1/server/healthcheck" ``` Set the monitor to alert you when the call fails or takes too long. **Step 3: Export metrics to Prometheus** Install the [Prometheus Exporter](https://docs.thinger.io/plugins/prometheus-exporter.md) plugin from **Plugins > Marketplace**. It publishes metrics about your devices and other resources in the Prometheus format, so that Prometheus, Grafana or Alertmanager can collect them and alert on them. The plugins of the [Monitoring](https://docs.thinger.io/plugins/monitoring.md) category cover the rest of the stack. **Step 4: Get notified about devices** To know when a device disconnects or a reading goes out of range, create an [alarm](https://docs.thinger.io/platform/alarms.md) instead of watching the server. ## Result The console shows the load of every host, your uptime monitor alerts you if the instance stops answering, and your monitoring stack collects the metrics of your resources. ## Next steps - [Cluster Hosts](https://docs.thinger.io/administration/cluster-hosts.md): Watch the connections, CPU, memory and disk of each server of your instance, follow its logs live and restart it. - [Prometheus Exporter](https://docs.thinger.io/plugins/prometheus-exporter.md): Export Thinger's resource status in a Prometheus format - [Alarms](https://docs.thinger.io/platform/alarms.md): Define alarm rules that watch bucket data, device properties or connection status, and notify through endpoints when a condition is met. --- Source: https://docs.thinger.io/administration/plans-and-limits.md # Plans and limits > The Thinger.io plans, the kinds of limits each one sets, and which features of the documentation need a given plan. Each Thinger.io plan sets which features your account or instance has and how many resources it can hold. This page explains the kinds of limits and which pages carry a plan label. The figures of each plan, and its price, are on the [pricing page](https://thinger.io/pricing). ## Plans | Plan | What it is | |---|---| | **Free Cloud account** | An account on the shared server `iot.thinger.io`, to learn and prototype. It does not include plugins or the **Administration** features. | | **Small**, **Medium**, **Large** | Paid [Thinger.io Cloud](https://docs.thinger.io/administration/deployment/cloud.md) plans. Each one is a private instance with its own hostname and users. | | **Enterprise** | Includes [on-premise](https://docs.thinger.io/administration/deployment/on-premise.md), which is coming soon. | ## Kinds of limits | Kind | Examples | Where you see it | |---|---|---| | Number of resources | Devices, Data Buckets, dashboards, endpoints, access tokens, products, projects and their members, plugins, proxies, OAuth2 clients | When the number is limited, the create form shows how many you have and how many you can create. Creating more fails with an error. | | Features that are on or off | Projects, domains, brands, identity providers, claims | The menu shows an orange dot next to the features your plan does not include. | | Data | How long Data Buckets keep their data, the minimum interval between writes | The bucket settings. | | Instance | Server size, user accounts, tenants (domains and brands), backups | The plan of your Cloud instance. | ![Toolbox menu open with Syncs and Claims, and the orange dot next to Claims, highlighted, because the plan allows 0 claims](https://docs.thinger.io/screenshots/plans-and-limits-menu-mark.webp) *A feature the plan does not include* ![Header of the Claim Details form with the counter 0 / 0 and its orange dot, highlighted: the account has created 0 claims and its plan allows 0](https://docs.thinger.io/screenshots/plans-and-limits-form-counter.webp) *Counter of a create form* On a private instance, an administrator can set limits per account in [User Accounts](https://docs.thinger.io/administration/user-accounts.md#set-the-limits-of-an-account) and default limits in the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md#accounts), within what the plan of the instance allows. ![Limits tab of the Accounts section with the default account limits, all set to -1 (unlimited), and the bucket retention](https://docs.thinger.io/screenshots/settings-accounts-limits.webp) *Default limits of the accounts in the server settings* To check the limits that apply to an account and how much of each it uses, call `GET /v1/users/{user}/limits`. See the [REST API reference](https://docs.thinger.io/reference/rest-api/users.md). ## Plan labels in these docs Pages about a feature that needs a given plan show a label in their header: | Label | Pages | |---|---| | Medium plan and above | [Domains](https://docs.thinger.io/administration/domains.md), [Brands](https://docs.thinger.io/administration/brands.md), [OAuth2 Clients](https://docs.thinger.io/administration/oauth2-clients.md), [Proxies](https://docs.thinger.io/administration/proxies.md), customers and sub-accounts | | Large plan and above | [Identity Providers](https://docs.thinger.io/administration/identity-providers.md), included daily backups | | Enterprise | [On-premise](https://docs.thinger.io/administration/deployment/on-premise.md) | | Not available on free Cloud | [Plugins](https://docs.thinger.io/plugins.md) | Pages without a label work on every plan, within its limits. ## Change your plan To raise a limit of a Cloud instance, change its plan in the [billing portal](https://docs.thinger.io/administration/billing.md). Compare the plans on the [pricing page](https://thinger.io/pricing). --- Source: https://docs.thinger.io/reference/rest-api.md # REST API > Call the Thinger.io REST API: base URL, authentication, tokens, request format, errors and the reference of every operation. The Thinger.io REST API gives you access to everything in your account: devices, data buckets, dashboards, products and the rest of the console. This reference lists its 375 operations in 26 groups, generated from the OpenAPI document of the Thinger.io server 7.4.0. ## Base URL Every path in this reference is relative to your server: ```text https://YOUR_SERVER ``` `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. For example, `GET /v1/users/{user}/devices` is `https://YOUR_SERVER/v1/users/YOUR_USER/devices`. ## Authentication Operations that need authentication carry a token in the `Authorization` header with the `Bearer` scheme: ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/devices' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` When you cannot set a header, for example in a link, pass the token in the `authorization` query parameter (lowercase): `?authorization=YOUR_TOKEN`. The header takes precedence when both are present. The OpenAPI document declares two security schemes for the same token: `bearerAuth` (HTTP bearer, a JWT) and `oauth` (OAuth2 password flow with the token URL `https://YOUR_SERVER/oauth/token` and the scope `basic`). Each operation of the reference says whether it needs a token or is public. ### Access tokens Access tokens are the tokens you create in **Access Tokens** or with the [Access Tokens operations](https://docs.thinger.io/reference/rest-api/tokens.md). Use them for scripts, integrations and devices: - Each one is scoped: it grants only the resources and actions you allow, for example writing to one data bucket. - They don't expire. Disable or delete a token to revoke it. ### Sign in with a username and password `POST /oauth/token` exchanges the credentials of an account for an access token and a refresh token. The body is form-encoded, not JSON: ```bash curl -X POST 'https://YOUR_SERVER/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=password&username=YOUR_USER&password=YOUR_PASSWORD' ``` ```json { "access_token": "YOUR_TOKEN", "expires_in": 7200, "refresh_token": "YOUR_REFRESH_TOKEN", "scope": null, "token_type": "bearer" } ``` - The access token is valid for 2 hours (`expires_in`, in seconds). - The refresh token is valid for 61 days and can be used once. - Wrong credentials answer `401` with `{"error":{"message":"invalid username or password"}}`. - If the account has multi-factor authentication enabled, the answer is `403` with `"error": "mfa_required"` and the methods available to complete the sign-in. - After too many failed attempts from the same address, the answer is `429` for a while. ### Refresh the access token Before the access token expires, exchange the refresh token for a new pair. The old refresh token stops working: ```bash curl -X POST 'https://YOUR_SERVER/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=refresh_token&refresh_token=YOUR_REFRESH_TOKEN' ``` The answer has the same fields as the sign-in. An invalid or used refresh token answers `401`. ## Requests and responses - Request bodies are JSON: send `Content-Type: application/json`. A body with another content type, or JSON that does not parse, answers `400`. - A body that does not match the schema of the operation answers `400` with the first validation error. - Responses are JSON, except operations that return files or binary data. ## Errors Errors answer with an HTTP status and, in most cases, a JSON body with a message: ```json { "error": { "message": "not authorized" } } ``` | Status | When | |---|---| | `400` | The request or its body is not valid. | | `401` | The operation needs a token and it is missing, invalid or expired (`unauthorized`). | | `403` | The token is valid but does not grant this operation (`not authorized`). | | `404` | The route does not exist. The body is empty. | | `429` | A rate limit applies, for example after too many failed sign-in attempts. | | `500` | Unexpected server error. | ## OpenAPI document Download the OpenAPI 3.1 document of this reference: [openapi.json](https://docs.thinger.io/openapi.json). Use it with OpenAPI tools, such as client generators or API explorers. Your own instance serves the document for its version at `GET /openapi.json`, and also at `GET /v1/server/swagger.json` unless the instance administrator disabled it. ## Groups | Group | Operations | Description | | --- | --- | --- | | [Authentication](https://docs.thinger.io/reference/rest-api/authentication.md) | 1 | Get access and refresh tokens for an account. The overview of the REST API shows the form-encoded body this operation expects. | | [User Accounts](https://docs.thinger.io/reference/rest-api/users.md) | 40 | Manage user accounts and their profile, password, email, timezone, multi-factor authentication and passkeys. | | [Devices](https://docs.thinger.io/reference/rest-api/devices.md) | 45 | Create and configure devices, call their resources, and manage their tokens, properties, callbacks and files. | | [Dashboards](https://docs.thinger.io/reference/rest-api/dashboards.md) | 8 | Create, read, update, clone and delete dashboards. | | [Data Buckets](https://docs.thinger.io/reference/rest-api/buckets.md) | 17 | Create data buckets, write and read their data, and manage tags, exports and imports. | | [Endpoints](https://docs.thinger.io/reference/rest-api/endpoints.md) | 11 | Create and call endpoints, and list the endpoint templates. | | [Alarms](https://docs.thinger.io/reference/rest-api/alarms.md) | 18 | Manage alarm rules and alarm instances, and test rules and their notifications. | | [Access Tokens](https://docs.thinger.io/reference/rest-api/tokens.md) | 8 | Create, read, update, clone and delete access tokens. | | [Assets](https://docs.thinger.io/reference/rest-api/assets.md) | 1 | Read the locations of the assets of an account. | | [Asset Types](https://docs.thinger.io/reference/rest-api/types.md) | 17 | Manage asset types, their properties and the locations of their assets. | | [Asset Groups](https://docs.thinger.io/reference/rest-api/groups.md) | 17 | Manage asset groups, their properties and the locations of their assets. | | [File Storages](https://docs.thinger.io/reference/rest-api/storages.md) | 19 | Create file storages and upload, read, rename and delete their files. | | [Products](https://docs.thinger.io/reference/rest-api/products.md) | 38 | Manage products and their profile, properties, firmwares and services. | | [Projects](https://docs.thinger.io/reference/rest-api/projects.md) | 27 | Manage projects and their members, roles and properties. | | [Plugins](https://docs.thinger.io/reference/rest-api/plugins.md) | 23 | List plugins, manage their state and properties, read their logs and call their endpoints. | | [Syncs](https://docs.thinger.io/reference/rest-api/syncs.md) | 13 | Manage syncs and their locks. | | [Claims](https://docs.thinger.io/reference/rest-api/claims.md) | 10 | Configure claims and request the claim of a device. | | [Account Properties](https://docs.thinger.io/reference/rest-api/properties.md) | 8 | Manage the properties of a user account. | | [Roles](https://docs.thinger.io/reference/rest-api/roles.md) | 7 | Manage the roles of a user account. | | [Cluster Hosts](https://docs.thinger.io/reference/rest-api/hosts.md) | 9 | Manage the cluster hosts of an instance, their settings, logs and restarts. | | [Domains](https://docs.thinger.io/reference/rest-api/domains.md) | 6 | Add and verify custom domains for the console. | | [Brands](https://docs.thinger.io/reference/rest-api/brands.md) | 7 | Manage the brands of an instance and test their email settings. | | [OAuth2 Clients](https://docs.thinger.io/reference/rest-api/oauth-clients.md) | 5 | Manage the OAuth2 clients registered on an instance. | | [Identity Providers](https://docs.thinger.io/reference/rest-api/identity-providers.md) | 5 | Manage the identity providers users can sign in with. | | [Proxies](https://docs.thinger.io/reference/rest-api/proxies.md) | 5 | Manage the proxies that give external access to services of an instance. | | [Server](https://docs.thinger.io/reference/rest-api/server.md) | 10 | Read the version, health, settings, statistics and OpenAPI document of the server. | --- Source: https://docs.thinger.io/reference/rest-api/authentication.md # Authentication > REST API reference for Authentication: get access and refresh tokens for an account. The overview of the REST API shows the form-encoded body this operation expects. 1 operation. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `POST /oauth/token` - **Request:** POST /oauth/token - **Operation:** Authenticate - **Operation ID:** `Authentication_AuthenticateToken` - **Authentication:** none, public operation **Request body** (`application/x-www-form-urlencoded`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `grant_type` | string | yes | One of: `password`, `refresh_token` | `password` to sign in with the credentials of the account, `refresh_token` to get a new access token. | | `username` | string | no | | Username of the account. With `grant_type=password`. | | `password` | string | no | | Password of the account. With `grant_type=password`. | | `refresh_token` | string | no | | Refresh token of an earlier response. With `grant_type=refresh_token`. | **Example request**: Sign in ```bash curl -X POST 'https://YOUR_SERVER/oauth/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=password&username=YOUR_USER&password=YOUR_PASSWORD' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | --- Source: https://docs.thinger.io/reference/rest-api/users.md # User Accounts > REST API reference for User Accounts: manage user accounts and their profile, password, email, timezone, multi-factor authentication and passkeys. 40 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `POST /oauth/device/verification` - **Request:** POST /oauth/device/verification - **Operation:** AuthorizeDevice - **Operation ID:** `User_AuthorizeDeviceVerification` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/oauth/device/verification' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/accounts/password` - **Request:** POST /v1/accounts/password - **Operation:** CreateUserPassword - **Operation ID:** `User_CreatePassword` - **Authentication:** none, public operation **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/accounts/password' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `POST /v1/accounts/password/reset` - **Request:** POST /v1/accounts/password/reset - **Operation:** CreateUserPasswordReset - **Operation ID:** `User_CreatePasswordReset` - **Authentication:** none, public operation **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/accounts/password/reset' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/users` - **Request:** GET /v1/users - **Operation:** ListUsers - **Operation ID:** `User_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/users' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090745, "email": "jdoe@example.com", "enabled": true, "modified": 1792263090745, "role": "user", "user": "jdoe", "verified": true }, { "created": 1792263090745, "email": "operator1@example.com", "enabled": true, "modified": 1792263090745, "role": "member", "user": "operator1", "verified": true }, { "created": 1792263090745, "email": "jdoe@example.com", "enabled": true, "modified": 1792263090745, "role": "user", "user": "jdoe", "verified": true } ] ``` ## `POST /v1/users` - **Request:** POST /v1/users - **Operation:** CreateUser - **Operation ID:** `User_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `email` | string | yes | Format: email | | | `enabled` | boolean | no | | | | `options` | object | no | | | | `options.project` | object | no | | | | `options.project.default` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `password` | string | yes | Maximum length: 72 | Empty, when an admin creates the account: the user receives an email to set it. | | `recaptcha` | string | no | | | | `role` | string | no | One of: `user`, `admin`, `member`, `domain_admin` | user: a regular account. admin: server administrator (only admins create admins and domain admins). domain_admin: administers the accounts of its hosts. member: only works inside the projects it is invited to (needs options.project.default). | | `user` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `verified` | boolean | no | | Email already verified (admins can skip the verification email). | **Example request**: Account that sets its own password ```bash curl -X POST 'https://YOUR_SERVER/v1/users' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "email": "jdoe@example.com", "enabled": true, "password": "", "role": "user", "user": "jdoe", "verified": true }' ``` **Example body**: Member of a project ```json { "email": "operator1@example.com", "enabled": true, "options": { "project": { "default": "plant_madrid" } }, "password": "a-strong-password", "role": "member", "user": "operator1", "verified": true } ``` **Example body**: Regular account ```json { "email": "jdoe@example.com", "enabled": true, "password": "a-strong-password", "role": "user", "user": "jdoe", "verified": true } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/email/verify` - **Request:** POST /v1/users/email/verify - **Operation:** VerifyUserEmail - **Operation ID:** `User_VerifyEmail` - **Authentication:** none, public operation **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/email/verify' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/users/{user}` - **Request:** GET /v1/users/{user} - **Operation:** ReadUserConfig - **Operation ID:** `User_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Account that sets its own password) ```json { "created": 1792263090745, "email": "jdoe@example.com", "enabled": true, "modified": 1792263090745, "password": "", "role": "user", "user": "jdoe", "verified": true } ``` **Response example** (200, Member of a project) ```json { "created": 1792263090745, "email": "operator1@example.com", "enabled": true, "modified": 1792263090745, "options": { "project": { "default": "plant_madrid" } }, "password": "a-strong-password", "role": "member", "user": "operator1", "verified": true } ``` **Response example** (200, Regular account) ```json { "created": 1792263090745, "email": "jdoe@example.com", "enabled": true, "modified": 1792263090745, "password": "a-strong-password", "role": "user", "user": "jdoe", "verified": true } ``` ## `PUT /v1/users/{user}` - **Request:** PUT /v1/users/{user} - **Operation:** UpdateUser - **Operation ID:** `User_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `email` | string | no | | | | `enabled` | boolean | no | | | | `host` | array of string | no | Maximum items: 10 | Domains the account belongs to (set on sign-up from the request host). Used for the brand emails, brand cross_sign_in and domain admins. | | `limits` | object | no | | Per-account overrides of the server limits: {"<collection>": {"max_count": n}} (-1 = unlimited, 0 = disabled), and buckets.retention {period, unit}. | | `options` | object | no | | | | `options.additionalProperties` | any | no | | | | `options.project` | object | no | | | | `options.project.default` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `password` | string | no | Length: 6 to 72 | | | `role` | string | no | One of: `user`, `admin`, `member`, `domain_admin` | | | `verified` | boolean | no | | | **Example request**: Disable an account ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": false }' ``` **Example body**: Make it a domain admin of a brand ```json { "host": [ "iot.example.com" ], "role": "domain_admin" } ``` **Example body**: Raise its limits ```json { "limits": { "buckets": { "max_count": 50 }, "devices": { "max_count": 500 } } } ``` **Example body**: Set a new password ```json { "password": "a-new-strong-password" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}` - **Request:** DELETE /v1/users/{user} - **Operation:** DeleteUser - **Operation ID:** `User_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/account` - **Request:** GET /v1/users/{user}/account - **Operation:** ReadUserAccount - **Operation ID:** `User_ReadAccount` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/account' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/email` - **Request:** GET /v1/users/{user}/email - **Operation:** ReadUserEmail - **Operation ID:** `User_ReadEmail` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/email' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/events` > **Deprecated.** The OpenAPI document marks this operation as deprecated. - **Request:** GET /v1/users/{user}/events - **Operation:** SubscribeUserEvents - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/events' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/federated_identities/{identity_provider}` - **Request:** DELETE /v1/users/{user}/federated_identities/{identity_provider} - **Operation:** DeleteUserFederatedIdentity - **Operation ID:** `User_DeleteFederatedIdentity` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `identity_provider` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/federated_identities/YOUR_IDENTITY_PROVIDER' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/info/device_locations` - **Request:** GET /v1/users/{user}/info/device_locations - **Operation:** ListDeviceLocations - **Operation ID:** `User_ListDeviceLocationsDevice_location` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/info/device_locations' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/info/devices/locations` - **Request:** GET /v1/users/{user}/info/devices/locations - **Operation:** ListDeviceLocations - **Operation ID:** `User_ListDeviceLocations` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/info/devices/locations' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/limits` - **Request:** GET /v1/users/{user}/limits - **Operation:** ReadUserLimits - **Operation ID:** `User_ReadLimits` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/limits' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/limits/{resource}` - **Request:** GET /v1/users/{user}/limits/{resource} - **Operation:** ReadUserLimits - **Operation ID:** `User_ReadResourceLimits` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `resource` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/limits/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/membership/{project_owner}/{project_id}/permissions` - **Request:** GET /v1/users/{user}/membership/{project_owner}/{project_id}/permissions - **Operation:** ReadProjectPermissions - **Operation ID:** `User_ReadProjectPermissions` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project_owner` | path | string | yes | | | `project_id` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/membership/YOUR_PROJECT_OWNER/YOUR_PROJECT_ID/permissions' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/mfa` - **Request:** GET /v1/users/{user}/mfa - **Operation:** ReadUserMFA - **Operation ID:** `User_ReadMFAMfa` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/mfa/totp` - **Request:** DELETE /v1/users/{user}/mfa/totp - **Operation:** DeleteUserTOTP - **Operation ID:** `User_DeleteTOTPTotp` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/totp' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/mfa/totp/backup-codes` - **Request:** POST /v1/users/{user}/mfa/totp/backup-codes - **Operation:** CreateUserTOTPBackupCodes - **Operation ID:** `User_CreateTOTPBackupCodesBackup-code` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/totp/backup-codes' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/mfa/totp/setup` - **Request:** POST /v1/users/{user}/mfa/totp/setup - **Operation:** SetupUserTOTP - **Operation ID:** `User_SetupTOTP` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/totp/setup' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/mfa/totp/verify` - **Request:** POST /v1/users/{user}/mfa/totp/verify - **Operation:** VerifyUserTOTP - **Operation ID:** `User_VerifyTOTP` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/totp/verify' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/mfa/webauthn/credentials/{credential}` - **Request:** PUT /v1/users/{user}/mfa/webauthn/credentials/{credential} - **Operation:** UpdateWebAuthnCredential - **Operation ID:** `User_UpdateWebAuthnCredential` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `credential` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `name` | string | yes | Length: 1 to 255 | | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/webauthn/credentials/YOUR_CREDENTIAL' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/mfa/webauthn/credentials/{credential}` - **Request:** DELETE /v1/users/{user}/mfa/webauthn/credentials/{credential} - **Operation:** DeleteWebAuthnCredential - **Operation ID:** `User_DeleteWebAuthnCredential` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `credential` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/webauthn/credentials/YOUR_CREDENTIAL' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/mfa/webauthn/register/options` - **Request:** POST /v1/users/{user}/mfa/webauthn/register/options - **Operation:** WebAuthnRegisterOptions - **Operation ID:** `User_WebAuthnRegisterOptions` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/webauthn/register/options' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/mfa/webauthn/register/verify` - **Request:** POST /v1/users/{user}/mfa/webauthn/register/verify - **Operation:** WebAuthnRegisterVerify - **Operation ID:** `User_WebAuthnRegisterVerify` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/mfa/webauthn/register/verify' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/oauth/authorize` - **Request:** POST /v1/users/{user}/oauth/authorize - **Operation:** AuthorizeOauth - **Operation ID:** `User_AuthorizeOauth` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `client_id` | string | yes | | | | `login_hint` | string | no | | | | `nonce` | string | no | | | | `prompt` | string | no | | | | `redirect_uri` | string | no | | | | `response_mode` | string | no | | | | `response_type` | string | yes | One of: `code` | | | `scope` | string | no | | | | `state` | string | no | | | | `ui_locales` | string | no | | | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/oauth/authorize' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "client_id": "", "response_type": "code" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/passkeys` - **Request:** GET /v1/users/{user}/passkeys - **Operation:** ReadUserPasskeys - **Operation ID:** `User_ReadPasskeys` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/passkeys' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/passkeys/register/options` - **Request:** POST /v1/users/{user}/passkeys/register/options - **Operation:** PasskeyRegisterOptions - **Operation ID:** `User_PasskeyRegisterOptions` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/passkeys/register/options' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/passkeys/register/verify` - **Request:** POST /v1/users/{user}/passkeys/register/verify - **Operation:** PasskeyRegisterVerify - **Operation ID:** `User_PasskeyRegisterVerify` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/passkeys/register/verify' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/passkeys/{credential}` - **Request:** PUT /v1/users/{user}/passkeys/{credential} - **Operation:** UpdateUserPasskey - **Operation ID:** `User_UpdatePasskey` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `credential` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `name` | string | yes | Length: 1 to 255 | | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/passkeys/YOUR_CREDENTIAL' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/passkeys/{credential}` - **Request:** DELETE /v1/users/{user}/passkeys/{credential} - **Operation:** DeleteUserPasskey - **Operation ID:** `User_DeletePasskey` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `credential` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/passkeys/YOUR_CREDENTIAL' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/password` - **Request:** PUT /v1/users/{user}/password - **Operation:** UpdateUserPassword - **Operation ID:** `User_UpdatePassword` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/password' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/profile` - **Request:** GET /v1/users/{user}/profile - **Operation:** ReadUserProfile - **Operation ID:** `User_ReadProfile` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/profile' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/profile` - **Request:** PUT /v1/users/{user}/profile - **Operation:** UpdateUserProfile - **Operation ID:** `User_UpdateProfile` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `company` | string | no | Length: 0 to 255 | | | `location` | string | no | Length: 0 to 255 | | | `name` | string | no | Length: 0 to 255 | | | `picture` | string | no | Maximum length: 50000
Pattern: `^$\|^data:image/(?:png\|jpeg\|webp);base64,(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==\|[A-Za-z0-9+/]{3}=)?$` | | | `url` | string | no | Length: 0 to 255 | | **Example request**: Public profile ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/profile' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "company": "Acme Farms", "location": "Madrid, Spain", "name": "Jane Doe", "url": "https://acme.example" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/stats` - **Request:** GET /v1/users/{user}/stats - **Operation:** ReadUserStatistics - **Operation ID:** `User_ReadStatistics` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/stats' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/timezone` - **Request:** GET /v1/users/{user}/timezone - **Operation:** ReadUserTimezone - **Operation ID:** `User_ReadTimezone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/timezone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/timezone` - **Request:** PUT /v1/users/{user}/timezone - **Operation:** UpdateUserTimezone - **Operation ID:** `User_UpdateTimezone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `timezone` | string | yes | Length: 1 to 255 | | **Example request**: Madrid ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/timezone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "timezone": "Europe/Madrid" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v2/users/{user}/events` - **Request:** GET /v2/users/{user}/events - **Operation:** SubscribeUserEvents - **Operation ID:** `User_SubscribeEvents` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v2/users/YOUR_USER/events' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/devices.md # Devices > REST API reference for Devices: create and configure devices, call their resources, and manage their tokens, properties, callbacks and files. 45 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/devices` - **Request:** GET /v1/users/{user}/devices - **Operation:** ListDevices - **Operation ID:** `Device_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/devices' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "asset_group": "AssetGroup", "asset_type": "AssetType", "created": 1792263090700, "description": "HTTP Device", "device": "http_device", "enabled": true, "modified": 1792263090700, "name": "SN0300301", "type": "HTTP" }, { "asset_group": "AssetGroup", "asset_type": "AssetType", "created": 1792263090700, "description": "MQTT Device", "device": "mqtt_device", "enabled": true, "modified": 1792263090700, "name": "SN0300301", "type": "MQTT" }, { "asset_group": "AssetGroup", "asset_type": "AssetType", "created": 1792263090700, "description": "Thinger Device", "device": "thinger_device", "enabled": true, "modified": 1792263090700, "name": "SN0300301", "type": "Generic" } ] ``` ## `POST /v1/users/{user}/devices` - **Request:** POST /v1/users/{user}/devices - **Operation:** CreateDevice - **Operation ID:** `Device_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `asset_group` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `asset_type` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `connection` | object | no | | | | `connection.timeouts` | object | no | | | | `connection.timeouts.disconnect` | integer | no | Minimum: 60 | | | `connection.timeouts.sleep` | integer | no | Minimum: 0 | | | `credentials` | string | yes | Length: 6 to 255 | | | `description` | string | no | Length: 0 to 255 | | | `device` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `enabled` | boolean | no | | | | `labels` | object | no | Keys: `^[A-Za-z0-9_][A-Za-z0-9_-]{0,62}$` | | | `labels.*` | string | no | Maximum length: 255 | | | `name` | string | no | Length: 0 to 255 | | | `product` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: `Generic`, `MQTT` | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `asset_group` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `asset_type` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `description` | string | no | Length: 1 to 255 | | | `device` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `enabled` | boolean | no | | | | `labels` | object | no | Keys: `^[A-Za-z0-9_][A-Za-z0-9_-]{0,62}$` | | | `labels.*` | string | no | Maximum length: 255 | | | `name` | string | no | Length: 0 to 255 | | | `parent` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `product` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `protocol` | string | no | Length: 1 to 50 | | | `type` | string | no | One of: `HTTP`, `Virtual`, `Subdevice` | | **Example request**: HTTP Device ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/devices' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "asset_group": "AssetGroup", "asset_type": "AssetType", "description": "HTTP Device", "device": "http_device", "enabled": true, "name": "SN0300301", "type": "HTTP" }' ``` **Example body**: MQTT Device ```json { "asset_group": "AssetGroup", "asset_type": "AssetType", "credentials": "YOUR_TOKEN", "description": "MQTT Device", "device": "mqtt_device", "enabled": true, "name": "SN0300301", "type": "MQTT" } ``` **Example body**: Thinger Device ```json { "asset_group": "AssetGroup", "asset_type": "AssetType", "credentials": "YOUR_TOKEN", "description": "Thinger Device", "device": "thinger_device", "enabled": true, "name": "SN0300301", "type": "Generic" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/devices/{device}` - **Request:** GET /v1/users/{user}/devices/{device} - **Operation:** ReadDeviceStatus - **Operation ID:** `Device_ReadStatus` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/devices/{device}` - **Request:** PUT /v1/users/{user}/devices/{device} - **Operation:** UpdateDevice - **Operation ID:** `Device_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `asset_group` | string | no | Variant 1: Pattern: `^[a-zA-Z0-9_-]{1,32}$`
Variant 2: Maximum length: 0 | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `asset_type` | string | no | Variant 1: Pattern: `^[a-zA-Z0-9_-]{1,32}$`
Variant 2: Maximum length: 0 | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `connection` | object | no | | | | `connection.timeout` | integer | no | Minimum: 1 | | | `connection.timeouts` | object | no | | | | `connection.timeouts.disconnect` | integer | no | Minimum: 60 | | | `connection.timeouts.sleep` | integer | no | Minimum: 0 | | | `credentials` | string | no | Length: 1 to 255 | | | `description` | string | no | Length: 0 to 255 | | | `enabled` | boolean | no | | | | `labels` | object | no | Keys: `^[A-Za-z0-9_][A-Za-z0-9_-]{0,62}$` | | | `labels.*` | string | no | Maximum length: 255 | | | `name` | string | no | Length: 0 to 255 | | | `product` | string | no | Variant 1: Pattern: `^[a-zA-Z0-9_-]{1,32}$`
Variant 2: Maximum length: 0 | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Update Asset Group ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "asset_group": "Farm 1" }' ``` **Example body**: Update Asset Type ```json { "asset_type": "Truck" } ``` **Example body**: Update Credentials ```json { "credentials": "YOUR_TOKEN" } ``` **Example body**: Update Description ```json { "description": "Updated Description" } ``` **Example body**: Update Enabled ```json { "enabled": false } ``` **Example body**: Update Labels ```json { "labels": { "region": "europe", "type": "small" } } ``` **Example body**: Update Name ```json { "name": "SN0300301" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/devices/{device}` - **Request:** DELETE /v1/users/{user}/devices/{device} - **Operation:** DeleteDevice - **Operation ID:** `Device_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/devices/{device}/clone` - **Request:** GET /v1/users/{user}/devices/{device}/clone - **Operation:** CloneDeviceConfig - **Operation ID:** `Device_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/devices/{device}/clone` - **Request:** POST /v1/users/{user}/devices/{device}/clone - **Operation:** CloneDevice - **Operation ID:** `Device_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `device` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "device": "copy_of_device" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "device": "line_2_device", "name": "Line 2 copy" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/devices/{device}/projects` - **Request:** PUT /v1/users/{user}/devices/{device}/projects - **Operation:** UpdateDeviceProjects - **Operation ID:** `Device_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/devices/{device}/stats` > **Deprecated.** The OpenAPI document marks this operation as deprecated. - **Request:** GET /v1/users/{user}/devices/{device}/stats - **Operation:** ReadDeviceStatistics - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/stats' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/devices/{device}/tokens` - **Request:** GET /v1/users/{user}/devices/{device}/tokens - **Operation:** ListDeviceTokens - **Operation ID:** `Device_ListTokens` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/tokens' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/devices/{device}/tokens` - **Request:** POST /v1/users/{user}/devices/{device}/tokens - **Operation:** CreateDeviceToken - **Operation ID:** `Device_CreateToken` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Request body** (`application/json`, required) A token limited to this device: it can only call the listed device resources (all of them when token_resources is missing). Useful to let a third party read or control one device. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `token_expiration` | number | no | | Unix timestamp when the token stops working. | | `token_name` | string | yes | | | | `token_resources` | array of string | no | | Resource names the token can call. | **Example request**: All resources until a date ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/tokens' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "token_expiration": 1798761600, "token_name": "Installer" }' ``` **Example body**: Read two resources ```json { "token_name": "Display panel", "token_resources": [ "temperature", "humidity" ] } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/devices/{device}/tokens/{token}` - **Request:** DELETE /v1/users/{user}/devices/{device}/tokens/{token} - **Operation:** DeleteDeviceToken - **Operation ID:** `Device_DeleteToken` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `token` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/tokens/YOUR_TOKEN' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/devices/{device}/{resource}` > **Deprecated.** The OpenAPI document marks this operation as deprecated. - **Request:** GET /v1/users/{user}/devices/{device}/{resource} - **Operation:** AccessDeviceResources - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `resource` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/devices/{device}/{resource}` > **Deprecated.** The OpenAPI document marks this operation as deprecated. - **Request:** POST /v1/users/{user}/devices/{device}/{resource} - **Operation:** AccessDeviceResources - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `resource` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/devices/YOUR_DEVICE/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/info/devices/stats` - **Request:** GET /v1/users/{user}/info/devices/stats - **Operation:** ReadDeviceStatistics - **Operation ID:** `Device_ReadDevicesStatistics` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/info/devices/stats' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v2/users/{user}/devices/{device}/{resource}` > **Deprecated.** The OpenAPI document marks this operation as deprecated. - **Request:** GET /v2/users/{user}/devices/{device}/{resource} - **Operation:** AccessDeviceResources - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `resource` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v2/users/YOUR_USER/devices/YOUR_DEVICE/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v2/users/{user}/devices/{device}/{resource}` > **Deprecated.** The OpenAPI document marks this operation as deprecated. - **Request:** POST /v2/users/{user}/devices/{device}/{resource} - **Operation:** AccessDeviceResources - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `resource` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v2/users/YOUR_USER/devices/YOUR_DEVICE/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/buckets` - **Request:** GET /v3/users/{user}/devices/{device}/buckets - **Operation:** ListDeviceBuckets - **Operation ID:** `Device_ListBuckets` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/buckets' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/buckets/{bucket}/tags` - **Request:** GET /v3/users/{user}/devices/{device}/buckets/{bucket}/tags - **Operation:** ListDeviceBucketTags - **Operation ID:** `Device_ListBucketTags` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/buckets/YOUR_BUCKET/tags' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/buckets/{bucket}/tags/{tag}` - **Request:** GET /v3/users/{user}/devices/{device}/buckets/{bucket}/tags/{tag} - **Operation:** ReadDeviceBucketTag - **Operation ID:** `Device_ReadBucketTag` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `bucket` | path | string | yes | | | `tag` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/buckets/YOUR_BUCKET/tags/YOUR_TAG' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/callback` - **Request:** GET /v3/users/{user}/devices/{device}/callback - **Operation:** ReadDeviceCallbackConfig - **Operation ID:** `Device_ReadCallbackConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/callback' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v3/users/{user}/devices/{device}/callback` - **Request:** PUT /v3/users/{user}/devices/{device}/callback - **Operation:** UpdateDeviceCallback - **Operation ID:** `Device_UpdateCallback` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Request body** (`application/json`, required) What the server does with the JSON an HTTP device posts to its callback (POST /v3/users/{user}/devices/{device}/callback/data): write_bucket stores it in a bucket, call_endpoint forwards it to an endpoint, set_property saves it as a device property, send_property returns a property as the response (e.g. its configuration). properties.timeout: minutes without data before the device is shown as disconnected. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `actions` | object | no | | | | `actions.call_endpoint` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `actions.send_property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `actions.set_property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `actions.write_bucket` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `properties` | object | no | | | | `properties.timeout` | integer | no | | | **Example request**: Store the data in a bucket ```bash curl -X PUT 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/callback' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "actions": { "write_bucket": "meter_readings" }, "properties": { "timeout": 10 } }' ``` **Example body**: Store, notify and reply with a property ```json { "actions": { "call_endpoint": "readings_webhook", "send_property": "settings", "write_bucket": "meter_readings" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/callback/data` - **Request:** GET /v3/users/{user}/devices/{device}/callback/data - **Operation:** ReadDeviceCallbackResponse - **Operation ID:** `Device_ReadCallbackResponseData` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/callback/data' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v3/users/{user}/devices/{device}/callback/data` - **Request:** POST /v3/users/{user}/devices/{device}/callback/data - **Operation:** CallDeviceCallback - **Operation ID:** `Device_CallCallbackData` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Request body** (`application/json`, required) Data an HTTP device sends: any JSON. The device callback settings (PUT .../callback) decide what happens with it (bucket, endpoint, property, response). ?ts=<epoch ms> sets the timestamp. **Example request**: Meter reading ```bash curl -X POST 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/callback/data' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "energy": 1532.8, "power": 2.1, "voltage": 229.7 }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/files{file}` - **Request:** GET /v3/users/{user}/devices/{device}/files{file} - **Operation:** ReadDeviceFiles - **Operation ID:** `Device_ReadFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v3/users/{user}/devices/{device}/files{file}` - **Request:** PUT /v3/users/{user}/devices/{device}/files{file} - **Operation:** UpdateDeviceFiles - **Operation ID:** `Device_UpdateFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `file` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v3/users/{user}/devices/{device}/files{file}` - **Request:** PATCH /v3/users/{user}/devices/{device}/files{file} - **Operation:** RenameDeviceFiles - **Operation ID:** `Device_RenameFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `file` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PATCH 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v3/users/{user}/devices/{device}/files{file}` - **Request:** DELETE /v3/users/{user}/devices/{device}/files{file} - **Operation:** DeleteDeviceFiles - **Operation ID:** `Device_DeleteFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/properties` - **Request:** GET /v3/users/{user}/devices/{device}/properties - **Operation:** ListDeviceProperties - **Operation ID:** `Device_ListProperties` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090701, "description": "Sampling and alert thresholds", "modified": 1792263090701, "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }, { "created": 1792263090701, "modified": 1792263090701, "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } }, { "created": 1792263090701, "modified": 1792263090701, "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } }, { "created": 1792263090701, "modified": 1792263090701, "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ] ``` ## `POST /v3/users/{user}/devices/{device}/properties` - **Request:** POST /v3/users/{user}/devices/{device}/properties - **Operation:** CreateDeviceProperty - **Operation ID:** `Device_CreateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of object | no | | | | `(body)[].description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `(body)[].form` | object | no | | | | `(body)[].form.fields` | any | yes | | | | `(body)[].name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `(body)[].perm` | object | no | | | | `(body)[].perm.hidden` | array of string | no | Unique items | | | `(body)[].perm.readOnly` | array of string | no | Unique items | | | `(body)[].property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `(body)[].type` | string | no | One of: ``, `configuration` | | | `(body)[].value` | any | yes | | | *Variant 2*: Property Create. Schema for creating a property Schema for creating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Configuration value ```bash curl -X POST 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sampling and alert thresholds", "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }' ``` **Example body**: Location ```json { "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } } ``` **Example body**: Read-only for project members ```json { "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } } ``` **Example body**: Url dashboard of the resource ```json { "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/properties/{property}` - **Request:** GET /v3/users/{user}/devices/{device}/properties/{property} - **Operation:** ReadDeviceProperty - **Operation ID:** `Device_ReadProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v3/users/{user}/devices/{device}/properties/{property}` - **Request:** PUT /v3/users/{user}/devices/{device}/properties/{property} - **Operation:** UpdateDeviceProperty - **Operation ID:** `Device_UpdateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) Schema for updating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Hide from project members ```bash curl -X PUT 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "perm": { "hidden": [ "member" ] }, "value": "internal note" }' ``` **Example body**: Replace the value ```json { "value": { "alerts": true, "interval": 30, "max_temperature": 27 } } ``` **Example body**: Value, name and description ```json { "description": "Faster sampling during commissioning", "name": "Settings", "value": { "alerts": false, "interval": 10, "max_temperature": 28.5 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v3/users/{user}/devices/{device}/properties/{property}` - **Request:** PATCH /v3/users/{user}/devices/{device}/properties/{property} - **Operation:** UpdateDeviceProperty - **Operation ID:** `Device_PatchProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `value` | any | yes | | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `*` | any | no | | | **Example request**: Change some fields of the value ```bash curl -X PATCH 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "value": { "interval": 30 } }' ``` **Example body**: Flattened fields ```json { "value.alerts": false, "value.max_temperature": 27 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v3/users/{user}/devices/{device}/properties/{property}` - **Request:** DELETE /v3/users/{user}/devices/{device}/properties/{property} - **Operation:** DeleteDeviceProperty - **Operation ID:** `Device_DeleteProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/properties/{property}/clone` - **Request:** GET /v3/users/{user}/devices/{device}/properties/{property}/clone - **Operation:** CloneDevicePropertyConfig - **Operation ID:** `Device_ClonePropertyConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v3/users/{user}/devices/{device}/properties/{property}/clone` - **Request:** POST /v3/users/{user}/devices/{device}/properties/{property}/clone - **Operation:** CloneDeviceProperty - **Operation ID:** `Device_CloneProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "property": "copy_of_property" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "property": "line_2_property" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/resources` - **Request:** GET /v3/users/{user}/devices/{device}/resources - **Operation:** AccessDeviceResources - **Operation ID:** `Device_AccessResources` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/resources/{resource}` - **Request:** GET /v3/users/{user}/devices/{device}/resources/{resource} - **Operation:** AccessDeviceResources - **Operation ID:** `Device_AccessOutputResources` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `resource` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v3/users/{user}/devices/{device}/resources/{resource}` - **Request:** POST /v3/users/{user}/devices/{device}/resources/{resource} - **Operation:** AccessDeviceResources - **Operation ID:** `Device_AccessInputResources` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `resource` | path | string | yes | | **Request body** (`application/json`, required) Input of the device resource: whatever JSON the resource expects (see GET .../resources for its description). Resources without input take no body. **Example request**: Set a target ```bash curl -X POST 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "mode": "auto", "setpoint": 21.5 }' ``` **Example body**: Switch a relay ```json { "in": true } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/services` - **Request:** GET /v3/users/{user}/devices/{device}/services - **Operation:** ListDeviceServices - **Operation ID:** `Device_ListServices` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/services' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/services/{service}` - **Request:** GET /v3/users/{user}/devices/{device}/services/{service} - **Operation:** ReadDeviceService - **Operation ID:** `Device_ReadService` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `service` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/services/YOUR_SERVICE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/services/{service}/vnc` - **Request:** GET /v3/users/{user}/devices/{device}/services/{service}/vnc - **Operation:** AccessDeviceRemoteDesktop - **Operation ID:** `Device_AccessRemoteDesktopVnc` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `service` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/services/YOUR_SERVICE/vnc' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/services/{service}/web` - **Request:** GET /v3/users/{user}/devices/{device}/services/{service}/web - **Operation:** AccessDeviceWebServices - **Operation ID:** `Device_AccessWebServices` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | | `service` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/services/YOUR_SERVICE/web' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v3/users/{user}/devices/{device}/stats` - **Request:** GET /v3/users/{user}/devices/{device}/stats - **Operation:** ReadDeviceStatistics - **Operation ID:** `Device_ReadStatistics` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `device` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/stats' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /{version}/users/{user}/devices/{device}/buckets/{bucket}/data` - **Request:** GET /{version}/users/{user}/devices/{device}/buckets/{bucket}/data - **Operation:** ReadDeviceBucket - **Operation ID:** `Device_ReadBucketData` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `version` | path | string | yes | | | `user` | path | string | yes | | | `device` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/YOUR_VERSION/users/YOUR_USER/devices/YOUR_DEVICE/buckets/YOUR_BUCKET/data' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/dashboards.md # Dashboards > REST API reference for Dashboards: create, read, update, clone and delete dashboards. 8 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/dashboards` - **Request:** GET /v1/users/{user}/dashboards - **Operation:** ListDashboards - **Operation ID:** `Dashboard_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090743, "dashboard": "plant_overview", "description": "Production KPIs", "modified": 1792263090743, "name": "Plant overview" }, { "created": 1792263090743, "dashboard": "fleet", "description": "Device list and detail app", "modified": 1792263090743, "name": "Fleet", "source": "url" } ] ``` ## `POST /v1/users/{user}/dashboards` - **Request:** POST /v1/users/{user}/dashboards - **Operation:** CreateDashboard - **Operation ID:** `Dashboard_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) Widget dashboards are designed in the console editor (tabs with widgets). Url dashboards (source: url) render a web page, usually an app in a public file storage that is built with the dashboard SDK (npm package @thinger-io/dashboard-sdk). To show a dashboard on a device, product, asset type, group or project page, store the same object as its 'dashboard' property instead. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `controls` | any | no | | | | `dashboard` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `description` | string | no | Maximum length: 255 | | | `functions` | any | no | | | | `name` | string | yes | Length: 1 to 255 | | | `placeholders` | any | no | | | | `properties` | any | no | | | | `source` | string | no | One of: `widgets`, `url` | | | `tabs` | array of any | no | | | | `url` | string | no | Maximum length: 1024
Pattern: `^(/[^/\\]\|https://)` | | | `widgets` | array of any | no | | | **Example request**: Empty widget dashboard ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "dashboard": "plant_overview", "description": "Production KPIs", "name": "Plant overview", "tabs": [ { "icon": "fas fa-tachometer-alt", "name": "Main", "widgets": [] } ] }' ``` **Example body**: Url dashboard (SDK app) ```json { "dashboard": "fleet", "description": "Device list and detail app", "name": "Fleet", "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/dashboards/{dashboard}` - **Request:** GET /v1/users/{user}/dashboards/{dashboard} - **Operation:** ReadDashboardConfig - **Operation ID:** `Dashboard_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `dashboard` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards/YOUR_DASHBOARD' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Empty widget dashboard) ```json { "created": 1792263090743, "dashboard": "plant_overview", "description": "Production KPIs", "modified": 1792263090743, "name": "Plant overview", "tabs": [ { "icon": "fas fa-tachometer-alt", "name": "Main", "widgets": [] } ] } ``` **Response example** (200, Url dashboard (SDK app)) ```json { "created": 1792263090743, "dashboard": "fleet", "description": "Device list and detail app", "modified": 1792263090743, "name": "Fleet", "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } ``` ## `PUT /v1/users/{user}/dashboards/{dashboard}` - **Request:** PUT /v1/users/{user}/dashboards/{dashboard} - **Operation:** UpdateDashboard - **Operation ID:** `Dashboard_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `dashboard` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `controls` | any | no | | | | `description` | string | no | Maximum length: 255 | | | `functions` | any | no | | | | `name` | string | no | Length: 1 to 255 | | | `placeholders` | any | no | | | | `properties` | any | no | | | | `source` | string | no | One of: `widgets`, `url` | | | `tabs` | array of any | no | | | | `url` | string | no | Maximum length: 1024
Pattern: `^(/[^/\\]\|https://)` | | | `widgets` | array of any | no | | | **Example request**: Point to another entry file ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards/YOUR_DASHBOARD' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/device.html" }' ``` **Example body**: Rename ```json { "description": "Production KPIs", "name": "Plant overview (2026)" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/dashboards/{dashboard}` - **Request:** DELETE /v1/users/{user}/dashboards/{dashboard} - **Operation:** DeleteDashboard - **Operation ID:** `Dashboard_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `dashboard` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards/YOUR_DASHBOARD' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/dashboards/{dashboard}/clone` - **Request:** GET /v1/users/{user}/dashboards/{dashboard}/clone - **Operation:** CloneDashboardConfig - **Operation ID:** `Dashboard_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `dashboard` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards/YOUR_DASHBOARD/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/dashboards/{dashboard}/clone` - **Request:** POST /v1/users/{user}/dashboards/{dashboard}/clone - **Operation:** CloneDashboard - **Operation ID:** `Dashboard_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `dashboard` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `dashboard` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards/YOUR_DASHBOARD/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "dashboard": "copy_of_dashboard" }' ``` **Example body**: Copy with name and description ```json { "dashboard": "line_2_dashboard", "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/dashboards/{dashboard}/projects` - **Request:** PUT /v1/users/{user}/dashboards/{dashboard}/projects - **Operation:** UpdateDashboardProjects - **Operation ID:** `Dashboard_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `dashboard` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/dashboards/YOUR_DASHBOARD/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/buckets.md # Data Buckets > REST API reference for Data Buckets: create data buckets, write and read their data, and manage tags, exports and imports. 17 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/buckets` - **Request:** GET /v1/users/{user}/buckets - **Operation:** ListBuckets - **Operation ID:** `Bucket_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "bucket": "api_write", "config": { "source": "api" }, "created": 1792263090784, "description": "Bucket for API write", "enabled": true, "modified": 1792263090784, "name": "API Write" }, { "bucket": "mqtt_bucket", "config": { "source": "mqtt", "topic": "house/+/temperature" }, "created": 1792263090784, "description": "Bucket for MQTT topic", "enabled": true, "modified": 1792263090784, "name": "MQTT Bucket" }, { "bucket": "device_bucket", "config": { "device": "macbook", "interval": 300, "resource": "data", "source": "device", "update": "interval" }, "created": 1792263090784, "description": "Bucket for Thinger.io device", "enabled": true, "modified": 1792263090784, "name": "Device Bucket" }, { "bucket": "device_write", "config": { "source": "write" }, "created": 1792263090784, "description": "Bucket dor device write", "enabled": true, "modified": 1792263090784, "name": "Device Write" }, { "backend": "influxdb", "bucket": "vibration", "config": { "device": "vibration_01", "interval": 10, "resource": "accel", "source": "device", "update": "interval" }, "created": 1792263090784, "description": "Accelerometer read every 10 seconds", "enabled": true, "modified": 1792263090784, "name": "Vibration" }, { "bucket": "meter_readings", "config": { "source": "write", "tags": [ "device", "site" ] }, "created": 1792263090784, "description": "Readings written by every meter, tagged by device and site", "enabled": true, "modified": 1792263090784, "name": "Meter readings" } ] ``` ## `POST /v1/users/{user}/buckets` - **Request:** POST /v1/users/{user}/buckets - **Operation:** CreateBucket - **Operation ID:** `Bucket_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `asset_group` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `asset_type` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `backend` | string | no | One of: ``, `mongodb`, `influxdb`, `dynamodb` | Specifies the database backend to use for storage, with an option for default (represented by an empty string), 'mongodb', or 'influxdb'. | | `bucket` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `config` | object | yes | | Configuration schema for a data bucket specifying how data is sourced and updated. This schema supports multiple source types including devices and MQTT topics, each with its own set of required properties. | | `config` | object | no | | Variant 1: Configuration for data sourced from a device. This requires specifying the device, user, resource, update interval, and optional tags. | | `config.device` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 1: The unique identifier for the device. | | `config.interval` | number | yes | | Variant 1: The time between updates, in seconds. | | `config.resource` | string | yes | Maximum length: 255 | Variant 1: The specific resource from the device being tracked. | | `config.source` | string | yes | One of: `device` | Variant 1: Indicates the data source is a device. | | `config.tags` | array of string | no | Maximum items: 5 | Variant 1: A collection of tags for categorization, limited to 5. | | `config.update` | string | yes | One of: `interval` | Variant 1: Specifies that the bucket is updated at regular intervals. | | `config.user` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 1: The unique identifier for the user associated with this bucket. | | `config` | object | no | | Variant 2: Configuration for data sourced from a device with event-based or no updates. This variation does not require an interval. | | `config.device` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 2: The unique identifier for the device. | | `config.resource` | string | yes | Maximum length: 255 | Variant 2: The specific resource from the device being tracked. | | `config.source` | string | yes | One of: `device` | Variant 2: Indicates the data source is a device. | | `config.tags` | array of string | no | Maximum items: 5 | Variant 2: A collection of tags for categorization, limited to 5. | | `config.update` | string | yes | One of: `events`, `none` | Variant 2: Specifies how the bucket is updated: either by specific events or not updated automatically. | | `config.user` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 2: The unique identifier for the user associated with this bucket. | | `config` | object | no | | Variant 3: Configuration for data sourced from an MQTT topic. This requires specifying the topic and allows optional tags. | | `config.source` | string | yes | One of: `mqtt` | Variant 3: Indicates the data source is an MQTT topic. | | `config.tags` | array of string | no | Maximum items: 5 | Variant 3: A collection of tags for categorization, limited to 5. | | `config.topic` | string | yes | Maximum length: 512 | Variant 3: The MQTT topic from which data is sourced. | | `config` | object | no | | Variant 4: Configuration for data manually written or provided via an API. This variation only requires source specification and allows optional tags. | | `config.source` | string | yes | One of: `write`, `api` | Variant 4: Indicates the data source is either manually written ('write') or sourced via an API ('api'). | | `config.tags` | array of string | no | Maximum items: 5 | Variant 4: A collection of tags for categorization, limited to 5. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | yes | | | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `product` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `retention` | object | no | | Configuration schema for data bucket retention policy. | | `retention.period` | integer | no | Minimum: 0 | The duration of the retention period. 0 for unlimited retention. | | `retention.unit` | string | no | One of: `hours`, `days`, `weeks`, `months`, `years` | The unit of measurement for the retention period. | **Example request**: From API Call ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "bucket": "api_write", "config": { "source": "api" }, "description": "Bucket for API write", "enabled": true, "name": "API Write" }' ``` **Example body**: From MQTT Topic ```json { "bucket": "mqtt_bucket", "config": { "source": "mqtt", "topic": "house/+/temperature" }, "description": "Bucket for MQTT topic", "enabled": true, "name": "MQTT Bucket" } ``` **Example body**: From Thinger Device ```json { "bucket": "device_bucket", "config": { "device": "macbook", "interval": 300, "resource": "data", "source": "device", "update": "interval" }, "description": "Bucket for Thinger.io device", "enabled": true, "name": "Device Bucket" } ``` **Example body**: From Thinger Device Write ```json { "bucket": "device_write", "config": { "source": "write" }, "description": "Bucket dor device write", "enabled": true, "name": "Device Write" } ``` **Example body**: High rate on InfluxDB ```json { "backend": "influxdb", "bucket": "vibration", "config": { "device": "vibration_01", "interval": 10, "resource": "accel", "source": "device", "update": "interval" }, "description": "Accelerometer read every 10 seconds", "enabled": true, "name": "Vibration", "retention": { "period": 30, "unit": "days" } } ``` **Example body**: Tagged writes, kept 2 years ```json { "bucket": "meter_readings", "config": { "source": "write", "tags": [ "device", "site" ] }, "description": "Readings written by every meter, tagged by device and site", "enabled": true, "name": "Meter readings", "retention": { "period": 2, "unit": "years" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/buckets/{bucket}` - **Request:** GET /v1/users/{user}/buckets/{bucket} - **Operation:** ReadBucketConfig - **Operation ID:** `Bucket_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, From API Call) ```json { "bucket": "api_write", "config": { "source": "api" }, "created": 1792263090784, "description": "Bucket for API write", "enabled": true, "modified": 1792263090784, "name": "API Write" } ``` **Response example** (200, From MQTT Topic) ```json { "bucket": "mqtt_bucket", "config": { "source": "mqtt", "topic": "house/+/temperature" }, "created": 1792263090784, "description": "Bucket for MQTT topic", "enabled": true, "modified": 1792263090784, "name": "MQTT Bucket" } ``` **Response example** (200, From Thinger Device) ```json { "bucket": "device_bucket", "config": { "device": "macbook", "interval": 300, "resource": "data", "source": "device", "update": "interval" }, "created": 1792263090784, "description": "Bucket for Thinger.io device", "enabled": true, "modified": 1792263090784, "name": "Device Bucket" } ``` **Response example** (200, From Thinger Device Write) ```json { "bucket": "device_write", "config": { "source": "write" }, "created": 1792263090784, "description": "Bucket dor device write", "enabled": true, "modified": 1792263090784, "name": "Device Write" } ``` **Response example** (200, High rate on InfluxDB) ```json { "backend": "influxdb", "bucket": "vibration", "config": { "device": "vibration_01", "interval": 10, "resource": "accel", "source": "device", "update": "interval" }, "created": 1792263090784, "description": "Accelerometer read every 10 seconds", "enabled": true, "modified": 1792263090784, "name": "Vibration", "retention": { "period": 30, "unit": "days" } } ``` **Response example** (200, Tagged writes, kept 2 years) ```json { "bucket": "meter_readings", "config": { "source": "write", "tags": [ "device", "site" ] }, "created": 1792263090784, "description": "Readings written by every meter, tagged by device and site", "enabled": true, "modified": 1792263090784, "name": "Meter readings", "retention": { "period": 2, "unit": "years" } } ``` ## `PUT /v1/users/{user}/buckets/{bucket}` - **Request:** PUT /v1/users/{user}/buckets/{bucket} - **Operation:** UpdateBucket - **Operation ID:** `Bucket_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `asset_group` | string | no | Variant 1: Pattern: `^[a-zA-Z0-9_-]{1,32}$`
Variant 2: Maximum length: 0 | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `asset_type` | string | no | Variant 1: Pattern: `^[a-zA-Z0-9_-]{1,32}$`
Variant 2: Maximum length: 0 | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `backend` | string | no | One of: ``, `mongodb`, `influxdb`, `dynamodb` | Specifies the database backend to use for storage, with an option for default (represented by an empty string), 'mongodb', or 'influxdb'. | | `config` | object | no | | Configuration schema for a data bucket specifying how data is sourced and updated. This schema supports multiple source types including devices and MQTT topics, each with its own set of required properties. | | `config` | object | no | | Variant 1: Configuration for data sourced from a device. This requires specifying the device, user, resource, update interval, and optional tags. | | `config.device` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 1: The unique identifier for the device. | | `config.interval` | number | yes | | Variant 1: The time between updates, in seconds. | | `config.resource` | string | yes | Maximum length: 255 | Variant 1: The specific resource from the device being tracked. | | `config.source` | string | yes | One of: `device` | Variant 1: Indicates the data source is a device. | | `config.tags` | array of string | no | Maximum items: 5 | Variant 1: A collection of tags for categorization, limited to 5. | | `config.update` | string | yes | One of: `interval` | Variant 1: Specifies that the bucket is updated at regular intervals. | | `config.user` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 1: The unique identifier for the user associated with this bucket. | | `config` | object | no | | Variant 2: Configuration for data sourced from a device with event-based or no updates. This variation does not require an interval. | | `config.device` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 2: The unique identifier for the device. | | `config.resource` | string | yes | Maximum length: 255 | Variant 2: The specific resource from the device being tracked. | | `config.source` | string | yes | One of: `device` | Variant 2: Indicates the data source is a device. | | `config.tags` | array of string | no | Maximum items: 5 | Variant 2: A collection of tags for categorization, limited to 5. | | `config.update` | string | yes | One of: `events`, `none` | Variant 2: Specifies how the bucket is updated: either by specific events or not updated automatically. | | `config.user` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | Variant 2: The unique identifier for the user associated with this bucket. | | `config` | object | no | | Variant 3: Configuration for data sourced from an MQTT topic. This requires specifying the topic and allows optional tags. | | `config.source` | string | yes | One of: `mqtt` | Variant 3: Indicates the data source is an MQTT topic. | | `config.tags` | array of string | no | Maximum items: 5 | Variant 3: A collection of tags for categorization, limited to 5. | | `config.topic` | string | yes | Maximum length: 512 | Variant 3: The MQTT topic from which data is sourced. | | `config` | object | no | | Variant 4: Configuration for data manually written or provided via an API. This variation only requires source specification and allows optional tags. | | `config.source` | string | yes | One of: `write`, `api` | Variant 4: Indicates the data source is either manually written ('write') or sourced via an API ('api'). | | `config.tags` | array of string | no | Maximum items: 5 | Variant 4: A collection of tags for categorization, limited to 5. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `product` | string | no | Variant 1: Pattern: `^[a-zA-Z0-9_-]{1,32}$`
Variant 2: Maximum length: 0 | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `retention` | object | no | | Configuration schema for data bucket retention policy. | | `retention.period` | integer | no | Minimum: 0 | The duration of the retention period. 0 for unlimited retention. | | `retention.unit` | string | no | One of: `hours`, `days`, `weeks`, `months`, `years` | The unit of measurement for the retention period. | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "bucket": "api_write", "config": { "source": "api" }, "description": "Bucket for API write", "enabled": true, "name": "API Write" }' ``` **Example body**: Update 'config' ```json { "config": { "source": "api" } } ``` **Example body**: Update 'description' ```json { "description": "Bucket for API write" } ``` **Example body**: Update 'enabled' ```json { "enabled": true } ``` **Example body**: Update 'name' ```json { "name": "API Write" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/buckets/{bucket}` - **Request:** DELETE /v1/users/{user}/buckets/{bucket} - **Operation:** DeleteBucket - **Operation ID:** `Bucket_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/buckets/{bucket}/clone` - **Request:** GET /v1/users/{user}/buckets/{bucket}/clone - **Operation:** CloneBucketConfig - **Operation ID:** `Bucket_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/buckets/{bucket}/clone` - **Request:** POST /v1/users/{user}/buckets/{bucket}/clone - **Operation:** CloneBucket - **Operation ID:** `Bucket_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `bucket` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "bucket": "copy_of_bucket" }' ``` **Example body**: Copy with name and description ```json { "bucket": "line_2_bucket", "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/buckets/{bucket}/data` - **Request:** POST /v1/users/{user}/buckets/{bucket}/data - **Operation:** WriteBucket - **Operation ID:** `Bucket_WriteData` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Request body** (`application/json`, required) The JSON object becomes one record. ?ts=<epoch ms> sets its timestamp (MongoDB buckets also take a numeric 'ts' field). Fields listed in the bucket tags are indexed for filtering. The bucket must be enabled. **Example request**: One record ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/data' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "device": "greenhouse_01", "humidity": 51, "temperature": 23.4 }' ``` **Example body**: With its own timestamp ```json { "energy": 1532.8, "power": 2.1, "ts": 1791650000000 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/buckets/{bucket}/exports` - **Request:** GET /v1/users/{user}/buckets/{bucket}/exports - **Operation:** ListBucketExports - **Operation ID:** `Bucket_ListExports` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/exports' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/buckets/{bucket}/exports` - **Request:** POST /v1/users/{user}/buckets/{bucket}/exports - **Operation:** CreateBucketExport - **Operation ID:** `Bucket_CreateExport` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Request body** (`application/json`, required) Generates a file with the bucket data between min_ts and max_ts (epoch ms; all data when missing), listed in GET .../exports when ready. callback: notify by email to the owner or call an endpoint when it finishes. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `callback` | string | no | One of: `email`, `endpoint` | | | `data_type` | string | no | One of: `csv`, `arff`, `json` | | | `endpoint` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `max_ts` | number | no | Minimum: 0 | | | `min_ts` | number | no | Minimum: 0 | | | `timestamp_format` | string | no | One of: `iso`, `seconds`, `milliseconds` | | **Example request**: Everything as JSON, call an endpoint ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/exports' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "callback": "endpoint", "data_type": "json", "endpoint": "export_ready", "timestamp_format": "milliseconds" }' ``` **Example body**: Last month as CSV, email when ready ```json { "callback": "email", "data_type": "csv", "max_ts": 1791590400000, "min_ts": 1788998400000, "timestamp_format": "iso" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/buckets/{bucket}/exports/{file}` - **Request:** GET /v1/users/{user}/buckets/{bucket}/exports/{file} - **Operation:** ReadBucketExport - **Operation ID:** `Bucket_ReadExport` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/exports/YOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/buckets/{bucket}/exports/{file}` - **Request:** DELETE /v1/users/{user}/buckets/{bucket}/exports/{file} - **Operation:** DeleteBucketExport - **Operation ID:** `Bucket_DeleteExport` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/exports/YOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/buckets/{bucket}/imports` - **Request:** POST /v1/users/{user}/buckets/{bucket}/imports - **Operation:** CreateBucketImport - **Operation ID:** `Bucket_CreateImport` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Request body** (`application/json`, required) Loads records into the bucket from a file already uploaded to a file storage (CSV with a header row, as produced by an export). | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `file` | string | yes | | | | `source` | string | yes | One of: `storage` | | | `storage` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: CSV from a storage ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/imports' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "file": "meter_readings_2025.csv", "source": "storage", "storage": "imports" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/buckets/{bucket}/projects` - **Request:** PUT /v1/users/{user}/buckets/{bucket}/projects - **Operation:** UpdateBucketProjects - **Operation ID:** `Bucket_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/buckets/{bucket}/tags` - **Request:** GET /v1/users/{user}/buckets/{bucket}/tags - **Operation:** ListBucketTags - **Operation ID:** `Bucket_ListTags` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/tags' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/buckets/{bucket}/tags/{tag}` - **Request:** GET /v1/users/{user}/buckets/{bucket}/tags/{tag} - **Operation:** ReadBucketTag - **Operation ID:** `Bucket_ReadTag` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `bucket` | path | string | yes | | | `tag` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/buckets/YOUR_BUCKET/tags/YOUR_TAG' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /{version}/users/{user}/buckets/{bucket}/data` - **Request:** GET /{version}/users/{user}/buckets/{bucket}/data - **Operation:** ReadBucket - **Operation ID:** `Bucket_ReadData` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `version` | path | string | yes | | | `user` | path | string | yes | | | `bucket` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/YOUR_VERSION/users/YOUR_USER/buckets/YOUR_BUCKET/data' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/endpoints.md # Endpoints > REST API reference for Endpoints: create and call endpoints, and list the endpoint templates. 11 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/endpoints/templates` - **Request:** GET /v1/endpoints/templates - **Operation:** ListEndpointTemplates - **Operation ID:** `Endpoint_ListTemplates` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/endpoints/templates' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/endpoints/templates/{endpoint}` - **Request:** GET /v1/endpoints/templates/{endpoint} - **Operation:** ReadEndpointTemplateConfig - **Operation ID:** `Endpoint_ReadTemplateConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `endpoint` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/endpoints/templates/YOUR_ENDPOINT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/endpoints` - **Request:** GET /v1/users/{user}/endpoints - **Operation:** ListEndpoints - **Operation ID:** `Endpoint_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090703, "description": "Email Endpoint", "enabled": true, "endpoint": "email_endpoint", "modified": 1792263090703, "name": "Email", "type": "email" }, { "created": 1792263090703, "description": "HTTP Request", "enabled": true, "endpoint": "http_request", "modified": 1792263090703, "name": "HTTP", "type": "http_request" }, { "created": 1792263090703, "description": "HTTP request", "enabled": true, "endpoint": "http_request", "modified": 1792263090703, "name": "HTTP", "type": "http_request" } ] ``` ## `POST /v1/users/{user}/endpoints` - **Request:** POST /v1/users/{user}/endpoints - **Operation:** CreateEndpoint - **Operation ID:** `Endpoint_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) An endpoint is an outgoing action: type 'email', 'http_request' (webhooks, REST APIs), 'virtual' (no-op, for testing) or the id of an endpoint template (GET /v1/endpoints/templates lists them with their parameters; config is then {template, parameters}). Templates in config use `{{payload}}` (the data of the call) and its fields, e.g. `{{payload.temperature}}`. Called from the API (POST .../call), devices, product flows and alarm notifications. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | Settings of the endpoint type; not needed for 'virtual'. | | `description` | string | no | Maximum length: 255 | | | `enabled` | boolean | no | | | | `endpoint` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `name` | string | no | Maximum length: 255 | | | `type` | string | yes | Length: 1 to 255 | | **Example request**: Email ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "body": "

The current temperature and humidity are: {{temperature}}, {{humidity}}

", "body_type": "html", "recipient": "user@example.com", "reply_to": "user@example.com", "subject": "Endpoint Testing" }, "description": "Email Endpoint", "enabled": true, "endpoint": "email_endpoint", "name": "Email", "type": "email" }' ``` **Example body**: HTTP Request ```json { "config": { "body": "", "body_type": "json", "headers": [ { "key": "Authorization", "value": "Bearer xyz" } ], "method": "POST", "url": "https://api.acme.com/sensor" }, "description": "HTTP Request", "enabled": true, "endpoint": "http_request", "name": "HTTP", "type": "http_request" } ``` **Example body**: HTTP Request Custom Body ```json { "config": { "body": "{\n \"val1\" : {{temperature}},\n \"val2\": {{humidity}}\n}", "body_type": "custom", "headers": [ { "key": "Content-Type", "value": "application/json" } ], "method": "POST", "url": "https://api.acme.com/sensor" }, "description": "HTTP request", "enabled": true, "endpoint": "http_request", "name": "HTTP", "type": "http_request" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/endpoints/{endpoint}` - **Request:** GET /v1/users/{user}/endpoints/{endpoint} - **Operation:** ReadEndpointConfig - **Operation ID:** `Endpoint_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `endpoint` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/YOUR_ENDPOINT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Email) ```json { "config": { "body": "

The current temperature and humidity are: {{temperature}}, {{humidity}}

", "body_type": "html", "recipient": "user@example.com", "reply_to": "user@example.com", "subject": "Endpoint Testing" }, "created": 1792263090703, "description": "Email Endpoint", "enabled": true, "endpoint": "email_endpoint", "modified": 1792263090703, "name": "Email", "type": "email" } ``` **Response example** (200, HTTP Request) ```json { "config": { "body": "", "body_type": "json", "headers": [ { "key": "Authorization", "value": "Bearer xyz" } ], "method": "POST", "url": "https://api.acme.com/sensor" }, "created": 1792263090703, "description": "HTTP Request", "enabled": true, "endpoint": "http_request", "modified": 1792263090703, "name": "HTTP", "type": "http_request" } ``` **Response example** (200, HTTP Request Custom Body) ```json { "config": { "body": "{\n \"val1\" : {{temperature}},\n \"val2\": {{humidity}}\n}", "body_type": "custom", "headers": [ { "key": "Content-Type", "value": "application/json" } ], "method": "POST", "url": "https://api.acme.com/sensor" }, "created": 1792263090703, "description": "HTTP request", "enabled": true, "endpoint": "http_request", "modified": 1792263090703, "name": "HTTP", "type": "http_request" } ``` ## `PUT /v1/users/{user}/endpoints/{endpoint}` - **Request:** PUT /v1/users/{user}/endpoints/{endpoint} - **Operation:** UpdateEndpoint - **Operation ID:** `Endpoint_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `endpoint` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `description` | string | no | Maximum length: 255 | | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | | | `type` | string | no | Length: 1 to 255 | | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/YOUR_ENDPOINT' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "body": "

The current temperature and humidity are: {{temperature}}, {{humidity}}

", "body_type": "html", "recipient": "user@example.com", "reply_to": "user@example.com", "subject": "Endpoint Testing" }, "description": "Email Endpoint", "enabled": true, "endpoint": "email_endpoint", "name": "Email", "type": "email" }' ``` **Example body**: Update 'config' ```json { "config": { "body": "

The current temperature and humidity are: {{temperature}}, {{humidity}}

", "body_type": "html", "recipient": "user@example.com", "reply_to": "user@example.com", "subject": "Endpoint Testing" } } ``` **Example body**: Update 'description' ```json { "description": "Email Endpoint" } ``` **Example body**: Update 'enabled' ```json { "enabled": true } ``` **Example body**: Update 'name' ```json { "name": "Email" } ``` **Example body**: Update 'type' ```json { "type": "email" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/endpoints/{endpoint}` - **Request:** DELETE /v1/users/{user}/endpoints/{endpoint} - **Operation:** DeleteEndpoint - **Operation ID:** `Endpoint_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `endpoint` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/YOUR_ENDPOINT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/endpoints/{endpoint}/call` - **Request:** POST /v1/users/{user}/endpoints/{endpoint}/call - **Operation:** CallEndpoint - **Operation ID:** `Endpoint_Call` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `endpoint` | path | string | yes | | **Request body** (`application/json`, required) Optional JSON payload, available to the endpoint templates as `{{payload}}` (e.g. the body of a webhook or the content of an email). The response is what the endpoint answered. **Example request**: Alert payload ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/YOUR_ENDPOINT/call' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "device": "greenhouse_01", "message": "Temperature above 30", "temperature": 31.2 }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/endpoints/{endpoint}/clone` - **Request:** GET /v1/users/{user}/endpoints/{endpoint}/clone - **Operation:** CloneEndpointConfig - **Operation ID:** `Endpoint_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `endpoint` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/YOUR_ENDPOINT/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/endpoints/{endpoint}/clone` - **Request:** POST /v1/users/{user}/endpoints/{endpoint}/clone - **Operation:** CloneEndpoint - **Operation ID:** `Endpoint_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `endpoint` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `endpoint` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/YOUR_ENDPOINT/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "endpoint": "copy_of_endpoint" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "endpoint": "line_2_endpoint", "name": "Line 2 copy" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/endpoints/{endpoint}/projects` - **Request:** PUT /v1/users/{user}/endpoints/{endpoint}/projects - **Operation:** UpdateEndpointProjects - **Operation ID:** `Endpoint_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `endpoint` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/endpoints/YOUR_ENDPOINT/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/alarms.md # Alarms > REST API reference for Alarms: manage alarm rules and alarm instances, and test rules and their notifications. 18 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/alarms/instances` - **Request:** GET /v1/users/{user}/alarms/instances - **Operation:** ListAlarmInstances - **Operation ID:** `Alarm_ListInstances` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/alarms/instances` - **Request:** POST /v1/users/{user}/alarms/instances - **Operation:** CreateAlarmInstance - **Operation ID:** `Alarm_CreateInstance` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `alarm` | object | yes | | | | `alarm.rule` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `annotation` | string | no | Maximum length: 512 | | | `asset_group` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `asset_type` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `evaluation` | object | yes | | | | `evaluation.last_completed` | number | no | | | | `evaluation.last_values` | object | no | | | | `evaluation.total_duration` | number | no | | | | `instance` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `origin` | object | yes | | | | `origin.id` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `origin.name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `origin.source` | string | yes | One of: `device`, `user` | | | `reactivation` | object | no | | | | `reactivation.timespan` | object | no | | | | `reactivation.timespan.magnitude` | string | no | One of: `second`, `minute`, `hour`, `day`, `week`, `month`, `year` | | | `reactivation.timespan.value` | number | no | Minimum: 0 | | | `reactivation.type` | string | no | One of: `none`, `timespan` | | | `severity` | number | yes | Range: 0 to 4 | | | `state` | number | yes | Range: 0 to 4 | | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "instance": "", "alarm": {}, "name": "", "state": 0, "severity": 0, "origin": { "source": "device", "id": "", "name": "" }, "evaluation": {} }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/alarms/instances/stats` - **Request:** GET /v1/users/{user}/alarms/instances/stats - **Operation:** ReadAlarmInstanceStats - **Operation ID:** `Alarm_ReadInstanceStats` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/stats' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/alarms/instances/{instance}` - **Request:** GET /v1/users/{user}/alarms/instances/{instance} - **Operation:** ReadAlarmInstanceConfig - **Operation ID:** `Alarm_ReadInstanceConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `instance` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/alarms/instances/{instance}` - **Request:** PUT /v1/users/{user}/alarms/instances/{instance} - **Operation:** UpdateAlarmInstance - **Operation ID:** `Alarm_UpdateInstance` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `instance` | path | string | yes | | **Request body** (`application/json`, required) Mostly used to change the state of an alarm instance: 0 none, 1 activated, 2 acknowledged, 3 latched, 4 shelved, 5 cleared (final). 'reactivation' sets when an acknowledged, shelved or latched alarm becomes active again if the condition persists. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `annotation` | string | no | Maximum length: 512 | | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `reactivation` | object | no | | | | `reactivation.timespan` | object | no | | | | `reactivation.timespan.magnitude` | string | no | One of: `second`, `minute`, `hour`, `day`, `week`, `month`, `year` | | | `reactivation.timespan.value` | number | no | Minimum: 0 | | | `reactivation.type` | string | no | One of: `none`, `timespan` | | | `state` | number | no | Range: 0 to 6 | | **Example request**: Acknowledge ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "annotation": "Technician on the way", "state": 2 }' ``` **Example body**: Clear ```json { "annotation": "Fan replaced", "state": 5 } ``` **Example body**: Shelve for 4 hours ```json { "annotation": "Planned maintenance", "reactivation": { "timespan": { "magnitude": "hour", "value": 4 }, "type": "timespan" }, "state": 4 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/alarms/instances/{instance}` - **Request:** DELETE /v1/users/{user}/alarms/instances/{instance} - **Operation:** DeleteAlarmInstance - **Operation ID:** `Alarm_DeleteInstance` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `instance` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/alarms/instances/{instance}/projects` - **Request:** PUT /v1/users/{user}/alarms/instances/{instance}/projects - **Operation:** UpdateAlarmInstanceProjects - **Operation ID:** `Alarm_UpdateInstanceProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `instance` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/alarms/rules` - **Request:** GET /v1/users/{user}/alarms/rules - **Operation:** ListAlarmRules - **Operation ID:** `Alarm_ListRules` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090787, "description": "Mean temperature above 30 for 3 checks in a row, per device", "enabled": true, "modified": 1792263090787, "name": "Greenhouse too hot", "rule": "greenhouse_hot" }, { "created": 1792263090787, "description": "Any device of the smart_meter product disconnected", "enabled": true, "modified": 1792263090787, "name": "Meter offline", "rule": "meter_offline" }, { "created": 1792263090787, "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none", "enabled": true, "modified": 1792263090787, "name": "Water table too deep", "rule": "well_too_deep" }, { "created": 1792263090787, "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group", "enabled": true, "modified": 1792263090787, "name": "Low battery", "rule": "low_battery" } ] ``` ## `POST /v1/users/{user}/alarms/rules` - **Request:** POST /v1/users/{user}/alarms/rules - **Operation:** CreateAlarmRule - **Operation ID:** `Alarm_CreateRule` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) An alarm rule checks its data sources every check_interval and raises one alarm instance per device that meets the activation conditions. Sources: 'bucket' (bucket data, optionally aggregated and grouped by device), 'device_property' (a device property, resolved with type / group / product inheritance) and 'device_status' (connection.active, connection.ts). Sources can be narrowed with project, product, asset_type, asset_group or device. Conditions read '<source name>.<field>' and compare it with above, below, equal, not_equal (value), inside, outside (min, max), present or absent; a comparison on a field the device does not have is false (a bucket source with several mapping fields keeps a device that only has some of them), so 'a above 5 or b above 5' works on devices without b, and a device is skipped only when it has none of the fields the conditions read or misses a whole source (unless present / absent are used); values are strings, and can be expressions over other sources of the same device (e.g. 'limits.value.max_depth_m', a per-device threshold from a device_property source). device_property fields are paths in the property document: 'value.<field>'. Confirmation: immediate, sequence (N detections in a row) or timespan. Notifications call endpoints. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config.activation` | object | no | | | | `config.check_interval` | object | no | | | | `config.check_interval.magnitude` | string | no | One of: `second`, `minute`, `hour`, `day`, `week`, `month`, `year` | | | `config.check_interval.value` | number | no | Minimum: 0 | | | `config.data` | object | no | | | | `config.description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `config.name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `config.normalization` | object | no | | | | `config.reminder` | object | no | | | | `config.rule` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `config.severity` | number | no | Range: 0 to 4 | | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | yes | | | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `rule` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Bucket threshold ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "activation": { "conditions": [ { "comparison": "above", "field": "climate.temperature", "operator": "and", "type": "value_check", "value": "30" } ], "confirmation": { "mode": "sequence", "sequence": { "value": 3 } }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 5 }, "data": { "sources": [ { "bucket": { "aggregation": { "period": "5m", "type": "mean" }, "group_by": [ "device" ], "id": "greenhouse_climate", "mapping": [ "temperature" ] }, "name": "climate", "source": "bucket" } ] }, "normalization": { "conditions": [ { "comparison": "below", "field": "climate.temperature", "operator": "and", "type": "value_check", "value": "28" } ], "confirmation": { "mode": "timespan", "timespan": { "magnitude": "minute", "value": 15 } }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "reminder": { "interval": { "magnitude": "day", "value": 1 }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ], "type": "interval" }, "severity": 3 }, "description": "Mean temperature above 30 for 3 checks in a row, per device", "enabled": true, "name": "Greenhouse too hot", "rule": "greenhouse_hot" }' ``` **Example body**: Device offline ```json { "config": { "activation": { "conditions": [ { "comparison": "equal", "field": "status.connection.active", "operator": "and", "type": "value_check", "value": "0" } ], "confirmation": { "mode": "timespan", "timespan": { "magnitude": "minute", "value": 10 } }, "notifications": [ { "id": "support_webhook", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 1 }, "data": { "sources": [ { "device_status": { "fields": [ "connection.active", "connection.ts" ], "product": "smart_meter" }, "name": "status", "source": "device_status" } ] }, "normalization": { "conditions": [ { "comparison": "equal", "field": "status.connection.active", "operator": "and", "type": "value_check", "value": "1" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 2 }, "description": "Any device of the smart_meter product disconnected", "enabled": true, "name": "Meter offline", "rule": "meter_offline" } ``` **Example body**: Per-device threshold ```json { "config": { "activation": { "conditions": [ { "comparison": "above", "field": "well.depth_m", "operator": "and", "type": "value_check", "value": "limits.value.max_depth_m" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 15 }, "data": { "sources": [ { "bucket": { "aggregation": { "period": "1h", "type": "max" }, "group_by": [ "device" ], "id": "well_levels", "mapping": [ "depth_m" ] }, "name": "well", "source": "bucket" }, { "device_property": { "fields": [ "value.max_depth_m" ], "product": "piezometer", "property": "limits" }, "name": "limits", "source": "device_property" } ] }, "normalization": { "conditions": [ { "comparison": "below", "field": "well.depth_m", "operator": "and", "type": "value_check", "value": "limits.value.max_depth_m * 0.9" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 2 }, "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none", "enabled": true, "name": "Water table too deep", "rule": "well_too_deep" } ``` **Example body**: Property condition ```json { "config": { "activation": { "conditions": [ { "comparison": "below", "field": "battery.value.level", "operator": "and", "type": "value_check", "value": "15" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "hour", "value": 1 }, "data": { "sources": [ { "device_property": { "asset_group": "field_sensors", "fields": [ "value.level" ], "property": "battery" }, "name": "battery", "source": "device_property" } ] }, "normalization": { "conditions": [ { "comparison": "above", "field": "battery.value.level", "operator": "and", "type": "value_check", "value": "50" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 1 }, "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group", "enabled": true, "name": "Low battery", "rule": "low_battery" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/alarms/rules/{rule}` - **Request:** GET /v1/users/{user}/alarms/rules/{rule} - **Operation:** ReadAlarmRuleConfig - **Operation ID:** `Alarm_ReadRuleConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Bucket threshold) ```json { "config": { "activation": { "conditions": [ { "comparison": "above", "field": "climate.temperature", "operator": "and", "type": "value_check", "value": "30" } ], "confirmation": { "mode": "sequence", "sequence": { "value": 3 } }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 5 }, "data": { "sources": [ { "bucket": { "aggregation": { "period": "5m", "type": "mean" }, "group_by": [ "device" ], "id": "greenhouse_climate", "mapping": [ "temperature" ] }, "name": "climate", "source": "bucket" } ] }, "normalization": { "conditions": [ { "comparison": "below", "field": "climate.temperature", "operator": "and", "type": "value_check", "value": "28" } ], "confirmation": { "mode": "timespan", "timespan": { "magnitude": "minute", "value": 15 } }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "reminder": { "interval": { "magnitude": "day", "value": 1 }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ], "type": "interval" }, "severity": 3 }, "created": 1792263090787, "description": "Mean temperature above 30 for 3 checks in a row, per device", "enabled": true, "modified": 1792263090787, "name": "Greenhouse too hot", "rule": "greenhouse_hot" } ``` **Response example** (200, Device offline) ```json { "config": { "activation": { "conditions": [ { "comparison": "equal", "field": "status.connection.active", "operator": "and", "type": "value_check", "value": "0" } ], "confirmation": { "mode": "timespan", "timespan": { "magnitude": "minute", "value": 10 } }, "notifications": [ { "id": "support_webhook", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 1 }, "data": { "sources": [ { "device_status": { "fields": [ "connection.active", "connection.ts" ], "product": "smart_meter" }, "name": "status", "source": "device_status" } ] }, "normalization": { "conditions": [ { "comparison": "equal", "field": "status.connection.active", "operator": "and", "type": "value_check", "value": "1" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 2 }, "created": 1792263090787, "description": "Any device of the smart_meter product disconnected", "enabled": true, "modified": 1792263090787, "name": "Meter offline", "rule": "meter_offline" } ``` **Response example** (200, Per-device threshold) ```json { "config": { "activation": { "conditions": [ { "comparison": "above", "field": "well.depth_m", "operator": "and", "type": "value_check", "value": "limits.value.max_depth_m" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 15 }, "data": { "sources": [ { "bucket": { "aggregation": { "period": "1h", "type": "max" }, "group_by": [ "device" ], "id": "well_levels", "mapping": [ "depth_m" ] }, "name": "well", "source": "bucket" }, { "device_property": { "fields": [ "value.max_depth_m" ], "product": "piezometer", "property": "limits" }, "name": "limits", "source": "device_property" } ] }, "normalization": { "conditions": [ { "comparison": "below", "field": "well.depth_m", "operator": "and", "type": "value_check", "value": "limits.value.max_depth_m * 0.9" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 2 }, "created": 1792263090787, "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none", "enabled": true, "modified": 1792263090787, "name": "Water table too deep", "rule": "well_too_deep" } ``` **Response example** (200, Property condition) ```json { "config": { "activation": { "conditions": [ { "comparison": "below", "field": "battery.value.level", "operator": "and", "type": "value_check", "value": "15" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "hour", "value": 1 }, "data": { "sources": [ { "device_property": { "asset_group": "field_sensors", "fields": [ "value.level" ], "property": "battery" }, "name": "battery", "source": "device_property" } ] }, "normalization": { "conditions": [ { "comparison": "above", "field": "battery.value.level", "operator": "and", "type": "value_check", "value": "50" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 1 }, "created": 1792263090787, "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group", "enabled": true, "modified": 1792263090787, "name": "Low battery", "rule": "low_battery" } ``` ## `PUT /v1/users/{user}/alarms/rules/{rule}` - **Request:** PUT /v1/users/{user}/alarms/rules/{rule} - **Operation:** UpdateAlarmRule - **Operation ID:** `Alarm_UpdateRule` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Request body** (`application/json`, required) Fields sent replace the stored ones; config replaces the whole rule configuration (read it first to change part of it). | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config.activation` | object | no | | | | `config.check_interval` | object | no | | | | `config.check_interval.magnitude` | string | no | One of: `second`, `minute`, `hour`, `day`, `week`, `month`, `year` | | | `config.check_interval.value` | number | no | Minimum: 0 | | | `config.data` | object | no | | | | `config.description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `config.name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `config.normalization` | object | no | | | | `config.reminder` | object | no | | | | `config.rule` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `config.severity` | number | no | Range: 0 to 4 | | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Disable the rule ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": false }' ``` **Example body**: Rename ```json { "description": "Zone A sensors only", "name": "Greenhouse too hot - zone A" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/alarms/rules/{rule}` - **Request:** DELETE /v1/users/{user}/alarms/rules/{rule} - **Operation:** DeleteAlarmRule - **Operation ID:** `Alarm_DeleteRule` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/alarms/rules/{rule}/clone` - **Request:** GET /v1/users/{user}/alarms/rules/{rule}/clone - **Operation:** CloneAlarmRuleConfig - **Operation ID:** `Alarm_CloneRuleConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/alarms/rules/{rule}/clone` - **Request:** POST /v1/users/{user}/alarms/rules/{rule}/clone - **Operation:** CloneAlarmRule - **Operation ID:** `Alarm_CloneRule` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `rule` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "rule": "copy_of_rule" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "rule": "line_2_rule" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/alarms/rules/{rule}/projects` - **Request:** PUT /v1/users/{user}/alarms/rules/{rule}/projects - **Operation:** UpdateAlarmRuleProjects - **Operation ID:** `Alarm_UpdateRuleProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/alarms/rules/{rule}/test-notification` - **Request:** POST /v1/users/{user}/alarms/rules/{rule}/test-notification - **Operation:** TestRuleNotification - **Operation ID:** `Alarm_TestRuleNotificationTest-notification` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Request body** (`application/json`, required) Simulates an alarm event of a device and SENDS the notifications configured for that event type (config.<type>.notifications) to their endpoints, so real emails or webhooks go out. Returns the notifications and the alarm payload they carried. Nothing is stored. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config.activation` | object | no | | | | `config.check_interval` | object | no | | | | `config.check_interval.magnitude` | string | no | One of: `second`, `minute`, `hour`, `day`, `week`, `month`, `year` | | | `config.check_interval.value` | number | no | Minimum: 0 | | | `config.data` | object | no | | | | `config.description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `config.name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `config.normalization` | object | no | | | | `config.reminder` | object | no | | | | `config.rule` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `config.severity` | number | no | Range: 0 to 4 | | | `description` | string or null | no | | | | `event` | object | yes | | | | `event.origin` | string or null | no | | Device id. | | `event.type` | string | yes | One of: `activation`, `normalization`, `reminder` | | | `event.values` | any | no | | Source values that triggered the event, by source name. | | `name` | string or null | no | | | **Example request**: Activation of a device ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/test-notification' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "activation": { "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "severity": 3 }, "description": "Mean temperature above 30", "event": { "origin": "greenhouse_01", "type": "activation", "values": { "climate": { "temperature": 31.2 } } }, "name": "Greenhouse too hot" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/alarms/rules/{rule}/test-rule` - **Request:** POST /v1/users/{user}/alarms/rules/{rule}/test-rule - **Operation:** TestRule - **Operation ID:** `Alarm_TestRuleTest-rule` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Request body** (`application/json`, required) Fields sent replace the stored ones; config replaces the whole rule configuration (read it first to change part of it). | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config.activation` | object | no | | | | `config.check_interval` | object | no | | | | `config.check_interval.magnitude` | string | no | One of: `second`, `minute`, `hour`, `day`, `week`, `month`, `year` | | | `config.check_interval.value` | number | no | Minimum: 0 | | | `config.data` | object | no | | | | `config.description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `config.name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `config.normalization` | object | no | | | | `config.reminder` | object | no | | | | `config.rule` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `config.severity` | number | no | Range: 0 to 4 | | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Bucket threshold ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/test-rule' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "activation": { "conditions": [ { "comparison": "above", "field": "climate.temperature", "operator": "and", "type": "value_check", "value": "30" } ], "confirmation": { "mode": "sequence", "sequence": { "value": 3 } }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 5 }, "data": { "sources": [ { "bucket": { "aggregation": { "period": "5m", "type": "mean" }, "group_by": [ "device" ], "id": "greenhouse_climate", "mapping": [ "temperature" ] }, "name": "climate", "source": "bucket" } ] }, "normalization": { "conditions": [ { "comparison": "below", "field": "climate.temperature", "operator": "and", "type": "value_check", "value": "28" } ], "confirmation": { "mode": "timespan", "timespan": { "magnitude": "minute", "value": 15 } }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "reminder": { "interval": { "magnitude": "day", "value": 1 }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ], "type": "interval" }, "severity": 3 }, "description": "Mean temperature above 30 for 3 checks in a row, per device", "enabled": true, "name": "Greenhouse too hot" }' ``` **Example body**: Device offline ```json { "config": { "activation": { "conditions": [ { "comparison": "equal", "field": "status.connection.active", "operator": "and", "type": "value_check", "value": "0" } ], "confirmation": { "mode": "timespan", "timespan": { "magnitude": "minute", "value": 10 } }, "notifications": [ { "id": "support_webhook", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 1 }, "data": { "sources": [ { "device_status": { "fields": [ "connection.active", "connection.ts" ], "product": "smart_meter" }, "name": "status", "source": "device_status" } ] }, "normalization": { "conditions": [ { "comparison": "equal", "field": "status.connection.active", "operator": "and", "type": "value_check", "value": "1" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 2 }, "description": "Any device of the smart_meter product disconnected", "enabled": true, "name": "Meter offline" } ``` **Example body**: Per-device threshold ```json { "config": { "activation": { "conditions": [ { "comparison": "above", "field": "well.depth_m", "operator": "and", "type": "value_check", "value": "limits.value.max_depth_m" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "minute", "value": 15 }, "data": { "sources": [ { "bucket": { "aggregation": { "period": "1h", "type": "max" }, "group_by": [ "device" ], "id": "well_levels", "mapping": [ "depth_m" ] }, "name": "well", "source": "bucket" }, { "device_property": { "fields": [ "value.max_depth_m" ], "product": "piezometer", "property": "limits" }, "name": "limits", "source": "device_property" } ] }, "normalization": { "conditions": [ { "comparison": "below", "field": "well.depth_m", "operator": "and", "type": "value_check", "value": "limits.value.max_depth_m * 0.9" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 2 }, "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none", "enabled": true, "name": "Water table too deep" } ``` **Example body**: Property condition ```json { "config": { "activation": { "conditions": [ { "comparison": "below", "field": "battery.value.level", "operator": "and", "type": "value_check", "value": "15" } ], "confirmation": { "mode": "immediate" }, "notifications": [ { "id": "ops_email", "type": "endpoint" } ] }, "check_interval": { "magnitude": "hour", "value": 1 }, "data": { "sources": [ { "device_property": { "asset_group": "field_sensors", "fields": [ "value.level" ], "property": "battery" }, "name": "battery", "source": "device_property" } ] }, "normalization": { "conditions": [ { "comparison": "above", "field": "battery.value.level", "operator": "and", "type": "value_check", "value": "50" } ], "confirmation": { "mode": "immediate" }, "notifications": [] }, "reminder": { "notifications": [], "type": "none" }, "severity": 1 }, "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group", "enabled": true, "name": "Low battery" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/alarms/rules/{rule}/test-source` - **Request:** POST /v1/users/{user}/alarms/rules/{rule}/test-source - **Operation:** TestRuleSource - **Operation ID:** `Alarm_TestRuleSourceTest-source` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `rule` | path | string | yes | | **Request body** (`application/json`, required) One data source, as in config.data.sources: returns the data it produces now, per device. The rule id in the path does not need to exist yet. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `bucket` | object | no | | | | `check_interval` | object | no | | Window read by a bucket source without aggregation, as in config.check_interval (default: the rule's, or 1 minute). The rule does not need to exist. | | `device_property` | object | no | | | | `device_status` | object | no | | | | `name` | string or null | no | | | | `source` | string | yes | One of: `bucket`, `device_property`, `device_status` | | **Example request**: Bucket source ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/test-source' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "bucket": { "aggregation": { "period": "5m", "type": "mean" }, "group_by": [ "device" ], "id": "greenhouse_climate", "mapping": [ "temperature" ] }, "name": "climate", "source": "bucket" }' ``` **Example body**: Device property source ```json { "device_property": { "asset_group": "field_sensors", "fields": [ "value.level" ], "property": "battery" }, "name": "battery", "source": "device_property" } ``` **Example body**: Device status source ```json { "device_status": { "fields": [ "connection.active", "connection.ts" ], "product": "smart_meter" }, "name": "status", "source": "device_status" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/tokens.md # Access Tokens > REST API reference for Access Tokens: create, read, update, clone and delete access tokens. 8 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/tokens` - **Request:** GET /v1/users/{user}/tokens - **Operation:** ListTokens - **Operation ID:** `Token_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Admin Access", "token": "admin_access" }, { "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Shared Access", "token": "shared_access" }, { "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Greenhouse 01", "token": "greenhouse_01_access" }, { "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Read-only dashboard", "token": "readonly_dashboard" } ] ``` ## `POST /v1/users/{user}/tokens` - **Request:** POST /v1/users/{user}/tokens - **Operation:** CreateToken - **Operation ID:** `Token_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | yes | | | | `expire` | number | no | | Expiration as a unix timestamp in milliseconds: the token stops working then, and is deleted shortly after. Without it the token does not expire. Set when the token is created; it cannot be changed later. | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `token` | string | yes | Pattern: `^[a-zA-Z0-9_]{1,50}$` | | **Example request**: Admin Access ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "allow": { "*": { "*": "*" } }, "enabled": true, "name": "Admin Access", "token": "admin_access" }' ``` **Example body**: Custom Access ```json { "allow": { "Bucket": { "mqtt_bucket": [ "ReadBucket" ] }, "Device": { "*": [ "AccessDeviceResources" ] } }, "enabled": true, "name": "Shared Access", "token": "shared_access" } ``` **Example body**: One device ```json { "allow": { "Bucket": { "greenhouse_climate": [ "ReadBucket" ] }, "Device": { "greenhouse_01": [ "Read*", "AccessDeviceResources" ] } }, "enabled": true, "name": "Greenhouse 01", "token": "greenhouse_01_access" } ``` **Example body**: Read-only devices and buckets ```json { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "enabled": true, "name": "Read-only dashboard", "token": "readonly_dashboard" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/tokens/{token}` - **Request:** GET /v1/users/{user}/tokens/{token} - **Operation:** ReadTokenConfig - **Operation ID:** `Token_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `token` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens/YOUR_TOKEN' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Admin Access) ```json { "allow": { "*": { "*": "*" } }, "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Admin Access", "token": "admin_access" } ``` **Response example** (200, Custom Access) ```json { "allow": { "Bucket": { "mqtt_bucket": [ "ReadBucket" ] }, "Device": { "*": [ "AccessDeviceResources" ] } }, "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Shared Access", "token": "shared_access" } ``` **Response example** (200, One device) ```json { "allow": { "Bucket": { "greenhouse_climate": [ "ReadBucket" ] }, "Device": { "greenhouse_01": [ "Read*", "AccessDeviceResources" ] } }, "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Greenhouse 01", "token": "greenhouse_01_access" } ``` **Response example** (200, Read-only devices and buckets) ```json { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "created": 1792263090744, "enabled": true, "modified": 1792263090744, "name": "Read-only dashboard", "token": "readonly_dashboard" } ``` ## `PUT /v1/users/{user}/tokens/{token}` - **Request:** PUT /v1/users/{user}/tokens/{token} - **Operation:** UpdateToken - **Operation ID:** `Token_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `token` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `expire` | number | no | | Cannot be changed: the expiration is signed into the token when it is created. Create a new token instead. | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens/YOUR_TOKEN' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "allow": { "*": { "*": "*" } }, "enabled": true, "name": "Admin Access", "token": "admin_access" }' ``` **Example body**: Update 'allow' ```json { "allow": { "*": { "*": "*" } } } ``` **Example body**: Update 'enabled' ```json { "enabled": true } ``` **Example body**: Update 'name' ```json { "name": "Admin Access" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/tokens/{token}` - **Request:** DELETE /v1/users/{user}/tokens/{token} - **Operation:** DeleteToken - **Operation ID:** `Token_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `token` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens/YOUR_TOKEN' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/tokens/{token}/clone` - **Request:** GET /v1/users/{user}/tokens/{token}/clone - **Operation:** CloneTokenConfig - **Operation ID:** `Token_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `token` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens/YOUR_TOKEN/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/tokens/{token}/clone` - **Request:** POST /v1/users/{user}/tokens/{token}/clone - **Operation:** CloneToken - **Operation ID:** `Token_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `token` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `token` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens/YOUR_TOKEN/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "token": "copy_of_token" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "token": "line_2_token" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/tokens/{token}/projects` - **Request:** PUT /v1/users/{user}/tokens/{token}/projects - **Operation:** UpdateTokenProjects - **Operation ID:** `Token_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `token` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/tokens/YOUR_TOKEN/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/assets.md # Assets > REST API reference for Assets: read the locations of the assets of an account. 1 operation. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/assets/locations` - **Request:** GET /v1/users/{user}/assets/locations - **Operation:** ReadAssetsLocations - **Operation ID:** `Asset_ReadLocations` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/assets/locations' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/types.md # Asset Types > REST API reference for Asset Types: manage asset types, their properties and the locations of their assets. 17 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/types` - **Request:** GET /v1/users/{user}/types - **Operation:** ListTypes - **Operation ID:** `Type_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/types' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "description": "Gas boilers with remote control", "name": "Boiler", "type": "boiler" } ] ``` ## `POST /v1/users/{user}/types` - **Request:** POST /v1/users/{user}/types - **Operation:** CreateType - **Operation ID:** `Type_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) An asset type is what a device is (boiler, meter, gateway). Devices join one with their asset_type field and inherit its properties. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `name` | string | no | | | | `type` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Boiler ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/types' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Gas boilers with remote control", "name": "Boiler", "type": "boiler" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/types/{type}` - **Request:** GET /v1/users/{user}/types/{type} - **Operation:** ReadTypeConfig - **Operation ID:** `Type_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Boiler) ```json { "description": "Gas boilers with remote control", "name": "Boiler", "type": "boiler" } ``` ## `PUT /v1/users/{user}/types/{type}` - **Request:** PUT /v1/users/{user}/types/{type} - **Operation:** UpdateType - **Operation ID:** `Type_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `name` | string | no | | | **Example request**: Rename ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Condensing gas boilers", "name": "Gas boiler" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/types/{type}` - **Request:** DELETE /v1/users/{user}/types/{type} - **Operation:** DeleteType - **Operation ID:** `Type_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/types/{type}/clone` - **Request:** GET /v1/users/{user}/types/{type}/clone - **Operation:** CloneTypeConfig - **Operation ID:** `Type_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/types/{type}/clone` - **Request:** POST /v1/users/{user}/types/{type}/clone - **Operation:** CloneType - **Operation ID:** `Type_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `type` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "type": "copy_of_type" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "type": "line_2_type" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/types/{type}/locations` - **Request:** GET /v1/users/{user}/types/{type}/locations - **Operation:** ReadAssetsLocations - **Operation ID:** `Type_ReadAssetsLocations` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/locations' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/types/{type}/projects` - **Request:** PUT /v1/users/{user}/types/{type}/projects - **Operation:** UpdateTypeProjects - **Operation ID:** `Type_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/types/{type}/properties` - **Request:** GET /v1/users/{user}/types/{type}/properties - **Operation:** ListTypeProperties - **Operation ID:** `Type_ListProperties` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090710, "description": "Sampling and alert thresholds", "modified": 1792263090710, "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }, { "created": 1792263090710, "modified": 1792263090710, "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } }, { "created": 1792263090710, "modified": 1792263090710, "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } }, { "created": 1792263090710, "modified": 1792263090710, "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ] ``` ## `POST /v1/users/{user}/types/{type}/properties` - **Request:** POST /v1/users/{user}/types/{type}/properties - **Operation:** CreateTypeProperty - **Operation ID:** `Type_CreateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of object | no | | | | `(body)[].description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `(body)[].form` | object | no | | | | `(body)[].form.fields` | any | yes | | | | `(body)[].name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `(body)[].perm` | object | no | | | | `(body)[].perm.hidden` | array of string | no | Unique items | | | `(body)[].perm.readOnly` | array of string | no | Unique items | | | `(body)[].property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `(body)[].type` | string | no | One of: ``, `configuration` | | | `(body)[].value` | any | yes | | | *Variant 2*: Property Create. Schema for creating a property Schema for creating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Configuration value ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sampling and alert thresholds", "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }' ``` **Example body**: Location ```json { "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } } ``` **Example body**: Read-only for project members ```json { "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } } ``` **Example body**: Url dashboard of the resource ```json { "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/types/{type}/properties/{property}` - **Request:** GET /v1/users/{user}/types/{type}/properties/{property} - **Operation:** ReadTypeProperty - **Operation ID:** `Type_ReadProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/types/{type}/properties/{property}` - **Request:** PUT /v1/users/{user}/types/{type}/properties/{property} - **Operation:** UpdateTypeProperty - **Operation ID:** `Type_UpdateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) Schema for updating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Hide from project members ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "perm": { "hidden": [ "member" ] }, "value": "internal note" }' ``` **Example body**: Replace the value ```json { "value": { "alerts": true, "interval": 30, "max_temperature": 27 } } ``` **Example body**: Value, name and description ```json { "description": "Faster sampling during commissioning", "name": "Settings", "value": { "alerts": false, "interval": 10, "max_temperature": 28.5 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/users/{user}/types/{type}/properties/{property}` - **Request:** PATCH /v1/users/{user}/types/{type}/properties/{property} - **Operation:** UpdateTypeProperty - **Operation ID:** `Type_PatchProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `value` | any | yes | | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `*` | any | no | | | **Example request**: Change some fields of the value ```bash curl -X PATCH 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "value": { "interval": 30 } }' ``` **Example body**: Flattened fields ```json { "value.alerts": false, "value.max_temperature": 27 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/types/{type}/properties/{property}` - **Request:** DELETE /v1/users/{user}/types/{type}/properties/{property} - **Operation:** DeleteTypeProperty - **Operation ID:** `Type_DeleteProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/types/{type}/properties/{property}/clone` - **Request:** GET /v1/users/{user}/types/{type}/properties/{property}/clone - **Operation:** CloneTypePropertyConfig - **Operation ID:** `Type_ClonePropertyConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/types/{type}/properties/{property}/clone` - **Request:** POST /v1/users/{user}/types/{type}/properties/{property}/clone - **Operation:** CloneTypeProperty - **Operation ID:** `Type_CloneProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `type` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/types/YOUR_TYPE/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "property": "copy_of_property" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "property": "line_2_property" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/groups.md # Asset Groups > REST API reference for Asset Groups: manage asset groups, their properties and the locations of their assets. 17 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/groups` - **Request:** GET /v1/users/{user}/groups - **Operation:** ListGroups - **Operation ID:** `Group_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/groups' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "group": "madrid_line_2", "name": "Line 2", "parent": "madrid_plant" }, { "description": "Devices installed in the Madrid plant", "group": "madrid_plant", "name": "Madrid plant" } ] ``` ## `POST /v1/users/{user}/groups` - **Request:** POST /v1/users/{user}/groups - **Operation:** CreateGroup - **Operation ID:** `Group_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) An asset group is where or whose a device is (a site, a customer, a building). Groups nest through 'parent'; devices join one with their asset_group field and inherit its properties. Project members can be limited to some groups. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `group` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `name` | string | no | | | | `parent` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Area inside a site ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/groups' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "group": "madrid_line_2", "name": "Line 2", "parent": "madrid_plant" }' ``` **Example body**: Site ```json { "description": "Devices installed in the Madrid plant", "group": "madrid_plant", "name": "Madrid plant" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/groups/{group}` - **Request:** GET /v1/users/{user}/groups/{group} - **Operation:** ReadGroupConfig - **Operation ID:** `Group_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Area inside a site) ```json { "group": "madrid_line_2", "name": "Line 2", "parent": "madrid_plant" } ``` **Response example** (200, Site) ```json { "description": "Devices installed in the Madrid plant", "group": "madrid_plant", "name": "Madrid plant" } ``` ## `PUT /v1/users/{user}/groups/{group}` - **Request:** PUT /v1/users/{user}/groups/{group} - **Operation:** UpdateGroup - **Operation ID:** `Group_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `name` | string | no | | | **Example request**: Rename ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "North building", "name": "Madrid plant - north" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/groups/{group}` - **Request:** DELETE /v1/users/{user}/groups/{group} - **Operation:** DeleteGroup - **Operation ID:** `Group_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/groups/{group}/clone` - **Request:** GET /v1/users/{user}/groups/{group}/clone - **Operation:** CloneGroupConfig - **Operation ID:** `Group_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/groups/{group}/clone` - **Request:** POST /v1/users/{user}/groups/{group}/clone - **Operation:** CloneGroup - **Operation ID:** `Group_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `group` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "group": "copy_of_group" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "group": "line_2_group", "name": "Line 2 copy" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/groups/{group}/locations` - **Request:** GET /v1/users/{user}/groups/{group}/locations - **Operation:** ReadAssetsLocations - **Operation ID:** `Group_ReadAssetsLocations` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/locations' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/groups/{group}/projects` - **Request:** PUT /v1/users/{user}/groups/{group}/projects - **Operation:** UpdateGroupProjects - **Operation ID:** `Group_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/groups/{group}/properties` - **Request:** GET /v1/users/{user}/groups/{group}/properties - **Operation:** ListGroupProperties - **Operation ID:** `Group_ListProperties` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090708, "description": "Sampling and alert thresholds", "modified": 1792263090708, "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }, { "created": 1792263090708, "modified": 1792263090708, "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } }, { "created": 1792263090708, "modified": 1792263090708, "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } }, { "created": 1792263090708, "modified": 1792263090708, "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ] ``` ## `POST /v1/users/{user}/groups/{group}/properties` - **Request:** POST /v1/users/{user}/groups/{group}/properties - **Operation:** CreateGroupProperty - **Operation ID:** `Group_CreateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of object | no | | | | `(body)[].description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `(body)[].form` | object | no | | | | `(body)[].form.fields` | any | yes | | | | `(body)[].name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `(body)[].perm` | object | no | | | | `(body)[].perm.hidden` | array of string | no | Unique items | | | `(body)[].perm.readOnly` | array of string | no | Unique items | | | `(body)[].property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `(body)[].type` | string | no | One of: ``, `configuration` | | | `(body)[].value` | any | yes | | | *Variant 2*: Property Create. Schema for creating a property Schema for creating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Configuration value ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sampling and alert thresholds", "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }' ``` **Example body**: Location ```json { "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } } ``` **Example body**: Read-only for project members ```json { "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } } ``` **Example body**: Url dashboard of the resource ```json { "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/groups/{group}/properties/{property}` - **Request:** GET /v1/users/{user}/groups/{group}/properties/{property} - **Operation:** ReadGroupProperty - **Operation ID:** `Group_ReadProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/groups/{group}/properties/{property}` - **Request:** PUT /v1/users/{user}/groups/{group}/properties/{property} - **Operation:** UpdateGroupProperty - **Operation ID:** `Group_UpdateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) Schema for updating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Hide from project members ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "perm": { "hidden": [ "member" ] }, "value": "internal note" }' ``` **Example body**: Replace the value ```json { "value": { "alerts": true, "interval": 30, "max_temperature": 27 } } ``` **Example body**: Value, name and description ```json { "description": "Faster sampling during commissioning", "name": "Settings", "value": { "alerts": false, "interval": 10, "max_temperature": 28.5 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/users/{user}/groups/{group}/properties/{property}` - **Request:** PATCH /v1/users/{user}/groups/{group}/properties/{property} - **Operation:** UpdateGroupProperty - **Operation ID:** `Group_PatchProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `value` | any | yes | | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `*` | any | no | | | **Example request**: Change some fields of the value ```bash curl -X PATCH 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "value": { "interval": 30 } }' ``` **Example body**: Flattened fields ```json { "value.alerts": false, "value.max_temperature": 27 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/groups/{group}/properties/{property}` - **Request:** DELETE /v1/users/{user}/groups/{group}/properties/{property} - **Operation:** DeleteGroupProperty - **Operation ID:** `Group_DeleteProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/groups/{group}/properties/{property}/clone` - **Request:** GET /v1/users/{user}/groups/{group}/properties/{property}/clone - **Operation:** CloneGroupPropertyConfig - **Operation ID:** `Group_ClonePropertyConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/groups/{group}/properties/{property}/clone` - **Request:** POST /v1/users/{user}/groups/{group}/properties/{property}/clone - **Operation:** CloneGroupProperty - **Operation ID:** `Group_CloneProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `group` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/groups/YOUR_GROUP/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "property": "copy_of_property" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "property": "line_2_property" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/storages.md # File Storages > REST API reference for File Storages: create file storages and upload, read, rename and delete their files. 19 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/storages` - **Request:** GET /v1/users/{user}/storages - **Operation:** ListStorages - **Operation ID:** `Storage_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/storages' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090742, "description": "Storages", "index": "index.html", "modified": 1792263090742, "name": "File Storage", "public": true, "storage": "file_storage" }, { "created": 1792263090742, "description": "Manuals and reports; only readable with a token", "modified": 1792263090742, "name": "Documents", "public": false, "storage": "documents" } ] ``` ## `POST /v1/users/{user}/storages` - **Request:** POST /v1/users/{user}/storages - **Operation:** CreateStorage - **Operation ID:** `Storage_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `index` | string | no | Maximum length: 255 | | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `public` | boolean | no | | | | `storage` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `terminal_image` | string | no | Maximum length: 255
Pattern: `^[a-zA-Z0-9][a-zA-Z0-9._/-]*:[a-zA-Z0-9._-]+$` | | **Example request**: Create Storage ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/storages' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Storages", "index": "index.html", "name": "File Storage", "public": true, "storage": "file_storage" }' ``` **Example body**: Private storage ```json { "description": "Manuals and reports; only readable with a token", "name": "Documents", "public": false, "storage": "documents" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/storages/{storage}` - **Request:** GET /v1/users/{user}/storages/{storage} - **Operation:** ReadStorageConfig - **Operation ID:** `Storage_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Create Storage) ```json { "created": 1792263090742, "description": "Storages", "index": "index.html", "modified": 1792263090742, "name": "File Storage", "public": true, "storage": "file_storage" } ``` **Response example** (200, Private storage) ```json { "created": 1792263090742, "description": "Manuals and reports; only readable with a token", "modified": 1792263090742, "name": "Documents", "public": false, "storage": "documents" } ``` ## `PUT /v1/users/{user}/storages/{storage}` - **Request:** PUT /v1/users/{user}/storages/{storage} - **Operation:** UpdateStorage - **Operation ID:** `Storage_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `index` | string | no | Maximum length: 255 | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `public` | boolean | no | | | | `terminal_image` | string | no | Maximum length: 255
Pattern: `^[a-zA-Z0-9][a-zA-Z0-9._/-]*:[a-zA-Z0-9._-]+$` | | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Storages", "index": "index.html", "name": "File Storage", "public": true, "storage": "file_storage" }' ``` **Example body**: Update 'description' ```json { "description": "Storages" } ``` **Example body**: Update 'index' ```json { "index": "index.html" } ``` **Example body**: Update 'name' ```json { "name": "File Storage" } ``` **Example body**: Update 'public' ```json { "public": true } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/storages/{storage}` - **Request:** DELETE /v1/users/{user}/storages/{storage} - **Operation:** DeleteStorage - **Operation ID:** `Storage_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/storages/{storage}/clone` - **Request:** GET /v1/users/{user}/storages/{storage}/clone - **Operation:** CloneStorageConfig - **Operation ID:** `Storage_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/storages/{storage}/clone` - **Request:** POST /v1/users/{user}/storages/{storage}/clone - **Operation:** CloneStorage - **Operation ID:** `Storage_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `storage` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "storage": "copy_of_storage" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "storage": "line_2_storage" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/storages/{storage}/files` - **Request:** GET /v1/users/{user}/storages/{storage}/files - **Operation:** ListStorageFiles - **Operation ID:** `Storage_ListFiles` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/files' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/storages/{storage}/files/{file}` - **Request:** GET /v1/users/{user}/storages/{storage}/files/{file} - **Operation:** ReadStorageFiles - **Operation ID:** `Storage_ReadFiles` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/files/YOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/storages/{storage}/files/{file}` - **Request:** PUT /v1/users/{user}/storages/{storage}/files/{file} - **Operation:** UpdateStorageFiles - **Operation ID:** `Storage_UpdateFiles` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` Creates or overwrites the file with the raw request body (any content type); folders on the path are created. For large or binary files prefer PUT /v2/users/{user}/storages/{storage}/files/{path}, which streams the upload. **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `file` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/files/YOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/storages/{storage}/files/{file}` - **Request:** DELETE /v1/users/{user}/storages/{storage}/files/{file} - **Operation:** DeleteStorageFiles - **Operation ID:** `Storage_DeleteFiles` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/files/YOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/storages/{storage}/files{path}` - **Request:** POST /v1/users/{user}/storages/{storage}/files{path} - **Operation:** CreateStorageFiles - **Operation ID:** `Storage_CreateFiles.+)?)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` Uploads files into the folder of the path: multipart/form-data with one or more files, or JSON {"files": \[names\], "folders": \[names\]} to create empty files and folders. **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `path` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/filesYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/users/{user}/storages/{storage}/files{path}` - **Request:** PATCH /v1/users/{user}/storages/{storage}/files{path} - **Operation:** RenameStorageFiles - **Operation ID:** `Storage_RenameFiles.+)?)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `path` | path | string | yes | | **Request body** (`application/json`, required) Moves or renames the file or folder of the URL to 'path', inside the same storage. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `path` | string | yes | Maximum length: 255 | | **Example request**: Move into a folder ```bash curl -X PATCH 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/filesYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "path": "archive/2025/report.csv" }' ``` **Example body**: Rename a file ```json { "path": "docs/manual-v2.pdf" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/storages/{storage}/projects` - **Request:** PUT /v1/users/{user}/storages/{storage}/projects - **Operation:** UpdateStorageProjects - **Operation ID:** `Storage_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/storages/YOUR_STORAGE/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v2/users/{user}/storages/{storage}/files{file}` - **Request:** GET /v2/users/{user}/storages/{storage}/files{file} - **Operation:** ReadStorageFiles - **Operation ID:** `Storage_ReadFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v2/users/YOUR_USER/storages/YOUR_STORAGE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v2/users/{user}/storages/{storage}/files{file}` - **Request:** PUT /v2/users/{user}/storages/{storage}/files{file} - **Operation:** UpdateStorageFiles - **Operation ID:** `Storage_UpdateFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` Streams the raw request body (any content type, e.g. application/octet-stream) into the file; folders are created. A path ending in / creates a folder (empty body). ?overwrite=false fails if it exists. **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `file` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v2/users/YOUR_USER/storages/YOUR_STORAGE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v2/users/{user}/storages/{storage}/files{file}` - **Request:** PATCH /v2/users/{user}/storages/{storage}/files{file} - **Operation:** RenameStorageFiles - **Operation ID:** `Storage_RenameFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `file` | path | string | yes | | **Request body** (`application/json`, required) Moves or renames the file or folder of the URL to 'path', inside the same storage. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `path` | string | yes | | | **Example request**: Rename a file ```bash curl -X PATCH 'https://YOUR_SERVER/v2/users/YOUR_USER/storages/YOUR_STORAGE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "path": "/docs/manual-v2.pdf" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v2/users/{user}/storages/{storage}/files{file}` - **Request:** DELETE /v2/users/{user}/storages/{storage}/files{file} - **Operation:** DeleteStorageFiles - **Operation ID:** `Storage_DeleteFilesFiles(?.*$)` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v2/users/YOUR_USER/storages/YOUR_STORAGE/filesYOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v2/users/{user}/storages/{storage}/terminal` - **Request:** GET /v2/users/{user}/storages/{storage}/terminal - **Operation:** AccessStorageTerminal - **Operation ID:** `Storage_AccessTerminal` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `storage` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v2/users/YOUR_USER/storages/YOUR_STORAGE/terminal' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/products.md # Products > REST API reference for Products: manage products and their profile, properties, firmwares and services. 38 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/products` - **Request:** GET /v1/users/{user}/products - **Operation:** ListProducts - **Operation ID:** `Product_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/products` - **Request:** POST /v1/users/{user}/products - **Operation:** CreateProduct - **Operation ID:** `Product_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | Configuration schema for a product | | `config.fields` | array of object | no | | | | `config.fields[].icon` | object | no | | Icon schema for a product | | `config.fields[].icon.background` | string | no | | | | `config.fields[].icon.color` | string | no | | | | `config.fields[].icon.size` | number | no | | | | `config.fields[].icon.source` | string | yes | | | | `config.fields[].icon.type` | string | yes | One of: `fa`, `svg` | Icon type: font-awesome or svg | | `config.fields[].name` | string | yes | Length: 1 to 255 | | | `config.fields[].primary` | boolean | no | | | | `config.fields[].type` | string | no | One of: `string`, `number`, `date`, `time`, `datetime`, `timeago` | | | `config.fields[].value` | string | yes | Length: 1 to 255 | | | `config.icons` | array of object | no | | | | `config.icons[].conditions` | array of object | no | | | | `config.icons[].conditions[]` | object | no | | Variant 1: | | `config.icons[].conditions[].comparison` | string | no | One of: `above`, `below`, `equal`, `not_equal`, `inside`, `outside`, `present`, `absent` | Variant 1: Comparison expressions for conditional evaluation. Every comparison but present / absent is false on a missing field. | | `config.icons[].conditions[].field` | string | no | Length: 1 to 255 | Variant 1: | | `config.icons[].conditions[].operator` | string | no | One of: `and`, `or` | Variant 1: Operator expressions for conditional evaluation | | `config.icons[].conditions[].tag` | string | no | | Variant 1: | | `config.icons[].conditions[].value` | string | yes | Length: 1 to 255 | Variant 1: | | `config.icons[].conditions[]` | object | no | | Variant 2: | | `config.icons[].conditions[].comparison` | string | no | One of: `above`, `below`, `equal`, `not_equal`, `inside`, `outside`, `present`, `absent` | Variant 2: Comparison expressions for conditional evaluation. Every comparison but present / absent is false on a missing field. | | `config.icons[].conditions[].field` | string | no | Length: 1 to 255 | Variant 2: | | `config.icons[].conditions[].max` | string | yes | Length: 1 to 255 | Variant 2: | | `config.icons[].conditions[].min` | string | yes | Length: 1 to 255 | Variant 2: | | `config.icons[].conditions[].operator` | string | no | One of: `and`, `or` | Variant 2: Operator expressions for conditional evaluation | | `config.icons[].conditions[].tag` | string | no | | Variant 2: | | `config.icons[].icon` | object | yes | | Icon schema for a product | | `config.icons[].icon.background` | string | no | | | | `config.icons[].icon.color` | string | no | | | | `config.icons[].icon.size` | number | no | | | | `config.icons[].icon.source` | string | yes | | | | `config.icons[].icon.type` | string | yes | One of: `fa`, `svg` | Icon type: font-awesome or svg | | `config.type` | string | no | One of: ``, `thinremote` | Product type that determines the device status view | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `product` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `profile` | object | no | | | | `services` | object | no | | | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/products' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "product": "", "name": "" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}` - **Request:** GET /v1/users/{user}/products/{product} - **Operation:** ReadProductConfig - **Operation ID:** `Product_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}` - **Request:** PUT /v1/users/{user}/products/{product} - **Operation:** UpdateProduct - **Operation ID:** `Product_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | Configuration schema for a product | | `config.fields` | array of object | no | | | | `config.fields[].icon` | object | no | | Icon schema for a product | | `config.fields[].icon.background` | string | no | | | | `config.fields[].icon.color` | string | no | | | | `config.fields[].icon.size` | number | no | | | | `config.fields[].icon.source` | string | yes | | | | `config.fields[].icon.type` | string | yes | One of: `fa`, `svg` | Icon type: font-awesome or svg | | `config.fields[].name` | string | yes | Length: 1 to 255 | | | `config.fields[].primary` | boolean | no | | | | `config.fields[].type` | string | no | One of: `string`, `number`, `date`, `time`, `datetime`, `timeago` | | | `config.fields[].value` | string | yes | Length: 1 to 255 | | | `config.icons` | array of object | no | | | | `config.icons[].conditions` | array of object | no | | | | `config.icons[].conditions[]` | object | no | | Variant 1: | | `config.icons[].conditions[].comparison` | string | no | One of: `above`, `below`, `equal`, `not_equal`, `inside`, `outside`, `present`, `absent` | Variant 1: Comparison expressions for conditional evaluation. Every comparison but present / absent is false on a missing field. | | `config.icons[].conditions[].field` | string | no | Length: 1 to 255 | Variant 1: | | `config.icons[].conditions[].operator` | string | no | One of: `and`, `or` | Variant 1: Operator expressions for conditional evaluation | | `config.icons[].conditions[].tag` | string | no | | Variant 1: | | `config.icons[].conditions[].value` | string | yes | Length: 1 to 255 | Variant 1: | | `config.icons[].conditions[]` | object | no | | Variant 2: | | `config.icons[].conditions[].comparison` | string | no | One of: `above`, `below`, `equal`, `not_equal`, `inside`, `outside`, `present`, `absent` | Variant 2: Comparison expressions for conditional evaluation. Every comparison but present / absent is false on a missing field. | | `config.icons[].conditions[].field` | string | no | Length: 1 to 255 | Variant 2: | | `config.icons[].conditions[].max` | string | yes | Length: 1 to 255 | Variant 2: | | `config.icons[].conditions[].min` | string | yes | Length: 1 to 255 | Variant 2: | | `config.icons[].conditions[].operator` | string | no | One of: `and`, `or` | Variant 2: Operator expressions for conditional evaluation | | `config.icons[].conditions[].tag` | string | no | | Variant 2: | | `config.icons[].icon` | object | yes | | Icon schema for a product | | `config.icons[].icon.background` | string | no | | | | `config.icons[].icon.color` | string | no | | | | `config.icons[].icon.size` | number | no | | | | `config.icons[].icon.source` | string | yes | | | | `config.icons[].icon.type` | string | yes | One of: `fa`, `svg` | Icon type: font-awesome or svg | | `config.type` | string | no | One of: ``, `thinremote` | Product type that determines the device status view | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/products/{product}` - **Request:** DELETE /v1/users/{user}/products/{product} - **Operation:** DeleteProduct - **Operation ID:** `Product_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/clone` - **Request:** GET /v1/users/{user}/products/{product}/clone - **Operation:** CloneProductConfig - **Operation ID:** `Product_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/products/{product}/clone` - **Request:** POST /v1/users/{user}/products/{product}/clone - **Operation:** CloneProduct - **Operation ID:** `Product_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `product` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "product": "copy_of_product" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "product": "line_2_product" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/export` - **Request:** GET /v1/users/{user}/products/{product}/export - **Operation:** ExportProduct - **Operation ID:** `Product_Export` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/export' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/firmwares` - **Request:** GET /v1/users/{user}/products/{product}/firmwares - **Operation:** ListProductFirmwares - **Operation ID:** `Product_ListFirmwares` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/products/{product}/firmwares` - **Request:** POST /v1/users/{user}/products/{product}/firmwares - **Operation:** CreateProductFirmware - **Operation ID:** `Product_CreateFirmware` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `firmware` | string | yes | Pattern: `^[a-zA-Z0-9_]{1,25}$` | | | `name` | string | no | Maximum length: 255 | | | `version` | string | yes | Pattern: `(?:0\|[1-9]\d*)\.(?:0\|[1-9]\d*)\.(?:0\|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?` | | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "firmware": "", "version": "" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}` - **Request:** GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version} - **Operation:** ReadProductFirmwareConfig - **Operation ID:** `Product_ReadFirmwareConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `firmware` | path | string | yes | | | `firmware_version` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares/YOUR_FIRMWARE/YOUR_FIRMWARE_VERSION' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}` - **Request:** PUT /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version} - **Operation:** UpdateProductFirmware - **Operation ID:** `Product_UpdateFirmware` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `firmware` | path | string | yes | | | `firmware_version` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares/YOUR_FIRMWARE/YOUR_FIRMWARE_VERSION' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}` - **Request:** DELETE /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version} - **Operation:** DeleteProductFirmware - **Operation ID:** `Product_DeleteFirmware` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `firmware` | path | string | yes | | | `firmware_version` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares/YOUR_FIRMWARE/YOUR_FIRMWARE_VERSION' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}/flash` - **Request:** GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}/flash - **Operation:** FlashProductFirmware - **Operation ID:** `Product_FlashFirmware` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `firmware` | path | string | yes | | | `firmware_version` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares/YOUR_FIRMWARE/YOUR_FIRMWARE_VERSION/flash' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}/stream` - **Request:** GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}/stream - **Operation:** UpdateProductFirmware - **Operation ID:** `Product_UpdateFirmwareStream` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `firmware` | path | string | yes | | | `firmware_version` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares/YOUR_FIRMWARE/YOUR_FIRMWARE_VERSION/stream' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}/toolchain` - **Request:** GET /v1/users/{user}/products/{product}/firmwares/{firmware}/{firmware_version}/toolchain - **Operation:** UpdateProductFirmware - **Operation ID:** `Product_UpdateFirmwareToolchain` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `firmware` | path | string | yes | | | `firmware_version` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/firmwares/YOUR_FIRMWARE/YOUR_FIRMWARE_VERSION/toolchain' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/profile/code` - **Request:** GET /v1/users/{user}/products/{product}/profile/code - **Operation:** ReadProductProfile - **Operation ID:** `Product_ReadProfileCode` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/code' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}/profile/code` - **Request:** PUT /v1/users/{user}/products/{product}/profile/code - **Operation:** UpdateProductProfile - **Operation ID:** `Product_UpdateProfileCode` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | object or null | no | | JavaScript run by the server for this product: functions referenced by payload_function, device_id_resolver and function targets. Inline in `code`, or the files of a file storage in `storage` (takes precedence): its `index.js`, or `/index.js` with `path`, so one storage can hold a whole application (dashboard, product code…). | | `(body).code` | string or null | no | | | | `(body).path` | string or null | no | | Folder of the storage with the code (its index.js and node_modules), relative to the storage root, e.g. "code/meter". Empty: the storage root. | | `(body).storage` | string or null | no | | File storage id with the product code. | **Example request**: Code from a file storage ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/code' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "storage": "meter_product_code" }' ``` **Example body**: Code from a folder of an application storage ```json { "path": "code/meter", "storage": "fleet_app" } ``` **Example body**: Inline code ```json { "code": "function resolveDevice(payload) {\n // device id from the serial sent by the caller\n return 'meter_' + payload.serial;\n}\n\nfunction toCelsius(payload) {\n return { temperature: (payload.temperature_f - 32) * 5 / 9 };\n}\n" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/profile/console` - **Request:** GET /v1/users/{user}/products/{product}/profile/console - **Operation:** ReadProductProfile - **Operation ID:** `Product_ReadProfileConsole` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/console' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/profile/{category}` - **Request:** GET /v1/users/{user}/products/{product}/profile/{category} - **Operation:** ReadProductProfile - **Operation ID:** `Product_ReadProfile` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `category` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/YOUR_CATEGORY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}/profile/{category}` - **Request:** PUT /v1/users/{user}/products/{product}/profile/{category} - **Operation:** UpdateProductProfile - **Operation ID:** `Product_UpdateProfile` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` Replace every entry of a profile category. Entries missing from the body are removed; to change one entry use PUT .../profile/{category}/{resource}. **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `category` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | object or null | no | | Every entry of a category, by id. Replaces the whole category: entries missing from the body are removed (for properties, also the default property on the devices). | | `(body).*` | object or null | no | | One entry of a product profile category; its id is the {resource} path parameter (or the key in a category body). Entries only run when `enabled` is true. Fields by category. properties: `data` fills the device property of the same id (optional), `default.value` (any value but null: {}, \[\], "", 0 and false count) / `form` / `perm` make it a property of the product, which every device of the product inherits (source: product) until it sets its own. buckets: `data` writes into the bucket with the entry id, created on the first write, outside any project (devices read it through GET /devices/{device}/buckets/{bucket}/data); an id containing `{{device}}` gives one bucket per device (such ids only fit the whole-category PUT, as the {resource} path parameter cannot hold braces), otherwise one shared bucket tagged with device (and group); `tags`, `backend`, `retention`. flows: `data` → `sink`, `split_data` sends each array element separately. api: resources added to every device of the product: `request.data` (target), `response.data` (response), `device_id_resolver` (function of the product code that returns the device id from the payload, needed to call the resource through POST /products/{product}/resources/{resource}), `handle_connectivity` (validate / auto-provision the device on calls; default true for resource_stream targets). autoprovisions: `config`. endpoints: deprecated, use flows with an endpoint_call sink. | | `(body).*.backend` | any | no | | buckets: storage backend of the bucket when it is created (mongodb, influxdb, dynamodb; default the server's). | | `(body).*.config` | object or null | no | | autoprovisions: when a device that does not exist authenticates or calls a resource and its id matches `pattern`, it is created in this product (HTTP, or Subdevice for MQTT), with asset `type` / `group` and `project` if given. | | `(body).*.config.group` | string or null | no | | Asset group for the new devices. | | `(body).*.config.mode` | string or null | no | | pattern | | `(body).*.config.pattern` | string or null | no | | Regular expression on the device id, e.g. ^meter\_\[0-9\]{6}$. | | `(body).*.config.project` | string or null | no | | Project for the new devices. | | `(body).*.config.type` | string or null | no | | Asset type for the new devices. | | `(body).*.data` | object or null or array of object or null or null or null | no | | Data source, or an array of sources. | | `(body).*.data` | object or null | no | | Variant 1: Where a properties / buckets / flows entry gets its data. `source` selects the fields used: topic → `topic` (MQTT topic, + and # wildcards; `{{name}}` placeholders match one level, and in buckets each one becomes a tag of the record, with `{{field}}` naming the record field so several topics merge into one record); resource → `resource`, `update` (interval \| events) with `interval` + `magnitude`; resource_stream → `resource_stream` (the device pushes it); product_stream → `product_stream`; event → `event` with optional `filter`. Only devices of this product are listened to. The received data can then be transformed with `payload_type` / `payload` and `payload_function`. | | `(body).*.data.event` | string or null | no | | Variant 1: source event: server event name, e.g. device_state_change, device_property_update, bucket_write. | | `(body).*.data.filter` | object or null | no | | Variant 1: source event: extra filters (event field: value or regex). The product filter is always added. | | `(body).*.data.interval` | number or string or null | no | | Variant 1: source resource with update interval: number of `magnitude` units between reads, e.g. 60. | | `(body).*.data.magnitude` | string or null | no | | Variant 1: second (default) \| minute \| hour \| day \| week \| month \| year | | `(body).*.data.patch` | boolean or null | no | | Variant 1: properties only: merge the value into the device property instead of replacing it. | | `(body).*.data.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).*.data.payload_function` | string or null | no | | Variant 1: Name of a function of the product code that receives the payload and returns the value to use. | | `(body).*.data.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).*.data.product_stream` | string or null | no | | Variant 1: source product_stream: stream published by an API resource or flow of this product (target product_stream). | | `(body).*.data.resource` | string or null | no | | Variant 1: source resource: device resource read by the server. | | `(body).*.data.resource_stream` | string or null | no | | Variant 1: source resource_stream: device resource the device streams on its own. | | `(body).*.data.source` | string or null | no | | Variant 1: topic \| resource \| resource_stream \| product_stream \| event | | `(body).*.data.topic` | string or null | no | | Variant 1: source topic: MQTT topic of the device messages, e.g. devices/`{{device}}`/telemetry. | | `(body).*.data.update` | string or null | no | | Variant 1: source resource: interval (default, read every `interval` `magnitude`) \| events (the device streams it when it changes). | | `(body).*.data` | array of object or null or null | no | | Variant 2: | | `(body).*.data[].event` | string or null | no | | Variant 2: source event: server event name, e.g. device_state_change, device_property_update, bucket_write. | | `(body).*.data[].filter` | object or null | no | | Variant 2: source event: extra filters (event field: value or regex). The product filter is always added. | | `(body).*.data[].interval` | number or string or null | no | | Variant 2: source resource with update interval: number of `magnitude` units between reads, e.g. 60. | | `(body).*.data[].magnitude` | string or null | no | | Variant 2: second (default) \| minute \| hour \| day \| week \| month \| year | | `(body).*.data[].patch` | boolean or null | no | | Variant 2: properties only: merge the value into the device property instead of replacing it. | | `(body).*.data[].payload` | any | no | | Variant 2: Template string (payload_type template_payload) or JSON value. | | `(body).*.data[].payload_function` | string or null | no | | Variant 2: Name of a function of the product code that receives the payload and returns the value to use. | | `(body).*.data[].payload_type` | string or null or null | no | | Variant 2: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).*.data[].product_stream` | string or null | no | | Variant 2: source product_stream: stream published by an API resource or flow of this product (target product_stream). | | `(body).*.data[].resource` | string or null | no | | Variant 2: source resource: device resource read by the server. | | `(body).*.data[].resource_stream` | string or null | no | | Variant 2: source resource_stream: device resource the device streams on its own. | | `(body).*.data[].source` | string or null | no | | Variant 2: topic \| resource \| resource_stream \| product_stream \| event | | `(body).*.data[].topic` | string or null | no | | Variant 2: source topic: MQTT topic of the device messages, e.g. devices/`{{device}}`/telemetry. | | `(body).*.data[].update` | string or null | no | | Variant 2: source resource: interval (default, read every `interval` `magnitude`) \| events (the device streams it when it changes). | | `(body).*.data` | null | no | | Variant 3: | | `(body).*.default` | object or null | no | | properties: value of the product property that the devices inherit until they set their own, in `value`. Any value but null counts, {} and \[\] included. | | `(body).*.default.value` | any | no | | | | `(body).*.description` | string or null | no | | | | `(body).*.device_id_resolver` | string or null | no | | | | `(body).*.enabled` | boolean or null | no | | | | `(body).*.form` | object or null | no | | properties: form used by the console to edit the value (`fields`). | | `(body).*.handle_connectivity` | boolean or null | no | | | | `(body).*.name` | string or null | no | | | | `(body).*.perm` | object or null | no | | properties: console permissions, as the roles that do not see the property (hidden) or cannot edit it (readOnly); as in device properties. | | `(body).*.perm.hidden` | array of string or null | no | Unique items | | | `(body).*.perm.readOnly` | array of string or null | no | Unique items | | | `(body).*.request` | object or null | no | | | | `(body).*.request.data` | object or null or null | no | | | | `(body).*.request.data` | object or null | no | | Variant 1: What an API resource request (`request.data`) or a flow (`sink`) does. `target` selects the fields used: topic → `topic` (+ `retain`): publish to the device over MQTT; resource → `resource`: call a device resource (IOTMP devices); resource_stream → `resource_stream`; property → `property`: set a device property; function → `function`: run a function of the product code; endpoint_call → `endpoint`: call an endpoint; plugin_endpoint → `plugin` + `path`; product_stream → `product_stream` (and optional `product`): publish to a product stream; none. The body sent is built from `payload` / `payload_type` / `payload_function`. A target needs a device: the one in the URL, the source device, or the one returned by the entry's `device_id_resolver`. | | `(body).*.request.data.endpoint` | string or null | no | | Variant 1: target endpoint_call: endpoint id (may use placeholders). | | `(body).*.request.data.function` | string or null | no | | Variant 1: | | `(body).*.request.data.path` | string or null | no | | Variant 1: target plugin_endpoint: path inside the plugin, e.g. /api/process. | | `(body).*.request.data.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).*.request.data.payload_function` | string or null | no | | Variant 1: | | `(body).*.request.data.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).*.request.data.plugin` | string or null | no | | Variant 1: | | `(body).*.request.data.product` | string or null | no | | Variant 1: | | `(body).*.request.data.product_stream` | string or null | no | | Variant 1: | | `(body).*.request.data.property` | string or null | no | | Variant 1: | | `(body).*.request.data.resource` | string or null | no | | Variant 1: | | `(body).*.request.data.resource_stream` | string or null | no | | Variant 1: | | `(body).*.request.data.retain` | boolean or null | no | | Variant 1: target topic: publish as a retained MQTT message. | | `(body).*.request.data.target` | string or null | no | | Variant 1: topic \| resource \| resource_stream \| property \| function \| endpoint_call \| plugin_endpoint \| product_stream \| none | | `(body).*.request.data.topic` | string or null | no | | Variant 1: | | `(body).*.request.data` | null | no | | Variant 2: | | `(body).*.response` | object or null | no | | | | `(body).*.response.data` | object or null or null | no | | | | `(body).*.response.data` | object or null | no | | Variant 1: What an API resource answers (`response.data`). `source` selects it: request_response: what the request target returned; topic → `topic`: wait for a message on that MQTT topic (from the same device, or any with `publish_source`: any); property → `property`; resource → `resource`; function → `function`; endpoint_call → `endpoint`; none. The answer can be shaped with `payload` / `payload_type` / `payload_function`. | | `(body).*.response.data.endpoint` | string or null | no | | Variant 1: | | `(body).*.response.data.function` | string or null | no | | Variant 1: | | `(body).*.response.data.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).*.response.data.payload_function` | string or null | no | | Variant 1: | | `(body).*.response.data.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).*.response.data.property` | string or null | no | | Variant 1: | | `(body).*.response.data.publish_source` | string or null | no | | Variant 1: source topic: empty (only the same device) or any. | | `(body).*.response.data.resource` | string or null | no | | Variant 1: | | `(body).*.response.data.source` | string or null | no | | Variant 1: request_response \| topic \| property \| resource \| function \| endpoint_call \| none | | `(body).*.response.data.topic` | string or null | no | | Variant 1: | | `(body).*.response.data` | null | no | | Variant 2: | | `(body).*.retention` | object or null | no | | buckets: retention of the bucket when it is created. | | `(body).*.retention.period` | integer or string or null | no | | 0 = unlimited. | | `(body).*.retention.unit` | string or null | no | | hours \| days \| weeks \| months \| years | | `(body).*.sink` | object or null or null | no | | | | `(body).*.sink` | object or null | no | | Variant 1: What an API resource request (`request.data`) or a flow (`sink`) does. `target` selects the fields used: topic → `topic` (+ `retain`): publish to the device over MQTT; resource → `resource`: call a device resource (IOTMP devices); resource_stream → `resource_stream`; property → `property`: set a device property; function → `function`: run a function of the product code; endpoint_call → `endpoint`: call an endpoint; plugin_endpoint → `plugin` + `path`; product_stream → `product_stream` (and optional `product`): publish to a product stream; none. The body sent is built from `payload` / `payload_type` / `payload_function`. A target needs a device: the one in the URL, the source device, or the one returned by the entry's `device_id_resolver`. | | `(body).*.sink.endpoint` | string or null | no | | Variant 1: target endpoint_call: endpoint id (may use placeholders). | | `(body).*.sink.function` | string or null | no | | Variant 1: | | `(body).*.sink.path` | string or null | no | | Variant 1: target plugin_endpoint: path inside the plugin, e.g. /api/process. | | `(body).*.sink.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).*.sink.payload_function` | string or null | no | | Variant 1: | | `(body).*.sink.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).*.sink.plugin` | string or null | no | | Variant 1: | | `(body).*.sink.product` | string or null | no | | Variant 1: | | `(body).*.sink.product_stream` | string or null | no | | Variant 1: | | `(body).*.sink.property` | string or null | no | | Variant 1: | | `(body).*.sink.resource` | string or null | no | | Variant 1: | | `(body).*.sink.resource_stream` | string or null | no | | Variant 1: | | `(body).*.sink.retain` | boolean or null | no | | Variant 1: target topic: publish as a retained MQTT message. | | `(body).*.sink.target` | string or null | no | | Variant 1: topic \| resource \| resource_stream \| property \| function \| endpoint_call \| plugin_endpoint \| product_stream \| none | | `(body).*.sink.topic` | string or null | no | | Variant 1: | | `(body).*.sink` | null | no | | Variant 2: | | `(body).*.split_data` | boolean or null | no | | | | `(body).*.tags` | array or null | no | | buckets: record fields stored as tags (filterable), e.g. \["line"\]. | | `(body).*.type` | string or null | no | | properties: "" or configuration. | **Example request**: All buckets of the product, one of them per device (PUT …/profile/buckets) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/YOUR_CATEGORY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "telemetry": { "data": { "interval": 60, "magnitude": "second", "payload_type": "source_payload", "resource": "telemetry", "source": "resource", "update": "interval" }, "description": "One shared bucket, tagged with each device", "enabled": true, "name": "Telemetry", "retention": { "period": 6, "unit": "months" } }, "{{device}}_readings": { "data": { "payload_type": "source_payload", "source": "topic", "topic": "plant/{{line}}/{{device}}/{{field}}" }, "enabled": true, "name": "Readings", "tags": [ "line" ] } }' ``` **Example body**: Remove every flow (PUT …/profile/flows) ```json {} ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/profile/{category}/{resource}` - **Request:** GET /v1/users/{user}/products/{product}/profile/{category}/{resource} - **Operation:** ReadProductProfile - **Operation ID:** `Product_ReadProductProfileResource` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `category` | path | string | yes | | | `resource` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/YOUR_CATEGORY/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}/profile/{category}/{resource}` - **Request:** PUT /v1/users/{user}/products/{product}/profile/{category}/{resource} - **Operation:** UpdateProductProfile - **Operation ID:** `Product_UpdateProductProfileResource` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` Create or replace one entry of a profile category (properties, buckets, flows, api, autoprovisions; endpoints is deprecated). The product is reinitialized, so the change applies at once to its devices. **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `category` | path | string | yes | | | `resource` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | object or null | no | | One entry of a product profile category; its id is the {resource} path parameter (or the key in a category body). Entries only run when `enabled` is true. Fields by category. properties: `data` fills the device property of the same id (optional), `default.value` (any value but null: {}, \[\], "", 0 and false count) / `form` / `perm` make it a property of the product, which every device of the product inherits (source: product) until it sets its own. buckets: `data` writes into the bucket with the entry id, created on the first write, outside any project (devices read it through GET /devices/{device}/buckets/{bucket}/data); an id containing `{{device}}` gives one bucket per device (such ids only fit the whole-category PUT, as the {resource} path parameter cannot hold braces), otherwise one shared bucket tagged with device (and group); `tags`, `backend`, `retention`. flows: `data` → `sink`, `split_data` sends each array element separately. api: resources added to every device of the product: `request.data` (target), `response.data` (response), `device_id_resolver` (function of the product code that returns the device id from the payload, needed to call the resource through POST /products/{product}/resources/{resource}), `handle_connectivity` (validate / auto-provision the device on calls; default true for resource_stream targets). autoprovisions: `config`. endpoints: deprecated, use flows with an endpoint_call sink. | | `(body).backend` | any | no | | buckets: storage backend of the bucket when it is created (mongodb, influxdb, dynamodb; default the server's). | | `(body).config` | object or null | no | | autoprovisions: when a device that does not exist authenticates or calls a resource and its id matches `pattern`, it is created in this product (HTTP, or Subdevice for MQTT), with asset `type` / `group` and `project` if given. | | `(body).config.group` | string or null | no | | Asset group for the new devices. | | `(body).config.mode` | string or null | no | | pattern | | `(body).config.pattern` | string or null | no | | Regular expression on the device id, e.g. ^meter\_\[0-9\]{6}$. | | `(body).config.project` | string or null | no | | Project for the new devices. | | `(body).config.type` | string or null | no | | Asset type for the new devices. | | `(body).data` | object or null or array of object or null or null or null | no | | Data source, or an array of sources. | | `(body).data` | object or null | no | | Variant 1: Where a properties / buckets / flows entry gets its data. `source` selects the fields used: topic → `topic` (MQTT topic, + and # wildcards; `{{name}}` placeholders match one level, and in buckets each one becomes a tag of the record, with `{{field}}` naming the record field so several topics merge into one record); resource → `resource`, `update` (interval \| events) with `interval` + `magnitude`; resource_stream → `resource_stream` (the device pushes it); product_stream → `product_stream`; event → `event` with optional `filter`. Only devices of this product are listened to. The received data can then be transformed with `payload_type` / `payload` and `payload_function`. | | `(body).data.event` | string or null | no | | Variant 1: source event: server event name, e.g. device_state_change, device_property_update, bucket_write. | | `(body).data.filter` | object or null | no | | Variant 1: source event: extra filters (event field: value or regex). The product filter is always added. | | `(body).data.interval` | number or string or null | no | | Variant 1: source resource with update interval: number of `magnitude` units between reads, e.g. 60. | | `(body).data.magnitude` | string or null | no | | Variant 1: second (default) \| minute \| hour \| day \| week \| month \| year | | `(body).data.patch` | boolean or null | no | | Variant 1: properties only: merge the value into the device property instead of replacing it. | | `(body).data.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).data.payload_function` | string or null | no | | Variant 1: Name of a function of the product code that receives the payload and returns the value to use. | | `(body).data.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).data.product_stream` | string or null | no | | Variant 1: source product_stream: stream published by an API resource or flow of this product (target product_stream). | | `(body).data.resource` | string or null | no | | Variant 1: source resource: device resource read by the server. | | `(body).data.resource_stream` | string or null | no | | Variant 1: source resource_stream: device resource the device streams on its own. | | `(body).data.source` | string or null | no | | Variant 1: topic \| resource \| resource_stream \| product_stream \| event | | `(body).data.topic` | string or null | no | | Variant 1: source topic: MQTT topic of the device messages, e.g. devices/`{{device}}`/telemetry. | | `(body).data.update` | string or null | no | | Variant 1: source resource: interval (default, read every `interval` `magnitude`) \| events (the device streams it when it changes). | | `(body).data` | array of object or null or null | no | | Variant 2: | | `(body).data[].event` | string or null | no | | Variant 2: source event: server event name, e.g. device_state_change, device_property_update, bucket_write. | | `(body).data[].filter` | object or null | no | | Variant 2: source event: extra filters (event field: value or regex). The product filter is always added. | | `(body).data[].interval` | number or string or null | no | | Variant 2: source resource with update interval: number of `magnitude` units between reads, e.g. 60. | | `(body).data[].magnitude` | string or null | no | | Variant 2: second (default) \| minute \| hour \| day \| week \| month \| year | | `(body).data[].patch` | boolean or null | no | | Variant 2: properties only: merge the value into the device property instead of replacing it. | | `(body).data[].payload` | any | no | | Variant 2: Template string (payload_type template_payload) or JSON value. | | `(body).data[].payload_function` | string or null | no | | Variant 2: Name of a function of the product code that receives the payload and returns the value to use. | | `(body).data[].payload_type` | string or null or null | no | | Variant 2: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).data[].product_stream` | string or null | no | | Variant 2: source product_stream: stream published by an API resource or flow of this product (target product_stream). | | `(body).data[].resource` | string or null | no | | Variant 2: source resource: device resource read by the server. | | `(body).data[].resource_stream` | string or null | no | | Variant 2: source resource_stream: device resource the device streams on its own. | | `(body).data[].source` | string or null | no | | Variant 2: topic \| resource \| resource_stream \| product_stream \| event | | `(body).data[].topic` | string or null | no | | Variant 2: source topic: MQTT topic of the device messages, e.g. devices/`{{device}}`/telemetry. | | `(body).data[].update` | string or null | no | | Variant 2: source resource: interval (default, read every `interval` `magnitude`) \| events (the device streams it when it changes). | | `(body).data` | null | no | | Variant 3: | | `(body).default` | object or null | no | | properties: value of the product property that the devices inherit until they set their own, in `value`. Any value but null counts, {} and \[\] included. | | `(body).default.value` | any | no | | | | `(body).description` | string or null | no | | | | `(body).device_id_resolver` | string or null | no | | | | `(body).enabled` | boolean or null | no | | | | `(body).form` | object or null | no | | properties: form used by the console to edit the value (`fields`). | | `(body).handle_connectivity` | boolean or null | no | | | | `(body).name` | string or null | no | | | | `(body).perm` | object or null | no | | properties: console permissions, as the roles that do not see the property (hidden) or cannot edit it (readOnly); as in device properties. | | `(body).perm.hidden` | array of string or null | no | Unique items | | | `(body).perm.readOnly` | array of string or null | no | Unique items | | | `(body).request` | object or null | no | | | | `(body).request.data` | object or null or null | no | | | | `(body).request.data` | object or null | no | | Variant 1: What an API resource request (`request.data`) or a flow (`sink`) does. `target` selects the fields used: topic → `topic` (+ `retain`): publish to the device over MQTT; resource → `resource`: call a device resource (IOTMP devices); resource_stream → `resource_stream`; property → `property`: set a device property; function → `function`: run a function of the product code; endpoint_call → `endpoint`: call an endpoint; plugin_endpoint → `plugin` + `path`; product_stream → `product_stream` (and optional `product`): publish to a product stream; none. The body sent is built from `payload` / `payload_type` / `payload_function`. A target needs a device: the one in the URL, the source device, or the one returned by the entry's `device_id_resolver`. | | `(body).request.data.endpoint` | string or null | no | | Variant 1: target endpoint_call: endpoint id (may use placeholders). | | `(body).request.data.function` | string or null | no | | Variant 1: | | `(body).request.data.path` | string or null | no | | Variant 1: target plugin_endpoint: path inside the plugin, e.g. /api/process. | | `(body).request.data.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).request.data.payload_function` | string or null | no | | Variant 1: | | `(body).request.data.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).request.data.plugin` | string or null | no | | Variant 1: | | `(body).request.data.product` | string or null | no | | Variant 1: | | `(body).request.data.product_stream` | string or null | no | | Variant 1: | | `(body).request.data.property` | string or null | no | | Variant 1: | | `(body).request.data.resource` | string or null | no | | Variant 1: | | `(body).request.data.resource_stream` | string or null | no | | Variant 1: | | `(body).request.data.retain` | boolean or null | no | | Variant 1: target topic: publish as a retained MQTT message. | | `(body).request.data.target` | string or null | no | | Variant 1: topic \| resource \| resource_stream \| property \| function \| endpoint_call \| plugin_endpoint \| product_stream \| none | | `(body).request.data.topic` | string or null | no | | Variant 1: | | `(body).request.data` | null | no | | Variant 2: | | `(body).response` | object or null | no | | | | `(body).response.data` | object or null or null | no | | | | `(body).response.data` | object or null | no | | Variant 1: What an API resource answers (`response.data`). `source` selects it: request_response: what the request target returned; topic → `topic`: wait for a message on that MQTT topic (from the same device, or any with `publish_source`: any); property → `property`; resource → `resource`; function → `function`; endpoint_call → `endpoint`; none. The answer can be shaped with `payload` / `payload_type` / `payload_function`. | | `(body).response.data.endpoint` | string or null | no | | Variant 1: | | `(body).response.data.function` | string or null | no | | Variant 1: | | `(body).response.data.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).response.data.payload_function` | string or null | no | | Variant 1: | | `(body).response.data.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).response.data.property` | string or null | no | | Variant 1: | | `(body).response.data.publish_source` | string or null | no | | Variant 1: source topic: empty (only the same device) or any. | | `(body).response.data.resource` | string or null | no | | Variant 1: | | `(body).response.data.source` | string or null | no | | Variant 1: request_response \| topic \| property \| resource \| function \| endpoint_call \| none | | `(body).response.data.topic` | string or null | no | | Variant 1: | | `(body).response.data` | null | no | | Variant 2: | | `(body).retention` | object or null | no | | buckets: retention of the bucket when it is created. | | `(body).retention.period` | integer or string or null | no | | 0 = unlimited. | | `(body).retention.unit` | string or null | no | | hours \| days \| weeks \| months \| years | | `(body).sink` | object or null or null | no | | | | `(body).sink` | object or null | no | | Variant 1: What an API resource request (`request.data`) or a flow (`sink`) does. `target` selects the fields used: topic → `topic` (+ `retain`): publish to the device over MQTT; resource → `resource`: call a device resource (IOTMP devices); resource_stream → `resource_stream`; property → `property`: set a device property; function → `function`: run a function of the product code; endpoint_call → `endpoint`: call an endpoint; plugin_endpoint → `plugin` + `path`; product_stream → `product_stream` (and optional `product`): publish to a product stream; none. The body sent is built from `payload` / `payload_type` / `payload_function`. A target needs a device: the one in the URL, the source device, or the one returned by the entry's `device_id_resolver`. | | `(body).sink.endpoint` | string or null | no | | Variant 1: target endpoint_call: endpoint id (may use placeholders). | | `(body).sink.function` | string or null | no | | Variant 1: | | `(body).sink.path` | string or null | no | | Variant 1: target plugin_endpoint: path inside the plugin, e.g. /api/process. | | `(body).sink.payload` | any | no | | Variant 1: Template string (payload_type template_payload) or JSON value. | | `(body).sink.payload_function` | string or null | no | | Variant 1: | | `(body).sink.payload_type` | string or null or null | no | | Variant 1: How the payload is built. template_payload (default): `payload` is a template that may use `{{payload}}`, `{{payload.field}}`, `{{device}}`, `{{property.<name>}}`, `{{api.<resource>}}` or `{{meta.<device field>}}`; without `payload` it yields nothing, so a properties or buckets entry writes nothing. source_payload: the data as received (the same as `payload` "`{{payload}}`"). source_event: the whole event (device, product, timestamps, payload…). none: no payload. | | `(body).sink.plugin` | string or null | no | | Variant 1: | | `(body).sink.product` | string or null | no | | Variant 1: | | `(body).sink.product_stream` | string or null | no | | Variant 1: | | `(body).sink.property` | string or null | no | | Variant 1: | | `(body).sink.resource` | string or null | no | | Variant 1: | | `(body).sink.resource_stream` | string or null | no | | Variant 1: | | `(body).sink.retain` | boolean or null | no | | Variant 1: target topic: publish as a retained MQTT message. | | `(body).sink.target` | string or null | no | | Variant 1: topic \| resource \| resource_stream \| property \| function \| endpoint_call \| plugin_endpoint \| product_stream \| none | | `(body).sink.topic` | string or null | no | | Variant 1: | | `(body).sink` | null | no | | Variant 2: | | `(body).split_data` | boolean or null | no | | | | `(body).tags` | array or null | no | | buckets: record fields stored as tags (filterable), e.g. \["line"\]. | | `(body).type` | string or null | no | | properties: "" or configuration. | **Example request**: API resource that calls an endpoint (PUT …/profile/api/notify) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/YOUR_CATEGORY/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sends a notification from the device", "enabled": true, "name": "Notify", "request": { "data": { "endpoint": "notify_email", "payload": "{\"device\": \"{{device}}\", \"message\": \"{{payload.message}}\"}", "payload_type": "template_payload", "target": "endpoint_call" } }, "response": { "data": { "source": "request_response" } } }' ``` **Example body**: API resource to configure a device by serial, with device_id_resolver (PUT …/profile/api/configure) ```json { "device_id_resolver": "resolveDevice", "enabled": true, "name": "Configure", "request": { "data": { "payload": "{{payload.settings}}", "property": "settings", "target": "property" } }, "response": { "data": { "source": "request_response" } } } ``` **Example body**: Autoprovision devices by id pattern (PUT …/profile/autoprovisions/meters) ```json { "config": { "group": "plant_a", "mode": "pattern", "pattern": "^meter_[0-9]{6}$", "type": "meter" }, "description": "Creates meter_XXXXXX devices on their first connection", "enabled": true, "name": "Meters" } ``` **Example body**: Bucket fed from a device resource every 60 s (PUT …/profile/buckets/telemetry) ```json { "data": { "interval": 60, "magnitude": "second", "payload_type": "source_payload", "resource": "telemetry", "source": "resource", "update": "interval" }, "description": "One shared bucket, tagged with each device", "enabled": true, "name": "Telemetry", "retention": { "period": 6, "unit": "months" } } ``` **Example body**: Bucket from MQTT topics with tags (PUT …/profile/buckets/readings) ```json { "data": { "payload_type": "source_payload", "source": "topic", "topic": "plant/{{line}}/{{device}}/{{field}}" }, "enabled": true, "name": "Readings", "tags": [ "line" ] } ``` **Example body**: Configuration property with a default (PUT …/profile/properties/settings) ```json { "default": { "value": { "report_interval": 60, "threshold": 25.5 } }, "enabled": true, "name": "Settings", "perm": { "hidden": [], "readOnly": [ "member" ] }, "type": "configuration" } ``` **Example body**: Flow: email when a device disconnects (PUT …/profile/flows/offline_alert) ```json { "data": { "event": "device_state_change", "filter": { "state": "disconnected" }, "payload_type": "source_event", "source": "event" }, "enabled": true, "name": "Offline alert", "sink": { "endpoint": "notify_email", "payload": "{\"text\": \"{{device}} is offline\"}", "target": "endpoint_call" } } ``` **Example body**: Property set from an MQTT topic (PUT …/profile/properties/status) ```json { "data": { "payload_type": "source_payload", "source": "topic", "topic": "devices/{{device}}/status" }, "default": { "value": { "state": "unknown" } }, "description": "Last status message", "enabled": true, "name": "Status" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/products/{product}/profile/{category}/{resource}` - **Request:** DELETE /v1/users/{user}/products/{product}/profile/{category}/{resource} - **Operation:** UpdateProductProfile - **Operation ID:** `Product_DeleteProductProfileResource` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `category` | path | string | yes | | | `resource` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/profile/YOUR_CATEGORY/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}/projects` - **Request:** PUT /v1/users/{user}/products/{product}/projects - **Operation:** UpdateProductProjects - **Operation ID:** `Product_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/properties` - **Request:** GET /v1/users/{user}/products/{product}/properties - **Operation:** ListProductProperties - **Operation ID:** `Product_ListProperties` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090737, "description": "Sampling and alert thresholds", "modified": 1792263090737, "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }, { "created": 1792263090737, "modified": 1792263090737, "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } }, { "created": 1792263090737, "modified": 1792263090737, "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } }, { "created": 1792263090737, "modified": 1792263090737, "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ] ``` ## `POST /v1/users/{user}/products/{product}/properties` - **Request:** POST /v1/users/{user}/products/{product}/properties - **Operation:** CreateProductProperty - **Operation ID:** `Product_CreateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of object | no | | | | `(body)[].description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `(body)[].form` | object | no | | | | `(body)[].form.fields` | any | yes | | | | `(body)[].name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `(body)[].perm` | object | no | | | | `(body)[].perm.hidden` | array of string | no | Unique items | | | `(body)[].perm.readOnly` | array of string | no | Unique items | | | `(body)[].property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `(body)[].type` | string | no | One of: ``, `configuration` | | | `(body)[].value` | any | yes | | | *Variant 2*: Property Create. Schema for creating a property Schema for creating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Configuration value ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sampling and alert thresholds", "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }' ``` **Example body**: Location ```json { "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } } ``` **Example body**: Read-only for project members ```json { "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } } ``` **Example body**: Url dashboard of the resource ```json { "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/properties/{property}` - **Request:** GET /v1/users/{user}/products/{product}/properties/{property} - **Operation:** ReadProductProperty - **Operation ID:** `Product_ReadProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}/properties/{property}` - **Request:** PUT /v1/users/{user}/products/{product}/properties/{property} - **Operation:** UpdateProductProperty - **Operation ID:** `Product_UpdateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) Schema for updating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Hide from project members ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "perm": { "hidden": [ "member" ] }, "value": "internal note" }' ``` **Example body**: Replace the value ```json { "value": { "alerts": true, "interval": 30, "max_temperature": 27 } } ``` **Example body**: Value, name and description ```json { "description": "Faster sampling during commissioning", "name": "Settings", "value": { "alerts": false, "interval": 10, "max_temperature": 28.5 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/users/{user}/products/{product}/properties/{property}` - **Request:** PATCH /v1/users/{user}/products/{product}/properties/{property} - **Operation:** UpdateProductProperty - **Operation ID:** `Product_PatchProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `value` | any | yes | | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `*` | any | no | | | **Example request**: Change some fields of the value ```bash curl -X PATCH 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "value": { "interval": 30 } }' ``` **Example body**: Flattened fields ```json { "value.alerts": false, "value.max_temperature": 27 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/products/{product}/properties/{property}` - **Request:** DELETE /v1/users/{user}/products/{product}/properties/{property} - **Operation:** DeleteProductProperty - **Operation ID:** `Product_DeleteProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/properties/{property}/clone` - **Request:** GET /v1/users/{user}/products/{product}/properties/{property}/clone - **Operation:** CloneProductPropertyConfig - **Operation ID:** `Product_ClonePropertyConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/products/{product}/properties/{property}/clone` - **Request:** POST /v1/users/{user}/products/{product}/properties/{property}/clone - **Operation:** CloneProductProperty - **Operation ID:** `Product_CloneProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "property": "copy_of_property" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "property": "line_2_property" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/products/{product}/resources/{resource}` - **Request:** POST /v1/users/{user}/products/{product}/resources/{resource} - **Operation:** AccessProductResources - **Operation ID:** `Product_AccessResources` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` Call an API resource of the product (profile api) without naming a device. The body is free (any JSON, or an array to call it once per element) and is the `{{payload}}` of the resource. A device is only reached when the resource defines device_id_resolver, a product code function that returns the device id from the payload. **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `resource` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/resources/YOUR_RESOURCE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/services` - **Request:** GET /v1/users/{user}/products/{product}/services - **Operation:** ReadProductServices - **Operation ID:** `Product_ReadServices` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/services' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/products/{product}/services/{service}` - **Request:** GET /v1/users/{user}/products/{product}/services/{service} - **Operation:** ReadProductServices - **Operation ID:** `Product_ReadServices` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `service` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/services/YOUR_SERVICE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/products/{product}/services/{service}` - **Request:** PUT /v1/users/{user}/products/{product}/services/{service} - **Operation:** UpdateProductServices - **Operation ID:** `Product_UpdateServices` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `service` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | object or null | no | | A service the devices of the product expose, reached through the server: web (HTTP proxy) or vnc (remote desktop). The target is the address and port as seen from the device. | | `(body).description` | string or null | no | | | | `(body).enabled` | boolean or null | no | | | | `(body).name` | string or null | no | | | | `(body).security` | object or null | no | | | | `(body).security.ip_filtering` | boolean or null | no | | | | `(body).security.timeout_minutes` | number or null | no | | | | `(body).target` | object or null | no | | | | `(body).target.address` | string or null | no | | e.g. 127.0.0.1 | | `(body).target.port` | integer or string or null | no | | e.g. 8080 | | `(body).target.secure` | boolean or null | no | | The target uses TLS. | | `(body).type` | string or null | no | | web (default) \| vnc | | `(body).vnc` | object or null | no | | | | `(body).vnc.compression` | number or null | no | | | | `(body).vnc.quality` | number or null | no | | | | `(body).vnc.scale` | boolean or null | no | | | | `(body).vnc.shared` | boolean or null | no | | | | `(body).vnc.viewonly` | boolean or null | no | | | **Example request**: Remote desktop (PUT …/services/desktop) ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/services/YOUR_SERVICE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": true, "name": "Desktop", "target": { "address": "127.0.0.1", "port": 5900 }, "type": "vnc", "vnc": { "compression": 2, "quality": 6, "scale": true, "shared": true, "viewonly": false } }' ``` **Example body**: Web interface of the device (PUT …/services/web_ui) ```json { "description": "Device configuration page", "enabled": true, "name": "Web UI", "security": { "ip_filtering": false, "timeout_minutes": 60 }, "target": { "address": "127.0.0.1", "port": 8080, "secure": false }, "type": "web" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/products/{product}/services/{service}` - **Request:** DELETE /v1/users/{user}/products/{product}/services/{service} - **Operation:** DeleteProductServices - **Operation ID:** `Product_DeleteServices` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `product` | path | string | yes | | | `service` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/products/YOUR_PRODUCT/services/YOUR_SERVICE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/projects.md # Projects > REST API reference for Projects: manage projects and their members, roles and properties. 27 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/projects` - **Request:** GET /v1/users/{user}/projects - **Operation:** ListProjects - **Operation ID:** `Project_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090704, "description": "Description", "modified": 1792263090704, "name": "Project", "project": "project" } ] ``` ## `POST /v1/users/{user}/projects` - **Request:** POST /v1/users/{user}/projects - **Operation:** CreateProject - **Operation ID:** `Project_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config.limit_bucket_access` | boolean | no | | Bucket reads made over the project only return the records of the project's devices (the bucket needs a device tag). Default true for new projects. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `project` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Create Project ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Description", "name": "Project", "project": "project" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}` - **Request:** GET /v1/users/{user}/projects/{project} - **Operation:** ReadProjectConfig - **Operation ID:** `Project_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Create Project) ```json { "created": 1792263090704, "description": "Description", "modified": 1792263090704, "name": "Project", "project": "project" } ``` ## `PUT /v1/users/{user}/projects/{project}` - **Request:** PUT /v1/users/{user}/projects/{project} - **Operation:** UpdateProject - **Operation ID:** `Project_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config.limit_bucket_access` | boolean | no | | Bucket reads made over the project only return the records of the project's devices (the bucket needs a device tag). Default true for new projects. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Description", "name": "Project", "project": "project" }' ``` **Example body**: Update 'description' ```json { "description": "Description" } ``` **Example body**: Update 'name' ```json { "name": "Project" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/projects/{project}` - **Request:** DELETE /v1/users/{user}/projects/{project} - **Operation:** DeleteProject - **Operation ID:** `Project_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/clone` - **Request:** GET /v1/users/{user}/projects/{project}/clone - **Operation:** CloneProjectConfig - **Operation ID:** `Project_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/projects/{project}/clone` - **Request:** POST /v1/users/{user}/projects/{project}/clone - **Operation:** CloneProject - **Operation ID:** `Project_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `project` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "project": "copy_of_project" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "project": "line_2_project" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/members` - **Request:** GET /v1/users/{user}/projects/{project}/members - **Operation:** ListProjectMembers - **Operation ID:** `Project_ListMembers` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/members' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090706, "enabled": true, "member": "jane", "modified": 1792263090706 }, { "created": 1792263090706, "enabled": true, "member": "tech_madrid", "modified": 1792263090706 }, { "created": 1792263090706, "enabled": true, "member": "acme_viewer", "modified": 1792263090706 } ] ``` ## `POST /v1/users/{user}/projects/{project}/members` - **Request:** POST /v1/users/{user}/projects/{project}/members - **Operation:** CreateProjectMember - **Operation ID:** `Project_CreateMember` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Request body** (`application/json`, required) Shares the project with an account (member = its username). Effective permissions: its own allow / deny plus its project roles and global roles. 'groups' limits it to devices of those asset groups. With 'account' the server first creates that account (verified, role member, this project as default). | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `account` | object | no | | | | `account.email` | string | no | Format: email | | | `account.password` | string | no | | | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `enabled` | boolean | yes | | | | `global_roles` | array of string | no | Maximum items: 10 | | | `groups` | array of string | no | Maximum items: 10 | | | `hide_menu` | boolean | no | | | | `member` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `roles` | array of string | no | Maximum items: 10 | | **Example request**: Existing account with a role ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/members' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": true, "member": "jane", "roles": [ "operator" ] }' ``` **Example body**: Limited to a site ```json { "enabled": true, "groups": [ "madrid_plant" ], "hide_menu": true, "member": "tech_madrid", "roles": [ "operator" ] } ``` **Example body**: New account ```json { "account": { "email": "viewer@acme.example", "password": "a-long-random-password" }, "enabled": true, "member": "acme_viewer", "roles": [ "viewer" ] } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/members/{member}` - **Request:** GET /v1/users/{user}/projects/{project}/members/{member} - **Operation:** ReadProjectMemberConfig - **Operation ID:** `Project_ReadMemberConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `member` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/members/YOUR_MEMBER' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Existing account with a role) ```json { "created": 1792263090706, "enabled": true, "member": "jane", "modified": 1792263090706, "roles": [ "operator" ] } ``` **Response example** (200, Limited to a site) ```json { "created": 1792263090706, "enabled": true, "groups": [ "madrid_plant" ], "hide_menu": true, "member": "tech_madrid", "modified": 1792263090706, "roles": [ "operator" ] } ``` **Response example** (200, New account) ```json { "account": { "email": "viewer@acme.example", "password": "a-long-random-password" }, "created": 1792263090706, "enabled": true, "member": "acme_viewer", "modified": 1792263090706, "roles": [ "viewer" ] } ``` ## `PUT /v1/users/{user}/projects/{project}/members/{member}` - **Request:** PUT /v1/users/{user}/projects/{project}/members/{member} - **Operation:** UpdateProjectMember - **Operation ID:** `Project_UpdateMember` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `member` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `enabled` | boolean | no | | | | `global_roles` | array of string | no | Maximum items: 10 | | | `groups` | array of string | no | Maximum items: 10 | | | `hide_menu` | boolean | no | | | | `roles` | array of string | no | Maximum items: 10 | | **Example request**: Change roles ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/members/YOUR_MEMBER' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "roles": [ "viewer" ] }' ``` **Example body**: Suspend ```json { "enabled": false } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/projects/{project}/members/{member}` - **Request:** DELETE /v1/users/{user}/projects/{project}/members/{member} - **Operation:** DeleteProjectMember - **Operation ID:** `Project_DeleteMember` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `member` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/members/YOUR_MEMBER' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/properties` - **Request:** GET /v1/users/{user}/projects/{project}/properties - **Operation:** ListProjectProperties - **Operation ID:** `Project_ListProperties` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090705, "description": "Sampling and alert thresholds", "modified": 1792263090705, "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }, { "created": 1792263090705, "modified": 1792263090705, "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } }, { "created": 1792263090705, "modified": 1792263090705, "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } }, { "created": 1792263090705, "modified": 1792263090705, "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ] ``` ## `POST /v1/users/{user}/projects/{project}/properties` - **Request:** POST /v1/users/{user}/projects/{project}/properties - **Operation:** CreateProjectProperty - **Operation ID:** `Project_CreateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of object | no | | | | `(body)[].description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `(body)[].form` | object | no | | | | `(body)[].form.fields` | any | yes | | | | `(body)[].name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `(body)[].perm` | object | no | | | | `(body)[].perm.hidden` | array of string | no | Unique items | | | `(body)[].perm.readOnly` | array of string | no | Unique items | | | `(body)[].property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `(body)[].type` | string | no | One of: ``, `configuration` | | | `(body)[].value` | any | yes | | | *Variant 2*: Property Create. Schema for creating a property Schema for creating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Configuration value ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sampling and alert thresholds", "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }' ``` **Example body**: Location ```json { "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } } ``` **Example body**: Read-only for project members ```json { "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } } ``` **Example body**: Url dashboard of the resource ```json { "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/properties/{property}` - **Request:** GET /v1/users/{user}/projects/{project}/properties/{property} - **Operation:** ReadProjectProperty - **Operation ID:** `Project_ReadProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/projects/{project}/properties/{property}` - **Request:** PUT /v1/users/{user}/projects/{project}/properties/{property} - **Operation:** UpdateProjectProperty - **Operation ID:** `Project_UpdateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) Schema for updating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Hide from project members ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "perm": { "hidden": [ "member" ] }, "value": "internal note" }' ``` **Example body**: Replace the value ```json { "value": { "alerts": true, "interval": 30, "max_temperature": 27 } } ``` **Example body**: Value, name and description ```json { "description": "Faster sampling during commissioning", "name": "Settings", "value": { "alerts": false, "interval": 10, "max_temperature": 28.5 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/users/{user}/projects/{project}/properties/{property}` - **Request:** PATCH /v1/users/{user}/projects/{project}/properties/{property} - **Operation:** UpdateProjectProperty - **Operation ID:** `Project_PatchProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `value` | any | yes | | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `*` | any | no | | | **Example request**: Change some fields of the value ```bash curl -X PATCH 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "value": { "interval": 30 } }' ``` **Example body**: Flattened fields ```json { "value.alerts": false, "value.max_temperature": 27 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/projects/{project}/properties/{property}` - **Request:** DELETE /v1/users/{user}/projects/{project}/properties/{property} - **Operation:** DeleteProjectProperty - **Operation ID:** `Project_DeleteProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/properties/{property}/clone` - **Request:** GET /v1/users/{user}/projects/{project}/properties/{property}/clone - **Operation:** CloneProjectPropertyConfig - **Operation ID:** `Project_ClonePropertyConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/projects/{project}/properties/{property}/clone` - **Request:** POST /v1/users/{user}/projects/{project}/properties/{property}/clone - **Operation:** CloneProjectProperty - **Operation ID:** `Project_CloneProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "property": "copy_of_property" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "property": "line_2_property" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/roles` - **Request:** GET /v1/users/{user}/projects/{project}/roles - **Operation:** ListProjectRoles - **Operation ID:** `Project_ListRoles` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/roles' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "allow": { "Alarm": { "*": [ "List*", "Read*", "UpdateAlarmInstance" ] }, "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*", "AccessDeviceResources" ] } }, "created": 1792263090706, "enabled": true, "modified": 1792263090706, "role": "operator" }, { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "created": 1792263090706, "enabled": true, "modified": 1792263090706, "role": "viewer" } ] ``` ## `POST /v1/users/{user}/projects/{project}/roles` - **Request:** POST /v1/users/{user}/projects/{project}/roles - **Operation:** CreateProjectRole - **Operation ID:** `Project_CreateRole` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | **Request body** (`application/json`, required) A project role is a named set of permissions for members of this project (members.roles). Permissions: {<resource type>: {<resource id or \*>: action | \[actions\]}}; actions accept a trailing \* (Read\*, List\*). | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `enabled` | boolean | yes | | | | `role` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Operator ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/roles' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "allow": { "Alarm": { "*": [ "List*", "Read*", "UpdateAlarmInstance" ] }, "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*", "AccessDeviceResources" ] } }, "enabled": true, "role": "operator" }' ``` **Example body**: Viewer ```json { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "enabled": true, "role": "viewer" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/roles/{role}` - **Request:** GET /v1/users/{user}/projects/{project}/roles/{role} - **Operation:** ReadProjectRoleConfig - **Operation ID:** `Project_ReadRoleConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `role` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/roles/YOUR_ROLE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Operator) ```json { "allow": { "Alarm": { "*": [ "List*", "Read*", "UpdateAlarmInstance" ] }, "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*", "AccessDeviceResources" ] } }, "created": 1792263090706, "enabled": true, "modified": 1792263090706, "role": "operator" } ``` **Response example** (200, Viewer) ```json { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "created": 1792263090706, "enabled": true, "modified": 1792263090706, "role": "viewer" } ``` ## `PUT /v1/users/{user}/projects/{project}/roles/{role}` - **Request:** PUT /v1/users/{user}/projects/{project}/roles/{role} - **Operation:** UpdateProjectRole - **Operation ID:** `Project_UpdateRole` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `role` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `enabled` | boolean | no | | | **Example request**: Disable the role ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/roles/YOUR_ROLE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": false }' ``` **Example body**: Replace its permissions ```json { "allow": { "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/projects/{project}/roles/{role}` - **Request:** DELETE /v1/users/{user}/projects/{project}/roles/{role} - **Operation:** DeleteProjectRole - **Operation ID:** `Project_DeleteRole` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `role` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/roles/YOUR_ROLE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/projects/{project}/roles/{role}/clone` - **Request:** GET /v1/users/{user}/projects/{project}/roles/{role}/clone - **Operation:** CloneProjectRoleConfig - **Operation ID:** `Project_CloneRoleConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `role` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/roles/YOUR_ROLE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/projects/{project}/roles/{role}/clone` - **Request:** POST /v1/users/{user}/projects/{project}/roles/{role}/clone - **Operation:** CloneProjectRole - **Operation ID:** `Project_CloneRole` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `project` | path | string | yes | | | `role` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `role` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/projects/YOUR_PROJECT/roles/YOUR_ROLE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "role": "copy_of_role" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "role": "line_2_role" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/plugins.md # Plugins > REST API reference for Plugins: list plugins, manage their state and properties, read their logs and call their endpoints. 23 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /users/{user}/plugins/{plugin}{path}` - **Request:** GET /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointGet` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /users/{user}/plugins/{plugin}{path}` - **Request:** POST /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointPost` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /users/{user}/plugins/{plugin}{path}` - **Request:** PUT /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointPut` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PUT 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /users/{user}/plugins/{plugin}{path}` - **Request:** PATCH /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointPatch` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X PATCH 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /users/{user}/plugins/{plugin}{path}` - **Request:** DELETE /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointDelete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `HEAD /users/{user}/plugins/{plugin}{path}` - **Request:** HEAD /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointHead` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Example request** ```bash curl --head 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `OPTIONS /users/{user}/plugins/{plugin}{path}` - **Request:** OPTIONS /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointOptions` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Example request** ```bash curl -X OPTIONS 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `TRACE /users/{user}/plugins/{plugin}{path}` - **Request:** TRACE /users/{user}/plugins/{plugin}{path} - **Operation:** CallPluginEndpoint - **Operation ID:** `Plugin_CallPluginEndpointTrace` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `path` | path | string | yes | | **Example request** ```bash curl -X TRACE 'https://YOUR_SERVER/users/YOUR_USER/plugins/YOUR_PLUGINYOUR_PATH' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins` - **Request:** GET /v1/users/{user}/plugins - **Operation:** ListPlugins - **Operation ID:** `Plugin_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}` - **Request:** GET /v1/users/{user}/plugins/{plugin} - **Operation:** ReadPluginInfo - **Operation ID:** `Plugin_ReadInfo` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/plugins/{plugin}` - **Request:** POST /v1/users/{user}/plugins/{plugin} - **Operation:** ManagePluginState - **Operation ID:** `Plugin_ManageState` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}/files/{file}` - **Request:** GET /v1/users/{user}/plugins/{plugin}/files/{file} - **Operation:** ReadPluginFiles - **Operation ID:** `Plugin_ReadFiles` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `file` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/files/YOUR_FILE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}/properties` - **Request:** GET /v1/users/{user}/plugins/{plugin}/properties - **Operation:** ListPluginProperties - **Operation ID:** `Plugin_ListProperties` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090796, "description": "Sampling and alert thresholds", "modified": 1792263090796, "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }, { "created": 1792263090796, "modified": 1792263090796, "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } }, { "created": 1792263090796, "modified": 1792263090796, "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } }, { "created": 1792263090796, "modified": 1792263090796, "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ] ``` ## `POST /v1/users/{user}/plugins/{plugin}/properties` - **Request:** POST /v1/users/{user}/plugins/{plugin}/properties - **Operation:** CreatePluginProperty - **Operation ID:** `Plugin_CreateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of object | no | | | | `(body)[].description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `(body)[].form` | object | no | | | | `(body)[].form.fields` | any | yes | | | | `(body)[].name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `(body)[].perm` | object | no | | | | `(body)[].perm.hidden` | array of string | no | Unique items | | | `(body)[].perm.readOnly` | array of string | no | Unique items | | | `(body)[].property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `(body)[].type` | string | no | One of: ``, `configuration` | | | `(body)[].value` | any | yes | | | *Variant 2*: Property Create. Schema for creating a property Schema for creating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Configuration value ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sampling and alert thresholds", "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }' ``` **Example body**: Location ```json { "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } } ``` **Example body**: Read-only for project members ```json { "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } } ``` **Example body**: Url dashboard of the resource ```json { "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}/properties/{property}` - **Request:** GET /v1/users/{user}/plugins/{plugin}/properties/{property} - **Operation:** ReadPluginProperty - **Operation ID:** `Plugin_ReadProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/plugins/{plugin}/properties/{property}` - **Request:** PUT /v1/users/{user}/plugins/{plugin}/properties/{property} - **Operation:** UpdatePluginProperty - **Operation ID:** `Plugin_UpdateProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) Schema for updating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Hide from project members ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "perm": { "hidden": [ "member" ] }, "value": "internal note" }' ``` **Example body**: Replace the value ```json { "value": { "alerts": true, "interval": 30, "max_temperature": 27 } } ``` **Example body**: Value, name and description ```json { "description": "Faster sampling during commissioning", "name": "Settings", "value": { "alerts": false, "interval": 10, "max_temperature": 28.5 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/users/{user}/plugins/{plugin}/properties/{property}` - **Request:** PATCH /v1/users/{user}/plugins/{plugin}/properties/{property} - **Operation:** UpdatePluginProperty - **Operation ID:** `Plugin_PatchProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `value` | any | yes | | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `*` | any | no | | | **Example request**: Change some fields of the value ```bash curl -X PATCH 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "value": { "interval": 30 } }' ``` **Example body**: Flattened fields ```json { "value.alerts": false, "value.max_temperature": 27 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/plugins/{plugin}/properties/{property}` - **Request:** DELETE /v1/users/{user}/plugins/{plugin}/properties/{property} - **Operation:** DeletePluginProperty - **Operation ID:** `Plugin_DeleteProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}/properties/{property}/clone` - **Request:** GET /v1/users/{user}/plugins/{plugin}/properties/{property}/clone - **Operation:** ClonePluginPropertyConfig - **Operation ID:** `Plugin_ClonePropertyConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/plugins/{plugin}/properties/{property}/clone` - **Request:** POST /v1/users/{user}/plugins/{plugin}/properties/{property}/clone - **Operation:** ClonePluginProperty - **Operation ID:** `Plugin_CloneProperty` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "property": "copy_of_property" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "property": "line_2_property" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}/terminal` - **Request:** GET /v1/users/{user}/plugins/{plugin}/terminal - **Operation:** RunPluginCommand - **Operation ID:** `Plugin_RunCommandTerminal` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/terminal' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}/terminal/logs` - **Request:** GET /v1/users/{user}/plugins/{plugin}/terminal/logs - **Operation:** ReadPluginLogs - **Operation ID:** `Plugin_ReadLogs` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/terminal/logs' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/plugins/{plugin}/terminal/shell` - **Request:** GET /v1/users/{user}/plugins/{plugin}/terminal/shell - **Operation:** RunPluginShell - **Operation ID:** `Plugin_RunShell` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `plugin` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/plugins/YOUR_PLUGIN/terminal/shell' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/syncs.md # Syncs > REST API reference for Syncs: manage syncs and their locks. 13 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/syncs` - **Request:** GET /v1/users/{user}/syncs - **Operation:** ListSyncs - **Operation ID:** `Sync_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090740, "enabled": true, "modified": 1792263090740, "name": "Firmware uploads", "sync": "firmware_uploads" }, { "created": 1792263090740, "description": "Only one controller can dose at a time", "enabled": true, "modified": 1792263090740, "name": "Dosing pump", "sync": "dosing_pump" } ] ``` ## `POST /v1/users/{user}/syncs` - **Request:** POST /v1/users/{user}/syncs - **Operation:** CreateSync - **Operation ID:** `Sync_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A sync is a shared semaphore: 'available' slots that devices or scripts take with locks (POST .../syncs/{sync}/locks) and release, e.g. to let only N devices use a resource at the same time. 'timeout' (seconds) is the default lock lifetime; 0 = until released. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | yes | | | | `config` | object | no | | Variant 1: | | `config.available` | integer | yes | Minimum: 0 | Variant 1: | | `config.timeout` | integer | no | Minimum: 0 | Variant 1: | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | yes | | | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `sync` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Limit concurrent uploads ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "available": 5, "timeout": 600 }, "enabled": true, "name": "Firmware uploads", "sync": "firmware_uploads" }' ``` **Example body**: One device at a time ```json { "config": { "available": 1, "timeout": 120 }, "description": "Only one controller can dose at a time", "enabled": true, "name": "Dosing pump", "sync": "dosing_pump" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/syncs/{sync}` - **Request:** GET /v1/users/{user}/syncs/{sync} - **Operation:** ReadSyncConfig - **Operation ID:** `Sync_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Limit concurrent uploads) ```json { "config": { "available": 5, "timeout": 600 }, "created": 1792263090740, "enabled": true, "modified": 1792263090740, "name": "Firmware uploads", "sync": "firmware_uploads" } ``` **Response example** (200, One device at a time) ```json { "config": { "available": 1, "timeout": 120 }, "created": 1792263090740, "description": "Only one controller can dose at a time", "enabled": true, "modified": 1792263090740, "name": "Dosing pump", "sync": "dosing_pump" } ``` ## `PUT /v1/users/{user}/syncs/{sync}` - **Request:** PUT /v1/users/{user}/syncs/{sync} - **Operation:** UpdateSync - **Operation ID:** `Sync_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config` | object | no | | Variant 1: | | `config.available` | integer | yes | Minimum: 0 | Variant 1: | | `config.timeout` | integer | no | Minimum: 0 | Variant 1: | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Disable ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": false }' ``` **Example body**: More slots ```json { "config": { "available": 10, "timeout": 600 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/syncs/{sync}` - **Request:** DELETE /v1/users/{user}/syncs/{sync} - **Operation:** DeleteSync - **Operation ID:** `Sync_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/syncs/{sync}/clone` - **Request:** GET /v1/users/{user}/syncs/{sync}/clone - **Operation:** CloneSyncConfig - **Operation ID:** `Sync_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/syncs/{sync}/clone` - **Request:** POST /v1/users/{user}/syncs/{sync}/clone - **Operation:** CloneSync - **Operation ID:** `Sync_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `sync` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "sync": "copy_of_sync" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "sync": "line_2_sync" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/syncs/{sync}/locks` - **Request:** GET /v1/users/{user}/syncs/{sync}/locks - **Operation:** ListSyncLocks - **Operation ID:** `Sync_ListLocks` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/locks' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090741, "lock": "pump_controller_1", "modified": 1792263090741, "name": "Controller 1" }, { "created": 1792263090741, "lock": "bulk_job", "modified": 1792263090741, "slots": 2 } ] ``` ## `POST /v1/users/{user}/syncs/{sync}/locks` - **Request:** POST /v1/users/{user}/syncs/{sync}/locks - **Operation:** CreateSyncLock - **Operation ID:** `Sync_CreateLock` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Request body** (`application/json`, required) Takes 'slots' (default 1) of the sync. Fails when not enough slots are free. 'timeout' (seconds) overrides the sync default; without lock id a random one is assigned. Delete the lock to release it. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `lock` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `slots` | number | no | | | | `timeout` | number | no | | | **Example request**: Take one slot ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/locks' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "lock": "pump_controller_1", "name": "Controller 1" }' ``` **Example body**: Two slots for 60 seconds ```json { "lock": "bulk_job", "slots": 2, "timeout": 60 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/syncs/{sync}/locks/{lock}` - **Request:** GET /v1/users/{user}/syncs/{sync}/locks/{lock} - **Operation:** ReadSyncLockConfig - **Operation ID:** `Sync_ReadLockConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | | `lock` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/locks/YOUR_LOCK' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Take one slot) ```json { "created": 1792263090741, "lock": "pump_controller_1", "modified": 1792263090741, "name": "Controller 1" } ``` **Response example** (200, Two slots for 60 seconds) ```json { "created": 1792263090741, "lock": "bulk_job", "modified": 1792263090741, "slots": 2, "timeout": 60 } ``` ## `PUT /v1/users/{user}/syncs/{sync}/locks/{lock}` - **Request:** PUT /v1/users/{user}/syncs/{sync}/locks/{lock} - **Operation:** UpdateSyncLock - **Operation ID:** `Sync_UpdateLock` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | | `lock` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Rename ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/locks/YOUR_LOCK' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "Controller 1 - night shift" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/syncs/{sync}/locks/{lock}` - **Request:** DELETE /v1/users/{user}/syncs/{sync}/locks/{lock} - **Operation:** DeleteSyncLock - **Operation ID:** `Sync_DeleteLock` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | | `lock` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/locks/YOUR_LOCK' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/syncs/{sync}/projects` - **Request:** PUT /v1/users/{user}/syncs/{sync}/projects - **Operation:** UpdateSyncProjects - **Operation ID:** `Sync_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `sync` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/syncs/YOUR_SYNC/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/claims.md # Claims > REST API reference for Claims: configure claims and request the claim of a device. 10 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `POST /v1/claims` - **Request:** POST /v1/claims - **Operation:** RequestClaim - **Operation ID:** `Claim_Request` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `code` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `project` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Claim into a project ```bash curl -X POST 'https://YOUR_SERVER/v1/claims' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "code": "a1B2c3D4e5", "project": "my_greenhouse" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/claims/{code}` - **Request:** GET /v1/claims/{code} - **Operation:** ReadClaim - **Operation ID:** `Claim_Read` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `code` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/claims/YOUR_CODE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/claims` - **Request:** GET /v1/users/{user}/claims - **Operation:** ListClaims - **Operation ID:** `Claim_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/claims' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "claim": "kit_0042", "created": 1792263090794, "description": "Gateway, sensor and dashboard shipped in box 0042", "enabled": true, "modified": 1792263090794, "name": "Starter kit 0042" } ] ``` ## `POST /v1/users/{user}/claims` - **Request:** POST /v1/users/{user}/claims - **Operation:** CreateClaim - **Operation ID:** `Claim_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A claim lets another account take some of your resources into one of the projects you share with it: it opens the claim URL (or posts the code to /v1/claims), and the listed resources join that project; 'members' are added to it with 'members_roles' (global roles). 'max_claims' limits how many times the code works (0 = unlimited). | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `claim` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `config` | object | yes | | | | `config.domain` | string | no | Pattern: `^([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?$` | | | `config.max_claims` | integer | no | Minimum: 0 | | | `config.members` | array of string | no | | | | `config.members_roles` | array of string | no | | | | `config.projects` | array of string | no | | | | `config.resources` | array of object | yes | | | | `config.resources[].identifiers` | array of string | no | | | | `config.resources[].type` | string | no | | | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | yes | | | | `name` | string | yes | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Starter kit ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/claims' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "claim": "kit_0042", "config": { "max_claims": 1, "members": [ "support" ], "members_roles": [ "viewer" ], "resources": [ { "identifiers": [ "kit_0042_gw", "kit_0042_sensor" ], "type": "device" }, { "identifiers": [ "kit_dashboard" ], "type": "dashboard" } ] }, "description": "Gateway, sensor and dashboard shipped in box 0042", "enabled": true, "name": "Starter kit 0042" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/claims/{claim}` - **Request:** GET /v1/users/{user}/claims/{claim} - **Operation:** ReadClaimConfig - **Operation ID:** `Claim_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `claim` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/claims/YOUR_CLAIM' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Starter kit) ```json { "claim": "kit_0042", "config": { "max_claims": 1, "members": [ "support" ], "members_roles": [ "viewer" ], "resources": [ { "identifiers": [ "kit_0042_gw", "kit_0042_sensor" ], "type": "device" }, { "identifiers": [ "kit_dashboard" ], "type": "dashboard" } ] }, "created": 1792263090794, "description": "Gateway, sensor and dashboard shipped in box 0042", "enabled": true, "modified": 1792263090794, "name": "Starter kit 0042" } ``` ## `PUT /v1/users/{user}/claims/{claim}` - **Request:** PUT /v1/users/{user}/claims/{claim} - **Operation:** UpdateClaim - **Operation ID:** `Claim_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `claim` | path | string | yes | | **Request body** (`application/json`, required) config replaces the whole claim configuration. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `config.domain` | string | no | Pattern: `^([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?$` | | | `config.max_claims` | integer | no | Minimum: 0 | | | `config.members` | array of string | no | | | | `config.members_roles` | array of string | no | | | | `config.projects` | array of string | no | | | | `config.resources` | array of object | yes | | | | `config.resources[].identifiers` | array of string | no | | | | `config.resources[].type` | string | no | | | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Disable the code ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/claims/YOUR_CLAIM' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": false }' ``` **Example body**: Rename ```json { "name": "Starter kit 0042 - returned" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/claims/{claim}` - **Request:** DELETE /v1/users/{user}/claims/{claim} - **Operation:** DeleteClaim - **Operation ID:** `Claim_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `claim` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/claims/YOUR_CLAIM' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/claims/{claim}/clone` - **Request:** GET /v1/users/{user}/claims/{claim}/clone - **Operation:** CloneClaimConfig - **Operation ID:** `Claim_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `claim` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/claims/YOUR_CLAIM/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/claims/{claim}/clone` - **Request:** POST /v1/users/{user}/claims/{claim}/clone - **Operation:** CloneClaim - **Operation ID:** `Claim_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `claim` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `claim` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/claims/YOUR_CLAIM/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "claim": "copy_of_claim" }' ``` **Example body**: Copy with name and description ```json { "claim": "line_2_claim", "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/claims/{claim}/projects` - **Request:** PUT /v1/users/{user}/claims/{claim}/projects - **Operation:** UpdateClaimProjects - **Operation ID:** `Claim_UpdateProjects` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `claim` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of string | no | | Projects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; \[\] removes it from every project. | **Example request**: No projects ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/claims/YOUR_CLAIM/projects' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '[]' ``` **Example body**: One project ```json [ "YOUR_USER@greenhouse" ] ``` **Example body**: Two projects ```json [ "YOUR_USER@greenhouse", "YOUR_USER@maintenance" ] ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/properties.md # Account Properties > REST API reference for Account Properties: manage the properties of a user account. 8 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/properties` - **Request:** GET /v1/users/{user}/properties - **Operation:** ListProperties - **Operation ID:** `Property_ListProperties` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090745, "description": "Sampling and alert thresholds", "modified": 1792263090745, "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }, { "created": 1792263090745, "modified": 1792263090745, "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } }, { "created": 1792263090745, "modified": 1792263090745, "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } }, { "created": 1792263090745, "modified": 1792263090745, "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ] ``` ## `POST /v1/users/{user}/properties` - **Request:** POST /v1/users/{user}/properties - **Operation:** CreateProperty - **Operation ID:** `Property_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `(body)` | array of object | no | | | | `(body)[].description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `(body)[].form` | object | no | | | | `(body)[].form.fields` | any | yes | | | | `(body)[].name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `(body)[].perm` | object | no | | | | `(body)[].perm.hidden` | array of string | no | Unique items | | | `(body)[].perm.readOnly` | array of string | no | Unique items | | | `(body)[].property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `(body)[].type` | string | no | One of: ``, `configuration` | | | `(body)[].value` | any | yes | | | *Variant 2*: Property Create. Schema for creating a property Schema for creating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Configuration value ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/properties' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Sampling and alert thresholds", "name": "Settings", "property": "settings", "type": "configuration", "value": { "alerts": true, "interval": 60, "max_temperature": 28.5 } }' ``` **Example body**: Location ```json { "name": "Location", "property": "location", "value": { "lat": 40.4168, "lon": -3.7038 } } ``` **Example body**: Read-only for project members ```json { "name": "Calibration", "perm": { "readOnly": [ "member" ] }, "property": "calibration", "value": { "gain": 1.02, "offset": -0.4 } } ``` **Example body**: Url dashboard of the resource ```json { "name": "Dashboard", "property": "dashboard", "value": { "source": "url", "url": "/v1/users/YOUR_USER/storages/fleet_app/files/" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/properties/{property}` - **Request:** GET /v1/users/{user}/properties/{property} - **Operation:** ReadProperty - **Operation ID:** `Property_Read` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/users/{user}/properties/{property}` - **Request:** PUT /v1/users/{user}/properties/{property} - **Operation:** UpdateProperty - **Operation ID:** `Property_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) Schema for updating a property | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `form` | object | no | | | | `form.fields` | any | yes | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `perm` | object | no | | | | `perm.hidden` | array of string | no | Unique items | | | `perm.readOnly` | array of string | no | Unique items | | | `property` | string | no | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | | `type` | string | no | One of: ``, `configuration` | | | `value` | any | yes | | | **Example request**: Hide from project members ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "perm": { "hidden": [ "member" ] }, "value": "internal note" }' ``` **Example body**: Replace the value ```json { "value": { "alerts": true, "interval": 30, "max_temperature": 27 } } ``` **Example body**: Value, name and description ```json { "description": "Faster sampling during commissioning", "name": "Settings", "value": { "alerts": false, "interval": 10, "max_temperature": 28.5 } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/users/{user}/properties/{property}` - **Request:** PATCH /v1/users/{user}/properties/{property} - **Operation:** UpdateProperty - **Operation ID:** `Property_Patch` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) The body matches one of these 2 variants. *Variant 1* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `value` | any | yes | | | *Variant 2* | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `*` | any | no | | | **Example request**: Change some fields of the value ```bash curl -X PATCH 'https://YOUR_SERVER/v1/users/YOUR_USER/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "value": { "interval": 30 } }' ``` **Example body**: Flattened fields ```json { "value.alerts": false, "value.max_temperature": 27 } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/properties/{property}` - **Request:** DELETE /v1/users/{user}/properties/{property} - **Operation:** DeleteProperty - **Operation ID:** `Property_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/properties/YOUR_PROPERTY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/properties/{property}/clone` - **Request:** GET /v1/users/{user}/properties/{property}/clone - **Operation:** ClonePropertyConfig - **Operation ID:** `Property_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `property` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/properties/{property}/clone` - **Request:** POST /v1/users/{user}/properties/{property}/clone - **Operation:** CloneProperty - **Operation ID:** `Property_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `property` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `property` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/properties/YOUR_PROPERTY/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "property": "copy_of_property" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "property": "line_2_property" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/roles.md # Roles > REST API reference for Roles: manage the roles of a user account. 7 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/users/{user}/roles` - **Request:** GET /v1/users/{user}/roles - **Operation:** ListRoles - **Operation ID:** `Role_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/roles' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "allow": { "Alarm": { "*": [ "List*", "Read*", "UpdateAlarmInstance" ] }, "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*", "AccessDeviceResources" ] } }, "created": 1792263090707, "enabled": true, "modified": 1792263090707, "role": "operator" }, { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "created": 1792263090707, "enabled": true, "modified": 1792263090707, "role": "viewer" } ] ``` ## `POST /v1/users/{user}/roles` - **Request:** POST /v1/users/{user}/roles - **Operation:** CreateRole - **Operation ID:** `Role_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | **Request body** (`application/json`, required) A global role is a named set of permissions of the account, reusable by members of any of its projects (members.global_roles). Permissions: {<resource type>: {<resource id or \*>: action | \[actions\]}}; actions accept a trailing \* (Read\*, List\*). | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `enabled` | boolean | yes | | | | `role` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Operator ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/roles' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "allow": { "Alarm": { "*": [ "List*", "Read*", "UpdateAlarmInstance" ] }, "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*", "AccessDeviceResources" ] } }, "enabled": true, "role": "operator" }' ``` **Example body**: Viewer ```json { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "enabled": true, "role": "viewer" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/roles/{role}` - **Request:** GET /v1/users/{user}/roles/{role} - **Operation:** ReadRoleConfig - **Operation ID:** `Role_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `role` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Operator) ```json { "allow": { "Alarm": { "*": [ "List*", "Read*", "UpdateAlarmInstance" ] }, "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*", "AccessDeviceResources" ] } }, "created": 1792263090707, "enabled": true, "modified": 1792263090707, "role": "operator" } ``` **Response example** (200, Viewer) ```json { "allow": { "Bucket": { "*": [ "List*", "Read*" ] }, "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } }, "created": 1792263090707, "enabled": true, "modified": 1792263090707, "role": "viewer" } ``` ## `PUT /v1/users/{user}/roles/{role}` - **Request:** PUT /v1/users/{user}/roles/{role} - **Operation:** UpdateRole - **Operation ID:** `Role_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `role` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `allow` | object | no | | | | `allow.*` | object | no | Minimum properties: 1 | | | `allow.*.*` | string or array of string or object | no | | | | `allow.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `allow.*.*` | array of string or object | no | | Variant 2: | | `allow.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `allow.*.*[]` | object | no | | Variant 2: Variant 2: | | `allow.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `deny` | object | no | | | | `deny.*` | object | no | Minimum properties: 1 | | | `deny.*.*` | string or array of string or object | no | | | | `deny.*.*` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 1: | | `deny.*.*` | array of string or object | no | | Variant 2: | | `deny.*.*[]` | string | no | Pattern: `^[a-zA-Z0-9_\*]{1,64}$\|^\*$` | Variant 2: Variant 1: | | `deny.*.*[]` | object | no | | Variant 2: Variant 2: | | `deny.*.*[].*` | string or array of string | no | Variant 1: Pattern: `^[a-zA-Z0-9_\*]{1,32}$\|^\*$` | Variant 2: Variant 2: | | `enabled` | boolean | no | | | **Example request**: Disable the role ```bash curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "enabled": false }' ``` **Example body**: Replace its permissions ```json { "allow": { "Dashboard": { "*": [ "List*", "Read*" ] }, "Device": { "*": [ "List*", "Read*" ] } } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/users/{user}/roles/{role}` - **Request:** DELETE /v1/users/{user}/roles/{role} - **Operation:** DeleteRole - **Operation ID:** `Role_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `role` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/users/{user}/roles/{role}/clone` - **Request:** GET /v1/users/{user}/roles/{role}/clone - **Operation:** CloneRoleConfig - **Operation ID:** `Role_CloneConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `role` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/users/{user}/roles/{role}/clone` - **Request:** POST /v1/users/{user}/roles/{role}/clone - **Operation:** CloneRole - **Operation ID:** `Role_Clone` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `user` | path | string | yes | | | `role` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | Maximum length: 255 | A brief description of the resource, providing context or additional information, limited to 255 characters. | | `enabled` | boolean | no | | | | `name` | string | no | Maximum length: 255 | The name of the resource, limited to 255 characters. It can include any character. | | `role` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Copy with a new id ```bash curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/roles/YOUR_ROLE/clone' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "role": "copy_of_role" }' ``` **Example body**: Copy with name and description ```json { "description": "Same configuration as the original, for production line 2", "name": "Line 2 copy", "role": "line_2_role" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/hosts.md # Cluster Hosts > REST API reference for Cluster Hosts: manage the cluster hosts of an instance, their settings, logs and restarts. 9 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/hosts` - **Request:** GET /v1/hosts - **Operation:** ListHosts - **Operation ID:** `Host_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/hosts' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/hosts` - **Request:** POST /v1/hosts - **Operation:** CreateHost - **Operation ID:** `Host_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `host` | string | yes | Pattern: `^([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+(?:\.[a-zA-Z]{2,11})?$` | Hostname of the server. Hosts register themselves when they start. | **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/hosts' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "host": "" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/hosts/{host}` - **Request:** GET /v1/hosts/{host} - **Operation:** ReadHostConfig - **Operation ID:** `Host_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `host` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/hosts/YOUR_HOST' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/hosts/{host}` - **Request:** PUT /v1/hosts/{host} - **Operation:** UpdateHost - **Operation ID:** `Host_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `host` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | **Example request**: Describe the host ```bash curl -X PUT 'https://YOUR_SERVER/v1/hosts/YOUR_HOST' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Primary server, eu-west-1" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/hosts/{host}` - **Request:** DELETE /v1/hosts/{host} - **Operation:** DeleteHost - **Operation ID:** `Host_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `host` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/hosts/YOUR_HOST' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/hosts/{host}/logs` - **Request:** GET /v1/hosts/{host}/logs - **Operation:** ReadHostLogs - **Operation ID:** `Host_ReadLogs` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` Server output (stdout and stderr) of the host. A websocket upgrade streams new lines live; a plain GET returns the last lines as text/plain. Reads the logs of the Docker container the server runs in (deployment.container_name, default "thinger"); other cluster hosts are proxied. **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `host` | path | string | yes | | | `lines` | query | integer | no | Plain GET: number of last lines (1-5000, default 200). | | `timestamps` | query | boolean | no | Plain GET: prefix each line with its timestamp. | | `since` | query | integer | no | Plain GET: only lines after this unix timestamp, or this many seconds ago when below 31536000. | **Example request** ```bash curl 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/logs' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/hosts/{host}/restart` - **Request:** POST /v1/hosts/{host}/restart - **Operation:** UpdateHostState - **Operation ID:** `Host_UpdateStateRestart` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `host` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/restart' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/hosts/{host}/settings` - **Request:** GET /v1/hosts/{host}/settings - **Operation:** ReadHostSettings - **Operation ID:** `Host_ReadSettings` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `host` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/settings' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PUT /v1/hosts/{host}/settings` - **Request:** PUT /v1/hosts/{host}/settings - **Operation:** UpdateHostSettings - **Operation ID:** `Host_UpdateSettings` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `host` | path | string | yes | | **Request body** (`application/json`, required) Merged (RFC 7386 merge patch: null removes a key) into the host custom settings, on top of the provider settings. Changes apply after POST /v1/hosts/{host}/restart. Ports are strings: numbers are ignored by the server. On cloud instances (configured by a subscription), database, plugins, rate_limiter, http_server.hosts, accounts.limits.{accounts,brands,domains,members} and deployment.container_name belong to the plan: sending them returns 403, and stored ones are ignored. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `accounts` | object or null | no | | Accounts and limits. Brands can override the sign-up and login keys per domain. | | `accounts.admin_emails` | any | no | | Email addresses whose accounts become admins. | | `accounts.allow_password` | boolean or null | no | | | | `accounts.allow_passwordless` | boolean or null | no | | | | `accounts.federated_login` | boolean or null | no | | | | `accounts.identity_providers` | any | no | | Identity provider ids offered on login; empty offers every enabled one. | | `accounts.invalid_email_domains` | any | no | | Email domains rejected on sign-up. | | `accounts.invalid_usernames` | any | no | | Usernames that cannot be registered. | | `accounts.limits` | object or null | no | | Per collection: {"<collection>": {"max_count": n}} with -1 = unlimited and 0 = disabled. Collections: access_tokens, buckets, dashboards, devices, endpoints, plugins, projects, projects_members, storages, alarms_rules, alarms_instances, syncs, types, groups, products, proxies, oauth_clients, identity_providers (default 0: set it to enable them). Also buckets.retention {period, unit} and buckets / endpoints min_interval. Accounts can override them with their own limits. | | `accounts.max_password_length` | integer or string or null | no | | Default 48. | | `accounts.min_password_length` | integer or string or null | no | | Default 8. | | `accounts.public_sign_up` | boolean or null | no | | | | `accounts.public_sign_up_role` | string or null | no | | user or member. | | `accounts.require_2fa` | boolean or null | no | | | | `accounts.require_email_verification` | boolean or null | no | | | | `accounts.required_email_domains` | any | no | | Only these email domains can sign up. | | `buckets` | object or null | no | | | | `buckets.export` | object or null | no | | Where bucket exports are written: type filesystem ({filesystem: {export_path}}) or s3 ({s3: {bucket_id, aws_access_key_id, aws_secret_access_key, aws_region}}). | | `buckets.export.type` | string or null | no | | filesystem or s3. | | `buckets.storage` | object or null | no | | Where bucket data is stored: default is mongodb, influxdb or dynamodb, each with its own connection settings (mongodb {connection_string, max_retention, default_retention}, influxdb {host, port, username, password}, dynamodb {table_name, aws_access_key_id, aws_secret_access_key, aws_region}). | | `buckets.storage.default` | string or null | no | | mongodb, influxdb or dynamodb. | | `deployment` | object or null | no | | | | `deployment.contact_email` | string or null | no | | The account registered with this email becomes admin; also `{{admin}}` in email templates. | | `deployment.content_security_policy` | string or null | no | | | | `deployment.disable_swagger` | boolean or null | no | | | | `deployment.x_frame_options` | string or null | no | | Default SAMEORIGIN. | | `email` | object or null | no | | Server mail settings, used when a brand has no custom email. | | `email.from` | string or null | no | | Sender address. | | `email.from_name` | string or null | no | | | | `email.ses` | object or null | no | | | | `email.ses.aws_access_key_id` | string or null | no | | | | `email.ses.aws_region` | string or null | no | | | | `email.ses.aws_secret_access_key` | string or null | no | | | | `email.smtp` | object or null | no | | | | `email.smtp.host` | string or null | no | | | | `email.smtp.password` | string or null | no | | | | `email.smtp.port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | As a string, e.g. "587". | | `email.smtp.secure` | boolean or null | no | | true: implicit TLS (465); false: STARTTLS (587). | | `email.smtp.username` | string or null | no | | | | `email.type` | string or null | no | | smtp or ses. | | `http_server` | object or null | no | | HTTP API and console. | | `http_server.address` | string or null | no | | Listening address, e.g. 0.0.0.0. | | `http_server.enabled` | boolean or null | no | | | | `http_server.port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | e.g. "80". | | `http_server.ssl_port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | e.g. "443". | | `mqtt_server` | object or null | no | | MQTT broker for devices. | | `mqtt_server.address` | string or null | no | | | | `mqtt_server.enabled` | boolean or null | no | | | | `mqtt_server.port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | e.g. "1883". | | `mqtt_server.ssl_port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | e.g. "8883". | | `proxies` | object or null | no | | | | `proxies.dynamic_port_range_end` | integer or null | no | | Last one (default 51000). | | `proxies.dynamic_port_range_start` | integer or null | no | | First port given to proxies without a fixed port (default 50000). | | `scripting_engine` | object or null | no | | {"nodejs": {"enabled": true}}: JavaScript for product scripts. | | `ssl` | object or null | no | | | | `ssl.client_ca_certs` | string or null | no | | PEM certificates to accept as client certificates. | | `ssl.ssl_ciphers` | string or null | no | | OpenSSL cipher list. | | `ssl.ssl_enable_legacy_protocols` | boolean or null | no | | | | `ssl.ssl_prefer_server_ciphers` | boolean or null | no | | | | `thing_server` | object or null | no | | IOTMP server for devices. | | `thing_server.address` | string or null | no | | | | `thing_server.enabled` | boolean or null | no | | | | `thing_server.port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | e.g. "25200". | | `thing_server.port_v2` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | IOTMP v2, default "25204". | | `thing_server.ssl_port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | e.g. "25202". | | `thing_server.ssl_port_v2` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | IOTMP v2 over TLS, default "25206". | **Example request**: Change the MQTT ports ```bash curl -X PUT 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/settings' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "mqtt_server": { "port": "1884", "ssl_port": "8884" } }' ``` **Example body**: Enable projects, members and identity providers ```json { "accounts": { "limits": { "identity_providers": { "max_count": 5 }, "projects": { "max_count": -1 }, "projects_members": { "max_count": -1 } } } } ``` **Example body**: Remove a custom setting (back to the provider value) ```json { "deployment": { "x_frame_options": null } } ``` **Example body**: Send server emails with SMTP ```json { "email": { "from": "noreply@example.com", "from_name": "Example IoT", "smtp": { "host": "smtp.example.com", "password": "app-password", "port": "587", "secure": false, "username": "noreply@example.com" }, "type": "smtp" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/domains.md # Domains > REST API reference for Domains: add and verify custom domains for the console. 6 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/domains` - **Request:** GET /v1/domains - **Operation:** ListDomains - **Operation ID:** `Domain_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/domains' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090747, "description": "Console and API for Example customers", "domain": "iot.example.com", "modified": 1792263090747 } ] ``` ## `POST /v1/domains` - **Request:** POST /v1/domains - **Operation:** CreateDomain - **Operation ID:** `Domain_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `domain` | string | yes | Pattern: `^([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?$` | Hostname to serve with its own TLS certificate, e.g. iot.example.com. Before verifying, point it to this server (A/AAAA record to its IP, or CNAME to its hostname) and make sure port 80 is reachable from the internet: POST /v1/domains/{domain}/verify gets a Let's Encrypt certificate through an HTTP-01 challenge (a \*.wildcard needs the DNS-01 challenge, only on Thinger-hosted servers). Certificates renew automatically while the DNS keeps pointing here. Brand the console on it by creating a brand with the same id. | | `name` | string | no | | | **Example request**: Custom domain ```bash curl -X POST 'https://YOUR_SERVER/v1/domains' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Console and API for Example customers", "domain": "iot.example.com" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/domains/{domain}` - **Request:** GET /v1/domains/{domain} - **Operation:** ReadDomainConfig - **Operation ID:** `Domain_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `domain` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/domains/YOUR_DOMAIN' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Custom domain) ```json { "created": 1792263090747, "description": "Console and API for Example customers", "domain": "iot.example.com", "modified": 1792263090747 } ``` ## `PUT /v1/domains/{domain}` - **Request:** PUT /v1/domains/{domain} - **Operation:** UpdateDomain - **Operation ID:** `Domain_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `domain` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `name` | string | no | | | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/domains/YOUR_DOMAIN' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Console and API for Example customers", "domain": "iot.example.com" }' ``` **Example body**: Update 'description' ```json { "description": "Console and API for Example customers" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/domains/{domain}` - **Request:** DELETE /v1/domains/{domain} - **Operation:** DeleteDomain - **Operation ID:** `Domain_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `domain` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/domains/YOUR_DOMAIN' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/domains/{domain}/verify` - **Request:** POST /v1/domains/{domain}/verify - **Operation:** VerifyDomain - **Operation ID:** `Domain_Verify` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `domain` | path | string | yes | | **Request body** (`application/json`, required) A JSON object. **Example request** (skeleton generated from the schema: required fields only, neutral values) ```bash curl -X POST 'https://YOUR_SERVER/v1/domains/YOUR_DOMAIN/verify' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{}' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/brands.md # Brands > REST API reference for Brands: manage the brands of an instance and test their email settings. 7 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/brands` - **Request:** GET /v1/brands - **Operation:** ListBrands - **Operation ID:** `Brand_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/brands' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "brand": "iot.example.com", "created": 1792263090749, "description": "Console for Example customers", "enabled": true, "modified": 1792263090749, "name": "Example IoT" } ] ``` ## `POST /v1/brands` - **Request:** POST /v1/brands - **Operation:** CreateBrand - **Operation ID:** `Brand_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `brand` | string | yes | Pattern: `^([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+(?:\.[a-zA-Z]{2,11})?$` | The domain the brand applies to (e.g. iot.example.com): the console is branded for requests to that host. Point the domain to this server and register it in domains to get its certificate. | | `config` | object | no | | Look and behaviour of the console when it is opened on the brand domain. With PUT it replaces the whole stored config (and images missing from it are deleted); PATCH merges it into the stored one. | | `config.accounts` | object | no | | Sign-up and login on this domain. Each key overrides the server setting of the same name (host settings, accounts.\*). | | `config.accounts.allow_password` | boolean | no | | Password login (default true). | | `config.accounts.allow_passwordless` | boolean | no | | Passkey login. | | `config.accounts.cross_sign_in` | boolean | no | | false: only accounts created on this domain can sign in here (default true). | | `config.accounts.federated_login` | boolean | no | | Show the identity provider buttons. | | `config.accounts.identity_providers` | array of any | no | | Identity provider ids offered on this domain; empty offers every enabled one. | | `config.accounts.no_robot` | object | no | | reCAPTCHA on sign-up. The secret is only returned to admins. | | `config.accounts.no_robot.enabled` | boolean | no | | | | `config.accounts.no_robot.recaptcha` | object | no | | | | `config.accounts.no_robot.recaptcha.secret` | string | no | | | | `config.accounts.public_sign_up` | boolean | no | | Anyone can create an account. | | `config.accounts.public_sign_up_member_owner` | string | no | | Owner (admin or domain admin) of the project new members join. | | `config.accounts.public_sign_up_member_role` | string | no | | Role id given to the new members. | | `config.accounts.public_sign_up_project` | object | no | | | | `config.accounts.public_sign_up_project.limit_bucket_access` | boolean | no | | | | `config.accounts.public_sign_up_role` | string | no | | Role of the new accounts: user or member. | | `config.accounts.require_2fa` | boolean | no | | Require a second factor. | | `config.bright_logo` | string or null | no | | Menu logo. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.copyright` | string | no | | Footer text. | | `config.dark_logo` | string or null | no | | Platform logo: login and public pages, exports. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.description` | string | no | | Meta description (also og:description). | | `config.email` | string | no | | Support address shown in the menu (mailto). Not the sender of emails: see the brand email. | | `config.favicon` | string or null | no | | Browser icon. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.icon` | string or null | no | | Menu icon when the menu is folded. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.index_scripts` | string | no | | Raw HTML/JS injected in the page head (analytics…). Empty uses the default tag manager. | | `config.keywords` | string | no | | Meta keywords. | | `config.login` | object | no | | Login page. | | `config.login.background_color` | string | no | | CSS color. | | `config.login.background_image` | string | no | | Image URL. | | `config.login.background_style` | string | no | | Extra CSS as "property:value;property:value" (values cannot contain ':'). | | `config.login.box_class` | string | no | | Position of the login box: login-center, login-left or login-right. | | `config.login.box_style` | string | no | | Inline CSS of the login box. | | `config.name` | string | no | | Company name, used as title prefix and logo alt text. | | `config.product_types` | array of object | no | | Options of the product type selector. | | `config.product_types[].label` | string | no | | | | `config.product_types[].value` | string | no | | | | `config.pwa` | object | no | | Web app manifest (installable app). Served as is at /manifest.webmanifest. | | `config.pwa.background_color` | string | no | | | | `config.pwa.display` | string | no | | e.g. standalone. | | `config.pwa.icons` | array of object | no | | 192x192 and 512x512 icons, each for purpose any and maskable. | | `config.pwa.icons[].purpose` | string | no | | any or maskable. | | `config.pwa.icons[].sizes` | string | no | | e.g. 192x192. | | `config.pwa.icons[].src` | string or null | no | | data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.pwa.icons[].type` | string | no | | e.g. image/png. | | `config.pwa.name` | string | no | | | | `config.pwa.short_name` | string | no | | | | `config.pwa.start_url` | string | no | | | | `config.pwa.theme_color` | string | no | | CSS color, also the browser theme color. | | `config.share_image` | string or null | no | | Image for link previews (og:image). data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.show_community` | boolean | no | | Show the community links in the menu (default true). | | `config.show_version` | boolean | no | | Show the server version (default true). | | `config.style` | object | no | | | | `config.style.topBar` | object | no | | Console top bar. | | `config.style.topBar.background` | string | no | | CSS color. | | `config.style.topBar.color` | string | no | | CSS color of the text and icons. | | `config.title` | string | no | | Page title (also og:title). | | `config.url` | string | no | | Link of the logo on the login and public pages. | | `description` | string | no | | | | `enabled` | boolean | no | | | | `name` | string | no | | | **Example request**: Brand for a domain ```bash curl -X POST 'https://YOUR_SERVER/v1/brands' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "brand": "iot.example.com", "config": { "accounts": { "allow_password": true, "public_sign_up": false }, "copyright": "© Example Inc.", "email": "support@example.com", "login": { "background_color": "#132533", "box_class": "login-center" }, "name": "Example", "show_community": false, "style": { "topBar": { "background": "#132533", "color": "#ffffff" } }, "title": "Example IoT Console", "url": "https://www.example.com" }, "description": "Console for Example customers", "enabled": true, "name": "Example IoT" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/brands/{brand}` - **Request:** GET /v1/brands/{brand} - **Operation:** ReadBrandConfig - **Operation ID:** `Brand_ReadConfig` - **Authentication:** none, public operation **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `brand` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/brands/YOUR_BRAND' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | **Response example** (200, Brand for a domain) ```json { "brand": "iot.example.com", "config": { "accounts": { "allow_password": true, "public_sign_up": false }, "copyright": "© Example Inc.", "email": "support@example.com", "login": { "background_color": "#132533", "box_class": "login-center" }, "name": "Example", "show_community": false, "style": { "topBar": { "background": "#132533", "color": "#ffffff" } }, "title": "Example IoT Console", "url": "https://www.example.com" }, "created": 1792263090749, "description": "Console for Example customers", "enabled": true, "modified": 1792263090749, "name": "Example IoT" } ``` ## `PUT /v1/brands/{brand}` - **Request:** PUT /v1/brands/{brand} - **Operation:** UpdateBrand - **Operation ID:** `Brand_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `brand` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | Look and behaviour of the console when it is opened on the brand domain. With PUT it replaces the whole stored config (and images missing from it are deleted); PATCH merges it into the stored one. | | `config.accounts` | object | no | | Sign-up and login on this domain. Each key overrides the server setting of the same name (host settings, accounts.\*). | | `config.accounts.allow_password` | boolean | no | | Password login (default true). | | `config.accounts.allow_passwordless` | boolean | no | | Passkey login. | | `config.accounts.cross_sign_in` | boolean | no | | false: only accounts created on this domain can sign in here (default true). | | `config.accounts.federated_login` | boolean | no | | Show the identity provider buttons. | | `config.accounts.identity_providers` | array of any | no | | Identity provider ids offered on this domain; empty offers every enabled one. | | `config.accounts.no_robot` | object | no | | reCAPTCHA on sign-up. The secret is only returned to admins. | | `config.accounts.no_robot.enabled` | boolean | no | | | | `config.accounts.no_robot.recaptcha` | object | no | | | | `config.accounts.no_robot.recaptcha.secret` | string | no | | | | `config.accounts.public_sign_up` | boolean | no | | Anyone can create an account. | | `config.accounts.public_sign_up_member_owner` | string | no | | Owner (admin or domain admin) of the project new members join. | | `config.accounts.public_sign_up_member_role` | string | no | | Role id given to the new members. | | `config.accounts.public_sign_up_project` | object | no | | | | `config.accounts.public_sign_up_project.limit_bucket_access` | boolean | no | | | | `config.accounts.public_sign_up_role` | string | no | | Role of the new accounts: user or member. | | `config.accounts.require_2fa` | boolean | no | | Require a second factor. | | `config.bright_logo` | string or null | no | | Menu logo. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.copyright` | string | no | | Footer text. | | `config.dark_logo` | string or null | no | | Platform logo: login and public pages, exports. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.description` | string | no | | Meta description (also og:description). | | `config.email` | string | no | | Support address shown in the menu (mailto). Not the sender of emails: see the brand email. | | `config.favicon` | string or null | no | | Browser icon. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.icon` | string or null | no | | Menu icon when the menu is folded. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.index_scripts` | string | no | | Raw HTML/JS injected in the page head (analytics…). Empty uses the default tag manager. | | `config.keywords` | string | no | | Meta keywords. | | `config.login` | object | no | | Login page. | | `config.login.background_color` | string | no | | CSS color. | | `config.login.background_image` | string | no | | Image URL. | | `config.login.background_style` | string | no | | Extra CSS as "property:value;property:value" (values cannot contain ':'). | | `config.login.box_class` | string | no | | Position of the login box: login-center, login-left or login-right. | | `config.login.box_style` | string | no | | Inline CSS of the login box. | | `config.name` | string | no | | Company name, used as title prefix and logo alt text. | | `config.product_types` | array of object | no | | Options of the product type selector. | | `config.product_types[].label` | string | no | | | | `config.product_types[].value` | string | no | | | | `config.pwa` | object | no | | Web app manifest (installable app). Served as is at /manifest.webmanifest. | | `config.pwa.background_color` | string | no | | | | `config.pwa.display` | string | no | | e.g. standalone. | | `config.pwa.icons` | array of object | no | | 192x192 and 512x512 icons, each for purpose any and maskable. | | `config.pwa.icons[].purpose` | string | no | | any or maskable. | | `config.pwa.icons[].sizes` | string | no | | e.g. 192x192. | | `config.pwa.icons[].src` | string or null | no | | data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.pwa.icons[].type` | string | no | | e.g. image/png. | | `config.pwa.name` | string | no | | | | `config.pwa.short_name` | string | no | | | | `config.pwa.start_url` | string | no | | | | `config.pwa.theme_color` | string | no | | CSS color, also the browser theme color. | | `config.share_image` | string or null | no | | Image for link previews (og:image). data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.show_community` | boolean | no | | Show the community links in the menu (default true). | | `config.show_version` | boolean | no | | Show the server version (default true). | | `config.style` | object | no | | | | `config.style.topBar` | object | no | | Console top bar. | | `config.style.topBar.background` | string | no | | CSS color. | | `config.style.topBar.color` | string | no | | CSS color of the text and icons. | | `config.title` | string | no | | Page title (also og:title). | | `config.url` | string | no | | Link of the logo on the login and public pages. | | `description` | string | no | | | | `email` | object | no | | Emails sent to accounts of this domain (verification, password…). With PUT it replaces the whole stored email config; PATCH merges it. Read it with GET /v1/brands/{brand}/email and try a template with POST /v1/brands/{brand}/email/test. | | `email.custom` | boolean | no | | true: send with `settings` instead of the server mail settings. | | `email.settings` | object | no | | | | `email.settings.from` | string | no | | Sender address. | | `email.settings.from_name` | string | no | | Sender name. | | `email.settings.ses` | object | no | | | | `email.settings.ses.aws_access_key_id` | string | no | | | | `email.settings.ses.aws_region` | string | no | | e.g. eu-west-1. | | `email.settings.ses.aws_secret_access_key` | string | no | | | | `email.settings.smtp` | object | no | | | | `email.settings.smtp.host` | string | no | | | | `email.settings.smtp.password` | string | no | | | | `email.settings.smtp.port` | string or integer | no | Pattern: `^[0-9]{1,5}$` | As a string, e.g. "587" (numbers are ignored by the server). | | `email.settings.smtp.secure` | boolean | no | | true: implicit TLS (usually port 465); false: the server must offer STARTTLS (usually 587). | | `email.settings.smtp.username` | string | no | | | | `email.settings.type` | string | no | | smtp or ses. | | `email.templates` | object | no | | Per template: email_verification, forgot_password, create_password, device_disabled. Missing fields use the defaults. Subject and body may use `{{code}}` (the token for the link), `{{user}}`, `{{email}}`, `{{host}}`, `{{admin}}`, `{{host_url}}` and, in device_disabled, `{{device}}`. Links: `{{host_url}}`/verify_email?code=`{{code}}`, `{{host_url}}`/password?code=`{{code}}` (forgot_password), `{{host_url}}`/create_password?code=`{{code}}`. `{{name}}`, `{{url}}`, `{{logo}}` and `{{description}}` only exist in the built-in defaults: in a custom template write the brand name and the logo URL (e.g. https://<brand>/brand/images/dark_logo.png) directly. The 'enabled' flag is not enforced yet. | | `email.templates.create_password` | object | no | | | | `email.templates.create_password.body` | string | no | | HTML. | | `email.templates.create_password.enabled` | boolean or string | no | | The built-in defaults carry it as a string. | | `email.templates.create_password.from` | string | no | | | | `email.templates.create_password.from_name` | string | no | | | | `email.templates.create_password.subject` | string | no | | | | `email.templates.device_disabled` | object | no | | | | `email.templates.device_disabled.body` | string | no | | HTML. | | `email.templates.device_disabled.enabled` | boolean or string | no | | The built-in defaults carry it as a string. | | `email.templates.device_disabled.from` | string | no | | | | `email.templates.device_disabled.from_name` | string | no | | | | `email.templates.device_disabled.subject` | string | no | | | | `email.templates.email_verification` | object | no | | | | `email.templates.email_verification.body` | string | no | | HTML. | | `email.templates.email_verification.enabled` | boolean or string | no | | The built-in defaults carry it as a string. | | `email.templates.email_verification.from` | string | no | | | | `email.templates.email_verification.from_name` | string | no | | | | `email.templates.email_verification.subject` | string | no | | | | `email.templates.forgot_password` | object | no | | | | `email.templates.forgot_password.body` | string | no | | HTML. | | `email.templates.forgot_password.enabled` | boolean or string | no | | The built-in defaults carry it as a string. | | `email.templates.forgot_password.from` | string | no | | | | `email.templates.forgot_password.from_name` | string | no | | | | `email.templates.forgot_password.subject` | string | no | | | | `enabled` | boolean | no | | | | `name` | string | no | | | **Example request**: Replace the whole config (logos missing from it are deleted) ```bash curl -X PUT 'https://YOUR_SERVER/v1/brands/YOUR_BRAND' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "bright_logo": "/brand/images/bright_logo.png", "dark_logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==", "name": "Example", "style": { "topBar": { "background": "#132533", "color": "#ffffff" } }, "title": "Example IoT Console" } }' ``` **Example body**: Send emails with Amazon SES ```json { "email": { "custom": true, "settings": { "from": "noreply@example.com", "from_name": "Example IoT", "ses": { "aws_access_key_id": "AKIA…", "aws_region": "eu-west-1", "aws_secret_access_key": "…" }, "type": "ses" } } } ``` **Example body**: Send emails with SMTP ```json { "email": { "custom": true, "settings": { "from": "noreply@example.com", "from_name": "Example IoT", "smtp": { "host": "smtp.example.com", "password": "app-password", "port": "587", "secure": false, "username": "noreply@example.com" }, "type": "smtp" } } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `PATCH /v1/brands/{brand}` - **Request:** PATCH /v1/brands/{brand} - **Operation:** UpdateBrand - **Operation ID:** `Brand_Patch` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `brand` | path | string | yes | | **Request body** (`application/json`, required) Partial update: only the fields sent change; config and email are merged into the stored ones (RFC 7386 merge patch: a null value removes a key). Images left out are kept. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object or null | no | | Look and behaviour of the console when it is opened on the brand domain. With PUT it replaces the whole stored config (and images missing from it are deleted); PATCH merges it into the stored one. | | `config.accounts` | object or null | no | | Sign-up and login on this domain. Each key overrides the server setting of the same name (host settings, accounts.\*). | | `config.accounts.allow_password` | boolean or null | no | | Password login (default true). | | `config.accounts.allow_passwordless` | boolean or null | no | | Passkey login. | | `config.accounts.cross_sign_in` | boolean or null | no | | false: only accounts created on this domain can sign in here (default true). | | `config.accounts.federated_login` | boolean or null | no | | Show the identity provider buttons. | | `config.accounts.identity_providers` | array of any or null | no | | Identity provider ids offered on this domain; empty offers every enabled one. | | `config.accounts.no_robot` | object or null | no | | reCAPTCHA on sign-up. The secret is only returned to admins. | | `config.accounts.no_robot.enabled` | boolean or null | no | | | | `config.accounts.no_robot.recaptcha` | object or null | no | | | | `config.accounts.no_robot.recaptcha.secret` | string or null | no | | | | `config.accounts.public_sign_up` | boolean or null | no | | Anyone can create an account. | | `config.accounts.public_sign_up_member_owner` | string or null | no | | Owner (admin or domain admin) of the project new members join. | | `config.accounts.public_sign_up_member_role` | string or null | no | | Role id given to the new members. | | `config.accounts.public_sign_up_project` | object or null | no | | | | `config.accounts.public_sign_up_project.limit_bucket_access` | boolean or null | no | | | | `config.accounts.public_sign_up_role` | string or null | no | | Role of the new accounts: user or member. | | `config.accounts.require_2fa` | boolean or null | no | | Require a second factor. | | `config.bright_logo` | string or null | no | | Menu logo. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.copyright` | string or null | no | | Footer text. | | `config.dark_logo` | string or null | no | | Platform logo: login and public pages, exports. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.description` | string or null | no | | Meta description (also og:description). | | `config.email` | string or null | no | | Support address shown in the menu (mailto). Not the sender of emails: see the brand email. | | `config.favicon` | string or null | no | | Browser icon. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.icon` | string or null | no | | Menu icon when the menu is folded. data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.index_scripts` | string or null | no | | Raw HTML/JS injected in the page head (analytics…). Empty uses the default tag manager. | | `config.keywords` | string or null | no | | Meta keywords. | | `config.login` | object or null | no | | Login page. | | `config.login.background_color` | string or null | no | | CSS color. | | `config.login.background_image` | string or null | no | | Image URL. | | `config.login.background_style` | string or null | no | | Extra CSS as "property:value;property:value" (values cannot contain ':'). | | `config.login.box_class` | string or null | no | | Position of the login box: login-center, login-left or login-right. | | `config.login.box_style` | string or null | no | | Inline CSS of the login box. | | `config.name` | string or null | no | | Company name, used as title prefix and logo alt text. | | `config.product_types` | array of object or null or null | no | | Options of the product type selector. | | `config.product_types[].label` | string or null | no | | | | `config.product_types[].value` | string or null | no | | | | `config.pwa` | object or null | no | | Web app manifest (installable app). Served as is at /manifest.webmanifest. | | `config.pwa.background_color` | string or null | no | | | | `config.pwa.display` | string or null | no | | e.g. standalone. | | `config.pwa.icons` | array of object or null or null | no | | 192x192 and 512x512 icons, each for purpose any and maskable. | | `config.pwa.icons[].purpose` | string or null | no | | any or maskable. | | `config.pwa.icons[].sizes` | string or null | no | | e.g. 192x192. | | `config.pwa.icons[].src` | string or null | no | | data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.pwa.icons[].type` | string or null | no | | e.g. image/png. | | `config.pwa.name` | string or null | no | | | | `config.pwa.short_name` | string or null | no | | | | `config.pwa.start_url` | string or null | no | | | | `config.pwa.theme_color` | string or null | no | | CSS color, also the browser theme color. | | `config.share_image` | string or null | no | | Image for link previews (og:image). data:image/png;base64,… or data:image/webp;base64,… to replace the image (stored under /brand/images/), the stored /brand/images/… URL to keep it, "" or null to remove it. | | `config.show_community` | boolean or null | no | | Show the community links in the menu (default true). | | `config.show_version` | boolean or null | no | | Show the server version (default true). | | `config.style` | object or null | no | | | | `config.style.topBar` | object or null | no | | Console top bar. | | `config.style.topBar.background` | string or null | no | | CSS color. | | `config.style.topBar.color` | string or null | no | | CSS color of the text and icons. | | `config.title` | string or null | no | | Page title (also og:title). | | `config.url` | string or null | no | | Link of the logo on the login and public pages. | | `description` | string | no | | | | `email` | object or null | no | | Emails sent to accounts of this domain (verification, password…). With PUT it replaces the whole stored email config; PATCH merges it. Read it with GET /v1/brands/{brand}/email and try a template with POST /v1/brands/{brand}/email/test. | | `email.custom` | boolean or null | no | | true: send with `settings` instead of the server mail settings. | | `email.settings` | object or null | no | | | | `email.settings.from` | string or null | no | | Sender address. | | `email.settings.from_name` | string or null | no | | Sender name. | | `email.settings.ses` | object or null | no | | | | `email.settings.ses.aws_access_key_id` | string or null | no | | | | `email.settings.ses.aws_region` | string or null | no | | e.g. eu-west-1. | | `email.settings.ses.aws_secret_access_key` | string or null | no | | | | `email.settings.smtp` | object or null | no | | | | `email.settings.smtp.host` | string or null | no | | | | `email.settings.smtp.password` | string or null | no | | | | `email.settings.smtp.port` | string or integer or null | no | Pattern: `^[0-9]{1,5}$` | As a string, e.g. "587" (numbers are ignored by the server). | | `email.settings.smtp.secure` | boolean or null | no | | true: implicit TLS (usually port 465); false: the server must offer STARTTLS (usually 587). | | `email.settings.smtp.username` | string or null | no | | | | `email.settings.type` | string or null | no | | smtp or ses. | | `email.templates` | object or null | no | | Per template: email_verification, forgot_password, create_password, device_disabled. Missing fields use the defaults. Subject and body may use `{{code}}` (the token for the link), `{{user}}`, `{{email}}`, `{{host}}`, `{{admin}}`, `{{host_url}}` and, in device_disabled, `{{device}}`. Links: `{{host_url}}`/verify_email?code=`{{code}}`, `{{host_url}}`/password?code=`{{code}}` (forgot_password), `{{host_url}}`/create_password?code=`{{code}}`. `{{name}}`, `{{url}}`, `{{logo}}` and `{{description}}` only exist in the built-in defaults: in a custom template write the brand name and the logo URL (e.g. https://<brand>/brand/images/dark_logo.png) directly. The 'enabled' flag is not enforced yet. | | `email.templates.create_password` | object or null | no | | | | `email.templates.create_password.body` | string or null | no | | HTML. | | `email.templates.create_password.enabled` | boolean or string or null | no | | The built-in defaults carry it as a string. | | `email.templates.create_password.from` | string or null | no | | | | `email.templates.create_password.from_name` | string or null | no | | | | `email.templates.create_password.subject` | string or null | no | | | | `email.templates.device_disabled` | object or null | no | | | | `email.templates.device_disabled.body` | string or null | no | | HTML. | | `email.templates.device_disabled.enabled` | boolean or string or null | no | | The built-in defaults carry it as a string. | | `email.templates.device_disabled.from` | string or null | no | | | | `email.templates.device_disabled.from_name` | string or null | no | | | | `email.templates.device_disabled.subject` | string or null | no | | | | `email.templates.email_verification` | object or null | no | | | | `email.templates.email_verification.body` | string or null | no | | HTML. | | `email.templates.email_verification.enabled` | boolean or string or null | no | | The built-in defaults carry it as a string. | | `email.templates.email_verification.from` | string or null | no | | | | `email.templates.email_verification.from_name` | string or null | no | | | | `email.templates.email_verification.subject` | string or null | no | | | | `email.templates.forgot_password` | object or null | no | | | | `email.templates.forgot_password.body` | string or null | no | | HTML. | | `email.templates.forgot_password.enabled` | boolean or string or null | no | | The built-in defaults carry it as a string. | | `email.templates.forgot_password.from` | string or null | no | | | | `email.templates.forgot_password.from_name` | string or null | no | | | | `email.templates.forgot_password.subject` | string or null | no | | | | `enabled` | boolean | no | | | | `name` | string | no | | | **Example request**: Change the SMTP password ```bash curl -X PATCH 'https://YOUR_SERVER/v1/brands/YOUR_BRAND' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "email": { "settings": { "smtp": { "password": "new-app-password" } } } }' ``` **Example body**: Change the title only ```json { "config": { "title": "New Console Title" } } ``` **Example body**: Disable public sign-up ```json { "config": { "accounts": { "public_sign_up": false } } } ``` **Example body**: Remove a logo ```json { "config": { "icon": null } } ``` **Example body**: Replace a logo ```json { "config": { "dark_logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==" } } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/brands/{brand}` - **Request:** DELETE /v1/brands/{brand} - **Operation:** DeleteBrand - **Operation ID:** `Brand_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `brand` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/brands/YOUR_BRAND' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `POST /v1/brands/{brand}/email/test` - **Request:** POST /v1/brands/{brand}/email/test - **Operation:** TestBrandEmail - **Operation ID:** `Brand_TestEmail` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `brand` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `template` | string | yes | Pattern: `^[a-zA-Z0-9_-]{1,32}$` | A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters. | **Example request**: Password reset email ```bash curl -X POST 'https://YOUR_SERVER/v1/brands/YOUR_BRAND/email/test' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "template": "forgot_password" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/oauth-clients.md # OAuth2 Clients > REST API reference for OAuth2 Clients: manage the OAuth2 clients registered on an instance. 5 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/oauth_clients` - **Request:** GET /v1/oauth_clients - **Operation:** ListOauthClients - **Operation ID:** `OauthClient_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/oauth_clients' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090752, "description": "Mobile and web app of Example", "enabled": true, "modified": 1792263090752, "name": "Example App", "oauth_client": "example_app" } ] ``` ## `POST /v1/oauth_clients` - **Request:** POST /v1/oauth_clients - **Operation:** CreateOauthClient - **Operation ID:** `OauthClient_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `enabled` | boolean | no | | Disabled clients cannot authorize nor get tokens. | | `name` | string | yes | | Application name shown on the consent screen. | | `oauth_client` | string | yes | Pattern: `^[a-zA-Z0-9-_]{1,32}$` | Client id used by the application in the OAuth2 flows (authorization code, device flow). | | `picture` | string | no | | Logo shown on the consent screen, as a data URL. | | `prompt` | string | no | | Text of the consent screen. | | `redirect_uri` | string | yes | | Allowed redirect URIs, one per line (newline separated). The redirect_uri of each request must match one of them exactly (case-insensitive). | | `scope` | object | no | | Permissions requested for the application, as a permission tree ({"Device": {"\*": \["ReadDevice"\]}}). Informational: the token scope comes from the authorize request. | | `secret` | string | yes | | Client secret. Stored as is and returned to admins. | **Example request**: Web application ```bash curl -X POST 'https://YOUR_SERVER/v1/oauth_clients' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Mobile and web app of Example", "enabled": true, "name": "Example App", "oauth_client": "example_app", "prompt": "Example App wants to read your devices", "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback", "scope": { "Device": { "*": [ "ListDevices", "ReadDevice" ] } }, "secret": "change-this-long-random-secret" }' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/oauth_clients/{oauth_client}` - **Request:** GET /v1/oauth_clients/{oauth_client} - **Operation:** ReadOauthClientConfig - **Operation ID:** `OauthClient_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `oauth_client` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/oauth_clients/YOUR_OAUTH_CLIENT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Web application) ```json { "created": 1792263090752, "description": "Mobile and web app of Example", "enabled": true, "modified": 1792263090752, "name": "Example App", "oauth_client": "example_app", "prompt": "Example App wants to read your devices", "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback", "scope": { "Device": { "*": [ "ListDevices", "ReadDevice" ] } }, "secret": "change-this-long-random-secret" } ``` ## `PUT /v1/oauth_clients/{oauth_client}` - **Request:** PUT /v1/oauth_clients/{oauth_client} - **Operation:** UpdateOauthClient - **Operation ID:** `OauthClient_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `oauth_client` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `description` | string | no | | | | `enabled` | boolean | no | | | | `name` | string | no | | | | `picture` | string | no | | | | `prompt` | string | no | | | | `redirect_uri` | string | no | | | | `scope` | object | no | | | | `secret` | string | no | | | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/oauth_clients/YOUR_OAUTH_CLIENT' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "description": "Mobile and web app of Example", "enabled": true, "name": "Example App", "oauth_client": "example_app", "prompt": "Example App wants to read your devices", "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback", "scope": { "Device": { "*": [ "ListDevices", "ReadDevice" ] } }, "secret": "change-this-long-random-secret" }' ``` **Example body**: Update 'description' ```json { "description": "Mobile and web app of Example" } ``` **Example body**: Update 'enabled' ```json { "enabled": true } ``` **Example body**: Update 'name' ```json { "name": "Example App" } ``` **Example body**: Update 'prompt' ```json { "prompt": "Example App wants to read your devices" } ``` **Example body**: Update 'redirect_uri' ```json { "redirect_uri": "https://app.example.com/oauth/callback\nhttp://localhost:4200/oauth/callback" } ``` **Example body**: Update 'scope' ```json { "scope": { "Device": { "*": [ "ListDevices", "ReadDevice" ] } } } ``` **Example body**: Update 'secret' ```json { "secret": "change-this-long-random-secret" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/oauth_clients/{oauth_client}` - **Request:** DELETE /v1/oauth_clients/{oauth_client} - **Operation:** DeleteOauthClient - **Operation ID:** `OauthClient_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `oauth_client` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/oauth_clients/YOUR_OAUTH_CLIENT' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/identity-providers.md # Identity Providers > REST API reference for Identity Providers: manage the identity providers users can sign in with. 5 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/identity_providers` - **Request:** GET /v1/identity_providers - **Operation:** ListIdentityProviders - **Operation ID:** `IdentityProvider_List` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/identity_providers' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090753, "enabled": true, "identity_provider": "google", "modified": 1792263090753, "name": "Google", "type": "oidc" }, { "created": 1792263090753, "enabled": true, "identity_provider": "entra", "modified": 1792263090753, "name": "Microsoft", "type": "oidc" } ] ``` ## `POST /v1/identity_providers` - **Request:** POST /v1/identity_providers - **Operation:** CreateIdentityProvider - **Operation ID:** `IdentityProvider_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) OpenID Connect provider for the console login. Disabled by default: set accounts.limits.identity_providers.max_count in the host settings (and restart). Register https://<brand domain>/oauth/callback as redirect URI in the provider, check it with POST /v1/identity_providers/{id}/test, and offer it on a domain with the brand config accounts.federated_login / accounts.identity_providers. | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `attribute_mapping` | object | no | | | | `attribute_mapping.company` | string | no | Default: `organization` | Claim to use for company - not a standard OIDC claim | | `attribute_mapping.email` | string | no | Default: `email` | | | `attribute_mapping.location` | string | no | Default: `locale` | Claim to use for location | | `attribute_mapping.name` | string | no | Default: `name` | | | `attribute_mapping.picture` | string | no | Default: `picture` | | | `attribute_mapping.username` | string | no | Default: `preferred_username` | Claim to use for username | | `attribute_mapping.website` | string | no | Default: `website` | Claim to use for profile URL | | `client_id` | string | yes | | OAuth2 client ID registered with the IdP | | `client_secret` | string | yes | | OAuth2 client secret | | `description` | string | no | | Optional description | | `display` | object | no | | | | `display.button_text` | string | no | | | | `display.logo` | string | no | | Logo as base64 data URL | | `domain` | string | yes | | Identity provider domain, e.g. your-tenant.us.auth0.com | | `enabled` | boolean | no | Default: `true` | | | `identity_provider` | string | yes | Pattern: `^[a-zA-Z0-9-_]{1,32}$` | Unique identifier for the identity provider | | `name` | string | yes | | Display name for the identity provider | | `provisioning` | object | no | | | | `provisioning.allowed_domains` | array of string | no | | Allowed email domains. Leave empty to allow all. | | `provisioning.email_trust_mode` | string | no | One of: `trust_idp`, `verify_with_claim`, `always_verify`
Default: `verify_with_claim` | Email verification mode | | `provisioning.mode` | string | no | One of: `auto_provision`, `match_only`
Default: `auto_provision` | User provisioning mode | | `scopes` | array of string | no | Default: `["openid","profile","email"]` | OAuth2 scopes to request | | `token_endpoint_auth_method` | string | no | One of: `client_secret_post`, `client_secret_basic`, `none`
Default: `client_secret_post` | Token endpoint authentication method | | `type` | string | yes | One of: `oidc` | Identity provider type - currently only OIDC supported | **Example request**: Google, existing accounts only ```bash curl -X POST 'https://YOUR_SERVER/v1/identity_providers' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "client_id": ".apps.googleusercontent.com", "client_secret": "", "display": { "button_text": "Sign in with Google" }, "domain": "accounts.google.com", "enabled": true, "identity_provider": "google", "name": "Google", "provisioning": { "email_trust_mode": "verify_with_claim", "mode": "match_only" }, "type": "oidc" }' ``` **Example body**: Microsoft Entra ID ```json { "client_id": "", "client_secret": "", "display": { "button_text": "Sign in with Microsoft" }, "domain": "login.microsoftonline.com//v2.0", "enabled": true, "identity_provider": "entra", "name": "Microsoft", "provisioning": { "allowed_domains": [ "example.com" ], "email_trust_mode": "trust_idp", "mode": "auto_provision" }, "scopes": [ "openid", "profile", "email" ], "type": "oidc" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/identity_providers/{identity_provider}` - **Request:** GET /v1/identity_providers/{identity_provider} - **Operation:** ReadIdentityProviderConfig - **Operation ID:** `IdentityProvider_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `identity_provider` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/identity_providers/YOUR_IDENTITY_PROVIDER' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, Google, existing accounts only) ```json { "client_id": ".apps.googleusercontent.com", "client_secret": "", "created": 1792263090753, "display": { "button_text": "Sign in with Google" }, "domain": "accounts.google.com", "enabled": true, "identity_provider": "google", "modified": 1792263090753, "name": "Google", "provisioning": { "email_trust_mode": "verify_with_claim", "mode": "match_only" }, "type": "oidc" } ``` **Response example** (200, Microsoft Entra ID) ```json { "client_id": "", "client_secret": "", "created": 1792263090753, "display": { "button_text": "Sign in with Microsoft" }, "domain": "login.microsoftonline.com//v2.0", "enabled": true, "identity_provider": "entra", "modified": 1792263090753, "name": "Microsoft", "provisioning": { "allowed_domains": [ "example.com" ], "email_trust_mode": "trust_idp", "mode": "auto_provision" }, "scopes": [ "openid", "profile", "email" ], "type": "oidc" } ``` ## `PUT /v1/identity_providers/{identity_provider}` - **Request:** PUT /v1/identity_providers/{identity_provider} - **Operation:** UpdateIdentityProvider - **Operation ID:** `IdentityProvider_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `identity_provider` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `attribute_mapping` | object | no | | | | `attribute_mapping.company` | string | no | | | | `attribute_mapping.email` | string | no | | | | `attribute_mapping.location` | string | no | | | | `attribute_mapping.name` | string | no | | | | `attribute_mapping.picture` | string | no | | | | `attribute_mapping.username` | string | no | | | | `attribute_mapping.website` | string | no | | | | `client_id` | string | no | | | | `client_secret` | string | no | | | | `description` | string | no | | | | `display` | object | no | | | | `display.button_text` | string | no | | | | `display.logo` | string | no | | | | `domain` | string | no | | | | `enabled` | boolean | no | | | | `name` | string | no | | | | `provisioning` | object | no | | | | `provisioning.allowed_domains` | array of string | no | | | | `provisioning.email_trust_mode` | string | no | One of: `trust_idp`, `verify_with_claim`, `always_verify` | | | `provisioning.mode` | string | no | One of: `auto_provision`, `match_only` | | | `scopes` | array of string | no | | | | `token_endpoint_auth_method` | string | no | One of: `client_secret_post`, `client_secret_basic`, `none` | | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/identity_providers/YOUR_IDENTITY_PROVIDER' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "client_id": ".apps.googleusercontent.com", "client_secret": "", "display": { "button_text": "Sign in with Google" }, "domain": "accounts.google.com", "enabled": true, "identity_provider": "google", "name": "Google", "provisioning": { "email_trust_mode": "verify_with_claim", "mode": "match_only" }, "type": "oidc" }' ``` **Example body**: Update 'client_id' ```json { "client_id": ".apps.googleusercontent.com" } ``` **Example body**: Update 'client_secret' ```json { "client_secret": "" } ``` **Example body**: Update 'display' ```json { "display": { "button_text": "Sign in with Google" } } ``` **Example body**: Update 'domain' ```json { "domain": "accounts.google.com" } ``` **Example body**: Update 'enabled' ```json { "enabled": true } ``` **Example body**: Update 'name' ```json { "name": "Google" } ``` **Example body**: Update 'provisioning' ```json { "provisioning": { "email_trust_mode": "verify_with_claim", "mode": "match_only" } } ``` **Example body**: Update 'type' ```json { "type": "oidc" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/identity_providers/{identity_provider}` - **Request:** DELETE /v1/identity_providers/{identity_provider} - **Operation:** DeleteIdentityProvider - **Operation ID:** `IdentityProvider_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `identity_provider` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/identity_providers/YOUR_IDENTITY_PROVIDER' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/proxies.md # Proxies > REST API reference for Proxies: manage the proxies that give external access to services of an instance. 5 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /v1/proxies` - **Request:** GET /v1/proxies - **Operation:** ListProxies - **Operation ID:** `Proxy_ListProxies` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/proxies' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200) ```json [ { "created": 1792263090786, "description": "Served at https://grafana.: the proxy id is the subdomain, and it needs a wildcard certificate", "enabled": true, "modified": 1792263090786, "name": "Grafana", "proxy": "grafana" }, { "created": 1792263090786, "description": "TCP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "TCP Proxy Name", "proxy": "tcp_proxy_id" }, { "created": 1792263090786, "description": "TCP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "TCP Proxy Name", "proxy": "tcp_proxy_id" }, { "created": 1792263090786, "description": "UDP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "UDP Proxy Name", "proxy": "udp_proxy_id" }, { "created": 1792263090786, "description": "UDP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "UDP Proxy Name", "proxy": "udp_proxy_id" } ] ``` ## `POST /v1/proxies` - **Request:** POST /v1/proxies - **Operation:** CreateProxy - **Operation ID:** `Proxy_Create` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | yes | | protocol: tcp, udp, tcp_iotmp or http_iotmp. source: {port (number), secure (TLS), routing: port \| subdomain (the proxy id becomes the subdomain of the server hostname), allowed_ips (IOTMP)}. target: {type: address \| plugin, address, plugin: {user, name}, port (number), secure, timeout (seconds, default 10)}; IOTMP protocols also take target.user and target.device. options.timeout_minutes expires sessions. port_management (default true) opens ports on Thinger-hosted servers. Creating or updating starts the listener right away; an update with a partial config replaces the stored config. | | `description` | string | no | | | | `enabled` | boolean | no | | | | `name` | string | yes | | | | `proxy` | string | yes | Pattern: `^[a-zA-Z0-9-_]{1,32}$` | | **Example request**: HTTPS Subdomain to Plugin ```bash curl -X POST 'https://YOUR_SERVER/v1/proxies' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "protocol": "tcp", "source": { "routing": "subdomain", "secure": true }, "target": { "plugin": { "name": "grafana", "user": "user_id" }, "port": 3000, "secure": false, "type": "plugin" } }, "description": "Served at https://grafana.: the proxy id is the subdomain, and it needs a wildcard certificate", "enabled": true, "name": "Grafana", "proxy": "grafana" }' ``` **Example body**: TCP Proxy to Host ```json { "config": { "protocol": "tcp", "source": { "port": 8090, "secure": true }, "target": { "address": "localhost", "port": 8086, "secure": false, "type": "address" } }, "description": "TCP Proxy Description", "enabled": true, "name": "TCP Proxy Name", "proxy": "tcp_proxy_id" } ``` **Example body**: TCP Proxy to Plugin ```json { "config": { "protocol": "tcp", "source": { "port": 8090, "secure": true }, "target": { "plugin": { "name": "plugin_id", "user": "user_id" }, "port": 8086, "secure": false, "type": "plugin" } }, "description": "TCP Proxy Description", "enabled": true, "name": "TCP Proxy Name", "proxy": "tcp_proxy_id" } ``` **Example body**: UDP Proxy to Host ```json { "config": { "protocol": "udp", "source": { "port": 9000 }, "target": { "address": "localhost", "port": 9000, "type": "address" } }, "description": "UDP Proxy Description", "enabled": true, "name": "UDP Proxy Name", "proxy": "udp_proxy_id" } ``` **Example body**: UDP Proxy to Plugin ```json { "config": { "protocol": "udp", "source": { "port": 9000 }, "target": { "plugin": { "name": "plugin_id", "user": "user_id" }, "port": 9000, "type": "plugin" } }, "description": "UDP Proxy Description", "enabled": true, "name": "UDP Proxy Name", "proxy": "udp_proxy_id" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/proxies/{proxy}` - **Request:** GET /v1/proxies/{proxy} - **Operation:** ReadProxyConfig - **Operation ID:** `Proxy_ReadConfig` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `proxy` | path | string | yes | | **Example request** ```bash curl 'https://YOUR_SERVER/v1/proxies/YOUR_PROXY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | **Response example** (200, HTTPS Subdomain to Plugin) ```json { "config": { "protocol": "tcp", "source": { "routing": "subdomain", "secure": true }, "target": { "plugin": { "name": "grafana", "user": "user_id" }, "port": 3000, "secure": false, "type": "plugin" } }, "created": 1792263090786, "description": "Served at https://grafana.: the proxy id is the subdomain, and it needs a wildcard certificate", "enabled": true, "modified": 1792263090786, "name": "Grafana", "proxy": "grafana" } ``` **Response example** (200, TCP Proxy to Host) ```json { "config": { "protocol": "tcp", "source": { "port": 8090, "secure": true }, "target": { "address": "localhost", "port": 8086, "secure": false, "type": "address" } }, "created": 1792263090786, "description": "TCP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "TCP Proxy Name", "proxy": "tcp_proxy_id" } ``` **Response example** (200, TCP Proxy to Plugin) ```json { "config": { "protocol": "tcp", "source": { "port": 8090, "secure": true }, "target": { "plugin": { "name": "plugin_id", "user": "user_id" }, "port": 8086, "secure": false, "type": "plugin" } }, "created": 1792263090786, "description": "TCP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "TCP Proxy Name", "proxy": "tcp_proxy_id" } ``` **Response example** (200, UDP Proxy to Host) ```json { "config": { "protocol": "udp", "source": { "port": 9000 }, "target": { "address": "localhost", "port": 9000, "type": "address" } }, "created": 1792263090786, "description": "UDP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "UDP Proxy Name", "proxy": "udp_proxy_id" } ``` **Response example** (200, UDP Proxy to Plugin) ```json { "config": { "protocol": "udp", "source": { "port": 9000 }, "target": { "plugin": { "name": "plugin_id", "user": "user_id" }, "port": 9000, "type": "plugin" } }, "created": 1792263090786, "description": "UDP Proxy Description", "enabled": true, "modified": 1792263090786, "name": "UDP Proxy Name", "proxy": "udp_proxy_id" } ``` ## `PUT /v1/proxies/{proxy}` - **Request:** PUT /v1/proxies/{proxy} - **Operation:** UpdateProxy - **Operation ID:** `Proxy_Update` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `proxy` | path | string | yes | | **Request body** (`application/json`, required) | Field | Type | Required | Constraints | Description | | --- | --- | --- | --- | --- | | `config` | object | no | | | | `description` | string | no | | | | `enabled` | boolean | no | | | | `name` | string | no | | | **Example request**: Full Update ```bash curl -X PUT 'https://YOUR_SERVER/v1/proxies/YOUR_PROXY' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "config": { "protocol": "tcp", "source": { "routing": "subdomain", "secure": true }, "target": { "plugin": { "name": "grafana", "user": "user_id" }, "port": 3000, "secure": false, "type": "plugin" } }, "description": "Served at https://grafana.: the proxy id is the subdomain, and it needs a wildcard certificate", "enabled": true, "name": "Grafana", "proxy": "grafana" }' ``` **Example body**: Update 'config' ```json { "config": { "protocol": "tcp", "source": { "routing": "subdomain", "secure": true }, "target": { "plugin": { "name": "grafana", "user": "user_id" }, "port": 3000, "secure": false, "type": "plugin" } } } ``` **Example body**: Update 'description' ```json { "description": "Served at https://grafana.: the proxy id is the subdomain, and it needs a wildcard certificate" } ``` **Example body**: Update 'enabled' ```json { "enabled": true } ``` **Example body**: Update 'name' ```json { "name": "Grafana" } ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `DELETE /v1/proxies/{proxy}` - **Request:** DELETE /v1/proxies/{proxy} - **Operation:** DeleteProxy - **Operation ID:** `Proxy_Delete` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Parameters** | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `proxy` | path | string | yes | | **Example request** ```bash curl -X DELETE 'https://YOUR_SERVER/v1/proxies/YOUR_PROXY' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/rest-api/server.md # Server > REST API reference for Server: read the version, health, settings, statistics and OpenAPI document of the server. 10 operations. For the base URL, authentication and errors, see the [REST API overview](https://docs.thinger.io/reference/rest-api.md). ## `GET /openapi.json` - **Request:** GET /openapi.json - **Operation:** ReadServerApi - **Operation ID:** `Server_ReadApiOpenapi.json` - **Authentication:** none, public operation **Example request** ```bash curl 'https://YOUR_SERVER/openapi.json' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/server/actions` - **Request:** GET /v1/server/actions - **Operation:** ReadServerActions - **Operation ID:** `Server_ReadActions` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/actions' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/server/assets` - **Request:** GET /v1/server/assets - **Operation:** ReadServerAssets - **Operation ID:** `Server_ReadAssets` - **Authentication:** none, public operation **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/assets' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/server/buckets/backends` - **Request:** GET /v1/server/buckets/backends - **Operation:** ReadServerBucketsBackends - **Operation ID:** `Server_ReadBucketsBackends` - **Authentication:** none, public operation **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/buckets/backends' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/server/events` - **Request:** GET /v1/server/events - **Operation:** ReadServerEvents - **Operation ID:** `Server_ReadEvents` - **Authentication:** none, public operation **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/events' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/server/healthcheck` - **Request:** GET /v1/server/healthcheck - **Operation:** ReadServerHealthcheck - **Operation ID:** `Server_ReadHealthcheck` - **Authentication:** none, public operation **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/healthcheck' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/server/settings` - **Request:** GET /v1/server/settings - **Operation:** ReadServerSettings - **Operation ID:** `Server_ReadSettings` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/settings' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/server/statistics` - **Request:** GET /v1/server/statistics - **Operation:** ReadServerStatistics - **Operation ID:** `Server_ReadStatistics` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/statistics' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | ## `GET /v1/server/swagger.json` - **Request:** GET /v1/server/swagger.json - **Operation:** ReadServerApi - **Operation ID:** `Server_ReadApiSwagger.json` - **Authentication:** none, public operation **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/swagger.json' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | ## `GET /v1/server/version` - **Request:** GET /v1/server/version - **Operation:** ReadServerVersion - **Operation ID:** `Server_ReadVersion` - **Authentication:** access token, `Authorization: Bearer YOUR_TOKEN` **Example request** ```bash curl 'https://YOUR_SERVER/v1/server/version' \ -H 'Authorization: Bearer YOUR_TOKEN' ``` **Responses** | Status | Description | | --- | --- | | 200 | ok | | 401 | unauthorized | | 403 | forbidden | --- Source: https://docs.thinger.io/reference/events.md # Events > Subscribe to the realtime events of your Thinger.io account over a WebSocket, with the catalog of events, their filters and the permissions each one needs. Thinger.io emits an event whenever something happens in your account: a device connects, a record reaches a Data Bucket, an alarm fires. Open a WebSocket to receive the events you subscribe to as they happen, to keep a dashboard, an app or an integration current without polling. ## Connect Open a WebSocket to the events endpoint of your account: ```text wss://YOUR_SERVER/v2/users/YOUR_USER/events?authorization=YOUR_TOKEN ``` `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. Here `YOUR_TOKEN` is an access token of your account, or the session token of the console. The REST reference lists the endpoint as [`GET /v2/users/{user}/events`](https://docs.thinger.io/reference/rest-api/users.md#user-subscribeevents). | Query parameter | Required | Content | |---|---|---| | `authorization` | Yes, unless the token travels in an `Authorization: Bearer` header or an `authorization` cookie | The token. Browsers cannot set headers on a WebSocket, so they pass it here. | | `project` | No | A project ID. The connection works inside that project: for project members, and for access tokens bound to projects, which must use it. | The server refuses the connection with `401` when the token is not valid or has expired, and with `403` when the token cannot subscribe to events of that account or project. One connection carries any number of subscriptions. You send JSON messages to subscribe and unsubscribe; the server answers each one, and then sends the matching events. ## Subscribe Send a `register` message with the event name and its filters: ```json { "action": "register", "event": "device_state_change", "filters": { "device": "YOUR_DEVICE" } } ``` | Field | Content | |---|---| | `action` | `register`. | | `event` | An event name from the [catalog](#catalog). | | `filters` | Fields of the event and the values to match, for example `{ "device": "YOUR_DEVICE", "state": "connected" }`. Always send it; use `{}` to receive every event of that name. See [Filters](#filters). | | `params` | Optional. `{ "interval": }` limits how often stream data events (such as `device_resource_stream` with signal `data`) reach this subscription. | | `update` | Optional. `true` replaces the filters and params of an existing subscription with the same filters on this connection, instead of adding another one. | The server answers with `success` and the message it received in `request`. `registered` maps the event name to the ID of the new subscription: ```json { "success": true, "request": { "action": "register", "event": "device_state_change", "filters": { "device": "YOUR_DEVICE" } }, "registered": { "device_state_change": 3 } } ``` ## Unsubscribe Send `unregister` with the event name. With `filters`, only the subscriptions with those same filters are removed; without them, every subscription of this connection to that event: ```json { "action": "unregister", "event": "device_state_change", "filters": { "device": "YOUR_DEVICE" } } ``` ```json { "success": true, "request": { "action": "unregister", "event": "device_state_change", "filters": { "device": "YOUR_DEVICE" } }, "unregistered": { "device_state_change": 3 } } ``` To remove every subscription of the connection, send `clear`. The answer lists what was removed, also under `unregistered`: ```json { "action": "clear" } ``` ```json { "success": true, "request": { "action": "clear" }, "unregistered": { "device_state_change": [3], "bucket_write": [4] } } ``` ## Errors A refused message gets `success: false` and a `message`: ```json { "success": false, "request": { "action": "register", "event": "bucket_write", "filters": { "bucket": "climate" } }, "message": "action not allowed" } ``` | `message` | Cause | |---|---| | `invalid JSON input` | The message is not valid JSON (`request` is `null`). | | `required a JSON object` | The message is JSON, but not an object. | | `invalid action` | `action` is not `register`, `unregister` or `clear`. | | `invalid event name` | `event` is missing or empty. | | `requested event name cannot be mapped to permissions` | The token or project member subscribes to an event that is not in the [permissions table](#permissions), including unknown event names. | | `not enabled`, `no actions allowed`, `action not allowed` | The token or project member lacks the permission the event needs. | | `subscriptions over a project require a '…' filter` | Inside a project, the event needs a `device`, `bucket` or `rule` filter. | | `the '…' filter must be a resource identifier, or several separated by '\|'` | Inside a project, the filter is not a plain resource ID. | | `… '…' does not belong to the project` | Inside a project, the device, bucket or rule of the filter is not in the project, or not in the member's groups. | When the account owner subscribes to an event name that does not exist, the answer is `success: false` with `registered: null` and no `message`. ## Event messages Each event arrives as one JSON message: the fields of the event, plus `event`, `ts` (milliseconds since the epoch) and `user`. For example, a `device_state_change`: ```json { "device": "YOUR_DEVICE", "state": "connected", "event": "device_state_change", "ts": 1760700000000, "user": "YOUR_USER" } ``` Lifecycle events (`device_create`, `bucket_update`…) carry the document of the resource; `_delete` events carry its ID. Events of the **Server administrator** scope do not carry `user`. ## Filters Filter values are regular expressions that must match the whole value of the field: `"device": "sensor_.*"` matches every device whose ID starts with `sensor_`. An event without the filtered field does not match. When the field is a list, the event matches if any element does. Escape the regular expression characters `\ ^ $ . | ? * + ( ) [ ] { }` of a literal ID: a filter `"device": "sensor.1"` also matches `sensor_1`. Inside a project, filters take only plain resource IDs, or several joined with `|` (`"device": "sensor_1|sensor_2"`). ## Permissions What a connection can subscribe to depends on its token: | Connection | Can subscribe to | |---|---| | The account owner, with the console session token | Every event of the **Account** scope. Events of the **Server administrator** scope need a server administrator. | | An access token | Only the events below, with the permission each one needs. | | A project member, or an access token with `project` | Only the events below, with the member's permissions (and the token's, for a member's token), and the filter they require inside the project. | | Event | Permission | Filter required inside a project | |---|---|---| | `bucket_write` | `Bucket:ReadBucket` on the bucket of the `bucket` filter, or `Device:ReadDeviceBucket` on the device of the `device` filter | `device` or `bucket` | | `device_property_update` | `Device:ReadDeviceProperty` on the device of the `device` filter | `device` | | `device_state_change` | `Device:ReadDeviceConfig` on the device of the `device` filter | `device` | | `alarm_instance_activate`, `alarm_instance_normalize`, `alarm_instance_create`, `alarm_instance_update`, `alarm_instance_delete` | `Alarm:ListAlarmInstances` on all alarms (`*`) | None: the events are limited to the project | | `alarm_rule_execute` | `Alarm:ListAlarmRules` on all alarm rules (`*`) | `rule` | A permission on one resource needs the matching filter: `bucket_write` with `Bucket:ReadBucket` on the bucket `climate` works with `"filters": { "bucket": "climate" }`, not with `{}`. Access tokens and their permissions are managed in [Access Tokens](https://docs.thinger.io/platform/access-tokens.md). ## Catalog The public catalog `GET /v1/server/events` returns the name, filter fields and scope of every event the server can send. It needs no token and is not a stream: read it to discover the events and their filter values. This is the catalog of Thinger.io 7.4. It lists 123 events: 24 activity events and the lifecycle events of 33 resource types. **Scope** says who receives the event: **Account** events belong to the account that subscribes; **Server administrator** events are about the whole server and need a server administrator. ### Activity events **Values** lists the values a filter field takes. Each one is described in [Activity events in detail](#activity-events-in-detail). | Event | Fires when | Filters | Values | Scope | | --- | --- | --- | --- | --- | | `alarm_instance_activate` | An alarm instance becomes active. | `instance` | | Account | | `alarm_instance_normalize` | The condition of an active alarm instance returns to normal. | `instance` | | Account | | `alarm_rule_execute` | An alarm rule is evaluated. | `rule` | | Account | | `bucket_export_completed` | An export of a Data Bucket finishes and its file is ready. | `bucket`, `file` | | Account | | `bucket_export_failed` | An export of a Data Bucket fails. | `bucket`, `file` | | Account | | `bucket_export_started` | An export of a Data Bucket starts. | `bucket`, `file` | | Account | | `bucket_write` | A record is written to a Data Bucket. | `bucket` | | Account | | `claim_completed` | A device is claimed. | `claim` | | Account | | `device_authentication_failed` | A device tries to connect with wrong credentials. | `device` | | Account | | `device_callback_call` | An HTTP device sends data to its callback. | `device`, `product` | | Account | | `device_geofence_event` | A device enters or leaves a geofence, or stays inside or outside it. | `device`, `geofence`, `geofence_event`, `product` | `geofence_event`: `onEnter`, `onExit`, `whileInside`, `whileOutside` | Account | | `device_location_update` | The location of a device changes. | `device`, `product` | | Account | | `device_resource_request_failed` | A call to a device resource fails. | `device`, `product`, `resource` | | Account | | `device_resource_stream` | A stream of a device resource starts, stops, sends data or fails. | `device`, `product`, `resource`, `signal` | `signal`: `start`, `stop`, `data`, `error` | Account | | `device_state_change` | A device connects, disconnects, resumes, wakes up or goes to sleep. | `device`, `product`, `state` | `state`: `connected`, `disconnected`, `resumed`, `awake`, `asleep` | Account | | `device_stats_data` | The connection statistics of a connected device change (traffic, connection time). | `device`, `product` | | Account | | `device_topic_publish` | An MQTT device publishes to a topic. | `device`, `product`, `topic` | | Account | | `device_topic_subscribe` | An MQTT device subscribes to a topic. | `device`, `product`, `topic` | | Account | | `device_topic_unsubscribe` | An MQTT device unsubscribes from a topic. | `device`, `product`, `topic` | | Account | | `endpoint_call` | An endpoint is called. | `endpoint`, `type` | `type`: `email`, `http_request`, `virtual` | Account | | `endpoint_call_response` | An endpoint call finishes, successfully or not. | `endpoint`, `type`, `status`, `status_code` | `type`: `email`, `http_request`, `virtual`
`status`: `success`, `failure` | Account | | `plugin_action` | A plugin is started, stopped, upgraded or changes its state. | `plugin`, `action` | `action`: `start`, `restart`, `pause`, `unpause`, `stop`, `kill`, `create`, `upgrade`, `remove`, `public`, `private` | Account | | `product_script_log` | A script of a product writes to its log. | `product` | | Account | | `product_stream` | Data is sent to a stream of a product. | `product`, `stream` | | Account | ### Lifecycle events Each resource type emits `_create`, `_update` and `_delete` when a resource of that type is created, changed or deleted. Their filters are the IDs of the resource. | Resource type | Events | Filters | Scope | | --- | --- | --- | --- | | `alarm_instance` | `alarm_instance_create`, `alarm_instance_update`, `alarm_instance_delete` | `instance` | Account | | `alarm_rule` | `alarm_rule_create`, `alarm_rule_update`, `alarm_rule_delete` | `rule` | Account | | `brand` | `brand_create`, `brand_update`, `brand_delete` | `brand` | Server administrator | | `bucket` | `bucket_create`, `bucket_update`, `bucket_delete` | `bucket` | Account | | `claim` | `claim_create`, `claim_update`, `claim_delete` | `claim` | Account | | `dashboard` | `dashboard_create`, `dashboard_update`, `dashboard_delete` | `dashboard` | Account | | `device` | `device_create`, `device_update`, `device_delete` | `device` | Account | | `device_bucket` | `device_bucket_create`, `device_bucket_update`, `device_bucket_delete` | `device`, `bucket` | Account | | `device_property` | `device_property_create`, `device_property_update`, `device_property_delete` | `device`, `property` | Account | | `domain` | `domain_create`, `domain_update`, `domain_delete` | `domain` | Server administrator | | `endpoint` | `endpoint_create`, `endpoint_update`, `endpoint_delete` | `endpoint` | Account | | `group` | `group_create`, `group_update`, `group_delete` | `group` | Account | | `group_property` | `group_property_create`, `group_property_update`, `group_property_delete` | `group`, `property` | Account | | `host` | `host_create`, `host_update`, `host_delete` | `host` | Server administrator | | `identity_provider` | `identity_provider_create`, `identity_provider_update`, `identity_provider_delete` | `identity_provider` | Server administrator | | `oauth_client` | `oauth_client_create`, `oauth_client_update`, `oauth_client_delete` | `oauth_client` | Server administrator | | `plugin_property` | `plugin_property_create`, `plugin_property_update`, `plugin_property_delete` | `plugin`, `property` | Account | | `product` | `product_create`, `product_update`, `product_delete` | `product` | Account | | `product_property` | `product_property_create`, `product_property_update`, `product_property_delete` | `product`, `property` | Account | | `project` | `project_create`, `project_update`, `project_delete` | `project` | Account | | `project_member` | `project_member_create`, `project_member_update`, `project_member_delete` | `project`, `member` | Account | | `project_property` | `project_property_create`, `project_property_update`, `project_property_delete` | `project`, `property` | Account | | `project_role` | `project_role_create`, `project_role_update`, `project_role_delete` | `project`, `role` | Account | | `property` | `property_create`, `property_update`, `property_delete` | `property` | Account | | `proxy` | `proxy_create`, `proxy_update`, `proxy_delete` | `proxy` | Server administrator | | `role` | `role_create`, `role_update`, `role_delete` | `role` | Account | | `storage` | `storage_create`, `storage_update`, `storage_delete` | `storage` | Account | | `sync` | `sync_create`, `sync_update`, `sync_delete` | `sync` | Account | | `sync_lock` | `sync_lock_create`, `sync_lock_update`, `sync_lock_delete` | `sync`, `lock` | Account | | `token` | `token_create`, `token_update`, `token_delete` | `token` | Account | | `type` | `type_create`, `type_update`, `type_delete` | `type` | Account | | `type_property` | `type_property_create`, `type_property_update`, `type_property_delete` | `type`, `property` | Account | | `user` | `user_create`, `user_update`, `user_delete` | `user` | Server administrator | ## Activity events in detail ### alarm_instance_activate An alarm instance becomes active. Filters: `instance`. ### alarm_instance_normalize The condition of an active alarm instance returns to normal. Filters: `instance`. ### alarm_rule_execute An alarm rule is evaluated. Filters: `rule`. ### bucket_export_completed An export of a Data Bucket finishes and its file is ready. Filters: `bucket`, `file`. ### bucket_export_failed An export of a Data Bucket fails. Filters: `bucket`, `file`. ### bucket_export_started An export of a Data Bucket starts. Filters: `bucket`, `file`. ### bucket_write A record is written to a Data Bucket. Filters: `bucket`. ### claim_completed A device is claimed. Filters: `claim`. ### device_authentication_failed A device tries to connect with wrong credentials. Filters: `device`. ### device_callback_call An HTTP device sends data to its callback. Filters: `device`, `product`. ### device_geofence_event A device enters or leaves a geofence, or stays inside or outside it. Filters: `device`, `geofence`, `geofence_event`, `product`. Values of `geofence_event`: `onEnter`, `onExit`, `whileInside`, `whileOutside`. ### device_location_update The location of a device changes. Filters: `device`, `product`. ### device_resource_request_failed A call to a device resource fails. Filters: `device`, `product`, `resource`. ### device_resource_stream A stream of a device resource starts, stops, sends data or fails. Filters: `device`, `product`, `resource`, `signal`. Values of `signal`: `start`, `stop`, `data`, `error`. ### device_state_change A device connects, disconnects, resumes, wakes up or goes to sleep. Filters: `device`, `product`, `state`. Values of `state`: `connected`, `disconnected`, `resumed`, `awake`, `asleep`. ### device_stats_data The connection statistics of a connected device change (traffic, connection time). Filters: `device`, `product`. ### device_topic_publish An MQTT device publishes to a topic. Filters: `device`, `product`, `topic`. ### device_topic_subscribe An MQTT device subscribes to a topic. Filters: `device`, `product`, `topic`. ### device_topic_unsubscribe An MQTT device unsubscribes from a topic. Filters: `device`, `product`, `topic`. ### endpoint_call An endpoint is called. Filters: `endpoint`, `type`. Values of `type`: `email`, `http_request`, `virtual`. ### endpoint_call_response An endpoint call finishes, successfully or not. Filters: `endpoint`, `type`, `status`, `status_code`. Values of `type`: `email`, `http_request`, `virtual`. Values of `status`: `success`, `failure`. ### plugin_action A plugin is started, stopped, upgraded or changes its state. Filters: `plugin`, `action`. Values of `action`: `start`, `restart`, `pause`, `unpause`, `stop`, `kill`, `create`, `upgrade`, `remove`, `public`, `private`. ### product_script_log A script of a product writes to its log. Filters: `product`. ### product_stream Data is sent to a stream of a product. Filters: `product`, `stream`. ## Reconnect The server does not keep events for disconnected clients: events emitted while the socket is closed are lost, and the subscriptions end with the connection. After a reconnection, send the `register` messages again and read the current state (device status, last bucket records) through the [REST API](https://docs.thinger.io/reference/rest-api.md) to fill the gap. The server sends a WebSocket ping after 60 seconds without messages from the client and closes the connection if the client does not answer. Standard WebSocket clients answer pings on their own. ## Examples `YOUR_USER` is your username and `YOUR_DEVICE` the ID of one of your devices. **browser.js** ```js const url = 'wss://YOUR_SERVER/v2/users/YOUR_USER/events?authorization=YOUR_TOKEN'; function connect() { const ws = new WebSocket(url); ws.onopen = () => { ws.send(JSON.stringify({ action: 'register', event: 'device_state_change', filters: { device: 'YOUR_DEVICE' }, })); }; ws.onmessage = (message) => { const data = JSON.parse(message.data); if ('success' in data) { if (!data.success) console.error('Refused:', data.message ?? data); return; } console.log(`${data.device} is ${data.state}`); }; // Subscriptions end with the connection: connect and register again ws.onclose = () => setTimeout(connect, 5000); } connect(); ``` **websocat** ```bash echo '{"action":"register","event":"device_state_change","filters":{"device":"YOUR_DEVICE"}}' \ | websocat -n "wss://YOUR_SERVER/v2/users/YOUR_USER/events?authorization=YOUR_TOKEN" ``` The first message you receive is the answer with `registered`; connect or disconnect the device to receive the event. The command-line example uses [websocat](https://github.com/vi/websocat). ## Device resource streams A separate WebSocket streams the resources of one connected device, such as a sensor reading every few seconds: ```text wss://YOUR_SERVER/v3/users/YOUR_USER/devices/YOUR_DEVICE/resources/?authorization=YOUR_TOKEN&interval=5000 ``` The token needs `Device:AccessDeviceResources` on the device. Without `/`, one socket streams several resources of the device, which you choose with messages. | Query parameter | Content | |---|---| | `interval` | Sampling interval in milliseconds, for a single resource. `0` or none: the device sends its data when it produces it. | | `raw` | Present (no value): the socket carries only the resource data, as text or binary, without the event fields. Needs a resource in the URL. | | `signals` | Comma-separated signals to receive: `start`, `stop`, `data`, `error`. By default `data,error`. | Each message is a `device_resource_stream` event (`device`, `resource`, `signal`, `payload`, `ts`…), or only the payload in raw mode. On a socket for several resources, send `{ "resource": "", "interval": }` to start or change a stream (in these messages `interval` is in seconds, not milliseconds as in the URL), `{ "resource": "", "enabled": false }` to stop it, and `{ "resource": "", "payload": … }` to send input to it. Problems with a message arrive as `{ "error": "" }`, for example `{ "error": "device is not connected" }` or `{ "error": "cannot access this device resource with the supplied credentials" }`. If the device is not connected when you open the socket, the server answers `404` with `device not available`, and the socket closes when the device disconnects. ## Deprecated endpoints | Endpoint | Use instead | |---|---| | `GET /v1/users/{user}/events` (WebSocket) | `GET /v2/users/{user}/events`. The v1 socket sends no answers and has no `unregister` or `clear`. | | `GET /v1/users/{user}/devices/{device}/stats` (server-sent events with the device status) | The `device_state_change` event on `GET /v2/users/{user}/events`. | ## See also - [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md): `Thinger.events.subscribe` and the live functions of the SDK use this endpoint. - [REST API](https://docs.thinger.io/reference/rest-api.md) - [Access Tokens](https://docs.thinger.io/platform/access-tokens.md) --- Source: https://docs.thinger.io/reference/changelog.md # Changelog > Release history of the Thinger.io server and console, newest first, with what each version adds, improves, fixes and changes. Every Thinger.io server release, newest first, with what it adds, improves, fixes and changes and its release dates. Versions 4.6.7 and earlier are listed inside 5.0.1. Each library and tool has its own changelog next to its reference: [Arduino library](https://docs.thinger.io/reference/arduino-library/changelog.md), [CLI](https://docs.thinger.io/reference/cli/changelog.md), [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk/changelog.md) and [VS Code extension](https://docs.thinger.io/reference/vscode-extension/changelog.md). ## 7.4.1 **Release Date:** 27-10-2026 Covers every change since 7.0 (including the 7.1, 7.2 and 7.3 maintenance releases). ### Added #### Dashboards & apps * **[URL dashboards](https://docs.thinger.io/platform/dashboards/apps.md)**: a dashboard can now be a web application (for example, a folder of a file storage with its `index.html`) shown inside the console in a sandboxed iframe. The console hands it the session, the user, the project and the subject (device, product, asset type or group), keeps the app route in the console URL and follows its navigation. * Built with the new **[Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md)** (`@thinger-io/dashboard-sdk` on npm): typed access to devices, buckets (incremental realtime subscriptions included), properties, alarms, storages and projects. Apps can also run **standalone** with an access token, outside the console. ![Climate app, a URL dashboard built with the Dashboard SDK, shown inside the console with a table of the latest temperature and humidity of each sensor](https://docs.thinger.io/changelog/7.4/changelog-url-dashboard.webp) *A URL dashboard built with the Dashboard SDK* * Storage files are served with **HTTP revalidation** (ETag, Last-Modified, 304), so apps and assets reload only when they change. * **Product type system** with a **device monitor view** and brand-based visibility. * Control widgets and the LED indicator widget migrated from AngularJS to Angular, with unified default colors. ![Slider of the target temperature and Property Table with one row per climate device, with the Enabled switches and Threshold inputs, in their 7.4 style](https://docs.thinger.io/changelog/7.4/changelog-control-widgets.webp) *Control widgets in Angular* #### Products, APIs & flows * **Product code from a folder of a file storage** (`profile.code.path`), so one storage can hold a whole application (dashboard and product code). The code reads only its own storage. ![Product Script card of the env_sensor product with the storage option checked and the Documents File Storage selected as the source of the code](https://docs.thinger.io/changelog/7.4/changelog-product-code-storage.webp) *Product code loaded from a File Storage* * **Real-time script console** for debugging product code. ![Product Script card of the meter product with its code and, below, the real-time script console connected and waiting for output](https://docs.thinger.io/changelog/7.4/changelog-script-console.webp) *Real-time script console* * **`product_stream`** as a flow source and target. * Profiles fed by server events are initialized when the product is created and at startup. * Provider-declared resources are seeded at startup. * Placeholder paths accept **backslash-escaped dots**. #### Devices, buckets & events * **Free-form device labels** with multi-dimensional filtering (`?labels=`, `?labels.=`). * **Resource lists filter by nested fields** (`?origin.id=`, `?alarm.rule=`), by booleans, and by several values of the same parameter. * **Native geofence events** carry the product, asset type, group, zone id and zone properties; exits are emitted before entries, and geofences are checked when the `location` property is updated. * **Project members and access tokens** can subscribe to alarm and device state events, always scoped to their project. * MongoDB buckets get secondary indexes on tag fields and a 10 s query timeout. #### Authentication & security * **Access token expiration**: `expire` (unix ms) is now enforced. It is signed into the token, checked on every request, and expired tokens are deleted. * `allow_password` setting to disable password-based login (federated sign-in only). ![Accounts section of the server settings with the Authentication options: Password Login, highlighted, Passwordless Login and Require 2FA](https://docs.thinger.io/changelog/7.4/changelog-password-login.webp) *Password Login in the server settings* * New projects enable **`limit_bucket_access`** by default: members read bucket data only of the devices of the project. #### Administration * **Host logs over HTTP**: `GET /v1/hosts/{host}/logs` returns the last lines of the server log as text (`lines`, `since`, `timestamps`). * Admin APIs for brands, hosts and domains are validated and documented, including brand email templates (links, placeholders, logos) and a brand `PATCH`. * OpenAPI schemas and examples for user resources, product profiles, code and services. ### Improved * **SSL certificates**: expired certificates are renewed (an expired one was never renewed); a wildcard certificate covers a single label, and its bare domain only when the certificate names it; the updater starts once the servers are listening; after a failed renewal it retries in 5 min, 30 min and 2 h instead of a day; Let's Encrypt errors are logged with their type and detail. * Saving a product profile no longer goes over every connected device: only the streams that could not start are retried. Product streams start as soon as their resource becomes available. * Aggregations of MongoDB buckets: latest per group without a pre-group sort; fields are auto-discovered (numeric fields only) when none are given. * Missing resources answer **404** instead of 500. * Alarm rule `test-source` works before the rule exists and leaves no running instance. ### Fixed * **Security hardening** of access tokens and device tokens, authentication, MQTT connections, logs and bucket queries. We recommend updating. * Creating a file storage with an id that already exists (409) no longer deletes the files of the existing storage. * Alarms: a missing field no longer normalizes an alarm without a normalization condition of its own; `a or b` conditions activate on devices that only have `a`. * Project members can subscribe to buckets filtered by several devices (widget dashboards over many devices kept no realtime). * List filters match ids that are numeric or start with digits (IMEI, MAC, `0001`). * Product property permissions saved by the console are accepted by the profile validation. * Saving a brand through the API keeps its reCAPTCHA secret. * Geofence points use (lon, lat): circles have their real radius and polygons beyond 90° of longitude work. * Product streams: no duplicate or orphan streams; disabled Virtual devices are not connected; no duplicate first sample. * IOTMP: legacy varint fields read as 64-bit, exponential PSON sizing removed, float truncation and missing stream ids fixed. * HTTP: optional whitespace after header colons (RFC 9112); web proxy fixes (SSL source port, Set-Cookie rewriting, full request bodies). * Aggregation periods in seconds no longer crash MongoDB bucket reads. * Alarm and device pool lifetime fixes in async callbacks. ### Changed Behavior that may need attention when upgrading: * **Reserved bucket fields**: records with a `tags` or `_id` field are refused by MongoDB buckets (in a batch, the whole batch). * **Bucket reads**: invalid parameters return 400, as do `items=0` and `items>1000`. * **Aggregations** over several fields include records that have only some of them; `count` is per field. * **Product API target `property`** writes to the configured `request.property`. * **Product code** has no filesystem access when inline, and only its own storage when loaded from one. * New **listeners of a product stream** get no immediate sample: they receive the next one. * **Super admin**: the `thinger` super admin login needs the `TOKEN` variable of the server. On servers without it, it is disabled: use the administrator accounts. * **Device tokens** only reach the resources and the status of their device. To manage the device, use an access token. * **MQTT**: clients that send anything before `CONNECT` are disconnected. Clients that follow MQTT 3.1.1 are not affected. * **InfluxDB bucket reads** validate their parameters, and tag filters match literal values, as in MongoDB buckets. * **Realtime subscriptions**: an access token bound to projects must subscribe with `?project=`; without it, the subscription is rejected. The Dashboard SDK already sends it. * **Access tokens**: `expire` must be a future timestamp in milliseconds and cannot be changed after creation; tokens created before 7.4 with `expire` show it but do not expire. * **Cloud instances** (configured by a subscription): plan settings (account, brand, domain and member limits, plugins, rate limiter, database, HTTP hosts and the deployment container name) come only from the subscription. * **Product profile PUTs** are validated against their schema. * **Validation** of brand, host and domain admin APIs is stricter (the console is compatible). * **URL dashboards** receive the viewer's session token (same-origin pages only). Treat apps in public storages accordingly; a scoped token is planned. * The **Dashboard SDK** is no longer served from `/sdk/`: it is published on npm and pinned in the console. ## 7.0 **Community Release Date:** 04-02-2026 **Private Servers Release Date:** ~18-02-2026 ### Added #### Authentication & security * **Federated authentication via OpenID Connect (OIDC)**, allowing users to sign in using external identity providers (Google, Microsoft, Auth0, Okta, PingOne, and custom OIDC). * **Multi-Factor Authentication (MFA)** support, including: * **TOTP** (RFC 6238) with QR code setup and backup codes. * **WebAuthn** security keys as a second factor. * **Passkeys** for passwordless authentication with cross-platform support. * **OAuth2 Device Authorization Flow**, enabling secure device login via verification URLs. * **Certificate-based authentication** for device auto-provisioning, with enhanced credential validation. * **Login attempt limiting** for both password and MFA authentication, protecting accounts against repeated failed sign-in attempts. #### Alarms & rules * **Advanced alarm rule testing tools**, including: * Source data testing. * Dry-run mode for rule evaluation and notifications. * Copyable numeric variables from test results. * New **`present` and `absent` comparators**, enabling alarms that detect missing or non-reporting devices. * **GROUP BY support** for alarm data sources in MongoDB and InfluxDB. * Variable-friendly naming for alarm data sources in time-series configurations. * Alarm instance list now includes **Origin ID and Origin Name** fields. #### File explorer & file management * **New file explorer** for browsing and managing files on devices. * Support for custom **terminal images** when accessing storage terminals. * **Filesystem API for devices**, enabling upload, download and file management operations on compatible IOTMP devices (ThinRemote). * **Filesystem API v2 for storages**, with streaming uploads for large files and improved path validation. #### Plugins & marketplace * **Modernized plugin marketplace UI**, with improved browsing and filtering. * Improved plugin README rendering with: * GitHub-style markdown * Syntax highlighting * Alerts, tables of contents and proper image resolution * Improved plugin image and asset resolution across the platform. #### Monitoring & metrics * **Initial system and Docker monitoring components**, providing container-level metrics. * New APIs for retrieving **container and runtime statistics**. #### Devices & connectivity * **Subdevice (virtual device) support**, allowing devices to be dynamically created from MQTT gateway flows. * Improved device connectivity handling with **timeout-based lifecycle management** (sleep / wake / disconnect states). #### Products, APIs & flows * **Granular API endpoints** for product profile resources. * Support for **handling endpoint call responses** in product profiles. * Display of **full API endpoint URLs** when device identifier resolvers are configured. * Support for **array field matching** in event filters. * Product and device context is now fully included in resource stream events. #### UI & dashboards * Migration of **text widgets**, **device console**, and **terminal components** from AngularJS to Angular. * New **text widget** with color, icon, and value-based rules. ### Improved * Updated **Node.js runtime to 24 LTS**, including an improved permission model. * Improved **HTTP and streaming support** * Improved **product configuration schema validation**, returning structured JSON error responses. * Reduced unnecessary dashboard data refreshes and improved bucket data consistency. * Performance improvements in scripting, sockets and request handling. ### Fixed * Fixed multiple **alarm rule evaluation edge cases**, including: * GROUP BY behavior without aggregation. * Missing data source handling. * Query limits affecting device status rules. * Fixed authentication issues in mixed and federated flows. * Correct handling of tag parameters in API requests and dashboards. * Fixed CSV import issues related to timestamp parsing and normalization. * Various UI fixes related to widgets, layouts and rendering. ### Changed * Removal of legacy protocols and dependencies. ## 6.5 **Community Release Date:** 02-06-2025 **Private Servers Release Date:** 09-06-2025 ### Added * Products now display a **graph view** of data sources and targets, helping visualize the flow configuration within the product profile. ![Graph view of the Milesight AM103 product: the uplink resource streams to an uplink property and, through a decode function, to a bucket; the reboot and reporting_interval resources call a downlink resource that calls a plugin](https://docs.thinger.io/changelog/6.5/product-graph-view.webp) *Product graph view* * Added **property-level permissions** in products to control which device properties a project member can view or edit. ![Product property settings with the Hidden and Read Only role selectors and a dropdown listing the owner and member roles](https://docs.thinger.io/changelog/6.5/property-permissions.webp) *Property-level permissions for project members* * It is now possible to **edit dashboards on individual devices** (when inherited from a product). Editing can be restricted through new property permissions, allowing project owners to override the product dashboard while limiting access for end users. ![Dashboard tab of the device dragino_A84041E98182ABFE with the edit button on the right of the toolbar](https://docs.thinger.io/changelog/6.5/device-dashboard-edit.webp) *Dashboard editing at device level* * Introduced **user properties**, available under **Profile > Properties**. These will be further integrated into other system areas such as alarms, custom forms, and automations. ![Properties page of the user profile with an empty Properties table and the Refresh and Add buttons](https://docs.thinger.io/changelog/6.5/user-properties.webp) *User properties in the profile* * Added support for **MongoDB Transforms**, offering the same functionality previously available for InfluxDB. MongoDB now provides full parity in terms of data processing capabilities. ![Data source settings with a 15m mean aggregation and the Transform dropdown open: abs, ceil, cumulative_sum, derivative, difference, elapsed, floor, round, non_negative_derivative and non_negative_difference](https://docs.thinger.io/changelog/6.5/mongodb-transform-options.webp) *Data transforms on MongoDB buckets* * Initial support for using **Device Buckets** as data sources in dashboards. Device Buckets are defined at the product level. This avoids the need to share a root bucket when sharing devices across projects. ![Time Series Chart widget settings with the Data Source dropdown open, listing From Data Bucket, From Device Bucket, From Device Resource, From Device Property and Manual](https://docs.thinger.io/changelog/6.5/device-bucket-data-source.webp) *Device Bucket as a widget data source* * Introduced **Group Hierarchies**: you can now create nested groups and subgroups, enabling more organized asset structures. ![Add group form with the Optional Parent Group selector above the Group ID, name and description fields](https://docs.thinger.io/changelog/6.5/group-parent-selector.webp) *Parent group for nested groups* * Project members can now be **restricted to specific groups or subgroups** within a project. ![Member Permissions section with two role selectors and a Project Groups selector, whose tooltip reads Restrict access to specific asset groups inside the project](https://docs.thinger.io/changelog/6.5/member-group-restriction.webp) *Member access restricted to asset groups* * New **Flow** feature in the Product Profile, enabling the definition of custom **sources** and **targets**. You can now redirect data flows, for example, from a topic to an HTTP endpoint, or from a device property update to a topic. This feature deprecates the previous Endpoint, as it is much more versatile. Available targets include Device Resource, Endpoint Call and Product Function. ![Empty Flows table in the product profile with the Flow, Behaviour, State and Description columns](https://docs.thinger.io/changelog/6.5/product-flows-list.webp) *Flows in the product profile* ![Flow dialog on the Flow Target tab with the Target dropdown open: None, Device Resource, Device Stream, Device Property, Device Topic, Endpoint Call, Plugin Endpoint and Product Function](https://docs.thinger.io/changelog/6.5/flow-target-options.webp) *Flow target options* * Initial support for **mTLS (mutual TLS)** on MQTT devices. This feature is currently under testing in selected deployments and is not yet intended for production use. Contact us for early access or details. * Dashboards now implement lazy-loading to avoid fetching data from all tabs until they are accessed. This significantly improves loading times on large dashboards. ### Enhancements * Support for **JPG and WebP** formats when selecting plugin icons in the product plugin exporter. * Added `build_date` and `license` to the `/v1/server/version` endpoint, preparing for Community On-Premise releases. * Hide the billing link when using a Community license. * Removed Twitter link from the menu and brand settings. * Automatically **clean up Docker user networks** when the last plugin is uninstalled. * Improved Docker logging by printing **command responses** to the plugin logs. * Plugin installation dialog now **displays the resource ID** if the name is not available. * Added support for **binary data** in HTTP requests with unknown content types. * Dashboard placeholders can now **accept multiple values** from a single data source. * Dashboard functions can now access placeholders via the **`shared` variable**. * Product property forms now support **dates as keys** and **multi-field value inputs**. * Multiple improvements to **MongoDB Bucket performance and data retrieval**. * Plugin installer now correctly handles cases where only **development versions** of the plugin are available. * User sessions are now preserved for 24 hours by default. Opening Thinger.io in a new browser tab within that period will no longer trigger permission prompts. ### Fixed * Fixed **public signup logic** for Community On-Premise instances. * Fixed **console access over private IPs** in On-Premise deployments. * Fixed **ApexCharts not displaying** inside Group Widgets. * Fixed **incorrect data types** returned in the Server Statistics API. * Resolved an issue where **global roles** were not applied in the Console. * Fixed missing error **details in alert banners** from failed HTTP requests. * Prevented database callback structures from being created on **virtual devices**. * Fixed loading of HTML Widgets from **public storages**, regardless of access settings. * Restored default **HTTP connection timeout** to 10 minutes. * Fixed plugin configuration: **volumes and environment variables** were not applied properly. * Fixed confirmation **message not updating** after changing the user password. * Fixed the **multiple-resource-selector** making unnecessary API calls. * Fixed **Control Widget** not working inside Group Widgets. * Fixed **dashboard updates from buckets** not being reflected in real-time. * Device status filters not working on alarm rules ## 6.4 **Community Release Date:** 22-01-2025 **Private Servers Release Date:** 29-01-2024 ### Added * **Plugin Installation Dialog**: * Support for custom volumes, enabling the mounting of custom file storage to plugins like Node-RED, FTP, etc. * Support for configuring custom environment variables, e.g., for enabling Node-RED projects. ![Node-RED installation dialog on the Volumes tab, with the data storage mounted on /data and a Widgets file storage mounted on /widgets](https://docs.thinger.io/changelog/6.4/plugin-volumes.webp) *Custom volumes for a plugin* ![Node-RED installation dialog on the Environment Variables tab with NODE_RED_ENABLE_PROJECTS set to true](https://docs.thinger.io/changelog/6.4/plugin-environment-variables.webp) *Custom environment variables for a plugin* * **Virtual Devices**: Initial support for devices that are always connected and can fetch data from external resources (e.g., endpoints via products). Example use case: creating a weather device that fetches weather data and forecasts. ![Device Type dropdown in the Add Device form with Virtual Device selected among IOTMP, HTTP and MQTT devices](https://docs.thinger.io/changelog/6.4/virtual-device-type.webp) *Virtual Device type* * **Product Plugin Exporter**: Export products to a file storage, with options to: * Set plugin image, name, description, and version. * Edit the markdown readme with images, changelogs, etc. ![Plugin Exporter form for shelly-plus-1pm with the plugin image, name, description, version and author, and a markdown editor for the readme](https://docs.thinger.io/changelog/6.4/product-plugin-exporter.webp) *Product plugin exporter* * **New Event**: `endpoint_call_response`, providing the result of endpoint calls. * **Billing Menu for Admins**: Added a menu item linking to the customer portal. ![Billing entry with a card icon in the console menu](https://docs.thinger.io/changelog/6.4/billing-menu.webp) *Billing menu entry* * **Account Deletion**: Community users can now delete their accounts. ![Danger Zone panel with a warning about irreversible changes and a Delete Account button](https://docs.thinger.io/changelog/6.4/account-delete.webp) *Account deletion* * **Enhanced Product Profile Resources**: Resources can now target endpoints, plugin paths, call other api resources, and enable operations based on their responses. * **Experimental MongoDB Backend**: * Support for custom data retention policies for individual buckets. * Deprecates InfluxDB for new instances. ![Bucket Database Options with MongoDB as backend and a retention of 1 month](https://docs.thinger.io/changelog/6.4/bucket-mongodb-retention.webp) *MongoDB backend with data retention* ### Improved * **Default Plugin Shell**: Updated to point to `/bin/sh` (used in minimal images). Configurable via the `task.shell` parameter. * **Plugin Installation**: Plugins can now be installed directly from file storage, where Plugins are exported by default in the Plugin Exporter feature. * **Plugin Management Page**: Migrated to Angular with new features: * Supports reading `readme.md` and images from file storage. ![Node-RED plugin page with the version badges, the Install, Upgrade, Start, Stop, Kill, Restart, Pause, Resume and Remove buttons, and the Readme tab showing the plugin description and an image](https://docs.thinger.io/changelog/6.4/plugin-management-page.webp) *Plugin management page* * **Console Component**: Updated to Angular with text search functionality. ![Terminal running echo hello world with hello typed in the search box and highlighted in the output](https://docs.thinger.io/changelog/6.4/console-text-search.webp) *Console with text search* * **Charts**: Migrated to Angular using `ng-apexcharts`, resolving several issues. * **Location Updates**: Location properties now update with the current latitude and longitude values. * **File Storage API**: * Added support for specifying storage paths using the `path` parameter. * Automatically creates parent directories when uploading a file via `PUT` if they do not exist. * **Swagger API Schema**: Improved schema definitions for better clarity and usability. ### Fixed * **Bucket Operations**: * Resolved bucket writes with empty tag values. * Fixed bucket reads not using the `project` field. * **Endpoint Calls**: * Fixed endpoint call tests are not displaying `application/json` body with UTF-8 encoding in response headers. * **Plugin Environment Variables**: * Fixed creation of environment variables for plugins without default values. * Fixed issues when adding environment variables to such plugins. * **Project Roles**: Fixed form creation for project roles. * **Device Buckets**: Fixed an unauthorized message when a project member accesses `DeviceBucket`. * **Resource Streams**: Fixed product resource streams not initializing for non-IoTMP/PROTO devices on connection. * **Dashboard**: * Fixed window titles containing placeholders. * Fixed the removal of incorrect sub-widgets in group widgets. * Fixed missing sources in widgets within the group widgets. * Sharing a dashboard now automatically grants file storage read permissions if required (e.g., for HTML widgets). * **Frontend API**: Fixed API resource permissions. * **Mobile App**: Fixed issues with loading HTML widgets. * **HTML Widgets**: Fixed reliance on public access to file storage. * **Project Switching**: * Admin users within a project no longer see the info page. * Redirecting to the default state when switching projects now applies to all users. * **Resource List**: Under some conditions, a resource list, i.e., devices, may display duplicated items. ## 6.3 **Community Release Date:** 17-06-2024 **Private Servers Release Date:** 20-06-2024 ### Added #### Products * Products now include a new functionality to configure how devices should be displayed on an Assets Maps widget, including icons, background colors, labels, and extended information when the icon is clicked. It supports conditional icons and background colors according to the latest bucket data, property values, or device status. ![Animation of an Assets Map with a water level icon showing 4 % and battery 50 %; clicking it opens a card for Test Device with the water and battery levels](https://docs.thinger.io/changelog/6.3/assets-map-custom-icons.webp) *Assets Map with custom icons and fields* ![Product Visualization settings with two Font Awesome icons shown when bucket.front_data.percentage is above 70 or below 35, and Date, Available and Volume fields](https://docs.thinger.io/changelog/6.3/product-visualization.webp) *Product visualization settings* * Initial support for Device events as a source for Product resources (properties, buckets, endpoints), i.e., for reacting to device connection events. ![Property Source tab with Device Event as source, the device_state_change event and an Any state filter](https://docs.thinger.io/changelog/6.3/property-device-event-source.webp) *Device event as a data source* * Initial support for multiple data sources on Product properties, i.e., listening for different events/resources to update a single property. ![Property Source tab with two sources; Source 2 is a device_state_change event with Source Payload, payload processing and a Patch switch](https://docs.thinger.io/changelog/6.3/property-multiple-sources.webp) *Multiple data sources on a product property* * Initial support for Product properties PATCH to allow partial updates. ![Patch switch turned on, with the tooltip Enable this option to patch property values instead of replacing the entire value](https://docs.thinger.io/changelog/6.3/property-patch.webp) *Patch option on a product property* * Initial support for property data fetch on Product property, endpoints, and buckets template payloads. For example, it can be useful for modifying incoming bucket data based on device configuration. ![Template Payload that combines the incoming payload with the config property value, with insert_processing as payload processing function](https://docs.thinger.io/changelog/6.3/property-template-payload.webp) *Property data in a template payload* #### Other * New Assets Table widget to display device information in a table, with the possibility to export data to a PDF report, CSV file, and filter and sort columns. The asset table can merge multiple pieces of information from each asset, i.e., from device state, buckets, or properties. ![Assets Table widget with Connected, CPU Cores, CPU Procs, CPU Usage and Security Updates columns, a range filter open and Export to CSV and Export to PDF buttons](https://docs.thinger.io/changelog/6.3/assets-table-widget.webp) *Assets Table widget* * New notification icon to stay updated on the latest news in the Thinger.io ecosystem, like server updates, new library releases, etc. ![Latest Updates popup under the megaphone icon of the top bar, listing VSCode Remote OTA 1.1.0 and Arduino Library 2.30.0](https://docs.thinger.io/changelog/6.3/latest-updates.webp) *Latest updates in the top bar* * Support for enabling legacy TLS protocols (TLS v1.0 and TLS v1.1) by reducing OpenSSL security level. This can be useful to support connectivity with old devices that don't support newer TLS versions. It can be configured under **Cluster Host > Settings > SSL Certificates**. ![Insecure Protocols switch in the SSL server settings with the tooltip Enable insecure TLS 1.0 and TLS 1.1 protocols for legacy devices](https://docs.thinger.io/changelog/6.3/insecure-tls-protocols.webp) *TLS 1.0 and TLS 1.1 support* * Enable configuration for setting additional members and roles on project claims, i.e., for supervision and management. ![Claim settings with domain_admin as additional member and global_role as member role](https://docs.thinger.io/changelog/6.3/claim-additional-members.webp) *Additional members and roles on a claim* * Device services configured over Products will now use a configurable range of ports. This will simplify on-premise setup and speed up service access, as there will be no need to manage firewall rules dynamically. The port range is set in the host configuration. ![Proxies Settings of a host with a dynamic ports range from 50000 to 51000](https://docs.thinger.io/changelog/6.3/proxies-dynamic-ports.webp) *Dynamic ports range for product services* ### Improved * Product profile resources now simplify the payload configuration by allowing the selection of the source event, source payload, or a template payload. It also allows defining a custom payload processing function that is easier to configure than the current `{{payload:fn}}` definition. * Schema validation error messages are both in the API and server logs. * Reduce the required buffer size for each connected device. * Increased maximum dynamic buffer size, supporting larger message sizes. * Product API Resource responses can now use template placeholders, including properties or other API resources. * Improved claim resources landing with more informative messages. ### Fixed * Send `device_state_change` after product initialization. * Installing development plugin versions. * Bucket export download URL for buckets updated from a Project Member. * Inside and outside expression comparators on alarms. * Potential socket leak if the client did not try to perform the TLS handshake. * Console permissions when a developer/admin closes an external project. * Dashboard widget on community server not allowing the selection of a value. * Dashboard not showing configurable time selector. ## 6.2.2 **Community Release Date:** 18-04-2024 **Private Servers Release Date:** 30-04-2024 ### Added * Devices associated with a Product can now display bucket data directly from their pages, under the menu option called "Buckets". Each device can now list all the associated buckets and will filter out its data in the Data view. In future releases, we will add options for exporting, importing, and clearing data. This opens the possibility to avoid sharing raw bucket data with project members and effectively grant access only to their device data. With this feature, permissions are granted at the device level, with permissions like ViewDeviceBuckets, ReadDeviceBucket, ReadDeviceBucketTag, and ListDeviceBucketTags. ![Device menu open with the Buckets, Tokens, Terminal, Geofences, Inspector and Settings options](https://docs.thinger.io/changelog/6.2.2/device-buckets-menu.webp) *Buckets option in the device menu* * Introduced two new specific permissions for listing and reading bucket tags: `ListBucketTags`: Allows listing of bucket tags. `ReadBucketTag`: Allows reading of individual bucket tags. Previously, these operations required a more general `ReadBucketConfig` permission. This change provides more granular control over permissions. * Claims now support including additional projects in the claim process. This way, claimed resources can be added automatically to parent "global" projects that can be used to manage the resources with different profiles. ![Additional Projects field of a claim with projectB selected](https://docs.thinger.io/changelog/6.2.2/claim-additional-projects.webp) *Additional projects on a claim* * Projects can be configured to limit bucket data access based on project devices. This functionality is useful for displaying aggregated data on the project dashboard or for restricting data access to project members. Additionally, this option can be set in the claim settings, ensuring that member projects are automatically created with this access limitation in place. The option is in the project settings. ![Limit Bucket Data switch turned on under Advanced Options in the project settings](https://docs.thinger.io/changelog/6.2.2/project-limit-bucket-data.webp) *Limit Bucket Data project option* * Device Tokens are now available for MQTT and HTTP devices, as they can have regular API resources over a product. ### Improved * The templating system (used on products or endpoints) can now process placeholders with spaces. ```text {{ payload : FunctionName = 22 }} ``` * Internal LRU cache with a modern and safer implementation. * Removed unused 'curl' dependency on the base image, slightly reducing image size. ### Fixed * MQTT and HTTP devices can now also define Device tokens via the GUI, as they can define API resources over Products. * Problem when removing nested resources, i.e., Bucket exports, Project Members. * Bucket exports should not display set projects and clone context actions. * Bucket exports are not loading by default. * Apex Chart Widget preview is preventing the dashboard from being saved. * Apex Chart Widget series colors are not being updated when the widget has titles. * Problem when updating device locations. ## 6.1.0 **Community Release Date:** 08-04-2024 **Private Servers Release Date:** 15-04-2024 ### Added * Brand PWA configuration includes support for uploading app icons directly from the filesystem. It also allows the configuration of both 'maskable' and 'any' icon purposes. Fixes [https://github.com/thinger-io/thinger-server/issues/84](https://github.com/thinger-io/thinger-server/issues/84) ![Brand PWA App Icon 192x192 with purpose any, the current icon preview, a file picker and the path assets/img/app-192.png](https://docs.thinger.io/changelog/6.1.0/brand-pwa-icon.webp) *PWA icon uploaded from the file system* * Brand Share Image includes support for uploading an image directly from the filesystem. ![Brand Share Image with a thinger.io logo preview, a file picker and the image URL](https://docs.thinger.io/changelog/6.1.0/brand-share-image.webp) *Share image uploaded from the file system* * Brand Logos are now served from the web server instead of a JSON config, which should reduce load time. * Brand PWA "start_url" to make the console installable on Chrome. * Products can now be configured to resend device data to a given endpoint. For example, fetch a given resource every n seconds, or take data from a topic, and resend it to another service. ![Product Endpoint dialog for logger with Device Resource source, the temperature resource sampled every 60 seconds and a payload template](https://docs.thinger.io/changelog/6.1.0/product-endpoint.webp) *Endpoint in the product profile* * Products can now configure bucket tags to be used on the automatic initialization. Fixes [https://github.com/thinger-io/thinger-server/issues/81](https://github.com/thinger-io/thinger-server/issues/81) ![Product bucket Settings tab with the description, the Data Tags field and the Enabled switch](https://docs.thinger.io/changelog/6.1.0/product-bucket-data-tags.webp) *Data tags on a product bucket* * Products can now handle Resource Streams, i.e., to create custom profiles for HTTP devices. Product API Resources have a new Device Stream target. ![Product API resource Request tab with Device Stream as target, the resource name open and a payload template](https://docs.thinger.io/changelog/6.1.0/api-resource-device-stream.webp) *Device Stream target on a product API resource* * The endpoint call event now provides context about the caller. ![Event Inspector showing an endpoint_call event whose context includes the host, the request IP and the http_request source](https://docs.thinger.io/changelog/6.1.0/endpoint-call-context.webp) *Caller context in the endpoint call event* ### Improved * Add a resource cache for better performance on massive endpoint calls and bucket writes. * HTTP devices have been migrated to a new connection schema where it is possible to log their statistics, like bytes sent, received, and connections, as any other MQTT or IOTMP device. * HTTP devices can now be used inside dashboards with resources defined at the product level. * Device property selector for HTML widgets allows selecting any parent node (with nested values), or all property values by not selecting any field. Fixes [https://github.com/thinger-io/thinger-server/issues/16](https://github.com/thinger-io/thinger-server/issues/16) * Property PATCH now supports regular JSON for partial property updates. Fixes [https://github.com/thinger-io/thinger-server/issues/16](https://github.com/thinger-io/thinger-server/issues/16) * Brand icons and logos are now served from the filesystem instead of a data URL, improving page load. * Dashboard HTML widgets from external storage no longer require public storage access. In the case of members of a project, they will require read access to the storage. * Product properties, topics, resources, and functions can be generated now by calling a product function. * Product bucket writes can now override tag values based on the write payload. Previously, tags like device were always being set by the product, discarding any "device" field present on the payload. * Compatibility with OpenSSL 3.0 on SSL certificate provisioning. * IP Geocoding automatic updates. ### Fixed * Apex Charts widget colors do not honor time series color configuration. * Binary data on a product payload is not processed correctly. * Visual Studio Code is not opening the file storage correctly. * Products with just "run" resources were not displayed on the API explorer. * Product profile list for buckets, endpoints, auto provision, and api resources were always displaying "Property" instead of the resource type. * The info page displays on empty or restricted resources. * Statistics on socket count. ## 6.0.0 **Release Date:** 11-03-2024 ### Added * **Property Forms**: Allow creating custom forms for improving the user experience when setting values inside a property, i.e., when configuring a device. The form can be defined at a Product level, and it is currently supported by [Formly](https://formly.dev/). ![User Form tab of the tank_config property with the Formly field definition in a JavaScript editor](https://docs.thinger.io/changelog/6.0.0/property-form-fields.webp) *Property form definition* ![Tank configuration form with a diagram of the tank and fields for its position, diameter, volume and neck height](https://docs.thinger.io/changelog/6.0.0/property-form-preview.webp) *Device property edited with a form* * **Property Location**: Location properties now display a map for picking the address directly from the map or via a search bar for using an address. Once an address is selected, it automatically fills in the coordinates and timezone. ![Location property editor with a satellite map, a pin and an address search bar](https://docs.thinger.io/changelog/6.0.0/property-location-map.webp) *Location property editor* ![JSON value of the location property with lat, lon, name, address and timezone fields](https://docs.thinger.io/changelog/6.0.0/property-location-json.webp) *Fields filled in by the location editor* * **Dashboard Functions**: Dashboard now supports creating custom functions for processing any data used in the dashboard, i.e., for changing units, cropping decimals, or filtering values. Conversion functions can be selected in the data source configuration. ![Functions tab of the Dashboard Settings with a convertFunction in a JavaScript editor](https://docs.thinger.io/changelog/6.0.0/dashboard-functions.webp) *Dashboard functions* ![HTML Time Series widget source with the Processing dropdown open, offering Disabled and convertFunction](https://docs.thinger.io/changelog/6.0.0/widget-source-processing.webp) *Data source processed with a dashboard function* * **Dashboard Placeholders**: Dashboard now supports settings placeholders from a fixed value or a device property. Placeholders can be used in any string field on the dashboard, i.e., titles, units, or even inside functions to change the behavior of the function depending on the current device configuration. ![Placeholders tab of the Dashboard Settings with a Unit placeholder taken from the diameter.unit value of a device property](https://docs.thinger.io/changelog/6.0.0/dashboard-placeholders.webp) *Dashboard placeholders* ![Gauge widget Display Options with the Unit placeholder in the Units field](https://docs.thinger.io/changelog/6.0.0/gauge-units-placeholder.webp) *Placeholder in a units field* ![Dashboard function diameterConversion that switches on the unit placeholder to divide the value by 10 or 1000](https://docs.thinger.io/changelog/6.0.0/function-placeholder.webp) *Placeholder inside a dashboard function* * **Dashboard Property Button**: New "Property Button" widget for opening device properties for modification, even if they have a Property Form defined. ![Property Button widget settings with a device and the Configuración de Tanque property selected](https://docs.thinger.io/changelog/6.0.0/property-button-settings.webp) *Property Button settings* ![Property Button widget titled Config on a dashboard](https://docs.thinger.io/changelog/6.0.0/property-button-widget.webp) *Property Button on a dashboard* * **Dashboard Group Widget (BETA)**: New Group Widget that brings the possibility to add any number of widgets inside a parent widget. ![Group widget titled Settings with two child widgets and its add, clone, edit and remove buttons](https://docs.thinger.io/changelog/6.0.0/group-widget.webp) *Group widget* * **Dashboard Property Table (BETA)**: Introducing a new widget that enables quick editing of properties for a device or a set of devices. This widget includes various built-in controls such as text display, input text, input number, slider, color selection, switch, a save button, and an edit button. These elements can be configured in each column to patch a single property value. ![Property Table widget listing five valves with Slider, Color, State and Save columns](https://docs.thinger.io/changelog/6.0.0/property-table.webp) *Property Table widget* ![Property Table Display Options with a Name column of type Text and the value path name](https://docs.thinger.io/changelog/6.0.0/property-table-columns.webp) *Property Table columns* * **Claiming Feature**: The Claiming Feature is a versatile and user-friendly tool designed for administrators to configure and expose a selected number of resources, such as devices, for end-user claiming. This feature enables administrators to set up various resources that end-users can subsequently request effortlessly. Upon a successful request, these resources, like specific devices, are automatically integrated into the end-users' accounts. This streamlined process not only enhances user experience by simplifying resource acquisition but also provides administrators with efficient control over resource distribution and management. ![Claim form for SENSOR-A323-TMP-41 named Temperature Sensor, enabled with one maximum claim and the esp32eth device as claim resource](https://docs.thinger.io/changelog/6.0.0/claim-configuration.webp) *Claim configuration* One of the key strengths of this feature is its flexibility in claiming methods: users can initiate a claim through a directly generated URL, by scanning a QR Code, or by using a specific Claim Code. ![Claim Details with the claim code SENSOR-A323-TMP-41, its claim URL and a QR code](https://docs.thinger.io/changelog/6.0.0/claim-details.webp) *Claim code, URL and QR code* ![Claim Resources page on step 1, Claim, with the claim code filled in and a Next button](https://docs.thinger.io/changelog/6.0.0/claim-step-claim.webp) *Claim process: claim step* The second phase shows a review of the claim. ![Claim Resources page on step 2, Review, listing the esp32eth device and the target project](https://docs.thinger.io/changelog/6.0.0/claim-step-review.webp) *Claim process: review step* Once the claim is completed, the process may request the configuration of the devices, i.e., via the Property Forms defined on the product. ![Claim Resources page on step 3 with the message Claim process completed and a configure link for the esp32eth device](https://docs.thinger.io/changelog/6.0.0/claim-step-complete.webp) *Claim process: complete and configure* * **Configurable Brand Accounts**: We've introduced a new "Accounts" section for each brand. This enhancement allows more control over brand-specific behaviors, including: * **Cross Sign-In Control:** Determine whether users registered with one brand can log in to another, thereby enhancing security and user management. * **Public Sign-Up Options:** Choose whether to allow public sign-up for each brand, providing flexibility in user onboarding. * **Automated Role Assignment:** Set specific account roles for users who register through public sign-up, such as automatically assigning 'member' status for device claiming purposes. This update offers more customization to better align with the brand's unique operational needs. ![Accounts tab of a brand with the Cross Sign-in and Public Sign-up switches, Project Member as account role, a project owner and a devices member role](https://docs.thinger.io/changelog/6.0.0/brand-accounts.webp) *Brand accounts settings* * **Configurable Brand Scripts**: An update has been released that allows for the configuration of custom scripts for a brand's `index.html`. This enhancement facilitates the integration of tools such as Google Tag Manager and the monitoring of customer traffic. ![Scripts tab of a brand with a Google Tag Manager snippet in the Index Scripts editor](https://docs.thinger.io/changelog/6.0.0/brand-index-scripts.webp) *Brand index scripts* * **New Permissions**: Console is introducing an array of specific new permissions, enhancing the granularity with which administrators can control member access and actions within the console. This update distinctly separates permissions for actions performed through the API from those executed directly on the console interface. In the current version, all existing permissions will continue to function as before. However, future updates will require the explicit assignment of 'View' permissions to maintain the access level. This change lays the groundwork for more precise and customizable user role management, ensuring enhanced security and efficiency in operation. At this moment, they are partially released for Devices, but will be covering the whole console in future updates. ![Actions selector of a permission listing View, ViewDeviceAPI, ViewDeviceCallbackConfig, ViewDeviceDashboard, ViewDeviceGeofences, ViewDeviceInspector, ViewDeviceProperties and ViewDeviceSettings](https://docs.thinger.io/changelog/6.0.0/view-permissions.webp) *New View permissions* * **Updated Editors**: Now, editors are based on Monaco (the editor from Visual Studio Code) with support to maximize the editor and copy the contents. ![JSON editor with copy and maximize buttons showing a property value with color, inicio, name, open and slider fields](https://docs.thinger.io/changelog/6.0.0/monaco-json-editor.webp) *Monaco-based value editor* * **New Icon Picker**: There is a new icon picker with a much greater variety of icons and improved search capabilities. ![Select Icon dialog with a search box and a grid of light icons](https://docs.thinger.io/changelog/6.0.0/icon-picker.webp) *Icon picker* ### Improved * Double-click on Widget now opens the Widget editor! * Create and update properties' performance. * Time series data should not present data wraps anymore. * Internal Google Maps loader to potentially avoid multiple loads. * Buckets API query now supports the "group_by" parameter. * Move Swagger to an Angular component. New URL: https://console.thinger.io/swagger * Initial deprecation of InfluxDB v1. * Widget add time series automatically selects a different name and color for each series. * Dashboard source switching now allows switching between bucket tags, with minimum and maximum selected tags. * Dashboard internals. ### Fixed * Push button widget not working on mobile devices. * Real-time dashboards now work properly with project members and shared dashboards. * Fixed the issue where the dashboard widget with device resource data source was showing offline, despite the widget receiving data. * Deletion event not triggered for nested resources, i.e., device property. * Creation event not triggered for property resources. * Data bucket storage from Products using device resources with a fixed interval randomly stops writing. * Add Syncs to the tokens' actions. * Dashboard editing is not being disabled on non-active tabs. * Token configuration was missing the description field. * Delete resource from the console, sending parameters like index, count... ## 5.3.7 **Release Date:** 30-11-2023 ### Fixed * Issue while displaying the default project on member accounts. * Reset password not working for some email addresses. ## 5.3.6 **Release Date:** 24-10-2023 ### Added * Support for HTTP_HOST and HTTPS_HOST environment variables for HTTP requests over a proxy. * Support for disabling HOSTNAME resolutions on installed plugins, i.e., useful for plugins that require querying an external public IP (like FTP). ### Improved * Prevent large navigation breadcrumbs from overlapping the right menu button. ### Fixed * Device link to a Product web page not working on mobile devices (in the aside menu). * Error while updating account limits. * Support for 303 HTTP See Other status. ## 5.3.2 **Release Date:** 04-07-2023 ### Added * Widgets now have a "Show Offline" parameter to "turn off" the widget if the data is not recent. The widget is displayed as "Disconnected" when its data is older than the configured timespan. ![Show Offline widget option set to a timespan of 15 minutes](https://docs.thinger.io/changelog/5.3.2/widget-show-offline.webp) *Show Offline option* ![Animation of a Camara Frigorífica widget showing 30.00 °C with a red clock reading 12 m and an offline icon](https://docs.thinger.io/changelog/5.3.2/widget-offline.webp) *Widget shown as disconnected* * Product API Response can now be sourced directly from a function. * Product API Response can now be sourced directly from an IOTMP resource. ### Improved * Internal HTTP client stability. ### Fixed * Problem while counting active alarm instances on the menu. * Alarms that are not triggering notifications on creation when it has immediate activation. * Alarms that do not allow for selecting hours as reminder intervals. * IOTMP with multiple property stream subscriptions. * Products that do not process the API Responses payload configuration, but return just the original payload. * Input template params to Product API Request targeting functions are not being correctly processed. * Plugins that require a MongoDB user to interact with the database fail to upgrade. * Dashboard widget settings are closed when removing the widget background. ## 5.3.0 **Release Date:** 19-06-2023 **Discussion Topic:** [Thinger.io Community](https://community.thinger.io/t/thinger-io-iot-platform-version-5-3-0/4784) ### Added * New Alarms feature (BETA)! A completely new solution for managing IoT alarms, which includes rule definitions and alarm instance management. Some key features of the new solution: * Multiple data sources for configuring alarm triggering include data buckets, device properties, and device state. * Multiple severities: High, medium, low, none. * Independent activation and normalization conditions, including confirmations based on timespan or several consecutive events. * Multiple endpoint notifications on activation, normalization or reminder, i.e., for sending an email, a message to mobile, etc. * Alarm instance management via Acknowledge, Shelve, Latch, or Clear, including reactivation timeouts and operator annotations. ![Alarm rule Device Not Syncing with medium severity, a 10-minute check interval and an activation condition when ts() minus sync.modified is above 24 hours](https://docs.thinger.io/changelog/5.3.0/alarm-rule.webp) *Alarm rule configuration* ![Alarm instances list with two activated medium-severity Device Not Syncing alarms, their values, last seen and duration](https://docs.thinger.io/changelog/5.3.0/alarm-instances.webp) *Alarm instances* * Support for cloning almost any Thinger.io resource, from dashboards to data buckets, file storage, and projects. ![Bucket list with one bucket selected and the Clone action in the toolbar next to Set Type, Set Group, Set Projects and Remove](https://docs.thinger.io/changelog/5.3.0/clone-resource.webp) *Clone action* * HTTP endpoints now support embedded NodeJS scripts for custom payload processing when calling third-party services. ![Endpoint Request Body set to Send function return, with an endpointPayload function that returns the incoming payload](https://docs.thinger.io/changelog/5.3.0/endpoint-nodejs-function.webp) *NodeJS payload processing on an HTTP endpoint* ### Improved * The bucket list automatically refreshes the bucket state, i.e., when it finishes exporting or importing, which happens on a clone operation. * IOTMP proxies now work correctly with TLS endpoints. * HTTP over IOTMP now correctly supports WebSockets. * Resource list and navigation: * It is possible to change the maximum number of elements to display per page. * Page navigation/sorting is not reset after entering one element and going back to the list. * The changelog is now available at `https://docs.thinger.io/server/changelog`. ### Fixed * Remove project properties and project roles from the database on project deletion. * The bucket field selector now displays an input text for manually selecting the fields if the latest values cannot be queried, i.e., when they are older than one week. * Double loading of HTML widgets when the dashboard is open. * Proxy configuration was not displayed correctly if the source was different than TCP. * The bucket export list is not being displayed under some circumstances. * Resource lists on the front-end are not showing the correct permissions for members. * Prevent members from navigating to specific resources if no permissions are available. * Update the Device permission on the front-end. ## 5.2.2 **Release Date:** 12-04-2023 ### Fixed * Timestamp on HTTP device callbacks from HTTP plugin ## 5.2.1 **Release Date:** 10-04-2023 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-5-2-0/4709) ### Added * Included support for installing Products over plugins. Now, there are some Shelly devices added to the plugins Marketplace. We will grow it soon! Looking for contributors and partnerships! ![Plugin cards for Shelly 1L, Shelly Plug S and Shelly Plus 1PM in the marketplace](https://docs.thinger.io/changelog/5.2.1/marketplace-shelly-plugins.webp) *Shelly plugins in the marketplace* * Initial support for devices auto-provisioning over products. It is currently based on the device id, but will include other features like white lists, manual approval, etc. ![Auto Provision table of a product with shelly_plus_1pm enabled for the pattern shellyplus1pm-\[a-fA-F0-9\]+](https://docs.thinger.io/changelog/5.2.1/product-auto-provision.webp) *Auto provision in a product* * New Plugins Marketplace based on a monorepo repository: [Thinger.io Plugins](https://github.com/thinger-io/plugins). It will allow better maintainability and simplify new contributions! * Initial Plugin Exporter feature inside Products. This way, a Product can be easily converted to a Plugin. enhancing user contributions. ![Exporter tab of the shelly_plus_1pm product showing the generated plugin JSON with name, version, metadata and product resources](https://docs.thinger.io/changelog/5.2.1/product-plugin-exporter.webp) *Plugin exporter in a product* * Device type to "device_authentication_failed" event. ### Improved * Avoid creating a Docker network if the plugin does not run a task (i.e., products). * Plugins marketplace on the frontend, with better image alignment. * Permissions assigned to user File Storage are 1000:1000, so they can be easily edited over plugins, i.e, in Node-Red, VSCode, Jupyter plugins, etc. * Plugin files copied on installation now have 1000:1000 permissions, so they are modifiable over plugin shells. ### Fixed * Bucket exports showing duplicate columns * Domain creation when setting a name ## 5.1.12 **Release Date:** 16-03-2023 ### Fixed * Temporal restore of the default IOTMP buffer size until IOTMP-Websocket supports growing buffers ## 5.1.11 **Release Date:** 14-03-2023 ### Fixed * DynamoDB (community buckets) bucket projections when using reserved keywords ## 5.1.10 **Release Date:** 08-03-2023 ### Fixed * Null/false on bulk bucket writes when using tags on topic placeholders * DynamoDB (community buckets) bucket projections when using non-alpha characters ## 5.1.9 **Release Date:** 07-03-2023 ### Improved * Bulk bucket writes are now also supported by products ## 5.1.8 **Release Date:** 06-03-2023 ### Fixed * Center images on the dashboard image widget. * Remove the undesired console.log used in development * HTML widgets from file storage may fail to load * The dashboard add widget modal closes when adding a new background color ### Improved * DynamoDB can now use field projections from dashboards to save bandwidth * Reduced dashboards' max chunks fetch to support large datasets on DynamoDB ## 5.1.7 **Release Date:** 06-03-2023 ### Added * Daily Data transmission on device Status (For MQTT and IOTMP) ### Fixed * Computed data transmission for current and past days ## 5.1.6 **Release Date:** 03-03-2023 ### Fixed * Big logo shown on shared dashboards ## 5.1.5 **Release Date:** 03-03-2023 ### Fixed * Problem when converting certain InfluxDB data back to JSON. ## 5.1.4 **Release Date:** 02-03-2023 ### Improved * Maximum message size for IOTMP/MQTT devices. ## 5.1.3 **Release Date:** 01-03-2023 ### Fixed * Fix SSL certificates provisioning on instance startup. ## 5.1.2 **Release Date:** 27-02-2023 ### Fixed * Plugin Environment variables not initialized on upgrade. * Dashboard error popups are hidden on the device dashboard. * The menu on mobile is not responding to the first touch event. ### Improved * Disconnect the mechanism after server restart. It should correctly handle device disconnections and their events. ## 5.1.1 **Release Date:** 24-02-2023 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-5-1-1/4669) ### Added * Infinity scroll on mobile view. * Support for bulk data bucket writes, i.e., `[{"ts": 1675360078000, "val1": 0, "val2": 1},{"ts": 1675360088000, "val1":1, "val2":3}]`. Only working on private instances at this time. * The clock icon displays full time when the mouse is over ![Last Connection column showing 10m with a tooltip reading 20/02/2023, 19:12](https://docs.thinger.io/changelog/5.1.1/last-connection-tooltip.webp) *Full time on the clock icon* * The protocol column now displays the connection security ![Protocol column with a green lock on HTTP and a red lock on MQTT, and the tooltip Connection security: TLSv1.3](https://docs.thinger.io/changelog/5.1.1/connection-security-tooltip.webp) *Connection security in the protocol column* * Error/Info messages on mobile view ![Devices page in the mobile view with the error Cannot process your request, connection not available](https://docs.thinger.io/changelog/5.1.1/mobile-error-message.webp) *Error message in the mobile view* ![Devices page in the mobile view with the message No devices to show](https://docs.thinger.io/changelog/5.1.1/mobile-info-message.webp) *Info message in the mobile view* ### Fixed * "Never" is shown again when the device has not been connected * Resource inspector not opening * Minor bugs * Bucket import error reporting * Plugin logs are not working with the latest Docker versions * Locks are not deleted when Sync is removed ### Improved * Scrollbars on the left menu and content are now overlay scrollbars with auto-hide. * Action buttons are now displayed on the left in desktop view. ![Device list with one device selected and the Set Type, Set Group, Set Projects and Remove actions on the left of the toolbar](https://docs.thinger.io/changelog/5.1.1/list-actions-left.webp) *Action buttons on the left* * Resource ID is also displayed on mobile view * Set Type, Set Group, and Set Projects do not require a list refresh. ## 5.0.1 **Release Date:** 2023-02-14 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-5-0-1/4664) ### Added * Support for **ARM64** (Raspberry Pi, Apple M1, Apple M2). * New 'Syncs' feature inside the Toolbox section: Semaphores for distributed IoT devices that can be used for bandwidth limiters, access control, max number of devices doing OTA, etc. This feature can be used both from the API and IOTMP devices using the new `lock_sync` and `unlock_sync` methods. Each lock acquires a fixed number of slots if they are available. ![Sync form for parking_access, Available Parking Spaces, with 125 slots available and an empty default timeout](https://docs.thinger.io/changelog/5.0.1/sync-form.webp) *Sync configuration* * New Content-Security-Policy HTTP header configuration on **Cluster Settings > Deployment**. * Products can now target a File Storage for their script (still under testing). It will automatically load the `index.js` script into the Storage. ![Product Script panel with the Scripts file storage selected](https://docs.thinger.io/changelog/5.0.1/product-script-storage.webp) *Product script in a file storage* * Product APIs can now target a script function for their destination and include additional placeholder data from properties or other device APIs. ![Product API resource Request tab with Product Function as target, the totp function and a payload with property and payload placeholders](https://docs.thinger.io/changelog/5.0.1/api-resource-product-function.webp) *Product Function target on a product API* ### Fixed * Product APIs with Property as its target (the property was not written). * Exception when `TOKEN` is not provided. ### Improved * Installed plugins are now automatically updated on impersonation changes. * UI with better support for mobile devices. Will be released as an APP. Still under development! ![Console in the mobile view with the side menu open over the dashboard of a Shelly Plug S device](https://docs.thinger.io/changelog/5.0.1/mobile-menu.webp) *Console menu in the mobile view* ### 4.6.7 **Release Date:** 2022-12-20 #### Fixed * SSL automatic updates. #### Added * Search any field on resource lists via API, i.e., email on user accounts. * Internal configurable parameter "certificates.min_certificate_validity" #### Improved * Validate sort and order query parameters on resource listing. ### 4.6.6 **Release Date:** 2022-11-22 #### Fixed * Database initialization for users without an initial password. * Device access without permissions, i.e., from a member. ### 4.6.5 **Release Date:** 2022-11-22 #### Fixed * Bucket clear error. * Remove export, create log. ### 4.6.4 **Release Date:** 2022-10-28 #### Fixed * Bucket export with a custom date interval does nothing. * The difference transformation without aggregation provoked an error. * Representation issue on the dashboard when setting an absolute timeframe after a relative timeframe. ### 4.6.3 **Release Date:** 2022-10-27 #### Added * A new setting on the Dashboard control allows hiding hours from the absolute date range picker. #### Improved * Aggregated dashboard time series queries that include a transform (i.e., a difference or derivative) now automatically expand the query interval (lower bound) to display the expected range on the UI. #### Fixed * Date-time selector now relies on the datetime-local HTML5 component, removing some issues related to the previous date-time picker. * Access tokens without a project should not limit access to project resources ### 4.6.1 **Release Date:** 2022-10-13 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-6-0/4553) #### Added * Experimental **IOTMP Proxies** (TCP/HTTP) for connecting with device local network resources, i.e., devices/routers webpages, terminals, RDP, VNC, etc. These proxies require a new IOTMP client library for Linux. ![Proxy Settings form with the Protocol dropdown open: TCP, UDP, TCP over IOTMP and HTTP over IOTMP](https://docs.thinger.io/changelog/4.6.1/proxy-protocols.webp) *Proxy protocols* For example, the IOTMP Linux Client working on a [RevPi](https://revolutionpi.com/) provides access to the device configuration over its local web page. ![RevPi login page shown inside the RevPi tab of the RevPiClone device in the console](https://docs.thinger.io/changelog/4.6.1/revpi-web-over-proxy.webp) *RevPi web page through the IOTMP client* * Support for defining **Web Services** inside `Products` section. It allows defining web pages that can be accessed over an IOTMP linux client. ![Web Service dialog for RevPiClone targeting 192.168.1.188 on port 41080 without SSL/TLS](https://docs.thinger.io/changelog/4.6.1/product-web-service.webp) *Web service in a product* * Ability to **create project members** directly from the "Add Member" section, creating the user automatically by providing only the email address. ![Member Details form with the Existing User switch off and Username, Email and Password fields](https://docs.thinger.io/changelog/4.6.1/add-member-new-user.webp) *New user from Add Member* * Each project can now define a set of **Project Roles** that can be used by any member within a project. ![Project Roles menu entry](https://docs.thinger.io/changelog/4.6.1/project-roles-menu.webp) *Project Roles* * Each developer/admin account can now define a set of **Global Roles** that can be used by any member within any project. For example, a general-purpose read role that can be shared in all projects. ![Global Roles menu entry](https://docs.thinger.io/changelog/4.6.1/global-roles-menu.webp) *Global Roles* * **Project member permissions** can now be established by **roles** in addition to custom member permissions, simplifying permissions management. All global roles, project roles, and custom permissions can be established together (if required). ![Member Permissions with Global Roles and Project Roles selectors above the Allow and Deny permission tables](https://docs.thinger.io/changelog/4.6.1/member-roles-permissions.webp) *Member permissions by roles* #### Improved * Members will go to the first allowed section after login or refresh, instead of the default Project Dashboard, i.e., devices or dashboards, if they do not have access to read the project dashboard. * Device resource streams now include different signals: start, stop, data, and error (on IOTMP devices), in order to keep track of streams. * Device Terminal now supports multiple concurrent sessions (with the IOTMP linux client). ![Terminal of the macbook device running htop with CPU, memory and process list](https://docs.thinger.io/changelog/4.6.1/device-terminal-htop.webp) *Device terminal* * The server can now use wildcard certificates, stored as `*.mydomain.com` in the certificates folder. Provisioning wildcard certificates over the 'Domains' section is not possible. * Internal socket server can now filter socket connections based on IP address. Used at this moment internally for proxies' security. #### Fixed * Very high loads over websockets could cause a crash under some circumstances. * Automatic transition to newly created resources when they are nested more than 2 levels (i.e., while creating a new project member). * Potential crash with multi-thread product initialization at startup. * Switching between projects or opening/closing projects is forbidden under some circumstances. * Set projects displayed on proxies (proxies do not support projects). * Missing selectors when configuring specific token permissions, i.e., over a proxy. * Access Tokens are now limited to the project scope where they are defined. * Payload not being sent on IOTMP devices. ### 4.5.4 **Release Date:** 2022-07-14 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-5-4/4483) #### Improved * File Storage Explorer does not download binary files automatically when clicked, it just displays a download button. ![File preview not available message with a download button for anydesk installer.dmg](https://docs.thinger.io/changelog/4.5.4/file-download-button.webp) *Download button for binary files* * Storage API now determines if a file without an extension is `text/plain` or `application/octect-stream` to set the correct `content-type` on the HTTP response. * Add option `rewrite_base_path` to avoid base path rewrite in plugins' reverse proxy. * File Storages can now be opened with VS Code when the plugin is installed. ![VS Code tab of the influxdb_plugin storage editing plugin.json, with a bash terminal below](https://docs.thinger.io/changelog/4.5.4/file-storage-vs-code.webp) *File storage opened with VS Code* ### 4.5.3 **Release Date:** 2022-07-13 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-5-0/4477) #### Added * Support for limiting range selector on dashboard (i.e., allow only relative and/or absolute range selection). ![Controls tab of the Dashboard Settings with an Aggregations field and the Range Selector limited to Absolute](https://docs.thinger.io/changelog/4.5.3/dashboard-range-selector.webp) *Range selector limits* * Screen helpers for all resources on Thinger.io, with links to documentation, API, features, etc. #### Improved * Location set from a device property now overwrites geo-ip location, and: * Trigger `device_location_changed` event with a new location. * Execute the Geofence configuration to trigger any action based on location change. * Fixed location is now displayed correctly on Assets Maps. #### Fixed * Fix Bucket query when fields contain a path with dots, i.e., environment.temperature ### 4.5.0 **Release Date:** 2022-06-28 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-5-0/4461) #### Added * New administration feature called 'Proxies' (starting on MEDIUM instances), which allows creating custom proxies to plugins or local services, i.e, redirect TCP or UDP traffic to Node-RED (for example, for COAP devices), or provide access to local InfluxDB2 install. ![Proxy Details for TCPNodeRed, forwarding TCP port 5555 to port 5555 of the node-red plugin](https://docs.thinger.io/changelog/4.5.0/proxy-tcp-node-red.webp) *TCP proxy to Node-RED* * New plugin InfluxDB2 (starting on MEDIUM instances, as it requires Proxies feature). It supports accessing the InfluxDB2 GUI and API for custom configurations, dashboards, alerts, ingestion, etc. ![InfluxDB v2.2.0 sign-in page inside the console](https://docs.thinger.io/changelog/4.5.0/influxdb2-plugin.webp) *InfluxDB2 interface in the console* * A plugin install can now initialize any resource in the console, i.e., InfluxDB2 plugin automatically initializes a proxy. * Plugins can now be defined without a task, i.e., the InfluxDB2 plugin does not deploy any additional container. #### Improved * Swagger API Generation (tested on the proxies API). * Plugin installs from File Storages. * The left menu now correctly displays the current selected plugin. #### Fixed * Some fixes on dashboards using image widget and map widget with geofences. * Devices API v2 not respecting the v2 specification (wrapping response inside 'out'). * Loading bucket data view without access to bucket config (required for loading tags information), i.e., when a member does not have permissions for ReadBucketConfig. * Plugins API now supports "id" query parameter, required for Plugin selector. ### 4.4.0 **Release Date:** 2022-06-20 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-4-0/4450) #### Added * Bucket view now displays tag values in the first column. ![Bucket data table with the date, then the device and group tag columns, then overtemperature and temperature](https://docs.thinger.io/changelog/4.4.0/bucket-tags-columns.webp) *Tag values in the bucket view* * Bucket's data query API now supports a new query param 'fields' for selecting specific fields from a bucket, i.e., ?fields=temperature, humidity. * Bucket's data query API now includes a v2 endpoint, removing the unnecessary 'val', or aggregation/transformation name, on each measurement. #### Improved * Dashboards now select only required fields from a bucket, improving bandwidth/resources for buckets with several fields. * Bucket view now auto-resizes columns according to the content size. * Bucket view now displays a 'Loading' overlay while fetching data. * InfluxDB2 performance relies on InfluxQL queries when possible. * Grafana plugin is now able to automatically configure data sources (both InfluxDB1 (compatibility) and InfluxDB2). ### 4.3.2 **Release Date:** 2022-06-15 #### Fixed * Map widget initialization occurs when the map is placed on a dashboard tab. ### 4.3.1 **Release Date:** 2022-06-14 #### Fixed * Fix the problem while installing plugins on small instances. ### 4.3.0 **Release Date:** 2022-06-12 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-3-0/4444) #### Added * Support for switching projects in the mobile view. ![Mobile menu with Close Project and a project selector showing Test Project](https://docs.thinger.io/changelog/4.3.0/mobile-project-switcher.webp) *Project switcher in the mobile view* * Show dashboard name on the project dashboard instead of the default navigation bar. ![Project dashboard of Test Project with the title Dashboard name! instead of the navigation bar](https://docs.thinger.io/changelog/4.3.0/project-dashboard-name.webp) *Dashboard name on the project dashboard* #### Fixed * The project dashboard switches when the user is not a member. ### 4.2.0 **Release Date:** 2022-06-08 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-2-0/4443) #### Added * Open Graph support for title, description and image, configurable for each brand, i.e., when sharing a link over a social network. ![Link preview of console.thinger.io in a chat, with the thinger.io image, the title Thinger.io | Cloud Console and the description](https://docs.thinger.io/changelog/4.2.0/open-graph-preview.webp) *Link preview with Open Graph data* * The bucket data viewer now includes a filter by time. ![Data Filtering panel with a Last 24 hours selector and device and group tag filters](https://docs.thinger.io/changelog/4.2.0/bucket-time-filter.webp) *Time filter in the bucket viewer* * The Set Project dialog now keeps previously assigned projects on the resources. ![Set Projects dialog for test_alvaro with TestProject already selected](https://docs.thinger.io/changelog/4.2.0/set-projects-dialog.webp) *Set Projects dialog* * Full support for new time-series backend: InfluxDB2. * Server API updates with support for querying branch information and statistics from localhost. * Landing pages for each resource type, providing information and links to resources. ![Custom Domains landing page with a Create a Domain button and the reasons to use custom domains](https://docs.thinger.io/changelog/4.2.0/domains-landing-page.webp) *Landing page of a resource type* * Support for launching processes inside plugins and getting the command response over HTTP/WebSocket. * Shell over a plugin instance is now executed inside the plugin container (using exec). * Shell over a plugin now adapts to the original terminal size. * Show page title according to navigation state, i.e., 'Devices | esp32 | terminal'. ![Browser tab titled Devices | shellyplug-s-C18B12](https://docs.thinger.io/changelog/4.2.0/browser-tab-title.webp) *Page title in the browser tab* * Console rebrand based on new image/logo, including emails. ![New thinger.io logo above Sign in to your account](https://docs.thinger.io/changelog/4.2.0/login-new-logo.webp) *New logo* #### Improved * InfluxDB2 queries perform poorly when using 'heavy' buckets with multiple tag values. * Data bucket import now excludes empty or null values. * Internal proxies to plugins, required for supporting the latest Grafana version and its security requirements. * Plugins can now (and should) set the image version inside the task. Image field (i.e. grafana/grafana:8.5.4), so it can be decoupled from the plugin version. * InfluxDB2 + Grafana integration, with automatic source configuration on install. * Console terminals now use a custom user-friendly scrollbar. * Dashboard view on mobile when controls are enabled (timespan selector and aggregation). * Mobile navigation occurs when clicking on the menu or showing tables. * Data bucket viewer now displays local time instead of ISO date on bucket entries. * Better compatibility for showing last update timestamp on dashboard widgets (even time series charts). * Using 'password' type on account management. * Fix the tachometer widget scaling and value update. #### Fixed * Multiple dashboard queries on dashboards when using buckets with several tag values. * Undesired timestamp plot on time series chart when no field mapping is present on the widget source. * The slider widget malfunctions when setting the step width smaller than 1.0. * Dashboard aggregation controls are shown on the community version (only supported on private instances). * The console terminal is not releasing the window. * The plugin markdown is not shown. * Migration to the new dashboard sources is not working correctly on control widgets. * Download bucket exports are not working on the community. * Problems with device terminals after the 4.0.0 upgrade. * Search by id or name problem after introducing 'domain' on resources. * MQTT Fix potential crash with malformed inputs. * Email fixes when using multiple brands and multiple email servers. ### 4.0.0 **Release Date:** 2022-05-18 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-4-0-0/4442) #### Added * Support for multiple time series sources on time series widgets, i.e. charts, html time series, and maps. ![Widget sources Temperature and Humidity; the Temperature source reads the temperature value from a bucket filtered by device tag](https://docs.thinger.io/changelog/4.0.0/time-series-multiple-sources.webp) *Multiple sources on a time series widget* * Add new "Product" section to allow defining device profiles, that will help when managing devices at scale. ![Profile of the shelly_plug_s product with properties and buckets fed from MQTT topics, a relay API resource and a product script](https://docs.thinger.io/changelog/4.0.0/product-profile.webp) *Product profile* * It supports updating device properties from MQTT topics/device resources. * It supports defining buckets from MQTT topics/device resources. * It allows creating custom device APIs for MQTT/HTTP/IOTMP devices. * Add support for processing data payloads with NodeJS runtime. * Add support for defining per-product dashboard, which is inherited by each device. Devices now automatically open the product dashboard if it is available. * It adds another property hierarchy for devices, with this order Product > Type > Group > Device. * Data buckets now supports tags: multiple data from the same type can be stored in the same bucket. ![Bucket Configuration with device and group as data tags](https://docs.thinger.io/changelog/4.0.0/bucket-data-tags.webp) *Data tags on a bucket* * Dashboard support for buckets with tags. ![Widget data source from the shelly_em_meter bucket filtered by the device and emeter tags](https://docs.thinger.io/changelog/4.0.0/dashboard-bucket-tags.webp) *Bucket tags in a widget source* * New role named "Domain Admin", with the ability to manage developer/members inside the specified domain(s). ![User role dropdown with Admin, Domain Admin, Developer and Project Member](https://docs.thinger.io/changelog/4.0.0/domain-admin-role.webp) *Domain Admin role* * Initial support for device shadow information, i.e., being able to display last stream data on a dashboard even if de device is disconnected. * Add a new Inspector tool for any resource, so, it is possible to see live Events related to monitored resources, i.e., MQTT live data sent by a device. * Disabling a device from its settings disconnects the ongoing connection. * APIs now support additional content types: messagepack, cbor, ubjson, and form data. * Support for InfluxDB transformations on dashboards. ![Aggregate set to 1d mean and the Transform dropdown open with functions such as abs, ceil, cumulative_sum and derivative](https://docs.thinger.io/changelog/4.0.0/dashboard-transform.webp) *Transformations on a widget source* * Support for MQTT retained messages. #### Improved * Aggregated data in dashboards now uses the browser's timezone to display data correctly. * Device API now lazy loads device resources when clicked, useful for devices with several resources. * Device API now keeps track of opened resources when refreshing the API with the button. * Tokens and Device Tokens can be easily copied with a button. * Allow plugins to update current token permissions. * Auto-hide track waypoints on the map widget depending on the map zoom level. * The bucket data view now displays the real field case in the columns. #### Fixed * Brand email configuration is not working properly. * Profile Settings link not working. * Buckets source switch is not working when changing from a device resource to anything else. * Disabling a bucket did not stop a device resource from streaming properly. * Closing the host's dashboard throws an error on the console. * Resource selector not taking the correct selected id when using similar ids. * Device event 'device_authentication_failed' is not thrown. * Device enable/disable setting is not working properly. * Fix Device API curl example when the body request is 'false'. * Endpoint HTTP request body editor does not show until the 'Test' section is opened. * Fixed the butter-bar not showing while loading pages. * Fixed Image/MJPEG widget not updating images or updating after modifications. * MQTT client timeout is not being used. ### 3.4.2 **Release Date:** 2021-11-11 **Discussion Topic:** [Thinger.io Community Forum](https://community.thinger.io/t/platform-version-3-4-0/4134) #### Added * Initial version for OAuth2 Client authentication flow, i.e., connecting third-party apps like Alexa. ![Authorization page where Alexa Skill asks for access to the alvarolb account with Device permissions, and Deny and Allow buttons](https://docs.thinger.io/changelog/3.4.2/oauth2-authorization.webp) *OAuth2 authorization for Alexa* * New plugin: HTTP Device, supporting scaling HTTP device deployments. ![HTTP Device plugin card, HTTP Devices Integration, with a REST icon](https://docs.thinger.io/changelog/3.4.2/http-device-plugin.webp) *HTTP Device plugin* * Hide the Menu option for members. ![Hide Menu switch turned on](https://docs.thinger.io/changelog/3.4.2/hide-menu.webp) *Hide Menu option* * Improved HTML Widgets with support for custom AngularJS directives! * Opening a restricted link will redirect to the target URL after login. * Support for disabling Swagger API pages. Available on **Host Settings > Deployment**. ![Disable Swagger API switch turned on](https://docs.thinger.io/changelog/3.4.2/disable-swagger-api.webp) *Disable Swagger API option* * Now it is possible to configure X-Frame-Options to allow adding iframes on known pages. Available on **Host Settings > Deployment**. ![X-Frame-Options field set to SAMEORIGIN](https://docs.thinger.io/changelog/3.4.2/x-frame-options.webp) *X-Frame-Options setting* * Endpoints have an optional field name for displaying & search purposes. * Dozens of new server events that can be used with Node-RED, i.e., any resource create/update/delete. * API Endpoint '/v1/server/events' to query all available server events. * API Endpoint '/v1/server/assets' to query server asset types. * API Endpoint '/v2/users//events' with support for registering/unregistering server events, providing commands feedback. * Brand configuration for web metadata, like keywords and description. ![Brand Meta Description and Meta Keywords fields with the Thinger.io description and keywords](https://docs.thinger.io/changelog/3.4.2/brand-web-metadata.webp) *Brand web metadata* * Access tokens now provide a field with the hostname for easier cloud integration. * Devices can now be enabled or disabled from settings. #### Improved * Dashboards refresh buckets and properties sources in real-time. * Removed "#!" from URLs. Previous URLs are still valid. * Platform security by preventing refresh token re-usage. * Improve the refreshing token mechanism on the frontend (avoiding multiple queries). * The internal event system is now much more flexible and fault-tolerant. #### Fixed * Show server version option in custom brand configuration. * Set Project button is not showing sometimes while changing between projects. * Add resource button with broken layout when switching to a project with some selected items. * Server not registering above 50 MQTT listeners after restart. * Password update from the users section is not triggering the internal event for database update. * New instances are not showing the Hosts section after initial deployment. * Time series chart with absolute dates not working. * Set project dialog is not showing the Project selector under some circumstances. * Access token link not working on shared dashboard settings. * Device connection event trigger order on reconnection when 'reusing' credentials. * Server Event 'device_state_listener' not triggering with MQTT devices on disconnect. ### 3.3.0 **Release Date:** 2021-08-10 #### Added * Support for branding on login form, signup, forgot password, etc. It is possible to set the background color, image, location of the forms, and hide the public signup. ![Animation of three branded login pages on Thinger.io servers, for Nerospec IoT, Flux Play and KillingWatts, each with its own logo, background and form position](https://docs.thinger.io/changelog/3.3.0/branded-login-pages.webp) *Branded login pages* ![Login tab of a brand with background color, background image, box location Right, box style and the Public Signup switch off](https://docs.thinger.io/changelog/3.3.0/brand-login-settings.webp) *Brand login settings* #### Fixed * A problem with `PATCH` and `PUT` methods on properties, causing issues with the Project dashboards or the slider widget. * Groups section in the console should be working now for members with allowed permissions * Fix `Set Project` menu button for types and groups. * Assets menu now behaves correctly according to member permissions ### 3.2.2 **Release Date:** 2021-07-29 #### Added * Configurable default project for members after login. ![User settings with the Project Member role and Asset Tracking as default project](https://docs.thinger.io/changelog/3.2.2/member-default-project.webp) *Default project for a member* * A configurable dashboard for each project, shown by default after the member logs in or project. ![Console with the Asset Tracking project open, its dashboard as the first menu entry and the project selector in the top bar](https://docs.thinger.io/changelog/3.2.2/project-dashboard-menu.webp) *Project dashboard in the menu* * Console interface adapts to member permissions, hiding unavailable actions or sections. * Account management now allows changing per-user account limits (dashboards, devices, etc.). ![Account Limits of a user with default values for access tokens, buckets, dashboards, devices, endpoints, plugins, projects, project members, storages and asset types and groups](https://docs.thinger.io/changelog/3.2.2/account-limits.webp) *Per-user account limits* * Configurable Bucket data retention policy per-user account and default setting. ![Storage Limits with a bucket retention of 30 days](https://docs.thinger.io/changelog/3.2.2/bucket-retention-limit.webp) *Bucket retention per account* * Impersonate functionality to check other accounts easily from the admin account. ![Eye icon next to the alvarolbMember user in the user list](https://docs.thinger.io/changelog/3.2.2/impersonate-icon.webp) *Impersonate a user* * Support for linking dashboard widgets to another dashboard. * Websocket support for IOTMP and MQTT devices. * Support for selecting a timestamp as a field from bucket data. * Dashboard background now supports HTML color, i.e., #aabbcc instead of a URL image. #### Improved * Keep menu and sub-menu items as "active" respecting the hierarchy. * Refactored bucket layout section with different sections grouped by functionality. * Hide the project column when there is a project selected in the console. * Hide "ugly" resource names when navigating on resources inside a project, i.e., user.device. * Increased keep-alive tolerance for better device connection stability. * Disable close project button for members. #### Fixed * Apex Charts color contrast in title, subtitle, and axis labels. * Device creation error when switching from Generic to HTTP after filling in some fields. * Bucket download links for community buckets exported to S3. * Disable internal database creations for members. * Bucket export state when export fails. * DB error while updating a device without stats. * Invalid property update event when modified from dashboard slider (or PATCH REST API). * Disable property creation when parent resource does not exist. ### 3.1.0 **Release Date:** 2021-05-05 #### Added * New HTML widget for its use with time series data (i.e., display tables). ![Table with ts, inst_waterFlow_liter and inst_waterFlow columns rendered by an HTML time series widget](https://docs.thinger.io/changelog/3.1.0/html-time-series-table.webp) *HTML time series widget* * Current HTML widget now supports multiple values to be selected. #### Fixed * Install/upgrade custom plugin version. * Geofences are not working for some polygons. * Fix the LED colors editor (each color in a single row). * Set X and Y axis limits on time series charts to prevent freezes with wrong values. * Fix a problem with the min and max y-axis on the time series chart when set to zero. * Fix legacy bug regarding buckets query & merging. * Allow modification of an existing widget type. * Fix template replacement when using `{{}}` as a pattern. #### Improved * Starting a plugin will show its log by default (some plugins require boot time, so this provides feedback to the user). * Plugins with master or latest tags will force an update when installing or upgrading. * Security when mounting volumes inside plugins. ### 3.0.0 **Release Date:** 2021-04-16 #### Added * Apex Charts are now available (in BETA)! ![Apex Charts widget settings with a Line chart preview of apples, bananas and oranges series](https://docs.thinger.io/changelog/3.0.0/apex-charts-widget.webp) *Apex Charts widget* * Add aggregation based on the client browser's timezone. * Allow MQTT 3.1 client connections (in addition to 3.1.1). * Initial support for VSCode plugin (starting from Medium instances). Contact us for more details. * Added openapi.json to support restish. * Add support for displaying last known location of a device on the map. #### Improved * Show plugins in menu only if the plugin is running to avoid confusion. * Assets Map widget options are now more legible with different backgrounds. * Upgraded widget buttons. * Dashboard error handling with a time series chart. * Thinger.io Docker image is now smaller. * Plugins engine now supporting installs from Storages, setting custom user, etc. #### Fixed * A problem with instances using the server "www." subdomain. * Storage editor not opening due to Chrome security fix. ### 2.9.9 **Release Date:** 2021-02-28 #### Added * New widget "Assets Maps" for viewing all assets by type/group in map, with search capabilities. ![Assets Map widget with clusters of 47 assets in Spain and 12 in China, and a Search Asset box](https://docs.thinger.io/changelog/2.9.9/assets-map-widget.webp) *Assets Map widget* * New widget "Source Switcher" acting as previous template feature: allow to change the device/bucket within a tab. ![Animation of a Source Switcher dropdown listing devices; selecting NodeMCU Placa updates the map widget below](https://docs.thinger.io/changelog/2.9.9/source-switcher-widget.webp) *Source Switcher widget* * Add support for disabling fullscreen button on widgets (@rin67630). ![Show Fullscreen switch turned off](https://docs.thinger.io/changelog/2.9.9/show-fullscreen-option.webp) *Show Fullscreen option* * Add an option in the shared dashboard settings to automatically update the permissions from the shared link. ![Shared dashboard settings with the Dashboard_DeviceSwitcher access token and the Update Token switch on](https://docs.thinger.io/changelog/2.9.9/shared-dashboard-update-token.webp) *Update Token option* * Add support to modify min row height in dashboards. * Buckets can now support an asset type and group. * Add an option for setting asset types and groups for devices/buckets creation and from its settings/lists. * Devices can hold now a friendly name, i.e., a serial number, plate id, etc. * Support for creating new accounts (members and developers) without a password. The user will be required to initialize the password via email. * New page that allows the developers/members initialize their accounts passwords. * Support for multi-brand email templates and servers. Brands can now define its own emails templates and custom mail servers for communicating with users. ![Email Templates tab of a brand on the Create Password template, with sender, subject Activate Your Account, a preview and Show Code and Test Email buttons](https://docs.thinger.io/changelog/2.9.9/brand-email-templates.webp) *Brand email templates* * Added email template editor and mail server settings inside Brands section with options for template testing. * Add STARTTLS support in SMTP for old servers not supporting direct SSL/TLS connections. #### Improved * Changed legacy email templates. * SMTP interface will correctly send the From Name. * Users without a verified email address can verify it automatically after initializing/resetting their password (which requires an email). * All source selectors will display the friendly name of the resource, i.e, the friendly name of a project, device or bucket. * Search supports now both searching by id and friendly name in all resources. * Control Widgets (buttons/sliders) now support mapped values (i.e., a field inside a resource). * Propagate websocket proxy error to caller in clustered deployments. * Asset types and groups are automatically created in the device/bucket creation (from API). #### Removed * Email communications when bucket export, clear, and delete succeed/fail. * Google Vector Maps are used by default in dashboards, as they were not performant enough. #### Fixed * Swagger API rendering problems. Now it is completely usable again. * Tachometer widget when setting major axis to 0 (@hjfosse). * Fix case search root resources (domains, hosts, brands, etc.). * Fixed an error while removing the panel title and subtitle (not updating). * Cropped the aggregation menu from the charts widget when the chart was smaller than the menu. * Fix the chart aggregation menu padding, hiding the right selector border. * Fixed some problems when loading multiple maps on dashboards. ### 2.9.8 **Release Date:** 2021-02-03 #### Added * Initial support for column sorting in all console lists (devices, buckets, dashboards, etc.). ![Dashboard list sorted by the Dashboard column, with a sort arrow in the header](https://docs.thinger.io/changelog/2.9.8/list-column-sorting.webp) *Column sorting* * Add support for configuring axis on chart widget. ![Time Series Chart Display Options with Axis and Multiple Axes checked and X and Y axis ticks, min and max fields](https://docs.thinger.io/changelog/2.9.8/chart-axis-options.webp) *Chart axis options* * Add support for setting placeholders in widgets title and subtitles. ![Widget settings with data.device.id as title and data.device.resource as subtitle placeholders](https://docs.thinger.io/changelog/2.9.8/widget-title-placeholders.webp) *Placeholders in widget titles* * Add support for showing last widget update. ![Temperature donut widget showing 32 °C with 4 s and a clock icon in its header](https://docs.thinger.io/changelog/2.9.8/widget-last-update.webp) *Last widget update* * Experimental support for IOTMP protocol on private instances that will allow: * Clients running on different languages (currently C++, Node.JS, web). Support needed for Python, Java, etc. * Resource Path Parameters. * Custom return code for HTTP methods. * Publish/Subscribe to MQTT topics. * Listen to server events. * Remote Shell on Linux. #### Improved * Forgot, login, change password and signup forms metadata for improved browser compatibility. #### Fixed * Device tokens are not opening under some circumstances. * Email settings are not being updated. * Properties listing on types and groups (removed Source column). * Legacy PSON error while decoding uint64_t values. ### 2.9.7 **Release Date:** 2020-11-09 #### Added * Add dashboard 'Developer' tab in settings showing source config, so users can share, copy, or edit dashboards from editor. * Add dashboard tabs, so, one dashboard can contain multiple tabs with different names and icons. * Add dashboard widget: push button (on only while it is pressed). * Add support for nested values on endpoint templates, i.e., `{{location.lat}}` `{{location.lng}}`. * Add role field in accounts list showing: Admin, Developer, and Project Member. * Add icon color on progressbar widget. * Add inner icon size for button widgets. * Add full screen mode for properties editor. * Add brand config for show/hide support links and server version. #### Improved * Dashboards settings are split on three different tabs. * Map widgets loading & initialization, now using vector maps instead of raster. * Disable popup exit when clicking outside, (i.e), when editing a property. * Font Awesome icons can be defined now as 'fas fa-...' to allow other styles (i.e. regular icons 'far fa-...'). * Led indicator colors now works with boolean values (as 0, 1) (thanks rin67630). * Property list does not wrap source or time. Improved mobile view. * Tachometer widget now appears correctly centered inside widget. * Reduce Docker image size: ~6 MB. #### Fixed * Bottom shadow on button widget. ### 2.9.6 **Release Date:** 2020-10-28 #### Added * Add (BETA) support for "template" dashboards, which allows switching resources (devices/buckets) directly from the dashboard. * Add template settings in dashboards. #### Improved * Improve UI by adding an icon according to its type to resource selectors. * Improve messages in the dashboard when the device is not available. #### Fixed * Fix JSON validation problem when creating tokens under some circumstances (i.e., from Dashboard with device properties) (thanks rin67631). ### 2.9.5 **Release Date:** 2020-10-15 #### Fixed * Change device credentials are not working properly (thanks rin67630). * Map size on load. * Remove the plugin problem. * Removing the user account correctly cleans all user plugins. * Bug with passwords being too long. #### Improved * Disable console being embedded into an iframe for security reasons (Clickjacking). ### 2.9.3 **Release Date:** 2020-10-01 #### Added * Add support for users with role 'Project Member', especially useful for end users * Project Members are not limited by the regular max user license limit. * Project Members customize the menu, hiding features not available for end-users * Add support for setting a custom profile picture, removing the Gravatar approach. * Add support for changing roles to accounts between user, admin, and member. #### Improved * User deletes now correctly erases all buckets, running plugins, and other critical resources associated with the account. * Token and members' permissions with the possibility to set wildcards on actions, i.e., `List*`, `Read*`, etc. * Adding a member to a project now displays a selector with search capabilities (for admins). #### Fixed * Batch users removal. * Fix removing properties from types and groups after their deletion. * Fix and restart other hosts in the cluster from the Cluster Host Admin. * Remove bucket exports after bucket deletion. * Remove the contextual "Set projects" button on resources that do not support it. * Avoid sending current project params on requests that do not support it. * "Close" project after account logout. * Other minor UI fixes. ### 2.9.2 **Release Date:** 2020-09-21 #### Added * Add support for defining asset types and asset groups. * Add support for defining geofences at device, type, and group levels. * Add support for showing geofences in device overview. * Add support for "inherited" properties in devices from their asset types and groups. * Viewer for asset types, groups and all assets in the map. * Generated device tokens point to the custom instance, so the Mobile APP can be used with private instances. * Contextual menu on device list supports changing its type, group, and project. * Contextual menu on any other resource supports changing its project. * Resource lists now show the current project of each resource. Also, type/group for devices. #### Improved * The Map widget contains more features, like showing track route, default zoom level, map type, path color, show waypoints, default location, show geofences, or hide default Google Maps control. * Dashboards now show the dashboard name in the page title to differentiate between several open dashboards. * Now it is possible to do insensitive case searches in lists or other resource selectors. * Property selectors now apply filtering at the DB level when searching. #### Fixed * Some problems with maps not loading properly or showing "ghost" markers. * Printing nested values, i.e., location.lat, from buckets onto a dashboard. * Fixed properties listing for devices with the same root identifier. * Fixed bucket export listing for buckets with the same root identifier. * Minor bug fixes and improvements. ### 2.8.2 **Release Date:** 2020-07-21 #### Fixed * The brand limitation was not applied correctly. * Updating a device property from a shared dashboard. ### 2.8.0 **Release Date:** 2020-07-14 #### Added * Add plugin settings for enabling public access to them (useful for plugins managing their own authentication, like Grafana). * Add support for writable filesystems on plugins (useful for installing plugins, i.e, inside Grafana). * Add changelog viewer. #### Fixed * Fixed plugin management control states. * Fixed Dashboard switch button when modifying a value from a property. * Minor bug fixes and improvements. #### Security * Fixed plugin privileges when running a shell over a container. Now all containers run with UID and GUID 1000. ### 2.7.6 **Release Date:** 2020-07-10 #### Added * Admin section "Cluster Hosts", supporting viewing all Thinger.io nodes in the cluster, and: * View host resources in real time, like connections, CPU/RAM usage, etc. * Configure Thinger.io: HTTP Server, Thinger Server, MQTT Server, Email, Buckets, SSL Certificates, Accounts, Deployment and Restart Server. * View host logs in real-time. * Brand support for PWA (Progressive Web Applications), setting theme color, icons, App name... * Dashboard settings: * Now supports dashboard backgrounds. * Now supports setting round corners on widgets. * Allow alpha widgets, setting colors like "#000000aa". * Allow hiding the header with a shared dashboard. #### Fixed * Timezone update in settings. * Date visualization on buckets according to timezone. * Complex object visualization on buckets. * Dashboard edition on mobile. --- Source: https://docs.thinger.io/reference/iotmp.md # IOTMP > The protocol between devices and Thinger.io - what it does, how a device connects (server, ports, TLS, credentials) and which libraries implement it. IOTMP (Internet of Things Message Protocol) is the protocol of the Thinger.io device libraries. A device opens one connection to the server and keeps it open; over it, the platform calls the device and the device calls the platform, in both directions and at any time. Messages are binary and use the PSON encoding, so they stay small on constrained boards and networks. The full specification of IOTMP and PSON, with the message formats, the encoding rules and wire examples, is published at [iotmp.io](https://iotmp.io). This page covers how Thinger.io uses the protocol and what you need to connect a device. - [IOTMP specification](https://iotmp.io): Message types, framing, PSON encoding, streaming and security of the protocol. ## What Thinger.io uses it for | Feature | Direction | What happens on the connection | |---|---|---| | [Device resources](https://docs.thinger.io/devices/arduino/coding.md#define-device-resources) | Platform to device | The platform asks the device for its list of device resources and calls them: reads a sensor, switches a relay. The console, the [REST API](https://docs.thinger.io/reference/rest-api/devices.md#device-accessoutputresources), dashboards, other devices and AI agents all go through it. | | Real-time streams | Device to platform | While a dashboard or another client listens to a device resource, the device sends its value at an interval or when it changes. Nothing is sent when no one listens. | | [Data Buckets](https://docs.thinger.io/platform/data-buckets.md) | Device to platform | The device writes data to a Data Bucket. | | [Properties](https://docs.thinger.io/platform/properties.md) | Device to platform | The device reads and writes its properties. | | [Endpoints](https://docs.thinger.io/platform/endpoints.md) | Device to platform | The device calls an endpoint, with or without data. | | Device-to-device calls | Device to platform to device | The device calls a device resource of another connected device of the same account. | | [Remote tools](https://docs.thinger.io/devices/remote-tools.md) | Platform to device | Terminal, file explorer and logs of the devices whose library supports them. | Because the connection stays open, the platform also knows whether each device is online: it changes when the connection opens or closes, and it fires the `device_state_change` event (see [Events](https://docs.thinger.io/reference/events.md)). ## Connect a device To connect, a device needs the server address, a port, and its credentials. The libraries set the port for you; you set the server only on a private instance. ### Server `YOUR_SERVER` is the host of your account: `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. The device libraries connect to the Thinger.io Cloud by default. Each library page explains how to set another server. ### Ports The server accepts IOTMP on these ports: | Port | Transport | Used by | |---|---|---| | `25206` | TLS | IOTMP as specified at iotmp.io: the ESP-IDF component, the Zephyr module and the Linux client. | | `25204` | TCP without encryption | The same clients, with TLS turned off. Use it only for development or on a trusted network. | | `443` | WebSocket over HTTPS, at `wss://YOUR_SERVER/iotmp` | The Linux client with the WebSocket transport, for networks that only allow web traffic. | | `25202` | TLS | IOTMP legacy: the Arduino library. | | `25200` | TCP without encryption | IOTMP legacy: the Arduino library on boards without TLS, or with TLS turned off. | Ports `25200` and `25202` carry **IOTMP legacy**, the earlier version of the protocol that the [Arduino library](https://docs.thinger.io/reference/arduino-library.md) speaks; the other ports carry IOTMP as specified at iotmp.io. You do not choose between them: each library uses its own ports. If a device cannot connect, check that the network allows outgoing connections to its port. Over WebSocket, the client requests the subprotocol `iotmp` in the handshake and sends each IOTMP message in one binary WebSocket message. On a private instance, the administrator can change these ports in the [server settings](https://docs.thinger.io/administration/cluster-hosts/settings.md) of each host. ### TLS Use TLS in production. The libraries check the server certificate: against the certificate of the Thinger.io Cloud servers, against the Let's Encrypt root certificate on a private instance, or against the certificate you configure. For a private instance with a self-signed certificate, each library has an option to skip the check; see its page. ### Device credentials The device authenticates with three values: your **username**, the **device ID** and the **device credentials**. It sends them in its first message, `CONNECT`, and the server answers before anything else happens. - The device must exist in your account as an **IOTMP Device** (type `Generic` in the API), created in **Devices** or with the [REST API](https://docs.thinger.io/reference/rest-api/devices.md#device-create). See [Devices](https://docs.thinger.io/platform/devices.md). - If the values do not match, the server rejects the connection and closes it. The libraries report it: the Arduino library, for example, prints `Auth Failed!` with `THINGER_SERIAL_DEBUG`. - Thinger.io authenticates IOTMP devices with device credentials only. ## Connection lifecycle ![Sequence between a device and the Thinger.io server: the device opens the connection and sends CONNECT with its credentials, the server answers OK; then the server lists and calls device resources with DESCRIBE and RUN and starts streams with START_STREAM, the device answers and sends STREAM_DATA and its own RUN requests; when idle the device sends KEEP_ALIVE and the server echoes it; if the connection is lost, the device reconnects.](https://docs.thinger.io/diagrams/iotmp-connection.svg) *An IOTMP connection, from the first message to a reconnection.* 1. **Connect.** The device opens the connection (TLS, TCP or WebSocket) and sends `CONNECT` with its credentials. The server answers `OK`, and the device is online; or it answers with an error and closes the connection. 2. **Requests.** Both sides send requests and wait for their answers. The platform lists the device resources with `DESCRIBE` and calls them with `RUN`; it starts and stops a stream with `START_STREAM` and `STOP_STREAM`, and the device sends the values in `STREAM_DATA`. The device uses `RUN` to write to a Data Bucket, read or write a property, or call an endpoint or another device. 3. **Keepalive.** When the device has nothing else to send, it sends `KEEP_ALIVE`, and the server echoes it. The libraries do it every 60 seconds. If the server receives nothing from the device for longer than its keepalive interval, plus a margin, it closes the connection and the device goes offline. 4. **Reconnect.** When the connection drops, the device libraries connect again on their own after a few seconds. A device that sends `DISCONNECT`, or closes the connection, goes offline at once. The message names, their fields, the recommended timeouts and the reconnection back-off are defined in the [specification](https://iotmp.io). ## Libraries that implement IOTMP | Library | Runs on | Ports | Guide | |---|---|---|---| | Arduino library (IOTMP legacy) | ESP32, ESP8266 and Arduino boards | `25202`, `25200` | [Arduino](https://docs.thinger.io/devices/arduino.md), [Arduino library reference](https://docs.thinger.io/reference/arduino-library.md) | | ESP-IDF component | ESP32 with ESP-IDF | `25206`, `25204` | [ESP-IDF](https://docs.thinger.io/devices/esp-idf.md) | | Zephyr module | Boards running Zephyr RTOS | `25206`, `25204` | [Zephyr](https://docs.thinger.io/devices/zephyr.md) | | Linux client | Linux computers and gateways | `25206`, `25204`, `443` | [Linux](https://docs.thinger.io/devices/linux.md) | Devices that cannot use these libraries connect over [MQTT](https://docs.thinger.io/devices/mqtt.md) or [HTTP](https://docs.thinger.io/devices/http.md) instead; see [Connect a device](https://docs.thinger.io/devices.md) to compare the options. To write your own client, follow the specification at [iotmp.io](https://iotmp.io), connect to port `25206` (or WebSocket on `443`) and authenticate with the device credentials of an IOTMP device. Once connected, your device resources appear in the console like those of any other device, and you can call them over HTTP with the [REST API](https://docs.thinger.io/reference/rest-api/devices.md#device-accessoutputresources). --- Source: https://docs.thinger.io/reference/arduino-library.md # Arduino library > Classes, functions, macros and compile options of the Thinger.io Arduino library, with their exact signatures and default values. The Thinger.io Arduino library connects a board to Thinger.io over [IOTMP legacy](https://docs.thinger.io/reference/iotmp.md#ports), the earlier version of IOTMP. This page lists its public API: the classes for each network, the connection functions, device resources, calls to the platform, macros and compile options. To learn how to use them, follow the [Coding guide](https://docs.thinger.io/devices/arduino/coding.md). | Package | Installed from | Version | Source code | | --- | --- | --- | --- | | `thinger.io` | Arduino Library Manager, PlatformIO | `2.49.0` | [thinger-io/Arduino-Library](https://github.com/thinger-io/Arduino-Library) | - **Install:** [Install](#install), on this page. To connect a board step by step, follow [Arduino](https://docs.thinger.io/devices/arduino.md). - **Changelog:** [Arduino library changelog](https://docs.thinger.io/reference/arduino-library/changelog.md): every release, with what it adds, changes and fixes. ## Install Install **thinger.io** from the library manager of the Arduino IDE (**Sketch > Include Library > Manage Libraries**), or add it to the project file of PlatformIO: **platformio.ini** ```ini lib_deps = thinger-io/thinger.io ``` The library examples are in **File > Examples > thinger.io**, one per board. Step-by-step setup is in [Arduino](https://docs.thinger.io/devices/arduino.md). ## Classes by network Include the header of your board and create one object of its class, usually called `thing`. Which class each board uses, and which ones support OTA updates, is listed in [Supported boards](https://docs.thinger.io/devices/arduino/boards.md). Every class takes the same three arguments: your username, the device ID and the device credentials. Two classes also take the serial port of the modem: | Constructor | Notes | |---|---| | `ThingerESP32(const char* user, const char* device, const char* device_credential)` | The same arguments for every board class. | | `ThingerTinyGSM(const char* user, const char* device, const char* device_credential, Stream& serial)` | GSM modems driven with AT commands. | | `ThingerESP8266AT(const char* user, const char* device, const char* device_credential, Stream& serial)` | An ESP8266 used as a Wi-Fi modem. | | `ThingerSmartConfig(const char* user, const char* device, const char* device_credential, bool use_led=true)` | ESP8266 that gets the Wi-Fi network from the ESP-Touch app. | ```cpp #include ThingerESP32 thing("YOUR_USER", "YOUR_DEVICE", "YOUR_TOKEN"); ``` `YOUR_TOKEN` is the device credentials, not an access token. ### Network setup Call these functions in `setup()`, before the first `thing.handle()`. Each one exists only in the classes listed. | Function | Classes | Description | |---|---|---| | `void add_wifi(const char* ssid, const char* password=nullptr)` | Wi-Fi classes (`ThingerESP32`, `ThingerESP8266`, `ThingerWiFiNINA`, `ThingerWifi101`, `ThingerR4WiFi`, `ThingerPicoW`, `ThingerMbed`, `ThingerZephyr`, `ThingerWifi`) | Adds a Wi-Fi network. On ESP32, ESP8266, Raspberry Pi Pico W and Pico 2 W, call it once per network: with two or more, the board scans and joins the strongest one, also when it reconnects; with one, it joins it without scanning, so a hidden network only works as the only one. On the other boards a second call replaces the first. On ESP32 and ESP8266, without a call the board joins the last network it used. | | `void add_wifi_enterprise(const char* ssid, const char* username, const char* password, const char* identity="", const char* ca_pem=nullptr)` | `ThingerESP32`, with version 3 of the esp32 board package | Adds a WPA2-Enterprise network with PEAP and EAP-MSCHAPv2, such as eduroam. `identity` is the outer identity; empty, the board uses the username. `ca_pem` is the certificate, in PEM format, of the authority of the authentication server: with it, the board checks the server and joins this network first, on its own, and tries the other networks if it cannot join it; without it, the server is not checked and the board joins the strongest of its networks. Only one network can carry a certificate. | | `void set_apn(const char* apn, const char* apn_username="", const char* apn_password="")` | `ThingerMKRGSM`, `ThingerMKRNB` | Sets the APN of the cellular network. | | `void set_pin(const char* pin)` | `ThingerMKRGSM`, `ThingerMKRNB`, `ThingerNBCore`, `ThingerLinkItOneGPRS` | Unlocks the SIM card with its PIN. | | `void setAPN(const char* APN, const char* user=nullptr, const char* password=nullptr)` | `ThingerTinyGSM` | Sets the APN. | | `void setPIN(const char* pin)` | `ThingerTinyGSM` | Unlocks the SIM card. | | `void set_address(const char* ip, const char* gateway, const char* subnet, const char* dns1="8.8.8.8", const char* dns2="8.8.4.4")` | `ThingerESP32Eth` | Uses a fixed IP address instead of DHCP. | | `void set_hostname(const char* hostname)` | `ThingerESP32Eth` | Sets the host name of the board on the network. | The example of the MKR NB 1500, trimmed: **ArduinoMKRNB1500.ino** ```cpp #include ThingerMKRNB thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { // optional set pin number thing.set_pin(PIN_NUMBER); // set APN thing.set_apn(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD); } ``` ### Run the connection in its own task On ESP32 with `#define THINGER_FREE_RTOS` (`ThingerESP32`, `ThingerESP32Eth` and `ThingerTinyGSM`), and on the Mbed OS boards (`ThingerMbed`, `ThingerMbedEth`: Nano RP2040 Connect, and Portenta H7 and Opta on the Mbed OS core), the connection can run in its own task. Call `thing.start()` in `setup()` instead of calling `thing.handle()` in `loop()`. | Function | Classes | Description | |---|---|---| | `bool start(unsigned core=ARDUINO_RUNNING_CORE, size_t stack_size=8192)` | `ThingerESP32`, `ThingerESP32Eth` and `ThingerTinyGSM` on ESP32, with `THINGER_FREE_RTOS` | Starts the task on the given core, with the given stack size in bytes. | | `bool start()` | `ThingerMbed`, `ThingerMbedEth` | Starts the task. | | `bool stop()` | Both | Stops the task. | | `bool is_running()` | Both | `true` while the task runs. | | `void lock()`, `void unlock()` | Both | Protect the variables that your device resources share with `loop()`, and the calls to the platform from another task, such as `write_bucket` or `call_endpoint`. On ESP32, `get_state()` and `get_error()` can be read from any task without them. | The ESP32RTOS example, trimmed: **ESP32RTOS.ino** ```cpp #define THINGER_SERIAL_DEBUG #define THINGER_FREE_RTOS #include ThingerESP32 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); void setup() { thing.add_wifi(SSID, SSID_PASSWORD); thing["millis"] >> outputValue(millis()); // start thinger on its own task thing.start(); } void loop() { // use thing.lock() thing.unlock() if using variables exposed on thinger resources } ``` ## Connection These functions are common to every class. | Function | Description | |---|---| | `void handle()` | Connects to the network and to the server when needed, answers the requests of the platform and sends the keepalive. Call it in every iteration of `loop()`. While the device is offline it returns at once between connection attempts, so `loop()` keeps running: see [Reconnection](#reconnection). | | `bool is_connected()` | `true` while the connection to the server is open. | | `void stop()` | Closes the connection. The next `thing.handle()` connects again. | | `void reboot()` | Closes the connection and restarts the board. | | `void set_credentials(const char* username, const char* device_id, const char* device_password)` | Changes the username, device ID and device credentials. Takes effect on the next connection. | | `void set_host(const char* host)` | Changes the server. Takes effect on the next connection. | | `const char* get_host()` | The current server. | | `const char* get_username()` | The username in use. | | `const char* get_device_id()` | The device ID in use. | | `void set_root_ca(const char* ca)` | Sets the root certificate that validates the server, in PEM format. It takes effect on the next connection. | | `const char* get_root_ca()` | The root certificate in use. | | `void set_state_listener(std::function state_listener)` | Calls `state_listener` on every change of the connection state. | | `THINGER_STATE get_state() const` | The last connection state, the one last passed to the state listener. | | `THINGER_ERROR get_error() const` | The reason of the last `NETWORK_CONNECT_ERROR` state, or `ERROR_NONE` once the network is connected. See [Network errors](#network-errors). | The strings you pass to `set_credentials`, `set_host` and `set_root_ca` are not copied: they must stay valid while the device runs (literals, globals or `String` objects that live as long as `thing`). ### Connection states `set_state_listener` receives one value of the `ThingerClient::THINGER_STATE` enumeration, in this order of a normal connection: | State | Meaning | |---|---| | `NETWORK_CONNECTING` | Joining the network (Wi-Fi, Ethernet or cellular). | | `NETWORK_CONNECTED` | The network is up. | | `NETWORK_CONNECT_ERROR` | The board could not join the network. | | `SOCKET_CONNECTING` | Opening the connection to the server. | | `SOCKET_CONNECTED` | The connection to the server is open. | | `SOCKET_CONNECTION_ERROR` | The server could not be reached. | | `THINGER_AUTHENTICATING` | Sending the device credentials. | | `THINGER_AUTHENTICATED` | The server accepted the device credentials. The device is online. | | `THINGER_AUTH_FAILED` | The server rejected the username, device ID or device credentials. | | `SOCKET_TIMEOUT` | The server stopped answering. | | `SOCKET_ERROR` | The connection failed. | | `SOCKET_DISCONNECTED` | The connection is closed. | | `THINGER_STOP_REQUEST` | The sketch called `thing.stop()` or `thing.reboot()`. | ```cpp thing.set_state_listener([](ThingerClient::THINGER_STATE state) { if (state == ThingerClient::THINGER_AUTHENTICATED) { Serial.println("Connected to Thinger.io"); } }); ``` ### Reconnection `thing.handle()` does not hold `loop()` while the device is offline: - The Wi-Fi classes listed for `add_wifi` in [Network setup](#network-setup) join the network step by step, one step on each `thing.handle()`, with the state `NETWORK_CONNECTING` in the meantime. They give up after 30 seconds without joining the network, and after 30 more without an IP address. Two exceptions wait inside `thing.handle()`: a board with several Wi-Fi networks scans them for a few seconds, and the WebConfig classes wait for the network. - The other classes wait for the network inside `thing.handle()`: Ethernet, cellular modems, `ThingerSmartConfig`, `ThingerCC3000`, `ThingerESP8266AT` and `ThingerLinkItOneWifi`. - The TLS connection and the authentication with the server take a few seconds on every attempt, inside `thing.handle()`. Between two attempts, `thing.handle()` returns at once until the wait ends: | Failure | Wait before the next attempt | |---|---| | The network (`NETWORK_CONNECT_ERROR`) | `RECONNECTION_TIMEOUT` milliseconds. | | The server: socket, TLS or authentication (`SOCKET_CONNECTION_ERROR`, `THINGER_AUTH_FAILED`) | `RECONNECTION_TIMEOUT` after the first failure, doubled on every failure up to `THINGER_RECONNECTION_MAX_TIMEOUT`, plus a random margin of up to 25 %, so many devices do not reconnect at the same time. It starts again from `RECONNECTION_TIMEOUT` once the device connects. | With `THINGER_SERIAL_DEBUG`, the serial monitor shows each wait: ```text [THINGER] Retrying connection in (ms): 5843 ``` ### Network errors `get_error()` returns one value of the `ThingerClient::THINGER_ERROR` enumeration. Each board reports the reasons it can tell apart, and `ERROR_UNKNOWN` for the rest. | Error | Meaning | Boards | |---|---|---| | `ERROR_NONE` | The network is connected. | All | | `ERROR_UNKNOWN` | The board does not report the reason. | All | | `NETWORK_NOT_CONFIGURED` | No Wi-Fi network or APN is set. With WebConfig, the configuration page closed without a Wi-Fi network. | Wi-Fi and cellular | | `NETWORK_NOT_FOUND` | The Wi-Fi network is not available. | Wi-Fi | | `NETWORK_AUTH_ERROR` | The Wi-Fi network rejected the connection, usually for a wrong password. | Wi-Fi | | `NETWORK_NO_IP` | The board joined the Wi-Fi network but got no IP address. | Wi-Fi | | `MODEM_NOT_RESPONDING` | The modem does not answer. | `ThingerTinyGSM` | | `MODEM_SIM_ERROR` | The SIM card cannot be used, for example for a wrong PIN. | `ThingerTinyGSM` | | `NETWORK_NOT_REGISTERED` | The modem cannot register in the network, for example for lack of coverage. | `ThingerTinyGSM`, `ThingerNBCore`, `ThingerBC66` | | `NETWORK_REGISTRATION_DENIED` | The operator rejected the registration, for example because the SIM card is disabled. | `ThingerNBCore`, `ThingerBC66` | | `NETWORK_APN_ERROR` | The modem is registered, but the data connection does not open: check the APN. | `ThingerTinyGSM`, `ThingerMKRNB`, `ThingerMKRGSM` | ## Device resources A device resource is a function of the device that the platform can call. Declare it in `setup()` with `thing["name"]` and an operator that sets its direction: | Declaration | Equivalent function | Kind | |---|---|---| | `thing["name"] << [](pson& in){ … };` | `void set_input(std::function in_function)` | Input: receives data from the platform. | | `thing["name"] >> [](pson& out){ … };` | `void set_output(std::function out_function)` | Output: sends data to the platform. | | `thing["name"] = [](pson& in, pson& out){ … };` | `void set_input_output(std::function pson_in_pson_out_function)` | Input and output. | | `thing["name"] = [](){ … };` | `void set_function(std::function run_function)` | No data: runs an action. | An input resource is called with an empty `in` when the platform reads its current value, for example when you open it in the console. Check `in.is_empty()` and fill `in` with the current value, as in the Opta examples: **ArduinoOptaWiFi.ino** ```cpp thing["relay_d0"] << [](pson& in){ if(in.is_empty()){ in = (bool) digitalRead(D0); }else{ digitalWrite(D0, in ? HIGH : LOW); digitalWrite(LED_D0, in ? HIGH : LOW); } }; ``` An output resource fills `out` each time it is read: **ESP32.ino** ```cpp thing["millis"] >> outputValue(millis()); ``` Device resources can be nested, as in `thing["led"]["green"]`: the platform calls the inner device resource by its path, led/green. | Function | Description | |---|---| | `void then(std::function then)` | Runs `then` after each call to the resource has been answered. Not available on AVR boards. | | `void set_stream_listener(std::function stream_listener)` | Called when the platform starts (`enabled` is `true`) or stops listening to the resource, with the stream ID and the sampling interval in milliseconds. | ### Macros for common resources | Macro | Kind | Description | |---|---|---| | `digitalPin(PIN)` | Input | Sets a digital output pin on or off and reports its state. `PIN` must be a number or a `#define`. | | `analogPin(PIN)` | Input | Writes an analog (PWM) value to the pin. Not available on ESP32. | | `outputValue(value)` | Output | Sends the value of an expression or a variable. | | `outputString(value)` | Output | The same, for a text. | | `inputValue(value)` | Input | Stores the value received in a variable, and reports the current value. | | `inputValue(value, callback)` | Input | The same, and runs `callback` after each change. | | `servo(servo)` | Input | Moves a servo (an object of the Arduino Servo library) to the angle received, and reports its angle. | **ESP32.ino** ```cpp // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc) thing["GPIO_16"] << digitalPin(16); // resource output example (i.e. reading a sensor value) thing["millis"] >> outputValue(millis()); ``` ## The pson type `pson` holds the data of a device resource: a single value, an object with named fields or an array. Assign a value to write it, and assign the `pson` to a variable (or cast it) to read it. | Type | Write | Read | |---|---|---| | Boolean | `in = true;` | `bool value = in;` | | Integer | `out = 42;` | `int value = in;` (also `long`, `unsigned int`, `unsigned long`, `short`, `char`) | | Decimal | `out = 21.5;` | `float value = in;` or `double value = in;` | | Text | `out = "text";` or a `String` | `const char* text = in;` or `String text = in;` | | Object | `out["temperature"] = 21.5;` | `float value = in["temperature"];` | | Array | `pson_array& array = out;` then `array.add(1).add(2);` | — | | Bytes | `void set_bytes(void* bytes, size_t size)` | `bool get_bytes(const void*& bytes, size_t& size)` | | Function | Description | |---|---| | `bool is_empty()` | `true` if the `pson` has no value. In an input resource, `true` when the platform only reads the current value. | | `bool is_boolean()`, `bool is_number()`, `bool is_integer()`, `bool is_float()`, `bool is_string()`, `bool is_bytes()`, `bool is_object()`, `bool is_array()`, `bool is_null()` | The type of the value. | The wire format of `pson` is PSON, described on [iotmp.io](https://iotmp.io). ## Calls to the platform These functions send a request to the server. They need the device to be connected and return `false` if the request could not be sent. With the last argument (`confirm_write` or `confirm_call`) set to `true`, they wait for the server and return `true` only if the server accepted the request. ### Data Buckets | Function | Description | |---|---| | `bool write_bucket(const char* bucket_id, pson& data, bool confirm_write=false)` | Stores `data` in the Data Bucket. | | `bool write_bucket(const char* bucket_id, const char* resource_name, bool confirm_write=false)` | Stores the output of a device resource. | | `bool write_bucket(const char* bucket_id, thinger_resource& resource, bool confirm_write=false)` | The same, with the resource object: `thing["name"]`. | The Data Bucket must exist, with its data source set to the device write call. See [Data Buckets](https://docs.thinger.io/platform/data-buckets.md). ### Properties | Function | Description | |---|---| | `bool get_property(const char* property_identifier, pson& data)` | Reads a property of the device into `data`. Waits for the server. | | `bool set_property(const char* property_identifier, pson& data, bool confirm_write=false)` | Writes a property of the device. | See [Properties](https://docs.thinger.io/platform/properties.md). ### Endpoints | Function | Description | |---|---| | `bool call_endpoint(const char* endpoint_name, bool confirm_call=false)` | Calls the endpoint without data. | | `bool call_endpoint(const char* endpoint_name, pson& data, bool confirm_call=false)` | Calls the endpoint with `data`. | | `bool call_endpoint(const char* endpoint_name, const char* resource_name, bool confirm_call=false)` | Calls the endpoint with the output of a device resource. | | `bool call_endpoint(const char* endpoint_name, thinger_resource& resource, bool confirm_call=false)` | The same, with the resource object. | See [Endpoints](https://docs.thinger.io/platform/endpoints.md). ### Other devices | Function | Description | |---|---| | `bool call_device(const char* device_name, const char* resource_name, bool confirm_call=false)` | Calls a device resource of another device of your account. | | `bool call_device(const char* device_name, const char* resource_name, pson& data, bool confirm_call=false)` | The same, with `data` as input. | | `bool call_device(const char* device_name, const char* resource_name, thinger_resource& resource, bool confirm_call=false)` | The same, with the output of a local device resource as input. | The other device must be connected. ### Streams A stream sends the value of a device resource to whoever is listening in real time, such as an open dashboard. Nothing is sent, or stored, when no one is listening. | Function | Description | |---|---| | `bool stream(const char* resource)` | Sends the current output of the resource. Returns `false` if no one is listening. | | `bool stream(thinger_resource& resource)` | The same, with the resource object. | | `bool stream_data(thinger_resource& resource, pson& payload)` | Sends `payload` on the stream of the resource instead of its output. | The platform can also ask the device to sample an output resource at a fixed interval, for example for a dashboard widget that refreshes on its own; the library does it from `thing.handle()` without any code. ## Over-the-air updates The OTA classes receive firmware from the [Visual Studio Code extension](https://docs.thinger.io/devices/arduino.md#update-the-firmware-over-the-internet). Create the object after `thing`, with the class of your board (see [Supported boards](https://docs.thinger.io/devices/arduino/boards.md)): **ArduinoMKRNB1500.ino** ```cpp #include #include ThingerMKRNB thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL); ThingerMKRNBOTA ota(thing); ``` | Function | Description | |---|---| | `void set_enabled(bool enabled)` | Accepts (`true`, the default) or rejects updates. | | `bool is_enabled()` | Whether updates are accepted. | | `void set_block_size(size_t size)` | Size in bytes of each block of firmware. | | `void on_start(std::function on_start)` | Called when an update starts. | | `void on_progress(std::function on_progress)` | Called after each block, with the bytes received and the total. | | `void on_end(std::function on_end)` | Called when the update ends. | The device reports its OTA settings in the `$ota/options` device resource, which the extension reads before each update. ### Compatibility check To keep a device from installing a firmware built for other hardware, such as another PCB version or a cellular modem instead of Wi-Fi, define `THINGER_OTA_CHECK` before the OTA include, with one entry per key and value: ```cpp #define THINGER_OTA_CHECK(FIELD) FIELD("PCB_MODEL", "SENSOR_I2C") FIELD("PCB_VERSION", "V2") #include #include ``` - The fields are stored in the firmware binary, and the device reports them in `$ota/options`. - The Visual Studio Code extension compares the fields of the new firmware with those of the device, and asks for confirmation when they differ or the new firmware has none. - The device rejects an update whose fields differ from its own or are missing, unless the user confirmed it in the extension. It answers with the error `"Firmware not compatible with this device (THINGER_OTA_CHECK)"`. - A device without fields accepts any firmware. - Up to 16 fields, with keys of 1 to 32 characters and values of up to 128 characters, and no repeated keys. A sketch that breaks a limit does not compile. - Available on every board with OTA updates. ### Automatic rollback (ESP32) On the ESP32, define `THINGER_OTA_ROLLBACK` before the OTA include. A new firmware must then connect to Thinger.io within `THINGER_OTA_ROLLBACK_TIMEOUT` seconds of its first start; otherwise the board goes back to the previous firmware. It also goes back if it restarts before connecting, for example after a crash. ```cpp #define THINGER_OTA_ROLLBACK #define THINGER_OTA_ROLLBACK_TIMEOUT 300 #include #include ``` The new firmware is the one that must define it: a firmware without it is accepted as soon as it starts. Define it in only one source file of the project, the one that includes the OTA header. More in [OTA updates](https://docs.thinger.io/devices/ota.md). ## Compile options Define these options before the first `#include` of the library, or as build flags (`-D`) in PlatformIO. | Option | Default | Description | |---|---|---| | `THINGER_SERVER` | `"iot.thinger.io"` | Server to connect to. On a private instance, set your domain, `YOUR_SERVER`. With this option, the library validates the server with the root certificate of Let's Encrypt (ISRG Root X1) instead of the one of the Thinger.io Cloud servers (USERTrust RSA); use `THINGER_ROOT_CA` if your server has a certificate from another authority. | | `THINGER_ROOT_CA` | Not defined | Root certificate, in PEM format, that validates the server, for a private instance whose certificate comes from its own authority. Define it in the sketch, before the include, as in [Server and TLS](https://docs.thinger.io/devices/arduino/boards.md#server-and-tls). It replaces the default certificates. ESP32, ESP8266, Raspberry Pi Pico W and Pico 2 W, Arduino UNO R4 WiFi, Arduino UNO Q, and the boards of the Arduino Zephyr core (`ThingerZephyr`). | | `THINGER_SSL_PORT` | `25202` | Server port for TLS connections. | | `THINGER_PORT` | `25200` | Server port for connections without TLS. | | `THINGER_SERIAL_DEBUG` | Not defined | Prints each connection step to the serial port. Open the serial monitor at the speed you set with `Serial.begin()`. | | `THINGER_INSECURE_SSL` | Not defined | Connects over TLS without validating the server certificate, for a private instance with a self-signed certificate. ESP32, ESP8266, Raspberry Pi Pico W and Pico 2 W, and the boards of the Arduino Zephyr core (`ThingerZephyr`). On the Arduino UNO R4 WiFi, the Wi-Fi module always validates the certificate: with this option, it validates it with its own certificates instead of the root certificate of the library. | | `_DISABLE_TLS_` | Not defined | Connects without TLS, to `THINGER_PORT`. | | `THINGER_FREE_RTOS` | Not defined | ESP32: adds `thing.start()` to run the connection in its own task, with `ThingerESP32`, `ThingerESP32Eth` and `ThingerTinyGSM`. | | `RECONNECTION_TIMEOUT` | `5000` | Milliseconds to wait after a failed connection attempt, and the first wait after a failure of the server. See [Reconnection](#reconnection). | | `THINGER_RECONNECTION_MAX_TIMEOUT` | `30000` | Longest wait, in milliseconds, between two attempts to connect to the server, without the random margin. | | `DEFAULT_READ_TIMEOUT` | `10000` | Milliseconds to wait for the rest of a message from the server. | | `THINGER_OTA_COMPRESSION` | `1` on ESP32, Portenta H7 and Opta; `0` on Raspberry Pi Pico W and Pico 2 W | `1` receives the OTA firmware compressed, `0` uncompressed. On the Pico boards, compression needs a recent version of the Visual Studio Code extension. | | `THINGER_OTA_CHECK` | Not defined | Compatibility fields of the firmware for OTA updates. See [Compatibility check](#compatibility-check). | | `THINGER_OTA_ROLLBACK` | Not defined | ESP32: goes back to the previous firmware if a new one does not connect to Thinger.io. See [Automatic rollback](#automatic-rollback-esp32). | | `THINGER_OTA_ROLLBACK_TIMEOUT` | `300` | ESP32, with `THINGER_OTA_ROLLBACK`: seconds a new firmware has to connect to Thinger.io. | | `THINGER_OTA_VERSION` | (empty) | Firmware version the device reports for OTA updates. The Visual Studio Code extension skips devices that already run the same version. | | `THINGER_DEVICE_SSID` | `"Thinger-Device"` | WebConfig classes: name of the Wi-Fi network the board opens for its setup. | | `THINGER_DEVICE_SSID_PSWD` | `"thinger.io"` | WebConfig classes: password of that network. See [WebConfig](https://docs.thinger.io/devices/arduino/webconfig.md). | | `THINGER_WEBCONFIG_ATTEMPTS` | `3` | WebConfig classes: failed attempts to join the stored Wi-Fi network before the configuration page opens again. `0` turns it off. | | `THINGER_WEBCONFIG_PORTAL_TIMEOUT` | `180` | WebConfig classes: seconds the configuration page stays open when it opens for that reason. | Some boards do not support TLS with this library: they always connect without TLS, to `THINGER_PORT`. The [IOTMP reference](https://docs.thinger.io/reference/iotmp.md#ports) lists the ports of the server. ## See also - [Coding guide](https://docs.thinger.io/devices/arduino/coding.md): how to use this API in a sketch. - [Supported boards](https://docs.thinger.io/devices/arduino/boards.md): the class, include and OTA support of each board. - [IOTMP](https://docs.thinger.io/reference/iotmp.md): the protocol; the library speaks its legacy version. - [Arduino library changelog](https://docs.thinger.io/reference/arduino-library/changelog.md): what each version of the library adds, changes and fixes. - [Troubleshooting](https://docs.thinger.io/devices/troubleshooting.md): connection problems. --- Source: https://docs.thinger.io/reference/arduino-library/changelog.md # Arduino library changelog > Every release of the Thinger.io Arduino library, newest first, with what each version adds, changes and fixes on each family of boards. Every release of the `thinger.io` Arduino library, newest first, as its changelog describes it. Each release, with its source code, is on [GitHub](https://github.com/thinger-io/Arduino-Library/releases); to install the library and connect a board, follow [Arduino](https://docs.thinger.io/devices/arduino.md), and its API is in the [Arduino library reference](https://docs.thinger.io/reference/arduino-library.md). This page covers up to version **2.49.0**. ## 2.49.0 #### Arduino Zephyr core - **Added** `ThingerZephyr` for boards with WiFi on the Arduino Zephyr core (Arduino Zephyr Boards), which replaces the Mbed OS core (end of life in July 2026): tested on Portenta H7 and Opta, with TLS certificate validation, and the non-blocking WiFi connection of 2.48.0. Examples: `ArduinoZephyr`, and `ArduinoOptaZephyr` for the Opta relays, status leds, user button and inputs. - It uses its own TCP/TLS client on the Zephyr sockets, as the TLS client of the core (`ZephyrSSLClient` 1.0.0) cannot connect: it sets a list of credential tags with uninitialized entries, and registers the credentials again on every connection. - Install the Zephyr loader once with Tools > Burn Bootloader. If the WiFi does not start (`WiFi.status()` is `WL_NO_SHIELD`), install the WiFi module firmware with the `WiFiFirmwareUpdater` example of the Arduino Mbed OS core, as the Zephyr core reads it from the QSPI flash. - OTA updates will be available once the Arduino Zephyr core publishes its OTA support (already in development), as the current version (1.0.0) does not include it. ## 2.48.0 #### General - **Changed** `thing.handle()` no longer blocks the `loop()` while the device is offline, so the sketch keeps running (i.e., to show the connection state on a display with `thing.get_state()`): - It does not wait to retry a failed connection (it used to wait 5 seconds with `delay()`). - WiFi boards connect to the network step by step, checking the connection on every `thing.handle()`, instead of waiting up to 30 seconds for the WiFi and 30 more for the IP address (and up to 50 seconds more inside `WiFi.begin()` with WiFiNINA, or 10 with the UNO R4 WiFi). The state is `NETWORK_CONNECTING` meanwhile. Connecting to several networks (`WiFiMulti`) still blocks a few seconds while scanning, and WebConfig still waits for the connection. - The TLS connection and the authentication with the server still block the `loop()` for a few seconds on every attempt, as cellular modems while connecting to the network. - **Added** exponential backoff when the server cannot be reached or rejects the device (socket, TLS or authentication failures): the wait starts at `RECONNECTION_TIMEOUT` (5 seconds), and doubles on every failure up to `THINGER_RECONNECTION_MAX_TIMEOUT` (30 seconds), with a random jitter of up to 25%, so many devices do not reconnect at the same time (i.e., after a server restart). It is reset once the device connects. Network failures (i.e., WiFi or cellular) are still retried every `RECONNECTION_TIMEOUT`. #### ESP32 - **Added** automatic rollback of OTA updates with `#define THINGER_OTA_ROLLBACK`: a new firmware must connect to Thinger.io within `THINGER_OTA_ROLLBACK_TIMEOUT` seconds (300 by default), or the device rolls back to the previous firmware, also if it reboots before (i.e., because of a crash). So a firmware with a bug, or with wrong WiFi or Thinger.io credentials, does not leave a remote device offline. It uses the rollback support of the ESP32 bootloader, and works on every ESP32 family (tested on an ESP32-C3). #### WiFiNINA (Nano 33 IoT, MKR WiFi 1010) - **Fixed** OTA updates leaving the device unable to boot when the firmware stored in the WiFi module is corrupted: the bootloader (SNU) programs it as it is on the next boot. Now the update reads the stored file back and verifies its MD5 checksum before applying it, and fails with `The firmware stored in the WiFi module is corrupted` otherwise, so the device keeps running its current firmware. The WiFi module does not report write errors ([WiFiNINA#242](https://github.com/arduino-libraries/WiFiNINA/issues/242)), and it returns up to 255 bytes per read ([WiFiNINA#333](https://github.com/arduino-libraries/WiFiNINA/issues/333)). Tested on a MKR WiFi 1010 (NINA firmware 1.4.8), where updates work. On one Arduino Nano 33 IoT unit, with the same NINA firmware (and also 3.0.1), the stored firmware was corrupted during the update, which left it unable to boot before this fix, and now fails safely. #### Arduino Opta - **Fixed** `ArduinoOptaWiFi` example not configuring the WiFi network with `thing.add_wifi()`. Tested on hardware: connection with TLS and OTA updates. ## 2.47.1 #### Arduino Nano RP2040 Connect - **Fixed** OTA updates reported as successful, but the device rebooting with its previous firmware, when the new firmware does not include `ThingerMbedOTA.h` ([#46](https://github.com/thinger-io/Arduino-Library/issues/46)). The second stage bootloader (SFU) that applies the update is linked by `ThingerMbedOTA.h`, and it ignores a firmware without it, so the device could not be updated anymore. Now the update fails with `The firmware does not include ThingerMbedOTA.h, so it cannot be applied`. Tested on hardware with the Arduino Mbed OS Nano Boards core 4.6.0. ## 2.47.0 #### OTA - **Added** OTA compatibility check, to avoid installing a firmware built for another hardware (i.e., another PCB version, or a cellular modem instead of WiFi), based on the proposal of @swinp ([#60](https://github.com/thinger-io/Arduino-Library/pull/60), [vscode-extension#7](https://github.com/thinger-io/vscode-extension/issues/7)). Declare the compatibility fields before including the OTA header: ```cpp #define THINGER_OTA_CHECK(FIELD) FIELD("PCB_MODEL", "SENSOR_I2C") FIELD("PCB_VERSION", "V2") ``` The fields are embedded in the firmware binary, and reported by the device in the `$ota/options` resource, so the VS Code extension (1.2.0 or later) compares the device with the new firmware and asks for confirmation if they differ. The device also checks them, so it rejects an update from any client whose fields are different or missing, unless it is forced (i.e., confirmed by the user). Devices without fields are updated as before. Available on every board with OTA updates. Up to 16 fields, with keys of up to 32 characters and values of up to 128 characters, checked at compile time. ## 2.46.1 #### UNO R4 WiFi - **Fixed** the CA root certificate was not sent to the WiFi module, so the TLS connection was validated with its own CA bundle, and servers with a private CA or `set_root_ca()` did not work. Now it is validated with the library CA certificate, as on the ESP32. - **Fixed** build error with `THINGER_INSECURE_SSL`. The WiFi module cannot skip the certificate validation, so it uses its own CA bundle instead. - **Changed** OTA updates (`ThingerR4OTA`) are no longer experimental: tested on hardware with the WiFi module firmware 0.6.0. Note that old WiFi module firmwares (i.e., 0.2.1) cannot connect with TLS to Thinger.io, so update it with Tools > Firmware Updater in the Arduino IDE. ## 2.46.0 #### WebConfig - **Changed** `ThingerESP32WebConfig` stores the configuration (Thinger.io credentials and custom parameters) in NVS instead of SPIFFS ([#58](https://github.com/thinger-io/Arduino-Library/issues/58)). NVS keeps it on power loss, and it does not depend on the partition scheme, so it is not lost after flashing a firmware with another partition scheme. The configuration of previous versions is migrated from SPIFFS to NVS on the first boot, and the SPIFFS partition is no longer formatted if it cannot be mounted. Note that the WiFi credentials were already stored in NVS by the ESP32 WiFi driver. - **Fixed** `ThingerESP32WebConfig` opening the config portal at boot, randomly, with a WiFi network already configured, so it looked like the WiFi credentials were lost ([#58](https://github.com/thinger-io/Arduino-Library/issues/58)). WiFiManager reads the stored network from the WiFi driver, that was not initialized yet. - **Added** the config portal opens again when the device cannot connect to the saved WiFi network, i.e., it was moved to another place ([#49](https://github.com/thinger-io/Arduino-Library/issues/49)). After `THINGER_WEBCONFIG_ATTEMPTS` failed connections (3 by default, 0 to disable it), the portal is open for `THINGER_WEBCONFIG_PORTAL_TIMEOUT` seconds (180 by default), and then the device tries the saved network again. The portal shows the current values of the custom parameters, and the configuration does not change if the portal times out. - **Fixed** the config portal opening at boot when the WiFi is configured and the credentials are set in the constructor, but there is no stored configuration (i.e., after erasing the file system). ## 2.45.0 #### General - **Added** `thing.get_error()`, the reason of the last `NETWORK_CONNECT_ERROR`, or `ThingerClient::ERROR_NONE` once the network is connected ([#53](https://github.com/thinger-io/Arduino-Library/issues/53)). It can be read from the state listener or anytime: - WiFi (ESP32, ESP8266, Pico W and other WiFi boards): `NETWORK_NOT_CONFIGURED`, `NETWORK_NOT_FOUND`, `NETWORK_AUTH_ERROR` (usually a wrong password), `NETWORK_NO_IP`. WebConfig reports `NETWORK_NOT_CONFIGURED` if the config portal ends without configuring the WiFi. - Cellular (TinyGSM, NB-IoT Core, BC66, MKR NB 1500, MKR GSM 1400): `NETWORK_NOT_CONFIGURED` (no APN), `MODEM_NOT_RESPONDING`, `MODEM_SIM_ERROR`, `NETWORK_NOT_REGISTERED` (i.e., no coverage), `NETWORK_REGISTRATION_DENIED`, `NETWORK_APN_ERROR`, depending on what each modem reports. - Other failures, or clients that don't report the reason: `ERROR_UNKNOWN`. - **Changed** the connection state (`get_state()`) and error (`get_error()`) are atomic on ESP32, so they can be read from another task or core (i.e., with `THINGER_FREE_RTOS`) without `thing.lock()`. ## 2.44.0 #### General - **Added** `thing.get_state()`, which returns the last connection state reported to the state listener (i.e., `ThingerClient::THINGER_AUTHENTICATED` when the device is online) ([#52](https://github.com/thinger-io/Arduino-Library/issues/52)). - **Fixed** `multiple definition of CA_ROOT_CERTIFICATE` when the library is included from several source files ([#41](https://github.com/thinger-io/Arduino-Library/issues/41)). #### TinyGSM - **Fixed** `ThingerTinyGSM` with `THINGER_FREE_RTOS` on ESP32: it now supports `thing.start()` to run in its own FreeRTOS task, as `ThingerESP32` ([#50](https://github.com/thinger-io/Arduino-Library/issues/50)). ## 2.43.2 #### Console - **Fixed** crash on the second and following commands of `ThingerConsole` ([#55](https://github.com/thinger-io/Arduino-Library/issues/55)): the command parser used `static` lambdas capturing by reference, so they kept pointing to the variables of the first call. Note that `ThingerConsole` requires `std::function`, so it is not available on AVR boards. ## 2.43.1 #### WiFi - **Added** an optional `ca_pem` parameter to `add_wifi_enterprise()` (ESP32): the CA certificate of the authentication server. With it, the device validates the server and does not send the credentials to a fake access point with the same SSID. Without it, the server is not validated (WiFiMulti does not support it). Only one enterprise network can use it, and the device tries the other networks if it cannot connect. - **Changed** the identity of `add_wifi_enterprise()` defaults to the username when empty, as most authentication servers require an outer identity. #### ESP8266 / Raspberry Pi Pico W - **Fixed** `set_root_ca()` had no effect on ESP8266 and Pico W / Pico 2 W when called in `setup()`, as the certificate was loaded when constructing `thing`. Now it is loaded when connecting. ## 2.43.0 #### WiFi - **Added** several WiFi networks on ESP32, ESP8266 and Raspberry Pi Pico W / Pico 2 W: call `add_wifi()` once per network, and the device connects to the strongest known one (also when it reconnects). With a single network it connects directly, as before, so hidden networks keep working. - **Added** `add_wifi_enterprise(ssid, username, password, identity)` for WPA2-Enterprise networks (PEAP/EAP-MSCHAPv2, i.e., eduroam) on ESP32 with Arduino core 3.x. #### General - **Added** `THINGER_ROOT_CA` to define at compile time the CA root certificate (PEM) used to validate the server, i.e., for instances with their own CA. Define it before including the library; it takes precedence over the default certificates. `set_root_ca()` keeps changing it at runtime. ## 2.42.0 #### Raspberry Pi Pico W / Pico 2 W - **Added** `ThingerPicoW` for Raspberry Pi Pico W and Pico 2 W (and other RP2040/RP2350 boards with CYW43 WiFi) using the [Arduino-Pico](https://github.com/earlephilhower/arduino-pico) core, with TLS certificate validation (BearSSL + NTP). - **Added** `ThingerPicoOTA`: OTA updates stored in LittleFS and applied by the core bootloader. Requires a Flash Size option with a file system large enough for the firmware. Optional gzip compression with `THINGER_OTA_COMPRESSION`. - **Added** device reboot on the Arduino-Pico core. #### Arduino UNO Q - **Added** `ThingerUnoQ` for the Arduino UNO Q: the sketch runs on the MCU (Arduino Zephyr core) and connects through the Linux side with the TCP client of [Arduino_RouterBridge](https://github.com/arduino-libraries/Arduino_RouterBridge). TLS is done on Linux (TLS 1.3). #### Arduino UNO R4 WiFi - **Added** `ThingerR4OTA` (experimental, not yet tested on hardware): OTA updates stored in the ESP32-S3 module, which programs the board on reboot. Requires the UNO R4 WiFi firmware 0.4.1 or later. #### ESP32 - **Verified** ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C5, ESP32-C6 and ESP32-P4 (Ethernet) on ESP32 Arduino core 3.3, now compiled on every change. ## 2.41.1 #### General - **Added** GitHub Actions workflow that compiles the examples for a matrix of boards on every push, pull request and weekly (also against the latest cores). - **Fixed** `THINGER_USE_STATIC_MEMORY` had no effect: the library checked `THINGER_USE_STATIC__MEMORY` (double underscore), which is still accepted for backward compatibility. Define it as a build flag, as `ThingerClient.cpp` is compiled apart from the sketch. - **Fixed** `invertedDigitalPin` was not defined outside AVR and ESP8266 (ESP32, SAMD, Mbed, Renesas, etc.), and reported the opposite state when read. - **Fixed** RAM usage on AVR boards: the CA root certificate (about 2 KB) was copied to RAM even if AVR does not use TLS. Sketches like ArduinoYun or ESP8266AT on Arduino UNO fit again. #### ESP32 - **Fixed** `ThingerESP32OTA` compilation with ESP32 Arduino core 3.3 (ESP-IDF 5.5), where `rom/miniz.h` moved to `miniz.h`. OTA compression keeps working on cores 2.x and 3.x. - **Fixed** `ThingerESP32Eth` compilation with ESP32 Arduino core 3.x, where `ETH.h` no longer includes `WiFi.h`. - **Fixed** `ESP32WebConfig` example on boards without `LED_BUILTIN`. - **Fixed** missing `arduino_secrets.h` in the Thinger NB-IoT Core example. #### TinyGSM - **Fixed** `ThingerESP8266AT` compilation with TinyGSM 0.11 and 0.12, by using the concrete `TinyGsmClient` class. - **Fixed** `ThingerTinyGSM` compilation on AVR boards, which do not provide `std::function` for `setModuleReset`. #### ESP8266 - **Fixed** `SonoffTouch` example, updated to `ThingerESP8266WebConfig`. ## 2.41.0 #### OTA - **Added** support for configurable OTA timeout. Devices can now receive and apply timeout values from the VSCode extension during OTA initialization, allowing per-device timeout configuration for operations over slow connections (GSM/GPRS). ## 2.40.0 #### NB-IOT CORE - **Added** initial support for [Thinger NB-IOT Core](https://docs.thinger.io/others/hardware/thinger32-nb-iot). A module based on BC660 using Narrowband Technology. ## 2.31.0 #### ESP32 - **Fixed** compilation with newer Arduino Frameworks starting from version 3.0 #### Arduino R4 - **Added** initial support for Arduino R4 WiFi board. OTA support is not available yet. #### OTA - **Fixed** empty value for THINGER_OTA_VERSION when it is not defined. ## 2.30.0 #### OTA - **Added** support for defining `THINGER_OTA_VERSION` to set the firmware version on the device. This build flag allows the VSCode extension (from version 1.1.0) to skip updates on devices with the same firmware version. - **Improved** compressed/uncompressed checksum verification on OTA updates. #### Arduino Portenta/Opta Devices - **Added** OTA implementation for Arduino Portenta/Opta devices, including LZSS compression. - **Initial support** for Arduino Portenta/Opta Ethernet connectivity. - **Updated** Arduino Portenta examples for using thinger.io as an Mbed thread by using `thing.start()`. - **Added** specific Arduino Opta examples, including relay and status LED control. 2.29.0 #### ESP32 Ethernet - Improve ESP32 Ethernet TLS support by using stock Arduino WiFiClientSecure - Fix ESP32 log events related to Ethernet link status - Update ESP32 Ethernet default example including OTA support - Allow using THINGER_INSECURE_SSL definition to allow using self-signed certificates on ESP32 Ethernet 2.28.0 - Initial support for ESP32 Ethernet connection over TLS 2.27.0 - Fix compiling issues for AVR - Avoid trying to send keep-alive/streams on the first connection timeout 2.26.0 - Added CMakeLists for integration with ESP-IDF as component - Add ThingerClient methods to detect socket connection failures to improve network reconnection mechanisms - Improve BC66 - Improve MKRNB1500 2.25.2 - Fix Compiling on WiFi devices without WiFi.begin() support after adding the WebConfig compatibility on ESP32. - Fix PORTENTA H7 compiling issue: does not implement WiFi.begin(SSID). 2.25.1 - Fix ESP32 Webconfig issue - Improve ESP8266 NTP sync 2.25.0 - Add support for ESP32 Webconfig - Improve OTA by stopping user flows, handling timeouts, providing callbacks, etc. --- Source: https://docs.thinger.io/reference/esp-idf-client.md # ESP-IDF client > Packages, source code, installation and documentation of the Thinger.io IOTMP client for ESP-IDF, which connects an ESP32 without the Arduino framework. The Thinger.io IOTMP client for ESP-IDF connects an ESP32 to Thinger.io from an ESP-IDF project, without the Arduino framework. It is two components: `iotmp-espidf`, the client for ESP-IDF, and `iotmp-embedded`, the protocol core it shares with the [Zephyr client](https://docs.thinger.io/reference/zephyr-client.md). | Package | Installed from | Version | Source code | | --- | --- | --- | --- | | `iotmp-espidf` | Git repository | No releases yet (`main` branch) | [thinger-io/IOTMP-ESPIDF](https://github.com/thinger-io/IOTMP-ESPIDF) | | `iotmp-embedded` | Git repository | No releases yet (`main` branch) | [thinger-io/IOTMP-Embedded](https://github.com/thinger-io/IOTMP-Embedded) | - **Install:** Clone both components into your ESP-IDF project, as [ESP-IDF](https://docs.thinger.io/devices/esp-idf.md) explains step by step. - **Changelog:** No versioned releases published yet. ## Documentation | Topic | Page | |---|---| | Add the components, write the application and connect an ESP32 | [ESP-IDF](https://docs.thinger.io/devices/esp-idf.md) | | Output, input and action resources | [Define device resources](https://docs.thinger.io/devices/esp-idf.md#define-device-resources) | | Client task, reconnection, keep-alive and connection states | [Connection and reconnection](https://docs.thinger.io/devices/esp-idf.md#connection-and-reconnection) | | Options of `idf.py menuconfig` | [Configuration](https://docs.thinger.io/devices/esp-idf.md#configuration) | | Common errors | [Troubleshooting](https://docs.thinger.io/devices/esp-idf.md#troubleshooting) | | What each call to the platform does | [Coding guide](https://docs.thinger.io/devices/arduino/coding.md) of the Arduino library | | The protocol | [IOTMP](https://docs.thinger.io/reference/iotmp.md) | Firmware updates go through the update mechanism of ESP-IDF: the client does not receive [OTA updates](https://docs.thinger.io/devices/ota.md) through Thinger.io. --- Source: https://docs.thinger.io/reference/zephyr-client.md # Zephyr client > Packages, source code, installation and documentation of the Thinger.io IOTMP client module for Zephyr RTOS. The Thinger.io IOTMP client for Zephyr RTOS connects a board with a network interface supported by Zephyr to Thinger.io. It is two modules of your west workspace: `iotmp-zephyr`, the client for Zephyr, and `iotmp-embedded`, the protocol core it shares with the [ESP-IDF client](https://docs.thinger.io/reference/esp-idf-client.md). Arduino boards programmed from the Arduino IDE with the Arduino Zephyr core use the [Arduino library](https://docs.thinger.io/reference/arduino-library.md) instead. | Package | Installed from | Version | Source code | | --- | --- | --- | --- | | `iotmp-zephyr` | Git repository | No releases yet (`main` branch) | [thinger-io/IOTMP-Zephyr](https://github.com/thinger-io/IOTMP-Zephyr) | | `iotmp-embedded` | Git repository | No releases yet (`main` branch) | [thinger-io/IOTMP-Embedded](https://github.com/thinger-io/IOTMP-Embedded) | - **Install:** Add both modules to the `west.yml` of your workspace, as [Zephyr](https://docs.thinger.io/devices/zephyr.md) explains step by step. - **Changelog:** No versioned releases published yet. ## Documentation | Topic | Page | |---|---| | Add the modules, enable the client, define device resources and turn on TLS | [Zephyr](https://docs.thinger.io/devices/zephyr.md) | | Client thread, reconnection and connection states | [Connection and reconnection](https://docs.thinger.io/devices/zephyr.md#connection-and-reconnection) | | `CONFIG_THINGER_IOTMP` options of `prj.conf` | [Configuration](https://docs.thinger.io/devices/zephyr.md#configuration) | | What each call to the platform does | [Coding guide](https://docs.thinger.io/devices/arduino/coding.md) of the Arduino library | | The protocol | [IOTMP](https://docs.thinger.io/reference/iotmp.md) | Firmware updates go through the update mechanism of Zephyr: the client does not receive [OTA updates](https://docs.thinger.io/devices/ota.md) through Thinger.io. --- Source: https://docs.thinger.io/reference/linux-client.md # Linux client > Packages, source code, installation and documentation of the Thinger.io IOTMP client for Linux, the thinger_iotmp program and C++ library. The Thinger.io IOTMP client for Linux connects a Linux computer, such as a Raspberry Pi, a gateway or a server, to Thinger.io. It is the `thinger_iotmp` program, with a remote terminal, file access and command execution from the console, and a C++20 library for your own programs. | Package | Installed from | Version | Source code | | --- | --- | --- | --- | | `thinger_iotmp` | Git repository | No releases yet (`main` branch) | [thinger-io/IOTMP-Linux](https://github.com/thinger-io/IOTMP-Linux) | - **Install:** Build it from its repository and run it as a service, as [Linux](https://docs.thinger.io/devices/linux.md) explains step by step. - **Changelog:** No versioned releases published yet. ## Documentation | Topic | Page | |---|---| | Build the client, connect a computer and run it as a service | [Linux](https://docs.thinger.io/devices/linux.md) | | Command-line options and their environment variables | [Client options](https://docs.thinger.io/devices/linux.md#client-options) | | Device resources and tools of the client | [What the client provides](https://docs.thinger.io/devices/linux.md#what-the-client-provides) | | The client as a C++ library | [Write your own program](https://docs.thinger.io/devices/linux.md#write-your-own-program) | | Terminal and file explorer from the console | [Remote tools](https://docs.thinger.io/devices/remote-tools.md) | | Common errors | [Troubleshooting](https://docs.thinger.io/devices/linux.md#troubleshooting) | | The protocol | [IOTMP](https://docs.thinger.io/reference/iotmp.md) | To maintain a fleet of Linux machines remotely, [ThinRemote](https://thinremote.io) installs with one command and adds remote SSH, remote desktop, monitoring and fleet management. --- Source: https://docs.thinger.io/reference/cli.md # CLI > Every command and option of the thinger CLI, plus how to install it, sign in, use profiles, script it with JSON output and run its MCP server. The `thinger` command-line interface works with a Thinger.io server from your terminal: devices, products, Data Buckets and dashboard apps. It also runs an MCP server, so an AI client can use your account through the CLI's sign-in. The command reference on this page is generated from the CLI itself. | Package | Installed from | Version | Source code | | --- | --- | --- | --- | | [`@thinger-io/cli`](https://www.npmjs.com/package/@thinger-io/cli) | npm | `0.5.1` | [thinger-io/thinger-cli](https://github.com/thinger-io/thinger-cli) | | [`@thinger-io/cli-core`](https://www.npmjs.com/package/@thinger-io/cli-core) | npm | `0.5.2` | [thinger-io/thinger-cli-core](https://github.com/thinger-io/thinger-cli-core) | - **Install:** [Install](#install), on this page (`@thinger-io/cli-core` comes with it). To use its MCP server from an AI client, follow [Connect an AI agent](https://docs.thinger.io/ai/connect.md). - **Changelog:** [CLI changelog](https://docs.thinger.io/reference/cli/changelog.md): every release, with what it adds, changes and fixes. > **Info: Versions 0.x** > > While the CLI is in 0.x versions, commands and options can still change between minor versions. Check the [changelog](https://docs.thinger.io/reference/cli/changelog.md) before you upgrade scripts that depend on it. ## Install The CLI needs Node.js 20 or later. Install it globally from npm: ```bash npm install -g @thinger-io/cli ``` Check the installed version: ```bash thinger --version ``` You can also run any command without installing it, with `npx -y @thinger-io/cli `. ## Sign in `thinger login` signs in to a server and stores the session in a profile. Without options it asks for the sign-in method and the server. `YOUR_SERVER` is `iot.thinger.io` on the free Cloud account, or your own domain on a private instance. A bare host means HTTPS; give a full URL (`http://…` or a custom port) for anything else. | Method | How | What the profile keeps | |---|---|---| | OAuth (browser) | `thinger login`, then choose **OAuth (browser)**, or `thinger login --oauth`. The CLI shows a link and a code; you approve the access in the browser, signed in to your server (OAuth device flow). | An OAuth session with full access to your account, renewed on its own while you use it. | | Token | `thinger login --server YOUR_SERVER --username YOUR_USER --token YOUR_TOKEN`. Works without a terminal, for scripts and CI. | The access token you gave. Here `YOUR_TOKEN` is an access token of your account. | | Username and password | `thinger login`, then choose **Username and password**. The password is always asked interactively. | An access token named `Thinger CLI`, created in your account with full permissions. `thinger logout` revokes it. | The browser sign-in uses the **Thinger CLI** OAuth client, which every server creates for it (see [OAuth2 Clients](https://docs.thinger.io/administration/oauth2-clients.md#the-thinger-cli-client)). When the server does not have it, the CLI says so and offers username and password or a token instead. `--client-id ` signs in through another OAuth client registered on the server. When a profile is active, `thinger login` signs in again on that same profile. To add another server, use `thinger profile add`. `thinger logout` forgets the current profile and revokes the token the CLI created at sign-in; `--keep-token` keeps it on the server, and `--all` forgets every profile. Self-signed certificates are accepted only for `localhost` and `127.0.0.1`, or when `THINGER_INSECURE=1` is set. ## Profiles A profile is one server and one account. Use profiles to work with several servers or accounts: ```bash thinger profile add staging --server YOUR_SERVER --username YOUR_USER --token YOUR_TOKEN thinger profile list thinger profile use staging thinger device list --profile production ``` The CLI picks the profile in this order: 1. The `--profile ` option of the command. 2. The `THINGER_PROFILE` environment variable. 3. `THINGER_TOKEN` and `THINGER_SERVER`, when both are set (see [Environment variables](#environment-variables)). 4. The default profile, set with `thinger profile use`. The first profile you create becomes the default. ## Environment variables | Variable | Effect | |---|---| | `THINGER_TOKEN` | Access token to use instead of the saved profiles. Set it together with `THINGER_SERVER`. The token must be a JWT access token: the CLI reads the username from it. | | `THINGER_SERVER` | Server for `THINGER_TOKEN`: a host, or a URL for HTTP or a custom port. Setting `THINGER_TOKEN` without it is an error. | | `THINGER_PROFILE` | Profile to use when the command has no `--profile`. | | `THINGER_INSECURE` | Set it to `1` to accept self-signed certificates on any host. Any other value is ignored. | `THINGER_TOKEN` and `THINGER_SERVER` take precedence over the saved default profile, but not over a profile you name with `--profile` or `THINGER_PROFILE`. They are the usual way to run the CLI in CI: ```bash THINGER_SERVER=YOUR_SERVER THINGER_TOKEN=YOUR_TOKEN thinger device list --json ``` ## JSON output Commands that take `-j, --json` print a JSON envelope on standard output instead of tables and messages, so scripts and agents can parse the result. `login`, `logout` and `mcp` do not take it. On success, `data` holds the result. For example, `thinger device set-product YOUR_DEVICE "" --json` (which removes the device from its product) prints: ```json { "ok": true, "data": { "device": "YOUR_DEVICE", "product": null } } ``` On failure, the envelope carries the error message and a code: ```json { "ok": false, "error": { "message": "Unauthorized. Your token may have expired. Please reconfigure.", "code": "unauthorized" } } ``` | `code` | Meaning | |---|---| | `unauthorized` | The token is missing, expired or not valid for the server (HTTP 401), or it is not allowed to do this (HTTP 403, `Forbidden`). | | `not_found` | The device, product, bucket or other resource does not exist. | | `already_exists` | A resource with that ID already exists. | | `input_error` | An argument or option is not valid. | | `not_configured` | There is no profile: run `thinger login`. | | `needs_confirm` | A destructive command needs `--yes` in JSON mode or when there is no terminal to confirm it. | | `server_error` | The server answered with an error. | | `network_error` | The server could not be reached. | | `timeout` | The server did not answer in time. | | `error` | Any other error. | The exit status is `0` on success and `1` on error. ## Configuration file Profiles are stored in `~/.config/thinger-cli/config.json` in your home folder, on macOS, Linux and Windows alike. The folder is readable only by your user and the file is written with owner-only permissions, because it contains access tokens. Do not share it or commit it. ## Global options These options work with every command: ```text thinger [options] [command] ``` | Option | Description | | --- | --- | | `-V, --version` | output the version number | | `-u, --user ` | API user override (admin impersonation) | | `--profile ` | Configuration profile to use (defaults to the saved default) | | `-h, --help` | Display help for the command. | Add `--help` to any command or group to print its usage, for example `thinger dashboard publish --help`. ## Commands | Command | Description | | --- | --- | | [`thinger device`](#thinger-device) | Devices: records, properties, resources, data and their children | | [`thinger product`](#thinger-product) | Products: records, properties, profile and their export | | [`thinger bucket`](#thinger-bucket) | Data buckets: records, time series, exports and tags | | [`thinger dashboard`](#thinger-dashboard) | Dashboards: apps on the dashboard SDK (create, develop and publish them) and their records | | [`thinger storage`](#thinger-storage) | File storages; their files are type storage_file | | [`thinger plugin`](#thinger-plugin) | Plugins installed on the account: containers that add features (integrations, apps); their API is reached with `thinger plugin call` | | [`thinger endpoint`](#thinger-endpoint) | Endpoints: outgoing HTTP calls, emails, notifications (run one with its `call` action) | | [`thinger asset`](#thinger-asset) | Assets: types and groups that organize devices | | [`thinger project`](#thinger-project) | Projects: group resources of any type to share them or show them together | | [`thinger token`](#thinger-token) | Access tokens of the account, with their permission tree | | [`thinger alarm`](#thinger-alarm) | Alarms: the rules that watch devices and buckets, and the instances they raise | | [`thinger claim`](#thinger-claim) | Device claims: codes that let end users take ownership of a device | | [`thinger property`](#thinger-property) | Account properties: JSON values stored on the account | | [`thinger role`](#thinger-role) | Roles: named permission sets for project members | | [`thinger sync`](#thinger-sync) | Syncs: shared semaphores with a number of slots that devices or scripts take (locks) to coordinate | | [`thinger admin`](#thinger-admin) | Server administration (admin accounts): users, hosts, domains, brands… | | [`thinger login`](#thinger-login) | Sign in: re-authenticate the current profile, or create the first one. Use `profile add` for more servers. | | [`thinger logout`](#thinger-logout) | Forget the current profile (or --all) and revoke the API token the CLI created | | [`thinger profile`](#thinger-profile) | Manage configuration profiles | | [`thinger api`](#thinger-api) | Send a request to the server API (anything the commands do not cover) | | [`thinger doc`](#thinger-doc) | Guides for agents and app developers: the platform, product code, the dashboard SDK, this CLI | | [`thinger mcp`](#thinger-mcp) | Start the MCP server (stdio) for AI tool integration | ## thinger device Devices: records, properties, resources, data and their children ```text thinger device [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device list`](#thinger-device-list) | List devices: online state, id, name, type and product | | [`thinger device get`](#thinger-device-get) | Show a device as JSON | | [`thinger device create`](#thinger-device-create) | Register a device; Generic/MQTT ones get random credentials unless given | | [`thinger device update`](#thinger-device-update) | Update fields of a device (fields left out are kept) | | [`thinger device delete`](#thinger-device-delete) | Delete a device record from the platform (irreversible) | | [`thinger device clone`](#thinger-device-clone) | Copy a device under a new id | | [`thinger device describe`](#thinger-device-describe) | Fields, examples and permissions of a device, from the server's API | | [`thinger device send`](#thinger-device-send) | Send data as an HTTP device would: the server runs the device's callback | | [`thinger device overview`](#thinger-device-overview) | Usage of all the devices over the last 30 days, per day | | [`thinger device set-product`](#thinger-device-set-product) | Assign a device to a product ("" to unassign) | | [`thinger device stats`](#thinger-device-stats) | Usage over the last 30 days, per day: traffic and calls (empty when the server does not record usage) | | [`thinger device resource`](#thinger-device-resource) | Resources of a connected device: its firmware's API and its product's | | [`thinger device property`](#thinger-device-property) | Properties of a device: its structured state (configuration, calibration…) | | [`thinger device token`](#thinger-device-token) | Tokens scoped to one device and some of its resources | | [`thinger device bucket`](#thinger-device-bucket) | Buckets that hold data of a device (read-only listing) | | [`thinger device service`](#thinger-device-service) | Services a device exposes (web, VNC…) | | [`thinger device callback`](#thinger-device-callback) | HTTP callback settings of a device: what the server does with the data it receives | ### thinger device list List devices: online state, id, name, type and product ```text thinger device list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger device get Show a device as JSON ```text thinger device get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger device create Register a device; Generic/MQTT ones get random credentials unless given ```text thinger device create [options] [device] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | No | Device ID | | Option | Description | | --- | --- | | `-t, --type ` | Device type: Generic, MQTT, HTTP, Virtual, Subdevice (default: Generic) | | `-c, --credentials ` | Device credentials (6+ characters) | | `-n, --name ` | Display name | | `-d, --description ` | Description | | `-p, --product ` | Assign to a product | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | | `-j, --json` | Output as JSON | ### thinger device update Update fields of a device (fields left out are kept) ```text thinger device update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger device delete Delete a device record from the platform (irreversible) ```text thinger device delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | Device ID | | Option | Description | | --- | --- | | `-y, --yes` | Skip the interactive confirmation prompt | | `-j, --json` | Output as JSON | ### thinger device clone Copy a device under a new id ```text thinger device clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger device describe Fields, examples and permissions of a device, from the server's API ```text thinger device describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device send Send data as an HTTP device would: the server runs the device's callback ```text thinger device send [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | Device ID | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-j, --json` | Output as JSON | ### thinger device overview Usage of all the devices over the last 30 days, per day ```text thinger device overview [options] ``` | Option | Description | | --- | --- | | `--locations` | Also the last known position of each connected device | | `-j, --json` | Output as JSON | ### thinger device set-product Assign a device to a product ("" to unassign) ```text thinger device set-product [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | Device ID | | `product` | Yes | Product ID ("" removes the device from its product) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device stats Usage over the last 30 days, per day: traffic and calls (empty when the server does not record usage) ```text thinger device stats [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | ### thinger device resource Resources of a connected device: its firmware's API and its product's ```text thinger device resource [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device resource list`](#thinger-device-resource-list) | List the resources a connected device exposes, with their inputs and outputs | | [`thinger device resource call`](#thinger-device-resource-call) | Call a resource of a connected device: with --from or --set it runs it with that input; without, it reads its output | ### thinger device resource list List the resources a connected device exposes, with their inputs and outputs ```text thinger device resource list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | Device ID | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device resource call Call a resource of a connected device: with --from or --set it runs it with that input; without, it reads its output ```text thinger device resource call [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | Device ID | | `resource` | Yes | Resource of the device to call | | Option | Description | | --- | --- | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-j, --json` | Output as JSON | ### thinger device property Properties of a device: its structured state (configuration, calibration…) ```text thinger device property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device property list`](#thinger-device-property-list) | List device property records | | [`thinger device property get`](#thinger-device-property-get) | Show a device property as JSON | | [`thinger device property create`](#thinger-device-property-create) | Create a device property from --from and --set | | [`thinger device property update`](#thinger-device-property-update) | Update fields of a device property (fields left out are kept) | | [`thinger device property delete`](#thinger-device-property-delete) | Delete a device property | | [`thinger device property clone`](#thinger-device-property-clone) | Copy a device property under a new id | | [`thinger device property set`](#thinger-device-property-set) | Set the value of a device property (created when missing) | | [`thinger device property describe`](#thinger-device-property-describe) | Fields, examples and permissions of a device property, from the server's API | ### thinger device property list List device property records ```text thinger device property list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger device property get Show a device property as JSON ```text thinger device property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `property` | Yes | ID of the device property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger device property create Create a device property from --from and --set ```text thinger device property create [options] [property] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `property` | No | ID of the device property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger device property update Update fields of a device property (fields left out are kept) ```text thinger device property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `property` | Yes | ID of the device property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger device property delete Delete a device property ```text thinger device property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `property` | Yes | ID of the device property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger device property clone Copy a device property under a new id ```text thinger device property clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `property` | Yes | ID of the device property | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger device property set Set the value of a device property (created when missing) ```text thinger device property set [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `property` | Yes | ID of the device property | | `value` | Yes | Value, parsed as JSON (text when it is not JSON) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device property describe Fields, examples and permissions of a device property, from the server's API ```text thinger device property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device token Tokens scoped to one device and some of its resources ```text thinger device token [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device token list`](#thinger-device-token-list) | List device token records | | [`thinger device token create`](#thinger-device-token-create) | Create a device token from --from and --set | | [`thinger device token delete`](#thinger-device-token-delete) | Delete a device token | | [`thinger device token describe`](#thinger-device-token-describe) | Fields, examples and permissions of a device token, from the server's API | ### thinger device token list List device token records ```text thinger device token list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger device token create Create a device token from --from and --set ```text thinger device token create [options] [token] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `token` | No | ID of the device token | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger device token delete Delete a device token ```text thinger device token delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `token` | Yes | ID of the device token | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger device token describe Fields, examples and permissions of a device token, from the server's API ```text thinger device token describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device bucket Buckets that hold data of a device (read-only listing) ```text thinger device bucket [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device bucket list`](#thinger-device-bucket-list) | List device bucket records | | [`thinger device bucket describe`](#thinger-device-bucket-describe) | Fields, examples and permissions of a device bucket, from the server's API | | [`thinger device bucket tag`](#thinger-device-bucket-tag) | Tags of a device bucket | ### thinger device bucket list List device bucket records ```text thinger device bucket list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger device bucket describe Fields, examples and permissions of a device bucket, from the server's API ```text thinger device bucket describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device bucket tag Tags of a device bucket ```text thinger device bucket tag [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device bucket tag list`](#thinger-device-bucket-tag-list) | List device bucket tag records | | [`thinger device bucket tag get`](#thinger-device-bucket-tag-get) | Show a device bucket tag as JSON | | [`thinger device bucket tag describe`](#thinger-device-bucket-tag-describe) | Fields, examples and permissions of a device bucket tag, from the server's API | ### thinger device bucket tag list List device bucket tag records ```text thinger device bucket tag list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `bucket` | Yes | ID of the device bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger device bucket tag get Show a device bucket tag as JSON ```text thinger device bucket tag get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `bucket` | Yes | ID of the device bucket | | `tag` | Yes | ID of the device bucket tag | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger device bucket tag describe Fields, examples and permissions of a device bucket tag, from the server's API ```text thinger device bucket tag describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device service Services a device exposes (web, VNC…) ```text thinger device service [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device service list`](#thinger-device-service-list) | List device service records | | [`thinger device service get`](#thinger-device-service-get) | Show a device service as JSON | | [`thinger device service describe`](#thinger-device-service-describe) | Fields, examples and permissions of a device service, from the server's API | ### thinger device service list List device service records ```text thinger device service list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger device service get Show a device service as JSON ```text thinger device service get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | `service` | Yes | ID of the device service | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger device service describe Fields, examples and permissions of a device service, from the server's API ```text thinger device service describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger device callback HTTP callback settings of a device: what the server does with the data it receives ```text thinger device callback [options] [command] ``` | Command | Description | | --- | --- | | [`thinger device callback get`](#thinger-device-callback-get) | Show a device callback as JSON | | [`thinger device callback update`](#thinger-device-callback-update) | Update fields of a device callback (fields left out are kept) | | [`thinger device callback describe`](#thinger-device-callback-describe) | Fields, examples and permissions of a device callback, from the server's API | ### thinger device callback get Show a device callback as JSON ```text thinger device callback get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger device callback update Update fields of a device callback (fields left out are kept) ```text thinger device callback update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `device` | Yes | ID of the device | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger device callback describe Fields, examples and permissions of a device callback, from the server's API ```text thinger device callback describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger product Products: records, properties, profile and their export ```text thinger product [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product list`](#thinger-product-list) | List the products of the account, with their API resources | | [`thinger product get`](#thinger-product-get) | Show a product as JSON | | [`thinger product create`](#thinger-product-create) | Create a product, bare or from a JSON document (config + profile); the CLI template fills in the rest | | [`thinger product update`](#thinger-product-update) | Update fields of a product (fields left out are kept) | | [`thinger product delete`](#thinger-product-delete) | Delete a product (its devices stay, unassigned) | | [`thinger product clone`](#thinger-product-clone) | Copy a product under a new id | | [`thinger product describe`](#thinger-product-describe) | Fields, examples and permissions of a product, from the server's API | | [`thinger product export`](#thinger-product-export) | The product with what it depends on, as one JSON document, to back it up or recreate it | | [`thinger product apply`](#thinger-product-apply) | Create or update a product from the JSON `product export` writes (profile and properties included) | | [`thinger product profile`](#thinger-product-profile) | Profile of a product: the API resources, buckets, properties, autoprovisioning, flows and code its devices get | | [`thinger product property`](#thinger-product-property) | Properties of a product | | [`thinger product service`](#thinger-product-service) | Services a product exposes on its devices | ### thinger product list List the products of the account, with their API resources ```text thinger product list [options] ``` | Option | Description | Default | | --- | --- | --- | | `-j, --json` | Output as JSON | | | `-c, --concurrency ` | Max parallel API-resource lookups (default: 10) | `10` | | `--search ` | Text to look for in ids and names | | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | | `--count ` | Page size (default: all) | | | `--index ` | Offset of the first record | | ### thinger product get Show a product as JSON ```text thinger product get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product create Create a product, bare or from a JSON document (config + profile); the CLI template fills in the rest ```text thinger product create [options] [product] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | No | Product ID | | Option | Description | | --- | --- | | `-n, --name ` | Display name | | `-d, --description ` | Description | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | | `-j, --json` | Output as JSON | ### thinger product update Update fields of a product (fields left out are kept) ```text thinger product update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger product delete Delete a product (its devices stay, unassigned) ```text thinger product delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | Product ID | | Option | Description | | --- | --- | | `-y, --yes` | Skip the interactive confirmation prompt | | `-j, --json` | Output as JSON | ### thinger product clone Copy a product under a new id ```text thinger product clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product describe Fields, examples and permissions of a product, from the server's API ```text thinger product describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product export The product with what it depends on, as one JSON document, to back it up or recreate it ```text thinger product export [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | ### thinger product apply Create or update a product from the JSON `product export` writes (profile and properties included) ```text thinger product apply [options] ``` | Option | Description | | --- | --- | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-j, --json` | Output as JSON | ### thinger product profile Profile of a product: the API resources, buckets, properties, autoprovisioning, flows and code its devices get ```text thinger product profile [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product profile api`](#thinger-product-profile-api) | API resources a product adds to its devices (calls to device resources, endpoints, scripts) | | [`thinger product profile bucket`](#thinger-product-profile-bucket) | Buckets a product keeps for each of its devices | | [`thinger product profile property`](#thinger-product-profile-property) | Properties a product creates on each of its devices | | [`thinger product profile autoprovision`](#thinger-product-profile-autoprovision) | Autoprovisioning rules: which connecting devices join the product | | [`thinger product profile flow`](#thinger-product-profile-flow) | Data flows of a product: periodic reads of device resources | | [`thinger product profile code`](#thinger-product-profile-code) | Script code of a product (JavaScript run by the server for its devices) | ### thinger product profile api API resources a product adds to its devices (calls to device resources, endpoints, scripts) ```text thinger product profile api [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product profile api list`](#thinger-product-profile-api-list) | List product profile api records | | [`thinger product profile api get`](#thinger-product-profile-api-get) | Show a product profile api as JSON | | [`thinger product profile api create`](#thinger-product-profile-api-create) | Create a product profile api from --from and --set | | [`thinger product profile api update`](#thinger-product-profile-api-update) | Update fields of a product profile api (fields left out are kept) | | [`thinger product profile api delete`](#thinger-product-profile-api-delete) | Delete a product profile api | | [`thinger product profile api describe`](#thinger-product-profile-api-describe) | Fields, examples and permissions of a product profile api, from the server's API | | [`thinger product profile api call`](#thinger-product-profile-api-call) | Call a product API resource for the whole product (needs its device_id_resolver) | | [`thinger product profile api replace-all`](#thinger-product-profile-api-replace-all) | Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept | ### thinger product profile api list List product profile api records ```text thinger product profile api list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger product profile api get Show a product profile api as JSON ```text thinger product profile api get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile api | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product profile api create Create a product profile api from --from and --set ```text thinger product profile api create [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile api | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile api update Update fields of a product profile api (fields left out are kept) ```text thinger product profile api update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile api | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile api delete Delete a product profile api ```text thinger product profile api delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile api | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile api describe Fields, examples and permissions of a product profile api, from the server's API ```text thinger product profile api describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product profile api call Call a product API resource for the whole product (needs its device_id_resolver) ```text thinger product profile api call [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | Product ID | | `resource` | Yes | API resource of the product profile | | Option | Description | | --- | --- | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-j, --json` | Output as JSON | ### thinger product profile api replace-all Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept ```text thinger product profile api replace-all [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile bucket Buckets a product keeps for each of its devices ```text thinger product profile bucket [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product profile bucket list`](#thinger-product-profile-bucket-list) | List product profile bucket records | | [`thinger product profile bucket get`](#thinger-product-profile-bucket-get) | Show a product profile bucket as JSON | | [`thinger product profile bucket create`](#thinger-product-profile-bucket-create) | Create a product profile bucket from --from and --set | | [`thinger product profile bucket update`](#thinger-product-profile-bucket-update) | Update fields of a product profile bucket (fields left out are kept) | | [`thinger product profile bucket delete`](#thinger-product-profile-bucket-delete) | Delete a product profile bucket | | [`thinger product profile bucket describe`](#thinger-product-profile-bucket-describe) | Fields, examples and permissions of a product profile bucket, from the server's API | | [`thinger product profile bucket replace-all`](#thinger-product-profile-bucket-replace-all) | Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept | ### thinger product profile bucket list List product profile bucket records ```text thinger product profile bucket list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger product profile bucket get Show a product profile bucket as JSON ```text thinger product profile bucket get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product profile bucket create Create a product profile bucket from --from and --set ```text thinger product profile bucket create [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile bucket update Update fields of a product profile bucket (fields left out are kept) ```text thinger product profile bucket update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile bucket delete Delete a product profile bucket ```text thinger product profile bucket delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile bucket describe Fields, examples and permissions of a product profile bucket, from the server's API ```text thinger product profile bucket describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product profile bucket replace-all Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept ```text thinger product profile bucket replace-all [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile property Properties a product creates on each of its devices ```text thinger product profile property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product profile property list`](#thinger-product-profile-property-list) | List product profile property records | | [`thinger product profile property get`](#thinger-product-profile-property-get) | Show a product profile property as JSON | | [`thinger product profile property create`](#thinger-product-profile-property-create) | Create a product profile property from --from and --set | | [`thinger product profile property update`](#thinger-product-profile-property-update) | Update fields of a product profile property (fields left out are kept) | | [`thinger product profile property delete`](#thinger-product-profile-property-delete) | Delete a product profile property | | [`thinger product profile property describe`](#thinger-product-profile-property-describe) | Fields, examples and permissions of a product profile property, from the server's API | | [`thinger product profile property replace-all`](#thinger-product-profile-property-replace-all) | Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept | ### thinger product profile property list List product profile property records ```text thinger product profile property list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger product profile property get Show a product profile property as JSON ```text thinger product profile property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product profile property create Create a product profile property from --from and --set ```text thinger product profile property create [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile property update Update fields of a product profile property (fields left out are kept) ```text thinger product profile property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile property delete Delete a product profile property ```text thinger product profile property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile property describe Fields, examples and permissions of a product profile property, from the server's API ```text thinger product profile property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product profile property replace-all Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept ```text thinger product profile property replace-all [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile autoprovision Autoprovisioning rules: which connecting devices join the product ```text thinger product profile autoprovision [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product profile autoprovision list`](#thinger-product-profile-autoprovision-list) | List product profile autoprovision records | | [`thinger product profile autoprovision get`](#thinger-product-profile-autoprovision-get) | Show a product profile autoprovision as JSON | | [`thinger product profile autoprovision create`](#thinger-product-profile-autoprovision-create) | Create a product profile autoprovision from --from and --set | | [`thinger product profile autoprovision update`](#thinger-product-profile-autoprovision-update) | Update fields of a product profile autoprovision (fields left out are kept) | | [`thinger product profile autoprovision delete`](#thinger-product-profile-autoprovision-delete) | Delete a product profile autoprovision | | [`thinger product profile autoprovision describe`](#thinger-product-profile-autoprovision-describe) | Fields, examples and permissions of a product profile autoprovision, from the server's API | | [`thinger product profile autoprovision replace-all`](#thinger-product-profile-autoprovision-replace-all) | Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept | ### thinger product profile autoprovision list List product profile autoprovision records ```text thinger product profile autoprovision list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger product profile autoprovision get Show a product profile autoprovision as JSON ```text thinger product profile autoprovision get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile autoprovision | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product profile autoprovision create Create a product profile autoprovision from --from and --set ```text thinger product profile autoprovision create [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile autoprovision | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile autoprovision update Update fields of a product profile autoprovision (fields left out are kept) ```text thinger product profile autoprovision update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile autoprovision | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile autoprovision delete Delete a product profile autoprovision ```text thinger product profile autoprovision delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile autoprovision | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile autoprovision describe Fields, examples and permissions of a product profile autoprovision, from the server's API ```text thinger product profile autoprovision describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product profile autoprovision replace-all Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept ```text thinger product profile autoprovision replace-all [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile flow Data flows of a product: periodic reads of device resources ```text thinger product profile flow [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product profile flow list`](#thinger-product-profile-flow-list) | List product profile flow records | | [`thinger product profile flow get`](#thinger-product-profile-flow-get) | Show a product profile flow as JSON | | [`thinger product profile flow create`](#thinger-product-profile-flow-create) | Create a product profile flow from --from and --set | | [`thinger product profile flow update`](#thinger-product-profile-flow-update) | Update fields of a product profile flow (fields left out are kept) | | [`thinger product profile flow delete`](#thinger-product-profile-flow-delete) | Delete a product profile flow | | [`thinger product profile flow describe`](#thinger-product-profile-flow-describe) | Fields, examples and permissions of a product profile flow, from the server's API | | [`thinger product profile flow replace-all`](#thinger-product-profile-flow-replace-all) | Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept | ### thinger product profile flow list List product profile flow records ```text thinger product profile flow list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger product profile flow get Show a product profile flow as JSON ```text thinger product profile flow get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile flow | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product profile flow create Create a product profile flow from --from and --set ```text thinger product profile flow create [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile flow | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile flow update Update fields of a product profile flow (fields left out are kept) ```text thinger product profile flow update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile flow | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile flow delete Delete a product profile flow ```text thinger product profile flow delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `resource` | Yes | ID of the product profile flow | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile flow describe Fields, examples and permissions of a product profile flow, from the server's API ```text thinger product profile flow describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product profile flow replace-all Replace every entry of this profile category at once with the body ({id: entry, …}). The only way to use ids with placeholders such as `{{device}}`\_data, which the per-entry path does not accept ```text thinger product profile flow replace-all [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-y, --yes` | Do not ask for confirmation | ### thinger product profile code Script code of a product (JavaScript run by the server for its devices) ```text thinger product profile code [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product profile code get`](#thinger-product-profile-code-get) | Show a product profile code as JSON | | [`thinger product profile code update`](#thinger-product-profile-code-update) | Update fields of a product profile code (fields left out are kept) | | [`thinger product profile code describe`](#thinger-product-profile-code-describe) | Fields, examples and permissions of a product profile code, from the server's API | ### thinger product profile code get Show a product profile code as JSON ```text thinger product profile code get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product profile code update Update fields of a product profile code (fields left out are kept) ```text thinger product profile code update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product profile code describe Fields, examples and permissions of a product profile code, from the server's API ```text thinger product profile code describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product property Properties of a product ```text thinger product property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product property list`](#thinger-product-property-list) | List product property records | | [`thinger product property get`](#thinger-product-property-get) | Show a product property as JSON | | [`thinger product property create`](#thinger-product-property-create) | Create a product property from --from and --set | | [`thinger product property update`](#thinger-product-property-update) | Update fields of a product property (fields left out are kept) | | [`thinger product property delete`](#thinger-product-property-delete) | Delete a product property | | [`thinger product property clone`](#thinger-product-property-clone) | Copy a product property under a new id | | [`thinger product property set`](#thinger-product-property-set) | Set the value of a product property (created when missing) | | [`thinger product property describe`](#thinger-product-property-describe) | Fields, examples and permissions of a product property, from the server's API | ### thinger product property list List product property records ```text thinger product property list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger product property get Show a product property as JSON ```text thinger product property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `property` | Yes | ID of the product property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product property create Create a product property from --from and --set ```text thinger product property create [options] [property] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `property` | No | ID of the product property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product property update Update fields of a product property (fields left out are kept) ```text thinger product property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `property` | Yes | ID of the product property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger product property delete Delete a product property ```text thinger product property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `property` | Yes | ID of the product property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger product property clone Copy a product property under a new id ```text thinger product property clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `property` | Yes | ID of the product property | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product property set Set the value of a product property (created when missing) ```text thinger product property set [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `property` | Yes | ID of the product property | | `value` | Yes | Value, parsed as JSON (text when it is not JSON) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product property describe Fields, examples and permissions of a product property, from the server's API ```text thinger product property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger product service Services a product exposes on its devices ```text thinger product service [options] [command] ``` | Command | Description | | --- | --- | | [`thinger product service list`](#thinger-product-service-list) | List product service records | | [`thinger product service get`](#thinger-product-service-get) | Show a product service as JSON | | [`thinger product service create`](#thinger-product-service-create) | Create a product service from --from and --set | | [`thinger product service update`](#thinger-product-service-update) | Update fields of a product service (fields left out are kept) | | [`thinger product service delete`](#thinger-product-service-delete) | Delete a product service | | [`thinger product service describe`](#thinger-product-service-describe) | Fields, examples and permissions of a product service, from the server's API | ### thinger product service list List product service records ```text thinger product service list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger product service get Show a product service as JSON ```text thinger product service get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `service` | Yes | ID of the product service | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger product service create Create a product service from --from and --set ```text thinger product service create [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `service` | Yes | ID of the product service | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product service update Update fields of a product service (fields left out are kept) ```text thinger product service update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `service` | Yes | ID of the product service | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger product service delete Delete a product service ```text thinger product service delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `product` | Yes | ID of the product | | `service` | Yes | ID of the product service | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger product service describe Fields, examples and permissions of a product service, from the server's API ```text thinger product service describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger bucket Data buckets: records, time series, exports and tags ```text thinger bucket [options] [command] ``` | Command | Description | | --- | --- | | [`thinger bucket list`](#thinger-bucket-list) | List the data buckets of the account | | [`thinger bucket get`](#thinger-bucket-get) | Show a bucket as JSON | | [`thinger bucket create`](#thinger-bucket-create) | Create a bucket from --from and --set | | [`thinger bucket update`](#thinger-bucket-update) | Update fields of a bucket (fields left out are kept) | | [`thinger bucket delete`](#thinger-bucket-delete) | Delete a bucket | | [`thinger bucket clone`](#thinger-bucket-clone) | Copy a bucket under a new id | | [`thinger bucket describe`](#thinger-bucket-describe) | Fields, examples and permissions of a bucket, from the server's API | | [`thinger bucket read`](#thinger-bucket-read) | Read samples from a bucket (latest first by default) | | [`thinger bucket write`](#thinger-bucket-write) | Write samples: one JSON object, an array of them with their ts (unix ms), or NDJSON | | [`thinger bucket export`](#thinger-bucket-export) | Export the data of a bucket to a file (or stdout) and download it | | [`thinger bucket import`](#thinger-bucket-import) | Load records from a .csv already in a file storage (upload it with `thinger storage file upload`) into an existing bucket: body {source: "storage", storage, file}. Header row; ";" separated if the header has one, "," otherwise. The time column (ts, date or timestamp) takes unix MILLISECONDS (seconds are misread as ms) or ISO 8601, always taken as UTC. Other cells become numbers when they parse, text otherwise; empty and "null" are left out. Columns named like a bucket tag (config.tags) are stored as that tag: a device column in a bucket tagged `device` (product buckets are) makes the records readable per device. Writes straight to the backend (MongoDB or InfluxDB, not DynamoDB), with no rate limit and no bucket_write events; answers {"progress": N}, a percentage (100 when done; only the last line is shown). The way to load history in bulk: `thinger bucket write` is rate limited | | [`thinger bucket tag`](#thinger-bucket-tag) | Tags of a bucket and their values | | [`thinger bucket export-file`](#thinger-bucket-export-file) | Exports of a bucket (files generated from its data) | ### thinger bucket list List the data buckets of the account ```text thinger bucket list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger bucket get Show a bucket as JSON ```text thinger bucket get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger bucket create Create a bucket from --from and --set ```text thinger bucket create [options] [bucket] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | No | ID of the bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger bucket update Update fields of a bucket (fields left out are kept) ```text thinger bucket update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger bucket delete Delete a bucket ```text thinger bucket delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger bucket clone Copy a bucket under a new id ```text thinger bucket clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger bucket describe Fields, examples and permissions of a bucket, from the server's API ```text thinger bucket describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger bucket read Read samples from a bucket (latest first by default) ```text thinger bucket read [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | Data Bucket ID | | Option | Description | Default | | --- | --- | --- | | `-d, --device ` | Series a product bucket keeps for this device | | | `-n, --items ` | Number of samples | `10` | | `-m, --minutes ` | Only the last N minutes | | | `--sort ` | asc or desc | `desc` | | `--agg ` | Aggregation window, e.g. 5m, 1h | | | `--agg-type ` | Reducer: mean, max, min, sum, count, first, last… | | | `--fields ` | Comma-separated fields to return | | | `--group-by ` | Group key, e.g. device | | | `-j, --json` | Output as JSON | | ### thinger bucket write Write samples: one JSON object, an array of them with their ts (unix ms), or NDJSON ```text thinger bucket write [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | Data Bucket ID | | Option | Description | | --- | --- | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--ts ` | Timestamp of a single sample (unix ms) | | `-j, --json` | Output as JSON | ### thinger bucket export Export the data of a bucket to a file (or stdout) and download it ```text thinger bucket export [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | Data Bucket ID | | Option | Description | Default | | --- | --- | --- | | `-o, --output ` | Write it to this file | | | `--format ` | csv, json or arff | `csv` | | `--timestamps ` | iso, seconds or milliseconds | `iso` | | `--min-ts ` | From (unix ms; default: the first sample) | | | `--max-ts ` | To (unix ms; default: the last sample) | | | `--keep` | Keep the export file on the server (listed by bucket export-file list) | | | `-j, --json` | Output as JSON | | ### thinger bucket import Load records from a .csv already in a file storage (upload it with `thinger storage file upload`) into an existing bucket: body {source: "storage", storage, file}. Header row; ";" separated if the header has one, "," otherwise. The time column (ts, date or timestamp) takes unix MILLISECONDS (seconds are misread as ms) or ISO 8601, always taken as UTC. Other cells become numbers when they parse, text otherwise; empty and "null" are left out. Columns named like a bucket tag (config.tags) are stored as that tag: a device column in a bucket tagged `device` (product buckets are) makes the records readable per device. Writes straight to the backend (MongoDB or InfluxDB, not DynamoDB), with no rate limit and no bucket_write events; answers {"progress": N}, a percentage (100 when done; only the last line is shown). The way to load history in bulk: `thinger bucket write` is rate limited ```text thinger bucket import [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger bucket tag Tags of a bucket and their values ```text thinger bucket tag [options] [command] ``` | Command | Description | | --- | --- | | [`thinger bucket tag list`](#thinger-bucket-tag-list) | List bucket tag records | | [`thinger bucket tag get`](#thinger-bucket-tag-get) | Show a bucket tag as JSON | | [`thinger bucket tag describe`](#thinger-bucket-tag-describe) | Fields, examples and permissions of a bucket tag, from the server's API | ### thinger bucket tag list List bucket tag records ```text thinger bucket tag list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger bucket tag get Show a bucket tag as JSON ```text thinger bucket tag get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | `tag` | Yes | ID of the bucket tag | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger bucket tag describe Fields, examples and permissions of a bucket tag, from the server's API ```text thinger bucket tag describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger bucket export-file Exports of a bucket (files generated from its data) ```text thinger bucket export-file [options] [command] ``` | Command | Description | | --- | --- | | [`thinger bucket export-file list`](#thinger-bucket-export-file-list) | List bucket export-file records | | [`thinger bucket export-file create`](#thinger-bucket-export-file-create) | Create a bucket export-file from --from and --set | | [`thinger bucket export-file delete`](#thinger-bucket-export-file-delete) | Delete a bucket export-file | | [`thinger bucket export-file describe`](#thinger-bucket-export-file-describe) | Fields, examples and permissions of a bucket export-file, from the server's API | ### thinger bucket export-file list List bucket export-file records ```text thinger bucket export-file list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger bucket export-file create Create a bucket export-file from --from and --set ```text thinger bucket export-file create [options] [file] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | `file` | No | ID of the bucket export | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger bucket export-file delete Delete a bucket export-file ```text thinger bucket export-file delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `bucket` | Yes | ID of the bucket | | `file` | Yes | ID of the bucket export | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger bucket export-file describe Fields, examples and permissions of a bucket export-file, from the server's API ```text thinger bucket export-file describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger dashboard Dashboards: apps on the dashboard SDK (create, develop and publish them) and their records ```text thinger dashboard [options] [command] ``` | Command | Description | | --- | --- | | [`thinger dashboard list`](#thinger-dashboard-list) | List dashboard records | | [`thinger dashboard get`](#thinger-dashboard-get) | Show a dashboard as JSON | | [`thinger dashboard create`](#thinger-dashboard-create) | Create a dashboard from --from and --set | | [`thinger dashboard update`](#thinger-dashboard-update) | Update fields of a dashboard (fields left out are kept) | | [`thinger dashboard delete`](#thinger-dashboard-delete) | Delete a dashboard | | [`thinger dashboard clone`](#thinger-dashboard-clone) | Copy a dashboard under a new id | | [`thinger dashboard describe`](#thinger-dashboard-describe) | Fields, examples and permissions of a dashboard, from the server's API | | [`thinger dashboard init`](#thinger-dashboard-init) | Create a dashboard app (TypeScript, on @thinger-io/dashboard-sdk) from a template of the SDK | | [`thinger dashboard dev`](#thinger-dashboard-dev) | Link that opens the app on its own dev server (ng serve, Vite…) against the server, with a temporary token | | [`thinger dashboard publish`](#thinger-dashboard-publish) | Upload an app to a public storage and point dashboards at it | `thinger dashboard` builds dashboards as web apps on the [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md). `init` creates the project from a template of the SDK, `dev` prints a link that opens the app from its own dev server as a standalone page connected to your server, with a temporary token, and `publish` uploads the build to a public file storage and points the dashboards at it. See [Dashboard apps](https://docs.thinger.io/platform/dashboards/apps.md) for the workflow. `init` writes a `thinger.json` manifest in the project folder. `dev` and `publish` read it from the current folder, or from the file given with `--config`; their options override it: **thinger.json** ```json { "dashboard": { "dir": "dist", "storage": "app_greenhouse_1a2b", "prune": true, "to": [{ "type": "device", "id": "YOUR_DEVICE" }], "dev": { "url": "http://localhost:5173/" } } } ``` | Field | Content | |---|---| | `dir` | Build folder that `publish` uploads, relative to the manifest. It must be inside the project folder. | | `storage` | File storage the app is published to. `publish` creates it, public, if it does not exist. | | `prune` | `true` deletes files of the storage that are not in the upload. | | `to` | Destinations whose dashboard opens the app: `{ "type": "device", "id": "…" }` with type `device`, `product`, `asset_type`, `asset_group` or `project`, or `{ "dashboard": "…" }` for a dashboard. Each one can set its own `entry` and `route`. | | `dev` | Options of `thinger dashboard dev`: `url` of the dev server, `context`, `route` and `hours` the temporary token lasts. | ```bash thinger dashboard init greenhouse --to device:YOUR_DEVICE --install cd greenhouse npm run build thinger dashboard publish ``` ### thinger dashboard list List dashboard records ```text thinger dashboard list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger dashboard get Show a dashboard as JSON ```text thinger dashboard get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `dashboard` | Yes | ID of the dashboard | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger dashboard create Create a dashboard from --from and --set ```text thinger dashboard create [options] [dashboard] ``` | Argument | Required | Description | | --- | --- | --- | | `dashboard` | No | ID of the dashboard | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger dashboard update Update fields of a dashboard (fields left out are kept) ```text thinger dashboard update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `dashboard` | Yes | ID of the dashboard | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger dashboard delete Delete a dashboard ```text thinger dashboard delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `dashboard` | Yes | ID of the dashboard | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger dashboard clone Copy a dashboard under a new id ```text thinger dashboard clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `dashboard` | Yes | ID of the dashboard | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger dashboard describe Fields, examples and permissions of a dashboard, from the server's API ```text thinger dashboard describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger dashboard init Create a dashboard app (TypeScript, on @thinger-io/dashboard-sdk) from a template of the SDK ```text thinger dashboard init [options] ``` | Argument | Required | Description | | --- | --- | --- | | `dir` | Yes | New or empty folder for the app | | Option | Description | | --- | --- | | `-t, --template ` | Template of the SDK package: react, angular… (default react) | | `--to ` | Where it publishes: device:<id>, product:<id>, dashboard:<id>… | | `-s, --storage ` | Storage it publishes to (default app\_<folder>\_<random>) | | `--from ` | SDK package to take the template from: a version or tag on npm, or a folder or .tgz | | `--ci` | Add a GitHub workflow that publishes it on every push to main | | `--install` | Run npm install | | `-j, --json` | Output as JSON | ### thinger dashboard dev Link that opens the app on its own dev server (ng serve, Vite…) against the server, with a temporary token ```text thinger dashboard dev [options] [url] ``` | Argument | Required | Description | | --- | --- | --- | | `url` | No | Address of the app on its dev server (default: dev.url of the manifest) | | Option | Description | | --- | --- | | `--to ` | Context of a destination: device:<id>, product:<id>, dashboard:<id>… | | `--device ` | Device in the SDK context | | `--product ` | Product in the SDK context | | `--asset-type ` | Asset type in the SDK context | | `--asset-group ` | Asset group in the SDK context | | `--project ` | Project the app runs in | | `--route ` | Initial route, e.g. /devices | | `--hours ` | Hours the token lasts (default 8) | | `--open` | Open the link in the browser | | `--allow-remote` | Allow an app url that is not on this machine (the link carries a full-access token) | | `--config ` | Manifest (default thinger.json) | | `-j, --json` | Output as JSON | ### thinger dashboard publish Upload an app to a public storage and point dashboards at it ```text thinger dashboard publish [options] [dir] ``` | Argument | Required | Description | | --- | --- | --- | | `dir` | No | Folder to upload (default: dir of the manifest) | | Option | Description | | --- | --- | | `-s, --storage ` | Storage of the app (created public if missing) | | `--to ` | Dashboard to point (repeatable): dashboard:<id>, device:<id>, product:<id>, asset_type:<id>, asset_group:<id>, project:<id> | | `--entry ` | Page the destinations open (default index.html) | | `--route ` | Initial route of the destinations | | `--name ` | Name of a collection dashboard | | `--prune` | Delete files of the storage that are not in this upload | | `--no-prune` | Keep the storage's other files (overrides the manifest) | | `--bump` | Make consoles that have the app open reload it at once | | `--preview [hours]` | Also print standalone preview links (read-only, 1 h by default) | | `--no-point` | Upload without pointing the destinations (preview links only) | | `--config ` | Manifest (default thinger.json) | | `-j, --json` | Output as JSON | ## thinger storage File storages; their files are type storage_file ```text thinger storage [options] [command] ``` | Command | Description | | --- | --- | | [`thinger storage list`](#thinger-storage-list) | List storage records | | [`thinger storage get`](#thinger-storage-get) | Show a storage as JSON | | [`thinger storage create`](#thinger-storage-create) | Create a storage from --from and --set | | [`thinger storage update`](#thinger-storage-update) | Update fields of a storage (fields left out are kept) | | [`thinger storage delete`](#thinger-storage-delete) | Delete a storage | | [`thinger storage clone`](#thinger-storage-clone) | Copy a storage under a new id | | [`thinger storage describe`](#thinger-storage-describe) | Fields, examples and permissions of a storage, from the server's API | | [`thinger storage file`](#thinger-storage-file) | Files of a file storage | ### thinger storage list List storage records ```text thinger storage list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger storage get Show a storage as JSON ```text thinger storage get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | ID of the storage | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger storage create Create a storage from --from and --set ```text thinger storage create [options] [storage] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | No | ID of the storage | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger storage update Update fields of a storage (fields left out are kept) ```text thinger storage update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | ID of the storage | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger storage delete Delete a storage ```text thinger storage delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | ID of the storage | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger storage clone Copy a storage under a new id ```text thinger storage clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | ID of the storage | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger storage describe Fields, examples and permissions of a storage, from the server's API ```text thinger storage describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger storage file Files of a file storage ```text thinger storage file [options] [command] ``` | Command | Description | | --- | --- | | [`thinger storage file list`](#thinger-storage-file-list) | List the files of a storage, or of a folder in it | | [`thinger storage file delete`](#thinger-storage-file-delete) | Delete a file of a storage | | [`thinger storage file upload`](#thinger-storage-file-upload) | Upload a local file or folder (binary too), overwriting what is there; folders on the way are created | | [`thinger storage file download`](#thinger-storage-file-download) | Download a file: to -o, or printed (text) / piped (binary) | ### thinger storage file list List the files of a storage, or of a folder in it ```text thinger storage file list [options] [folder] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | File storage ID | | `folder` | No | Folder of the storage to list (default: all the files) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger storage file delete Delete a file of a storage ```text thinger storage file delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | File storage ID | | `path` | Yes | Path of the file in the storage | | Option | Description | | --- | --- | | `-y, --yes` | Do not ask for confirmation | | `-j, --json` | Output as JSON | ### thinger storage file upload Upload a local file or folder (binary too), overwriting what is there; folders on the way are created ```text thinger storage file upload [options] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | File storage ID | | `local` | Yes | Local file or folder | | Option | Description | | --- | --- | | `--to ` | Where in the storage: a file path, or the folder for a folder | | `-j, --json` | Output as JSON | ### thinger storage file download Download a file: to -o, or printed (text) / piped (binary) ```text thinger storage file download [options] ``` | Argument | Required | Description | | --- | --- | --- | | `storage` | Yes | File storage ID | | `path` | Yes | Path of the file in the storage | | Option | Description | | --- | --- | | `-o, --output ` | Write it to this file | | `-j, --json` | Output as JSON | ## thinger plugin Plugins installed on the account: containers that add features (integrations, apps); their API is reached with `thinger plugin call` ```text thinger plugin [options] [command] ``` | Command | Description | | --- | --- | | [`thinger plugin list`](#thinger-plugin-list) | List plugin records | | [`thinger plugin get`](#thinger-plugin-get) | Show a plugin as JSON | | [`thinger plugin describe`](#thinger-plugin-describe) | Fields, examples and permissions of a plugin, from the server's API | | [`thinger plugin call`](#thinger-plugin-call) | Call the API a plugin serves, at its own path | | [`thinger plugin install`](#thinger-plugin-install) | Install the plugin `id` (its name in the plugin catalog); the body holds its settings, query {version} picks one (default main). The container is created stopped: start it next | | [`thinger plugin upgrade`](#thinger-plugin-upgrade) | Upgrade the plugin to query {version} (default master); the body holds its settings. The container is recreated stopped (volumes kept): start it next | | [`thinger plugin uninstall`](#thinger-plugin-uninstall) | Uninstall the plugin: removes its container, files, volumes (its data) and properties | | [`thinger plugin start`](#thinger-plugin-start) | Start the plugin container | | [`thinger plugin stop`](#thinger-plugin-stop) | Stop the plugin container | | [`thinger plugin restart`](#thinger-plugin-restart) | Restart the plugin container | | [`thinger plugin pause`](#thinger-plugin-pause) | Pause the plugin container | | [`thinger plugin unpause`](#thinger-plugin-unpause) | Resume a paused plugin container | | [`thinger plugin kill`](#thinger-plugin-kill) | Kill the plugin container | | [`thinger plugin public`](#thinger-plugin-public) | Make the plugin's web interface reachable without signing in | | [`thinger plugin private`](#thinger-plugin-private) | Make the plugin's web interface require signing in again | | [`thinger plugin property`](#thinger-plugin-property) | Properties of a plugin, usually its configuration | ### thinger plugin list List plugin records ```text thinger plugin list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger plugin get Show a plugin as JSON ```text thinger plugin get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger plugin describe Fields, examples and permissions of a plugin, from the server's API ```text thinger plugin describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger plugin call Call the API a plugin serves, at its own path ```text thinger plugin call [options] [path] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | Plugin ID | | `path` | No | Path in the API of the plugin, e.g. /api/status | | Option | Description | | --- | --- | | `-X, --method ` | get, post, put, patch or delete (default: get, or post with a body) | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-j, --json` | Output as JSON | ### thinger plugin install Install the plugin `id` (its name in the plugin catalog); the body holds its settings, query {version} picks one (default main). The container is created stopped: start it next ```text thinger plugin install [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin upgrade Upgrade the plugin to query {version} (default master); the body holds its settings. The container is recreated stopped (volumes kept): start it next ```text thinger plugin upgrade [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin uninstall Uninstall the plugin: removes its container, files, volumes (its data) and properties ```text thinger plugin uninstall [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-y, --yes` | Do not ask for confirmation | ### thinger plugin start Start the plugin container ```text thinger plugin start [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin stop Stop the plugin container ```text thinger plugin stop [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin restart Restart the plugin container ```text thinger plugin restart [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin pause Pause the plugin container ```text thinger plugin pause [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin unpause Resume a paused plugin container ```text thinger plugin unpause [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin kill Kill the plugin container ```text thinger plugin kill [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin public Make the plugin's web interface reachable without signing in ```text thinger plugin public [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin private Make the plugin's web interface require signing in again ```text thinger plugin private [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin property Properties of a plugin, usually its configuration ```text thinger plugin property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger plugin property list`](#thinger-plugin-property-list) | List plugin property records | | [`thinger plugin property get`](#thinger-plugin-property-get) | Show a plugin property as JSON | | [`thinger plugin property create`](#thinger-plugin-property-create) | Create a plugin property from --from and --set | | [`thinger plugin property update`](#thinger-plugin-property-update) | Update fields of a plugin property (fields left out are kept) | | [`thinger plugin property delete`](#thinger-plugin-property-delete) | Delete a plugin property | | [`thinger plugin property clone`](#thinger-plugin-property-clone) | Copy a plugin property under a new id | | [`thinger plugin property set`](#thinger-plugin-property-set) | Set the value of a plugin property (created when missing) | | [`thinger plugin property describe`](#thinger-plugin-property-describe) | Fields, examples and permissions of a plugin property, from the server's API | ### thinger plugin property list List plugin property records ```text thinger plugin property list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger plugin property get Show a plugin property as JSON ```text thinger plugin property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | `property` | Yes | ID of the plugin property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger plugin property create Create a plugin property from --from and --set ```text thinger plugin property create [options] [property] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | `property` | No | ID of the plugin property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin property update Update fields of a plugin property (fields left out are kept) ```text thinger plugin property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | `property` | Yes | ID of the plugin property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger plugin property delete Delete a plugin property ```text thinger plugin property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | `property` | Yes | ID of the plugin property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger plugin property clone Copy a plugin property under a new id ```text thinger plugin property clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | `property` | Yes | ID of the plugin property | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger plugin property set Set the value of a plugin property (created when missing) ```text thinger plugin property set [options] ``` | Argument | Required | Description | | --- | --- | --- | | `plugin` | Yes | ID of the plugin | | `property` | Yes | ID of the plugin property | | `value` | Yes | Value, parsed as JSON (text when it is not JSON) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger plugin property describe Fields, examples and permissions of a plugin property, from the server's API ```text thinger plugin property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger endpoint Endpoints: outgoing HTTP calls, emails, notifications (run one with its `call` action) ```text thinger endpoint [options] [command] ``` | Command | Description | | --- | --- | | [`thinger endpoint list`](#thinger-endpoint-list) | List endpoint records | | [`thinger endpoint get`](#thinger-endpoint-get) | Show an endpoint as JSON | | [`thinger endpoint create`](#thinger-endpoint-create) | Create an endpoint from --from and --set | | [`thinger endpoint update`](#thinger-endpoint-update) | Update fields of an endpoint (fields left out are kept) | | [`thinger endpoint delete`](#thinger-endpoint-delete) | Delete an endpoint | | [`thinger endpoint clone`](#thinger-endpoint-clone) | Copy an endpoint under a new id | | [`thinger endpoint describe`](#thinger-endpoint-describe) | Fields, examples and permissions of an endpoint, from the server's API | | [`thinger endpoint call`](#thinger-endpoint-call) | Run the endpoint with the body as its payload (its templates see it as `{{payload}}`); returns what it answered | ### thinger endpoint list List endpoint records ```text thinger endpoint list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger endpoint get Show an endpoint as JSON ```text thinger endpoint get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `endpoint` | Yes | ID of the endpoint | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger endpoint create Create an endpoint from --from and --set ```text thinger endpoint create [options] [endpoint] ``` | Argument | Required | Description | | --- | --- | --- | | `endpoint` | No | ID of the endpoint | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger endpoint update Update fields of an endpoint (fields left out are kept) ```text thinger endpoint update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `endpoint` | Yes | ID of the endpoint | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger endpoint delete Delete an endpoint ```text thinger endpoint delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `endpoint` | Yes | ID of the endpoint | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger endpoint clone Copy an endpoint under a new id ```text thinger endpoint clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `endpoint` | Yes | ID of the endpoint | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger endpoint describe Fields, examples and permissions of an endpoint, from the server's API ```text thinger endpoint describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger endpoint call Run the endpoint with the body as its payload (its templates see it as `{{payload}}`); returns what it answered ```text thinger endpoint call [options] ``` | Argument | Required | Description | | --- | --- | --- | | `endpoint` | Yes | ID of the endpoint | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ## thinger asset Assets: types and groups that organize devices ```text thinger asset [options] [command] ``` | Command | Description | | --- | --- | | [`thinger asset type`](#thinger-asset-type) | Asset types: a category of device (e.g. "boiler"), with its own properties | | [`thinger asset group`](#thinger-asset-group) | Asset groups: a set of devices (e.g. a site), with its own properties | ### thinger asset type Asset types: a category of device (e.g. "boiler"), with its own properties ```text thinger asset type [options] [command] ``` | Command | Description | | --- | --- | | [`thinger asset type list`](#thinger-asset-type-list) | List asset type records | | [`thinger asset type get`](#thinger-asset-type-get) | Show an asset type as JSON | | [`thinger asset type create`](#thinger-asset-type-create) | Create an asset type from --from and --set | | [`thinger asset type update`](#thinger-asset-type-update) | Update fields of an asset type (fields left out are kept) | | [`thinger asset type delete`](#thinger-asset-type-delete) | Delete an asset type | | [`thinger asset type clone`](#thinger-asset-type-clone) | Copy an asset type under a new id | | [`thinger asset type describe`](#thinger-asset-type-describe) | Fields, examples and permissions of an asset type, from the server's API | | [`thinger asset type property`](#thinger-asset-type-property) | Properties of an asset type | ### thinger asset type list List asset type records ```text thinger asset type list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger asset type get Show an asset type as JSON ```text thinger asset type get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger asset type create Create an asset type from --from and --set ```text thinger asset type create [options] [type] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | No | ID of the asset type | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger asset type update Update fields of an asset type (fields left out are kept) ```text thinger asset type update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger asset type delete Delete an asset type ```text thinger asset type delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger asset type clone Copy an asset type under a new id ```text thinger asset type clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger asset type describe Fields, examples and permissions of an asset type, from the server's API ```text thinger asset type describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger asset type property Properties of an asset type ```text thinger asset type property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger asset type property list`](#thinger-asset-type-property-list) | List asset type property records | | [`thinger asset type property get`](#thinger-asset-type-property-get) | Show an asset type property as JSON | | [`thinger asset type property create`](#thinger-asset-type-property-create) | Create an asset type property from --from and --set | | [`thinger asset type property update`](#thinger-asset-type-property-update) | Update fields of an asset type property (fields left out are kept) | | [`thinger asset type property delete`](#thinger-asset-type-property-delete) | Delete an asset type property | | [`thinger asset type property clone`](#thinger-asset-type-property-clone) | Copy an asset type property under a new id | | [`thinger asset type property set`](#thinger-asset-type-property-set) | Set the value of an asset type property (created when missing) | | [`thinger asset type property describe`](#thinger-asset-type-property-describe) | Fields, examples and permissions of an asset type property, from the server's API | ### thinger asset type property list List asset type property records ```text thinger asset type property list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger asset type property get Show an asset type property as JSON ```text thinger asset type property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | `property` | Yes | ID of the asset type property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger asset type property create Create an asset type property from --from and --set ```text thinger asset type property create [options] [property] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | `property` | No | ID of the asset type property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger asset type property update Update fields of an asset type property (fields left out are kept) ```text thinger asset type property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | `property` | Yes | ID of the asset type property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger asset type property delete Delete an asset type property ```text thinger asset type property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | `property` | Yes | ID of the asset type property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger asset type property clone Copy an asset type property under a new id ```text thinger asset type property clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | `property` | Yes | ID of the asset type property | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger asset type property set Set the value of an asset type property (created when missing) ```text thinger asset type property set [options] ``` | Argument | Required | Description | | --- | --- | --- | | `type` | Yes | ID of the asset type | | `property` | Yes | ID of the asset type property | | `value` | Yes | Value, parsed as JSON (text when it is not JSON) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger asset type property describe Fields, examples and permissions of an asset type property, from the server's API ```text thinger asset type property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger asset group Asset groups: a set of devices (e.g. a site), with its own properties ```text thinger asset group [options] [command] ``` | Command | Description | | --- | --- | | [`thinger asset group list`](#thinger-asset-group-list) | List asset group records | | [`thinger asset group get`](#thinger-asset-group-get) | Show an asset group as JSON | | [`thinger asset group create`](#thinger-asset-group-create) | Create an asset group from --from and --set | | [`thinger asset group update`](#thinger-asset-group-update) | Update fields of an asset group (fields left out are kept) | | [`thinger asset group delete`](#thinger-asset-group-delete) | Delete an asset group | | [`thinger asset group clone`](#thinger-asset-group-clone) | Copy an asset group under a new id | | [`thinger asset group describe`](#thinger-asset-group-describe) | Fields, examples and permissions of an asset group, from the server's API | | [`thinger asset group property`](#thinger-asset-group-property) | Properties of an asset group | ### thinger asset group list List asset group records ```text thinger asset group list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger asset group get Show an asset group as JSON ```text thinger asset group get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger asset group create Create an asset group from --from and --set ```text thinger asset group create [options] [group] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | No | ID of the asset group | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger asset group update Update fields of an asset group (fields left out are kept) ```text thinger asset group update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger asset group delete Delete an asset group ```text thinger asset group delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger asset group clone Copy an asset group under a new id ```text thinger asset group clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger asset group describe Fields, examples and permissions of an asset group, from the server's API ```text thinger asset group describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger asset group property Properties of an asset group ```text thinger asset group property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger asset group property list`](#thinger-asset-group-property-list) | List asset group property records | | [`thinger asset group property get`](#thinger-asset-group-property-get) | Show an asset group property as JSON | | [`thinger asset group property create`](#thinger-asset-group-property-create) | Create an asset group property from --from and --set | | [`thinger asset group property update`](#thinger-asset-group-property-update) | Update fields of an asset group property (fields left out are kept) | | [`thinger asset group property delete`](#thinger-asset-group-property-delete) | Delete an asset group property | | [`thinger asset group property clone`](#thinger-asset-group-property-clone) | Copy an asset group property under a new id | | [`thinger asset group property set`](#thinger-asset-group-property-set) | Set the value of an asset group property (created when missing) | | [`thinger asset group property describe`](#thinger-asset-group-property-describe) | Fields, examples and permissions of an asset group property, from the server's API | ### thinger asset group property list List asset group property records ```text thinger asset group property list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger asset group property get Show an asset group property as JSON ```text thinger asset group property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | `property` | Yes | ID of the asset group property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger asset group property create Create an asset group property from --from and --set ```text thinger asset group property create [options] [property] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | `property` | No | ID of the asset group property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger asset group property update Update fields of an asset group property (fields left out are kept) ```text thinger asset group property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | `property` | Yes | ID of the asset group property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger asset group property delete Delete an asset group property ```text thinger asset group property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | `property` | Yes | ID of the asset group property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger asset group property clone Copy an asset group property under a new id ```text thinger asset group property clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | `property` | Yes | ID of the asset group property | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger asset group property set Set the value of an asset group property (created when missing) ```text thinger asset group property set [options] ``` | Argument | Required | Description | | --- | --- | --- | | `group` | Yes | ID of the asset group | | `property` | Yes | ID of the asset group property | | `value` | Yes | Value, parsed as JSON (text when it is not JSON) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger asset group property describe Fields, examples and permissions of an asset group property, from the server's API ```text thinger asset group property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger project Projects: group resources of any type to share them or show them together ```text thinger project [options] [command] ``` | Command | Description | | --- | --- | | [`thinger project list`](#thinger-project-list) | List project records | | [`thinger project get`](#thinger-project-get) | Show a project as JSON | | [`thinger project create`](#thinger-project-create) | Create a project from --from and --set | | [`thinger project update`](#thinger-project-update) | Update fields of a project (fields left out are kept) | | [`thinger project delete`](#thinger-project-delete) | Delete a project | | [`thinger project clone`](#thinger-project-clone) | Copy a project under a new id | | [`thinger project describe`](#thinger-project-describe) | Fields, examples and permissions of a project, from the server's API | | [`thinger project property`](#thinger-project-property) | Properties of a project | | [`thinger project member`](#thinger-project-member) | Members a project is shared with, and their roles | | [`thinger project role`](#thinger-project-role) | Roles defined inside a project | ### thinger project list List project records ```text thinger project list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger project get Show a project as JSON ```text thinger project get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger project create Create a project from --from and --set ```text thinger project create [options] [project] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | No | ID of the project | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project update Update fields of a project (fields left out are kept) ```text thinger project update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project delete Delete a project ```text thinger project delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger project clone Copy a project under a new id ```text thinger project clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project describe Fields, examples and permissions of a project, from the server's API ```text thinger project describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger project property Properties of a project ```text thinger project property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger project property list`](#thinger-project-property-list) | List project property records | | [`thinger project property get`](#thinger-project-property-get) | Show a project property as JSON | | [`thinger project property create`](#thinger-project-property-create) | Create a project property from --from and --set | | [`thinger project property update`](#thinger-project-property-update) | Update fields of a project property (fields left out are kept) | | [`thinger project property delete`](#thinger-project-property-delete) | Delete a project property | | [`thinger project property clone`](#thinger-project-property-clone) | Copy a project property under a new id | | [`thinger project property set`](#thinger-project-property-set) | Set the value of a project property (created when missing) | | [`thinger project property describe`](#thinger-project-property-describe) | Fields, examples and permissions of a project property, from the server's API | ### thinger project property list List project property records ```text thinger project property list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger project property get Show a project property as JSON ```text thinger project property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `property` | Yes | ID of the project property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger project property create Create a project property from --from and --set ```text thinger project property create [options] [property] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `property` | No | ID of the project property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project property update Update fields of a project property (fields left out are kept) ```text thinger project property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `property` | Yes | ID of the project property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger project property delete Delete a project property ```text thinger project property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `property` | Yes | ID of the project property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger project property clone Copy a project property under a new id ```text thinger project property clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `property` | Yes | ID of the project property | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project property set Set the value of a project property (created when missing) ```text thinger project property set [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `property` | Yes | ID of the project property | | `value` | Yes | Value, parsed as JSON (text when it is not JSON) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger project property describe Fields, examples and permissions of a project property, from the server's API ```text thinger project property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger project member Members a project is shared with, and their roles ```text thinger project member [options] [command] ``` | Command | Description | | --- | --- | | [`thinger project member list`](#thinger-project-member-list) | List project member records | | [`thinger project member get`](#thinger-project-member-get) | Show a project member as JSON | | [`thinger project member create`](#thinger-project-member-create) | Create a project member from --from and --set | | [`thinger project member update`](#thinger-project-member-update) | Update fields of a project member (fields left out are kept) | | [`thinger project member delete`](#thinger-project-member-delete) | Delete a project member | | [`thinger project member describe`](#thinger-project-member-describe) | Fields, examples and permissions of a project member, from the server's API | ### thinger project member list List project member records ```text thinger project member list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger project member get Show a project member as JSON ```text thinger project member get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `member` | Yes | ID of the project member | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger project member create Create a project member from --from and --set ```text thinger project member create [options] [member] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `member` | No | ID of the project member | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project member update Update fields of a project member (fields left out are kept) ```text thinger project member update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `member` | Yes | ID of the project member | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project member delete Delete a project member ```text thinger project member delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `member` | Yes | ID of the project member | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger project member describe Fields, examples and permissions of a project member, from the server's API ```text thinger project member describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger project role Roles defined inside a project ```text thinger project role [options] [command] ``` | Command | Description | | --- | --- | | [`thinger project role list`](#thinger-project-role-list) | List project role records | | [`thinger project role get`](#thinger-project-role-get) | Show a project role as JSON | | [`thinger project role create`](#thinger-project-role-create) | Create a project role from --from and --set | | [`thinger project role update`](#thinger-project-role-update) | Update fields of a project role (fields left out are kept) | | [`thinger project role delete`](#thinger-project-role-delete) | Delete a project role | | [`thinger project role clone`](#thinger-project-role-clone) | Copy a project role under a new id | | [`thinger project role describe`](#thinger-project-role-describe) | Fields, examples and permissions of a project role, from the server's API | ### thinger project role list List project role records ```text thinger project role list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger project role get Show a project role as JSON ```text thinger project role get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `role` | Yes | ID of the project role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger project role create Create a project role from --from and --set ```text thinger project role create [options] [role] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `role` | No | ID of the project role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project role update Update fields of a project role (fields left out are kept) ```text thinger project role update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `role` | Yes | ID of the project role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project role delete Delete a project role ```text thinger project role delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `role` | Yes | ID of the project role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger project role clone Copy a project role under a new id ```text thinger project role clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `project` | Yes | ID of the project | | `role` | Yes | ID of the project role | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger project role describe Fields, examples and permissions of a project role, from the server's API ```text thinger project role describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger token Access tokens of the account, with their permission tree ```text thinger token [options] [command] ``` | Command | Description | | --- | --- | | [`thinger token list`](#thinger-token-list) | List token records | | [`thinger token get`](#thinger-token-get) | Show a token as JSON | | [`thinger token create`](#thinger-token-create) | Create a token from --from and --set | | [`thinger token update`](#thinger-token-update) | Update fields of a token (fields left out are kept) | | [`thinger token delete`](#thinger-token-delete) | Delete a token | | [`thinger token clone`](#thinger-token-clone) | Copy a token under a new id | | [`thinger token describe`](#thinger-token-describe) | Fields, examples and permissions of a token, from the server's API | ### thinger token list List token records ```text thinger token list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger token get Show a token as JSON ```text thinger token get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `token` | Yes | ID of the token | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger token create Create a token from --from and --set ```text thinger token create [options] [token] ``` | Argument | Required | Description | | --- | --- | --- | | `token` | No | ID of the token | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger token update Update fields of a token (fields left out are kept) ```text thinger token update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `token` | Yes | ID of the token | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger token delete Delete a token ```text thinger token delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `token` | Yes | ID of the token | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger token clone Copy a token under a new id ```text thinger token clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `token` | Yes | ID of the token | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger token describe Fields, examples and permissions of a token, from the server's API ```text thinger token describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger alarm Alarms: the rules that watch devices and buckets, and the instances they raise ```text thinger alarm [options] [command] ``` | Command | Description | | --- | --- | | [`thinger alarm rule`](#thinger-alarm-rule) | Alarm rules: conditions on device or bucket data that raise alarm instances | | [`thinger alarm instance`](#thinger-alarm-instance) | Alarm instances raised by the rules; update them to acknowledge, shelve or clear | ### thinger alarm rule Alarm rules: conditions on device or bucket data that raise alarm instances ```text thinger alarm rule [options] [command] ``` | Command | Description | | --- | --- | | [`thinger alarm rule list`](#thinger-alarm-rule-list) | List alarm rule records | | [`thinger alarm rule get`](#thinger-alarm-rule-get) | Show an alarm rule as JSON | | [`thinger alarm rule create`](#thinger-alarm-rule-create) | Create an alarm rule from --from and --set | | [`thinger alarm rule update`](#thinger-alarm-rule-update) | Update fields of an alarm rule (fields left out are kept) | | [`thinger alarm rule delete`](#thinger-alarm-rule-delete) | Delete an alarm rule | | [`thinger alarm rule clone`](#thinger-alarm-rule-clone) | Copy an alarm rule under a new id | | [`thinger alarm rule describe`](#thinger-alarm-rule-describe) | Fields, examples and permissions of an alarm rule, from the server's API | | [`thinger alarm rule test`](#thinger-alarm-rule-test) | Evaluate a whole rule without raising alarms or notifying: the body is the rule as it would be saved ({name, enabled, config}), and the rule id may not exist yet. Without the body, it tests the saved rule | | [`thinger alarm rule test-source`](#thinger-alarm-rule-test-source) | Read one data source as the rule would (the rule id need not exist; the source comes in the body): the body is {name, source: "bucket" \| "device_property" \| "device_status", <source>: {…}}, e.g. {name: "loc", source: "device_property", device_property: {device: "d1", property: "location"}}. A bucket source without aggregation reads the window of `check_interval` (as in config.check_interval; default the saved rule's, or 1 minute) | | [`thinger alarm rule test-notification`](#thinger-alarm-rule-test-notification) | Send the rule notification for real, through its endpoints, with the body as the event data: people get it | ### thinger alarm rule list List alarm rule records ```text thinger alarm rule list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger alarm rule get Show an alarm rule as JSON ```text thinger alarm rule get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | Yes | ID of the alarm rule | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger alarm rule create Create an alarm rule from --from and --set ```text thinger alarm rule create [options] [rule] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | No | ID of the alarm rule | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger alarm rule update Update fields of an alarm rule (fields left out are kept) ```text thinger alarm rule update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | Yes | ID of the alarm rule | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger alarm rule delete Delete an alarm rule ```text thinger alarm rule delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | Yes | ID of the alarm rule | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger alarm rule clone Copy an alarm rule under a new id ```text thinger alarm rule clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | Yes | ID of the alarm rule | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger alarm rule describe Fields, examples and permissions of an alarm rule, from the server's API ```text thinger alarm rule describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger alarm rule test Evaluate a whole rule without raising alarms or notifying: the body is the rule as it would be saved ({name, enabled, config}), and the rule id may not exist yet. Without the body, it tests the saved rule ```text thinger alarm rule test [options] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | Yes | ID of the alarm rule | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger alarm rule test-source Read one data source as the rule would (the rule id need not exist; the source comes in the body): the body is {name, source: "bucket" | "device_property" | "device_status", <source>: {…}}, e.g. {name: "loc", source: "device_property", device_property: {device: "d1", property: "location"}}. A bucket source without aggregation reads the window of `check_interval` (as in config.check_interval; default the saved rule's, or 1 minute) ```text thinger alarm rule test-source [options] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | Yes | ID of the alarm rule | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger alarm rule test-notification Send the rule notification for real, through its endpoints, with the body as the event data: people get it ```text thinger alarm rule test-notification [options] ``` | Argument | Required | Description | | --- | --- | --- | | `rule` | Yes | ID of the alarm rule | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger alarm instance Alarm instances raised by the rules; update them to acknowledge, shelve or clear ```text thinger alarm instance [options] [command] ``` | Command | Description | | --- | --- | | [`thinger alarm instance list`](#thinger-alarm-instance-list) | List alarm instance records | | [`thinger alarm instance get`](#thinger-alarm-instance-get) | Show an alarm instance as JSON | | [`thinger alarm instance update`](#thinger-alarm-instance-update) | Update fields of an alarm instance (fields left out are kept) | | [`thinger alarm instance delete`](#thinger-alarm-instance-delete) | Delete an alarm instance | | [`thinger alarm instance describe`](#thinger-alarm-instance-describe) | Fields, examples and permissions of an alarm instance, from the server's API | | [`thinger alarm instance stats`](#thinger-alarm-instance-stats) | How many instances there are in each state: the health of the account at a glance, without listing them | ### thinger alarm instance list List alarm instance records ```text thinger alarm instance list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger alarm instance get Show an alarm instance as JSON ```text thinger alarm instance get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `instance` | Yes | ID of the alarm instance | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger alarm instance update Update fields of an alarm instance (fields left out are kept) ```text thinger alarm instance update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `instance` | Yes | ID of the alarm instance | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger alarm instance delete Delete an alarm instance ```text thinger alarm instance delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `instance` | Yes | ID of the alarm instance | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger alarm instance describe Fields, examples and permissions of an alarm instance, from the server's API ```text thinger alarm instance describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger alarm instance stats How many instances there are in each state: the health of the account at a glance, without listing them ```text thinger alarm instance stats [options] ``` | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | ## thinger claim Device claims: codes that let end users take ownership of a device ```text thinger claim [options] [command] ``` | Command | Description | | --- | --- | | [`thinger claim list`](#thinger-claim-list) | List claim records | | [`thinger claim get`](#thinger-claim-get) | Show a claim as JSON | | [`thinger claim create`](#thinger-claim-create) | Create a claim from --from and --set | | [`thinger claim update`](#thinger-claim-update) | Update fields of a claim (fields left out are kept) | | [`thinger claim delete`](#thinger-claim-delete) | Delete a claim | | [`thinger claim clone`](#thinger-claim-clone) | Copy a claim under a new id | | [`thinger claim describe`](#thinger-claim-describe) | Fields, examples and permissions of a claim, from the server's API | ### thinger claim list List claim records ```text thinger claim list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger claim get Show a claim as JSON ```text thinger claim get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `claim` | Yes | ID of the claim | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger claim create Create a claim from --from and --set ```text thinger claim create [options] [claim] ``` | Argument | Required | Description | | --- | --- | --- | | `claim` | No | ID of the claim | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger claim update Update fields of a claim (fields left out are kept) ```text thinger claim update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `claim` | Yes | ID of the claim | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger claim delete Delete a claim ```text thinger claim delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `claim` | Yes | ID of the claim | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger claim clone Copy a claim under a new id ```text thinger claim clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `claim` | Yes | ID of the claim | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger claim describe Fields, examples and permissions of a claim, from the server's API ```text thinger claim describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger property Account properties: JSON values stored on the account ```text thinger property [options] [command] ``` | Command | Description | | --- | --- | | [`thinger property list`](#thinger-property-list) | List property records | | [`thinger property get`](#thinger-property-get) | Show a property as JSON | | [`thinger property create`](#thinger-property-create) | Create a property from --from and --set | | [`thinger property update`](#thinger-property-update) | Update fields of a property (fields left out are kept) | | [`thinger property delete`](#thinger-property-delete) | Delete a property | | [`thinger property clone`](#thinger-property-clone) | Copy a property under a new id | | [`thinger property set`](#thinger-property-set) | Set the value of a property (created when missing) | | [`thinger property describe`](#thinger-property-describe) | Fields, examples and permissions of a property, from the server's API | ### thinger property list List property records ```text thinger property list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger property get Show a property as JSON ```text thinger property get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `property` | Yes | ID of the property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger property create Create a property from --from and --set ```text thinger property create [options] [property] ``` | Argument | Required | Description | | --- | --- | --- | | `property` | No | ID of the property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger property update Update fields of a property (fields left out are kept) ```text thinger property update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `property` | Yes | ID of the property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger property delete Delete a property ```text thinger property delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `property` | Yes | ID of the property | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger property clone Copy a property under a new id ```text thinger property clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `property` | Yes | ID of the property | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger property set Set the value of a property (created when missing) ```text thinger property set [options] ``` | Argument | Required | Description | | --- | --- | --- | | `property` | Yes | ID of the property | | `value` | Yes | Value, parsed as JSON (text when it is not JSON) | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger property describe Fields, examples and permissions of a property, from the server's API ```text thinger property describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger role Roles: named permission sets for project members ```text thinger role [options] [command] ``` | Command | Description | | --- | --- | | [`thinger role list`](#thinger-role-list) | List role records | | [`thinger role get`](#thinger-role-get) | Show a role as JSON | | [`thinger role create`](#thinger-role-create) | Create a role from --from and --set | | [`thinger role update`](#thinger-role-update) | Update fields of a role (fields left out are kept) | | [`thinger role delete`](#thinger-role-delete) | Delete a role | | [`thinger role clone`](#thinger-role-clone) | Copy a role under a new id | | [`thinger role describe`](#thinger-role-describe) | Fields, examples and permissions of a role, from the server's API | ### thinger role list List role records ```text thinger role list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger role get Show a role as JSON ```text thinger role get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `role` | Yes | ID of the role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger role create Create a role from --from and --set ```text thinger role create [options] [role] ``` | Argument | Required | Description | | --- | --- | --- | | `role` | No | ID of the role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger role update Update fields of a role (fields left out are kept) ```text thinger role update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `role` | Yes | ID of the role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger role delete Delete a role ```text thinger role delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `role` | Yes | ID of the role | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger role clone Copy a role under a new id ```text thinger role clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `role` | Yes | ID of the role | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger role describe Fields, examples and permissions of a role, from the server's API ```text thinger role describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger sync Syncs: shared semaphores with a number of slots that devices or scripts take (locks) to coordinate ```text thinger sync [options] [command] ``` | Command | Description | | --- | --- | | [`thinger sync list`](#thinger-sync-list) | List sync records | | [`thinger sync get`](#thinger-sync-get) | Show a sync as JSON | | [`thinger sync create`](#thinger-sync-create) | Create a sync from --from and --set | | [`thinger sync update`](#thinger-sync-update) | Update fields of a sync (fields left out are kept) | | [`thinger sync delete`](#thinger-sync-delete) | Delete a sync | | [`thinger sync clone`](#thinger-sync-clone) | Copy a sync under a new id | | [`thinger sync describe`](#thinger-sync-describe) | Fields, examples and permissions of a sync, from the server's API | | [`thinger sync lock`](#thinger-sync-lock) | Locks of a sync: slots currently taken | ### thinger sync list List sync records ```text thinger sync list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger sync get Show a sync as JSON ```text thinger sync get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger sync create Create a sync from --from and --set ```text thinger sync create [options] [sync] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | No | ID of the sync | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger sync update Update fields of a sync (fields left out are kept) ```text thinger sync update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--projects ` | Projects it belongs to, comma-separated "<owner>@<project>" | ### thinger sync delete Delete a sync ```text thinger sync delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger sync clone Copy a sync under a new id ```text thinger sync clone [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | `new-id` | Yes | ID of the copy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger sync describe Fields, examples and permissions of a sync, from the server's API ```text thinger sync describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger sync lock Locks of a sync: slots currently taken ```text thinger sync lock [options] [command] ``` | Command | Description | | --- | --- | | [`thinger sync lock list`](#thinger-sync-lock-list) | List sync lock records | | [`thinger sync lock get`](#thinger-sync-lock-get) | Show a sync lock as JSON | | [`thinger sync lock create`](#thinger-sync-lock-create) | Create a sync lock from --from and --set | | [`thinger sync lock update`](#thinger-sync-lock-update) | Update fields of a sync lock (fields left out are kept) | | [`thinger sync lock delete`](#thinger-sync-lock-delete) | Delete a sync lock | | [`thinger sync lock describe`](#thinger-sync-lock-describe) | Fields, examples and permissions of a sync lock, from the server's API | ### thinger sync lock list List sync lock records ```text thinger sync lock list [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger sync lock get Show a sync lock as JSON ```text thinger sync lock get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | `lock` | Yes | ID of the sync lock | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger sync lock create Create a sync lock from --from and --set ```text thinger sync lock create [options] [lock] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | `lock` | No | ID of the sync lock | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger sync lock update Update fields of a sync lock (fields left out are kept) ```text thinger sync lock update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | `lock` | Yes | ID of the sync lock | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger sync lock delete Delete a sync lock ```text thinger sync lock delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `sync` | Yes | ID of the sync | | `lock` | Yes | ID of the sync lock | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger sync lock describe Fields, examples and permissions of a sync lock, from the server's API ```text thinger sync lock describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger admin Server administration (admin accounts): users, hosts, domains, brands… ```text thinger admin [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin user`](#thinger-admin-user) | User accounts of the server | | [`thinger admin host`](#thinger-admin-host) | Hosts of the server cluster | | [`thinger admin domain`](#thinger-admin-domain) | Custom domains the server answers on | | [`thinger admin brand`](#thinger-admin-brand) | Brands: the look (and email) of the console on a domain | | [`thinger admin oauth-client`](#thinger-admin-oauth-client) | OAuth clients: applications allowed to sign users in against this server | | [`thinger admin identity-provider`](#thinger-admin-identity-provider) | Identity providers: external sign-in (OpenID Connect, OAuth) for the console | | [`thinger admin proxy`](#thinger-admin-proxy) | Proxies: services the server exposes through its own address | ### thinger admin user User accounts of the server ```text thinger admin user [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin user list`](#thinger-admin-user-list) | List user records | | [`thinger admin user get`](#thinger-admin-user-get) | Show an user as JSON | | [`thinger admin user create`](#thinger-admin-user-create) | Create an user from --from and --set | | [`thinger admin user update`](#thinger-admin-user-update) | Update fields of an user (fields left out are kept) | | [`thinger admin user delete`](#thinger-admin-user-delete) | Delete an user | | [`thinger admin user describe`](#thinger-admin-user-describe) | Fields, examples and permissions of an user, from the server's API | ### thinger admin user list List user records ```text thinger admin user list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger admin user get Show an user as JSON ```text thinger admin user get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `user` | Yes | ID of the user | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger admin user create Create an user from --from and --set ```text thinger admin user create [options] [user] ``` | Argument | Required | Description | | --- | --- | --- | | `user` | No | ID of the user | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin user update Update fields of an user (fields left out are kept) ```text thinger admin user update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `user` | Yes | ID of the user | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin user delete Delete an user ```text thinger admin user delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `user` | Yes | ID of the user | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger admin user describe Fields, examples and permissions of an user, from the server's API ```text thinger admin user describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger admin host Hosts of the server cluster ```text thinger admin host [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin host list`](#thinger-admin-host-list) | List host records | | [`thinger admin host get`](#thinger-admin-host-get) | Show a host as JSON | | [`thinger admin host create`](#thinger-admin-host-create) | Create a host from --from and --set | | [`thinger admin host update`](#thinger-admin-host-update) | Update fields of a host (fields left out are kept) | | [`thinger admin host delete`](#thinger-admin-host-delete) | Delete a host | | [`thinger admin host describe`](#thinger-admin-host-describe) | Fields, examples and permissions of a host, from the server's API | | [`thinger admin host logs`](#thinger-admin-host-logs) | The last lines of the host log, as text. query: {lines: 200, timestamps: true, since: …}. Reads the server container named in deployment.container_name (default "thinger"): not found means it has another name | | [`thinger admin host restart`](#thinger-admin-host-restart) | Restart the host: its devices and users lose the connection meanwhile | | [`thinger admin host get-settings`](#thinger-admin-host-get-settings) | Read the host settings | | [`thinger admin host update-settings`](#thinger-admin-host-update-settings) | Patch the host settings with the body (JSON merge: keys left out stay, null removes one); read them first | ### thinger admin host list List host records ```text thinger admin host list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger admin host get Show a host as JSON ```text thinger admin host get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | Yes | ID of the host | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger admin host create Create a host from --from and --set ```text thinger admin host create [options] [host] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | No | ID of the host | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin host update Update fields of a host (fields left out are kept) ```text thinger admin host update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | Yes | ID of the host | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin host delete Delete a host ```text thinger admin host delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | Yes | ID of the host | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger admin host describe Fields, examples and permissions of a host, from the server's API ```text thinger admin host describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger admin host logs The last lines of the host log, as text. query: {lines: 200, timestamps: true, since: …}. Reads the server container named in deployment.container_name (default "thinger"): not found means it has another name ```text thinger admin host logs [options] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | Yes | ID of the host | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | ### thinger admin host restart Restart the host: its devices and users lose the connection meanwhile ```text thinger admin host restart [options] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | Yes | ID of the host | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-y, --yes` | Do not ask for confirmation | ### thinger admin host get-settings Read the host settings ```text thinger admin host get-settings [options] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | Yes | ID of the host | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | ### thinger admin host update-settings Patch the host settings with the body (JSON merge: keys left out stay, null removes one); read them first ```text thinger admin host update-settings [options] ``` | Argument | Required | Description | | --- | --- | --- | | `host` | Yes | ID of the host | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin domain Custom domains the server answers on ```text thinger admin domain [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin domain list`](#thinger-admin-domain-list) | List domain records | | [`thinger admin domain get`](#thinger-admin-domain-get) | Show a domain as JSON | | [`thinger admin domain create`](#thinger-admin-domain-create) | Create a domain from --from and --set | | [`thinger admin domain update`](#thinger-admin-domain-update) | Update fields of a domain (fields left out are kept) | | [`thinger admin domain delete`](#thinger-admin-domain-delete) | Delete a domain | | [`thinger admin domain describe`](#thinger-admin-domain-describe) | Fields, examples and permissions of a domain, from the server's API | | [`thinger admin domain verify`](#thinger-admin-domain-verify) | Check that the domain resolves to this server (after the user configures its DNS) | ### thinger admin domain list List domain records ```text thinger admin domain list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger admin domain get Show a domain as JSON ```text thinger admin domain get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `domain` | Yes | ID of the domain | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger admin domain create Create a domain from --from and --set ```text thinger admin domain create [options] [domain] ``` | Argument | Required | Description | | --- | --- | --- | | `domain` | No | ID of the domain | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin domain update Update fields of a domain (fields left out are kept) ```text thinger admin domain update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `domain` | Yes | ID of the domain | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin domain delete Delete a domain ```text thinger admin domain delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `domain` | Yes | ID of the domain | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger admin domain describe Fields, examples and permissions of a domain, from the server's API ```text thinger admin domain describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger admin domain verify Check that the domain resolves to this server (after the user configures its DNS) ```text thinger admin domain verify [options] ``` | Argument | Required | Description | | --- | --- | --- | | `domain` | Yes | ID of the domain | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin brand Brands: the look (and email) of the console on a domain ```text thinger admin brand [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin brand list`](#thinger-admin-brand-list) | List brand records | | [`thinger admin brand get`](#thinger-admin-brand-get) | Show a brand as JSON | | [`thinger admin brand create`](#thinger-admin-brand-create) | Create a brand from --from and --set | | [`thinger admin brand update`](#thinger-admin-brand-update) | Update fields of a brand (fields left out are kept) | | [`thinger admin brand delete`](#thinger-admin-brand-delete) | Delete a brand | | [`thinger admin brand describe`](#thinger-admin-brand-describe) | Fields, examples and permissions of a brand, from the server's API | | [`thinger admin brand test-email`](#thinger-admin-brand-test-email) | Send a test email with the brand's email settings | ### thinger admin brand list List brand records ```text thinger admin brand list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger admin brand get Show a brand as JSON ```text thinger admin brand get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `brand` | Yes | ID of the brand | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger admin brand create Create a brand from --from and --set ```text thinger admin brand create [options] [brand] ``` | Argument | Required | Description | | --- | --- | --- | | `brand` | No | ID of the brand | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin brand update Update fields of a brand (fields left out are kept) ```text thinger admin brand update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `brand` | Yes | ID of the brand | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `--merge` | Patch the value (JSON merge) instead of replacing it | ### thinger admin brand delete Delete a brand ```text thinger admin brand delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `brand` | Yes | ID of the brand | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger admin brand describe Fields, examples and permissions of a brand, from the server's API ```text thinger admin brand describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger admin brand test-email Send a test email with the brand's email settings ```text thinger admin brand test-email [options] ``` | Argument | Required | Description | | --- | --- | --- | | `brand` | Yes | ID of the brand | | Option | Description | | --- | --- | | `-q, --query ` | Query parameter (repeatable) | | `-f, --field ` | Print only this field of the answer (dot path) | | `-o, --output ` | Write the answer to a file | | `-j, --json` | Output as JSON | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin oauth-client OAuth clients: applications allowed to sign users in against this server ```text thinger admin oauth-client [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin oauth-client list`](#thinger-admin-oauth-client-list) | List oauth-client records | | [`thinger admin oauth-client get`](#thinger-admin-oauth-client-get) | Show an oauth-client as JSON | | [`thinger admin oauth-client create`](#thinger-admin-oauth-client-create) | Create an oauth-client from --from and --set | | [`thinger admin oauth-client update`](#thinger-admin-oauth-client-update) | Update fields of an oauth-client (fields left out are kept) | | [`thinger admin oauth-client delete`](#thinger-admin-oauth-client-delete) | Delete an oauth-client | | [`thinger admin oauth-client describe`](#thinger-admin-oauth-client-describe) | Fields, examples and permissions of an oauth-client, from the server's API | ### thinger admin oauth-client list List oauth-client records ```text thinger admin oauth-client list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger admin oauth-client get Show an oauth-client as JSON ```text thinger admin oauth-client get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `oauth-client` | Yes | ID of the oauth client | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger admin oauth-client create Create an oauth-client from --from and --set ```text thinger admin oauth-client create [options] [oauth-client] ``` | Argument | Required | Description | | --- | --- | --- | | `oauth-client` | No | ID of the oauth client | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin oauth-client update Update fields of an oauth-client (fields left out are kept) ```text thinger admin oauth-client update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `oauth-client` | Yes | ID of the oauth client | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin oauth-client delete Delete an oauth-client ```text thinger admin oauth-client delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `oauth-client` | Yes | ID of the oauth client | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger admin oauth-client describe Fields, examples and permissions of an oauth-client, from the server's API ```text thinger admin oauth-client describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger admin identity-provider Identity providers: external sign-in (OpenID Connect, OAuth) for the console ```text thinger admin identity-provider [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin identity-provider list`](#thinger-admin-identity-provider-list) | List identity-provider records | | [`thinger admin identity-provider get`](#thinger-admin-identity-provider-get) | Show an identity-provider as JSON | | [`thinger admin identity-provider create`](#thinger-admin-identity-provider-create) | Create an identity-provider from --from and --set | | [`thinger admin identity-provider update`](#thinger-admin-identity-provider-update) | Update fields of an identity-provider (fields left out are kept) | | [`thinger admin identity-provider delete`](#thinger-admin-identity-provider-delete) | Delete an identity-provider | | [`thinger admin identity-provider describe`](#thinger-admin-identity-provider-describe) | Fields, examples and permissions of an identity-provider, from the server's API | ### thinger admin identity-provider list List identity-provider records ```text thinger admin identity-provider list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger admin identity-provider get Show an identity-provider as JSON ```text thinger admin identity-provider get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `identity-provider` | Yes | ID of the identity provider | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger admin identity-provider create Create an identity-provider from --from and --set ```text thinger admin identity-provider create [options] [identity-provider] ``` | Argument | Required | Description | | --- | --- | --- | | `identity-provider` | No | ID of the identity provider | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin identity-provider update Update fields of an identity-provider (fields left out are kept) ```text thinger admin identity-provider update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `identity-provider` | Yes | ID of the identity provider | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin identity-provider delete Delete an identity-provider ```text thinger admin identity-provider delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `identity-provider` | Yes | ID of the identity provider | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger admin identity-provider describe Fields, examples and permissions of an identity-provider, from the server's API ```text thinger admin identity-provider describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger admin proxy Proxies: services the server exposes through its own address ```text thinger admin proxy [options] [command] ``` | Command | Description | | --- | --- | | [`thinger admin proxy list`](#thinger-admin-proxy-list) | List proxy records | | [`thinger admin proxy get`](#thinger-admin-proxy-get) | Show a proxy as JSON | | [`thinger admin proxy create`](#thinger-admin-proxy-create) | Create a proxy from --from and --set | | [`thinger admin proxy update`](#thinger-admin-proxy-update) | Update fields of a proxy (fields left out are kept) | | [`thinger admin proxy delete`](#thinger-admin-proxy-delete) | Delete a proxy | | [`thinger admin proxy describe`](#thinger-admin-proxy-describe) | Fields, examples and permissions of a proxy, from the server's API | ### thinger admin proxy list List proxy records ```text thinger admin proxy list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `--search ` | Text to look for in ids and names | | `--filter ` | Filter (repeatable): product, type, asset_type, asset_group, project, labels, or a field of the records | | `--count ` | Page size (default: all) | | `--index ` | Offset of the first record | ### thinger admin proxy get Show a proxy as JSON ```text thinger admin proxy get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `proxy` | Yes | ID of the proxy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-f, --field ` | Print only this field (dot path, e.g. config.source) | | `-o, --output ` | Write the JSON to a file | ### thinger admin proxy create Create a proxy from --from and --set ```text thinger admin proxy create [options] [proxy] ``` | Argument | Required | Description | | --- | --- | --- | | `proxy` | No | ID of the proxy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin proxy update Update fields of a proxy (fields left out are kept) ```text thinger admin proxy update [options] ``` | Argument | Required | Description | | --- | --- | --- | | `proxy` | Yes | ID of the proxy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-n, --name ` | Name (over --from and --set) | | `-d, --description ` | Description (over --from and --set) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | ### thinger admin proxy delete Delete a proxy ```text thinger admin proxy delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `proxy` | Yes | ID of the proxy | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | | `-y, --yes` | Do not ask for confirmation | ### thinger admin proxy describe Fields, examples and permissions of a proxy, from the server's API ```text thinger admin proxy describe [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger login Sign in: re-authenticate the current profile, or create the first one. Use `profile add` for more servers. ```text thinger login [options] ``` | Option | Description | | --- | --- | | `--server ` | Server host (or URL for http / custom ports) | | `--username ` | Account username | | `--token ` | Existing API token (non-interactive login with --server and --username) | | `--oauth` | Sign in through the browser (OAuth device flow) | | `--client-id ` | OAuth client id registered on the server | ## thinger logout Forget the current profile (or --all) and revoke the API token the CLI created ```text thinger logout [options] ``` | Option | Description | | --- | --- | | `--all` | Forget every profile | | `--keep-token` | Do not revoke the API token on the server | ## thinger profile Manage configuration profiles ```text thinger profile [options] [command] ``` | Command | Description | | --- | --- | | [`thinger profile list`](#thinger-profile-list) | List configured profiles | | [`thinger profile current`](#thinger-profile-current) | Print the active profile | | [`thinger profile use`](#thinger-profile-use) | Set the default profile | | [`thinger profile add`](#thinger-profile-add) | Add a profile for another server (interactive, or with --server/--username/--token) | | [`thinger profile delete`](#thinger-profile-delete) | Remove a profile | ### thinger profile list List configured profiles ```text thinger profile list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger profile current Print the active profile ```text thinger profile current [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger profile use Set the default profile ```text thinger profile use [options] ``` | Argument | Required | Description | | --- | --- | --- | | `name` | Yes | Profile name | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger profile add Add a profile for another server (interactive, or with --server/--username/--token) ```text thinger profile add [options] [name] ``` | Argument | Required | Description | | --- | --- | --- | | `name` | No | Profile name (asked when missing) | | Option | Description | | --- | --- | | `--no-activate` | Do not set the new profile as default | | `--server ` | Server host (or URL for http / custom ports) | | `--username ` | Account username | | `--token ` | Existing API token (non-interactive with --server and --username) | | `--oauth` | Sign in through the browser (OAuth device flow) | | `--client-id ` | OAuth client id registered on the server | | `-j, --json` | Output as JSON | ### thinger profile delete Remove a profile ```text thinger profile delete [options] ``` | Argument | Required | Description | | --- | --- | --- | | `name` | Yes | Profile name | | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ## thinger api Send a request to the server API (anything the commands do not cover) ```text thinger api [options] ``` | Argument | Required | Description | | --- | --- | --- | | `path` | Yes | API path, e.g. /v1/users/{user}/devices ({user}: your account) | | Option | Description | | --- | --- | | `-X, --method ` | GET, POST, PUT, PATCH or DELETE (default: GET, or POST with a body) | | `--from ` | JSON body from a file, or - for stdin | | `-s, --set ` | Body field (repeatable; values parsed as JSON when they are; dots nest: data.source=resource) | | `-q, --query ` | Query parameter (repeatable) | | `-o, --output ` | Write the answer to a file (downloads, binary answers) | | `-j, --json` | Output as JSON ({ ok, data }) | ## thinger doc Guides for agents and app developers: the platform, product code, the dashboard SDK, this CLI ```text thinger doc [options] [command] ``` | Command | Description | | --- | --- | | [`thinger doc list`](#thinger-doc-list) | List the guides: the platform, product code, the dashboard SDK, this CLI | | [`thinger doc get`](#thinger-doc-get) | Print a guide (Markdown), whole | ### thinger doc list List the guides: the platform, product code, the dashboard SDK, this CLI ```text thinger doc list [options] ``` | Option | Description | | --- | --- | | `-j, --json` | Output as JSON | ### thinger doc get Print a guide (Markdown), whole ```text thinger doc get [options] ``` | Argument | Required | Description | | --- | --- | --- | | `doc` | Yes | ID of the guide (doc list gives them) | | Option | Description | | --- | --- | | `-o, --output ` | Write it to a file | | `-j, --json` | Output as JSON | ## thinger mcp Start the MCP server (stdio) for AI tool integration ```text thinger mcp [options] ``` | Option | Description | | --- | --- | | `--read-only` | Serve only the tools that read: describe, list, get and the read-only actions (or set THINGER_MCP_READ_ONLY=1) | `thinger mcp` starts an MCP server over standard input and output with the session of the active profile, so an AI client can work with your account. Sign in first with `thinger login`. To register it in Claude Code for all your projects: ```bash claude mcp add --scope user thinger -- thinger mcp ``` `thinger mcp --read-only` (or `THINGER_MCP_READ_ONLY=1`) serves only the tools and actions that read, to let an agent explore an account without changing anything. Other MCP clients take the same command: `thinger` with the argument `mcp`. How to set up each client (Claude Desktop, VS Code, Cursor and others) is in [Connect an AI agent](https://docs.thinger.io/ai/connect.md), and the tools the server offers are listed in [MCP tools](https://docs.thinger.io/ai/tools.md). > **Tip: Without installing the CLI** > > `npx -y @thinger-io/cli mcp` runs the server without installing the CLI, for example in Claude Code or a CI job. Desktop apps are more reliable with the installed `thinger` command: see [Connect an AI agent](https://docs.thinger.io/ai/connect.md). ## See also - [Dashboard SDK](https://docs.thinger.io/reference/dashboard-sdk.md) - [REST API](https://docs.thinger.io/reference/rest-api.md) - [MCP tools](https://docs.thinger.io/ai/tools.md) --- Source: https://docs.thinger.io/reference/cli/changelog.md # CLI changelog > Every release of the thinger CLI and its MCP server, newest first, with what each version adds, changes and fixes. Every release of the `thinger` CLI (`@thinger-io/cli` on npm), newest first, as its changelog describes it. Each release is on [GitHub](https://github.com/thinger-io/thinger-cli/releases); its commands are in the [CLI reference](https://docs.thinger.io/reference/cli.md) and its MCP tools in [MCP tools](https://docs.thinger.io/ai/tools.md). This page covers up to version **0.5.1**. ## 0.5.1 Released on 2026-10-31. #### Changed - `thinger login` offers the browser login (OAuth device flow) first, with the _Thinger CLI_ OAuth client that Thinger 7.5.0 and later create on every install. On an older server it says the client is missing and offers username and password or a token. #### Fixed - From `@thinger-io/cli-core` 0.5.1: `admin host update-settings` is described as the merge the server does, and its confirmation shows what changes and what a `null` removes. - Requires `@thinger-io/cli-core` 0.5.1. ## 0.5.0 Released on 2026-10-31. Every command follows one grammar, noun first: `thinger […] […] [] [options]`. Nouns nest under their parent (`device property`, `product profile api`), ids are positional and named after their noun, and the options keep one meaning everywhere (`-j` JSON, `-s` a body field, `-f` one field of the answer, `-o` a file, `-y` no questions). A few commands of 0.3 change form: see the table below. The old forms are gone, not aliased. The MCP server serves eight tools instead of 25: `thinger_resource_*` reach everything by `type`, and records are addressed with `ids`. The old tool names and the `parent`/`id` arguments are gone, not aliased: see the second table below. #### Added - Commands for every resource type the MCP server reaches, generated from the same catalog: `list|get|create|update|delete|clone|describe` and the type's actions (`thinger endpoint call`, `thinger alarm rule test`, `thinger admin host restart`…), with bodies from `--from` and `-s key=value`, `-n`/`-d` for the name and description, and `set ` on every kind of property. Endpoints, tokens, alarms, storages, projects, assets, syncs, claims, plugins, product profiles, properties and the server administration are now reachable from the command line and from CI. - `thinger api `: any request to the server, as `gh api` does. - Commands over the operations that are not CRUD: `thinger bucket write|export`, `thinger storage file list|upload|download|delete`, `thinger device send|overview`, `thinger device resource list|call`, `thinger product apply --from`, `thinger product profile api call` and `thinger plugin call`. `product export` and `product apply` keep a product in a repository and deploy it. - `device list`, `product list` and `bucket list` take `--search`, `--filter`, `--count` and `--index`; `device create` and `product create` take `--from`, `-s` and `--projects`; `get` takes `-f `. - `thinger doc list` and `thinger doc get `: the guides for agents from the command line. - MCP: `resource_describe` shows each type's ids, actions, the permission each operation needs and ready-to-send examples; actions that change a lot at once (`replace_all`, a host's settings or restart, removing a plugin) answer a plan and run with `confirm: true` (or ask through the client when it supports it); `thinger mcp --read-only` (or `THINGER_MCP_READ_ONLY=1`) serves only what reads. #### Changed (breaking) | 0.3 | 0.4 | | ------------------------------------------------ | ----------------------------------------------------------- | | `thinger device list ` | `thinger device list --search ` | | `thinger device info ` | `thinger device get ` | | `thinger device property ` | `thinger device property list ` | | `thinger device property ` | `thinger device property get ` | | `thinger device property-set

` | `thinger device property set ` | | `thinger device resource ` | `thinger device resource list ` | | `thinger device resource -i k=v` | `thinger device resource call -s k=v` | | `thinger product info ` | `thinger product get ` | | `thinger product property-list ` | `thinger product property list ` | | `thinger product property-get

` | `thinger product property get ` | | `thinger product property-set

` | `thinger product property set ` | | `thinger product property-delete

` | `thinger product property delete -y` | - `device property get` and `product property get` print the property record, with its value under `value`: `-f` paths start there (`-f value.setpoint` where 0.3 took `-f setpoint`). `device property list` and `product property list` print the records (`-j`: the records, not `{ product, properties: [names] }`). `product property delete` asks unless `-y`. `device resource call` takes its input from `--from` and `-s` (`-i` is gone); `-s` values are parsed as JSON, as before. - The root help groups the commands as Resources, Administration, Configuration and Integration. - The MCP tools (the commands keep their forms and `-j` outputs; the help names some positionals as the server does: `asset type get `, `asset group get `, `alarm rule get `, `alarm instance get `, `product profile get `): | 0.3 tool | 0.4 call | | ------------------------------------------------ | ----------------------------------------------------------------------------------------- | | `thinger_resource_* parent "d1" id "p1"` | `thinger_resource_* ids {"device": "d1", "property": "p1"}` | | `thinger_bucket_data_read` | `thinger_resource_list type "bucket_data" ids {bucket}` (`filter` for the query) | | `thinger_bucket_data_write` | `thinger_resource_create type "bucket_data" ids {bucket} body ` | | `thinger_storage_file_list` | `thinger_resource_list type "storage_file" ids {storage} filter {path}` | | `thinger_storage_file_read` | `thinger_resource_get type "storage_file" ids {storage, file}` | | `thinger_storage_file_write` | `thinger_resource_create type "storage_file" ids {storage, file} body {content or local}` | | `thinger_storage_file_delete` | `thinger_resource_delete type "storage_file" ids {storage, file}` | | `thinger_device_resource_list` | `thinger_resource_list type "device_resource" ids {device}` | | `thinger_device_resource_call` | `thinger_resource_call type "device_resource" action "call" ids {device, resource}` | | `thinger_device_data_send` | `thinger_resource_call type "device" action "send" ids {device} body ` | | `thinger_device_overview` | `thinger_resource_call type "device" action "overview"` | | `thinger_product_resource_call` | `thinger_resource_call type "product_profile_api" action "call" ids {product, resource}` | | `thinger_plugin_call` | `thinger_resource_call type "plugin" action "call" ids {plugin} body {path, method}` | | `thinger_doc_read` | `thinger_resource_get type "doc" ids {doc}` (`thinger_resource_list type "doc"` lists) | | `thinger_profile_list` | `thinger_resource_list type "profile"` | | `thinger_dashboard_init` / `_dev` / `_publish` | `thinger_resource_call type "dashboard" action "init"` / `"dev"` / `"publish"` | - Requires `@thinger-io/cli-core` 0.5.0. From this release the CLI's minor version follows the core's (0.5.x runs on cli-core 0.5.x), so there is no 0.4.0. #### Fixed - Tokens created with an expiry such as "30d" (`thinger_resource_create`) were refused by the server: it takes milliseconds. ## 0.3.0 Released on 2026-10-16. #### Added - `thinger dashboard dev [url]`: develop a dashboard app on its own dev server (ng serve, Vite…) against a real server: a link with a temporary token opens the local app as a standalone page whose SDK calls the server directly. - `thinger dashboard publish [dir]`: upload the build to a public storage and point dashboards at it (`--to`, repeatable; `--prune`, `--bump`, `--preview`, `--no-point`). Both read their settings from `thinger.json`. - `thinger dashboard init

`: a new dashboard app from a template of `@thinger-io/dashboard-sdk` (React or Angular, TypeScript), with its `thinger.json` and an `AGENTS.md`; `--ci` adds a GitHub workflow. - Publish and dev warn when the app's SDK needs a newer server, a newer SDK is on npm, or a page loads the deprecated script build. - MCP tools `thinger_dashboard_init` and `thinger_dashboard_dev` (25 tools): the same for agents, which open the dev link with their browser tools. - `THINGER_TOKEN` (an access token) and `THINGER_SERVER` replace the saved profile in every command and the MCP server (CI), unless `--profile` or `THINGER_PROFILE` names one; `thinger login` warns while `THINGER_TOKEN` is set. #### Changed - Requires `@thinger-io/cli-core` 0.4.0. - The guides for agents (`thinger_doc_read`: concepts, product code, server administration, the dashboard SDK reference and types) ship with the CLI and the SDK package instead of coming from the server, which stops serving `/sdk/`. Same ids; what needs a newer server says "since Thinger X". - Preview links no longer come with a layout check link: the server retires `/sdk/preview.html`. ## 0.2.3 Released on 2026-10-14. #### Changed - `@thinger-io/cli-core` 0.3.0: `thinger_resource_call` gains the `alarm_instance` action `stats` (how many instances there are in each state); actions check their parent and id; `resource_list` pages lists answered whole from any `index`. The tools are the same 23. ## 0.2.2 Released on 2026-10-12. #### Changed - First release of `@thinger-io/cli` from GitHub Actions (Trusted Publishing, with provenance); 0.2.1 was published by hand to create the package. ## 0.2.1 Released on 2026-10-12. #### Changed - Published as `@thinger-io/cli` (formerly `@thinger-io/thinger-cli`, now deprecated). The command is still `thinger` and profiles stay in `~/.config/thinger-cli`. ## 0.2.0 Released on 2026-10-10. #### Changed - Requires `@thinger-io/cli-core` 0.2.0: the MCP server goes from 48 tools to 23 (`thinger_resource_*` over a catalog of resource types, plus the operations that are not CRUD), less than half the size in `tools/list`. Tool names change: `thinger_devices` → `thinger_resource_list` with `type: "device"`, `thinger_profiles` → `thinger_profile_list`, `thinger_bucket_read` → `thinger_bucket_data_read`, and so on. - MCP instructions rewritten for the new tools. ## 0.1.1 Released on 2026-10-10. #### Changed - Requires `@thinger-io/cli-core` 0.1.1. First release published from GitHub Actions through Trusted Publishing. ## 0.1.0 Released on 2026-10-10. First version: the `thinger` CLI, built on [@thinger-io/cli-core](https://github.com/thinger-io/thinger-cli-core) (the generic core of ThinRemote's `thinr`, made independent of the product). #### Added - Thinger identity: profiles in `~/.config/thinger-cli`, `THINGER_PROFILE` / `THINGER_INSECURE`, MCP tools as `thinger_*`. - `login` with username/password (mints the `thinger_cli` API token), an existing token (non-interactive with `--server --username --token`) or the OAuth device flow with a client registered on the server. - `logout` forgets the current profile (or `--all`) and revokes the API token the CLI created. - Commands: `device` (list, info, create, delete, set-product, property, property-set, resource), `product` (list, info, create, delete, property-list, property-get, property-set, property-delete), `bucket` (list, read), `profile`. - `thinger mcp`: devices, resources, properties, products, product profiles, buckets, tokens, alarms and profiles. --- Source: https://docs.thinger.io/reference/dashboard-sdk.md # Dashboard SDK > Every function and type of @thinger-io/dashboard-sdk, the package for dashboards built as web apps, plus how to start, publish and share them. `@thinger-io/dashboard-sdk` is the package for dashboards built as web apps (React, Angular, Vue or plain TypeScript). The app runs inside a dashboard of the console with the session of the person viewing it, or on its own with a link that carries a token. The function reference on this page is generated from the type declarations of the package. | Package | Installed from | Version | Source code | | --- | --- | --- | --- | | [`@thinger-io/dashboard-sdk`](https://www.npmjs.com/package/@thinger-io/dashboard-sdk) | npm | `0.3.1` | [thinger-io/dashboard-sdk](https://github.com/thinger-io/dashboard-sdk) | - **Install:** [Get started](#get-started), on this page. To build and publish a first app step by step, follow [Build a dashboard app](https://docs.thinger.io/guides/dashboard-app.md). - **Changelog:** [Dashboard SDK changelog](https://docs.thinger.io/reference/dashboard-sdk/changelog.md): every release, with what it adds, changes and fixes. The oldest server the SDK supports is Thinger.io 7.4, and every function of this version works on it. > **Info: Versions 0.x** > > While the SDK is in 0.x versions, its contract with the console can still change between minor versions. Check the [changelog](https://docs.thinger.io/reference/dashboard-sdk/changelog.md) before you upgrade. ## Get started Create a project from a template of the SDK with the [CLI](https://docs.thinger.io/reference/cli.md#thinger-dashboard), or add the package to an existing app: ```bash npm install @thinger-io/dashboard-sdk ``` The package exports `Thinger`, a client that starts when the module is imported. Wait for `Thinger.ready()` and then call the modules: ```ts import { Thinger, type BucketRecord } from '@thinger-io/dashboard-sdk'; await Thinger.ready(); // Devices of the account, or of the project the dashboard runs in const devices = await Thinger.devices.list(); console.log(devices.map((device) => device.device)); // The last 6 hours of a Data Bucket, kept current as new data arrives const stop = Thinger.buckets.subscribe('climate', { from: '6h', items: 500 }, (data, err) => { if (err) return console.error(err); const records: BucketRecord[] = data ?? []; console.log(records.length); }); // Stop the live updates when the view goes away stop(); ``` `climate` stands for the ID of one of your Data Buckets. `ready()` rejects with `code: 'no-session'` when the page is opened outside the console without a standalone link. ## Inside the console A dashboard of the console can show your app instead of widgets. The console loads it in a sandboxed frame and hands it the session of the person viewing it: the app never handles credentials, and API calls run with that person's permissions and in their current project. Build the app with these rules: - Use hash routing (`#/devices`). The console keeps the route in its own URL, so reloading or sharing the console link reopens the same screen. - Use relative asset URLs (`base: './'` in Vite) and no `` tag. - Reload with `Thinger.reload()`, not `location.reload()`: a plain reload gets no session. - Do not use `localStorage`, `sessionStorage` or cookies; the frame has no storage of its own. Keep settings in [properties](#properties). - Open other screens of the console with `Thinger.navigate()`. - The app fills the content area of the console and scrolls inside it: design for that height instead of a fixed one. - Files of a private file storage need `Thinger.storages.url()`; a plain `` to them fails. - People who open a shared dashboard may lack some permissions: handle `status: 403` errors. ## Publish an app The console loads the app from a file storage of your account: 1. Upload the build folder to a **public** file storage with `index.html` as its index. The frame cannot send an authorization header when it loads files, so a private storage does not work. 2. Point the dashboard at the storage folder, **with the trailing slash**: `/v1/users/YOUR_USER/storages//files/`. Without the slash the server answers with the file list. 3. For per-device or per-product dashboards, set the same source on the `dashboard` property of that device or product. `thinger dashboard publish` does the three steps from the build folder; see the [CLI reference](https://docs.thinger.io/reference/cli.md#thinger-dashboard-publish). Publishing again replaces the files; with `--bump`, consoles that have the app open reload it at once. ## Standalone links An app published to a public storage also works outside the console, for example embedded in another website. Pass the session in the fragment of the URL: ```text https://YOUR_SERVER/v1/users/YOUR_USER/storages//files/#/&thinger_token=YOUR_TOKEN&thinger_project= ``` | Parameter | Content | |---|---| | `thinger_token` | Required. An access token (JWT); the SDK takes the user from it. Here `YOUR_TOKEN` is an access token of your account. | | `thinger_api` | Server address, URL-encoded, when the app is not served by the Thinger.io server: `https://host[:port]`, optionally with a path. Without it, the page's own origin. | | `thinger_project` | Project the app runs in; API calls are scoped to it. | | `thinger_device`, `thinger_product`, `thinger_type`, `thinger_group` | Fill `Thinger.context`, as a device, product, asset type or asset group dashboard would. | The fragment never reaches the server. The SDK reads the `thinger_*` parameters, removes them from the address bar and keeps them for the browser tab, so a reload keeps the session. There is no token renewal: when the token expires, calls fail with `status: 401` and the app needs a new link. `thinger dashboard publish --preview` prints such links with a read-only token. ## Permissions for a read-only token A standalone link carries a token; give it only what the app needs. For a read-only app, create the token in the project of the dashboard and allow: | Resource | Actions | |---|---| | Device | `ListDevices`, `ReadDeviceConfig`, `ReadDeviceStatus`, `ListDeviceProperties`, `ReadDeviceProperty`, `ReadDeviceBucket` | | Bucket | `ListBuckets`, `ReadBucket`, `ListBucketTags` | | Product, Type, Group, Project | `List…`, `Read…Config`, `List…Properties`, `Read…Property` of each one the app reads | | Alarm | `ListAlarmRules`, `ReadAlarmRuleConfig`, `ListAlarmInstances` | | Storage | `ReadStorageFiles`, for files of private storages | Add actions such as `AccessDeviceResources`, `SetDeviceProperty` or `UpdateAlarmInstance` only if the app calls device resources, writes properties or changes alarms. The live functions (`buckets.subscribe`, `devices.subscribeProperty`, `devices.subscribeState`, `alarms.subscribe`, `alarms.rules.subscribe` and `events.subscribe`) receive [events](https://docs.thinger.io/reference/events.md) over a WebSocket. An access token can subscribe only to the events of the [permissions table](https://docs.thinger.io/reference/events.md#permissions), each with its read permission: `ReadBucket` or `ReadDeviceBucket` for bucket writes, `ReadDeviceProperty` for property updates, `ReadDeviceConfig` for device state, and `ListAlarmInstances` or `ListAlarmRules` on all alarms for alarm events. When the server refuses a subscription, reads still work, the data does not update live, and the SDK logs a warning in the browser console. ## Errors Every call rejects with a `ThingerError`. Its `code` says why; subscriptions pass the error to their callback instead. | `code` | Meaning | Extra field | |---|---|---| | `http` | The server answered with an error status. The message reads `HTTP `. | `status` | | `unsupported` | The server is older than the function needs. | `requires`: the minimum server version | | `no-session` | No session yet: called before `ready()`, or the page was opened without one. | | | `invalid-argument` | The call itself is wrong, for example `device: true` without a context device. | | | `unexpected-response` | The server answered something the SDK cannot use. | | ```ts import { Thinger, ThingerError } from '@thinger-io/dashboard-sdk'; try { await Thinger.devices.get('YOUR_DEVICE'); } catch (err) { if (err instanceof ThingerError && err.code === 'http' && err.status === 404) { console.log('No such device'); } } ``` ## Time values Options such as `from` and `to` take a time value: | Value | Meaning | |---|---| | A number | Milliseconds since the epoch. | | A `Date` | That instant. | | `'now'` | The current time. | | `''` | That long before now. Units: `s` seconds, `m` minutes, `h` hours, `d` days, `w` weeks, `M` months (30 days), `y` years (365 days). Examples: `'30m'`, `'6h'`, `'7d'`, `'1M'`. | Units are case-sensitive (`m` is minutes, `M` is months), and combined values such as `'1h30m'` are not accepted: they fail with `code: 'invalid-argument'`. Without `from` and `to`, a query has no time bound. ## Script build > **Warning: Deprecated** > > The script build `thinger-dashboard.min.js`, which defines a global `Thinger` for pages without a bundler, is deprecated and logs a warning. Install the package from npm and `import { Thinger } from '@thinger-io/dashboard-sdk'` in every module instead; the migration notes are in the [changelog](https://docs.thinger.io/reference/dashboard-sdk/changelog.md). ## Thinger `Thinger` is the client the package exports, an instance of `ThingerClient`. Its modules are listed under [Modules](#modules). ### Thinger.version ```ts readonly version: string; ``` SDK version (semver). ### new ThingerClient ```ts constructor(options?: ClientOptions); ``` ### Thinger.apiBase ```ts get apiBase(): string; ``` Base URL of API calls ('' = the page's origin). ### Thinger.apiHost ```ts get apiHost(): string; ``` Informational: the absolute API host the console reported. ### Thinger.token ```ts get token(): string | null; ``` Viewer's access token. ### Thinger.user ```ts get user(): User | null; ``` `{ id }` of the viewer. ### Thinger.project ```ts get project(): Project | null; ``` Project the dashboard runs in; API calls are scoped to it (`?project=`). ### Thinger.context ```ts get context(): Context; ``` The resource whose `dashboard` property is shown: `{ device, product, type, group, project }`. ### Thinger.dashboard ```ts get dashboard(): DashboardRef | null; ``` `{ id, name }` of the dashboard (inside the console). ### Thinger.serverVersion ```ts get serverVersion(): string | null; ``` Server version (e.g. "7.5.0"), known after `ready()`; null when it could not be read. ### Thinger.ready ```ts ready(): Promise; ``` Resolves once the session is there: the console handshake, or the standalone link. It also waits (up to 3 s) for the server version, so `supports()` is accurate afterwards. Rejects when the page has no session at all. ### Thinger.onInit ```ts onInit(fn: (sdk: ThingerClient) => void): void; ``` Call `fn(Thinger)` on every init (and now, when already initialized). ### Thinger.supports ```ts supports(name: string): boolean; ``` Is a function available on this server? `name` is its path from `Thinger` ('devices.list', 'alarms.rules.get'). Functions that need a newer server than this one answer false; the rest true. Accurate after `ready()`; before it, or when the server version cannot be read, only unknown names answer false. ### Thinger.request ```ts request(path: string, opts?: RequestOptions): Promise; ``` API call: `fetch()` plus error handling and body parsing. `opts.body`: any JSON value, or a string, Blob, FormData or ArrayBuffer sent as is. `opts.as` forces the response type ('json', 'text', 'blob', 'arrayBuffer'); by default parsed JSON for JSON responses, text otherwise, null when empty. `opts.project: false` skips the project scoping. Throws a `ThingerError` `HTTP ` with `status`. ### Thinger.fetch ```ts fetch(path: string, options?: FetchOptions): Promise; ``` Authenticated `fetch()`: adds `Authorization: Bearer ` and, in a project, `?project=` (the server maps the URL's user to the project owner, so callers never need to know it). Inside the console, a 401 asks it for a new token and retries once. An absolute URL of another server goes out as a plain fetch: the token only travels to the Thinger server. ### Thinger.navigate ```ts navigate(target: NavigateTarget): void; ``` Navigate the console: a path or URL, or one of `{ device }`, `{ product }`, `{ project }`, `{ dashboard }`, `{ url }`. Standalone pages go to the URL themselves. ### Thinger.reload ```ts reload(): void; ``` Reload the app. Use it instead of `location.reload()`: inside the console it keeps the key of the frame load, without which the reloaded page gets no token. ## Modules | Module | Description | | --- | --- | | [`Thinger.events`](#events) | Server events (bucket writes, property updates, alarms…) over one WebSocket shared by every subscription, `/v2/users/{user}/events`. It reconnects with backoff, refreshing the token first when it has expired. | | [`Thinger.buckets`](#buckets) | Bucket data: read, write, live reads and tags. | | [`Thinger.devices`](#devices) | Devices: documents, properties, resources (read, call, poll, stream) and their events. | | [`Thinger.alarms`](#alarms) | Alarm instances: list, live list, state changes. | | [`Thinger.alarms.rules`](#alarms-rules) | Alarm rules and their executions. | | [`Thinger.resources`](#resources) | Any kind of resource, listed or read by id. | | [`Thinger.properties`](#properties) | Properties of devices, products, projects, groups and types. Also a place for the dashboard's own settings (e.g. a project or product property). | | [`Thinger.products`](#products) | Products and their API. | | [`Thinger.endpoints`](#endpoints) | Endpoints: email, webhooks, notifications… | | [`Thinger.storages`](#storages) | Files in file storages. Every call carries the viewer's token, so private storages work too. A plain `` to a private file goes without the token: use `url()`. | | [`Thinger.projects`](#projects) | Projects the viewer can open. Not scoped to the console's current project. | | [`Thinger.stats`](#stats) | Account and traffic statistics. | ## Thinger.events Server events (bucket writes, property updates, alarms…) over one WebSocket shared by every subscription, `/v2/users/{user}/events`. It reconnects with backoff, refreshing the token first when it has expired. ### events.subscribe ```ts subscribe(filter: EventFilter, cb: (event: E) => void, onReconnect?: () => void): Unsubscribe; ``` Subscribe to server events. `filter` is `{ event, ...filters }`, e.g. `{ event: 'bucket_write', bucket: 'b' }`. Events sent while the socket is down are lost: `onReconnect()` runs each time it comes back after a drop. ## Thinger.buckets Bucket data: read, write, live reads and tags. ### buckets.read ```ts read(bucketId: string, opts?: BucketQuery): Promise; ``` Records `{ ts, ...fields }`. `opts.device` reads the device-scoped view of a product bucket (a device id, or `true` for the context device): it only needs access to the device. ### buckets.write ```ts write(bucketId: string, value: unknown): Promise; ``` Write a record to a bucket (one whose data source is the API). ### buckets.tags ```ts tags(bucketId: string, opts?: { device?: string | true | null; }): Promise; tags(bucketId: string, tag: string, opts?: { device?: string | true | null; }): Promise; ``` Tags of a bucket, or the values seen for one tag (to build filters). ### buckets.subscribe ```ts subscribe(bucketId: string, cb: BucketCallback): Unsubscribe; subscribe(bucketId: string, opts: BucketSubscribeOptions, cb: BucketCallback): Unsubscribe; ``` `read(bucketId, opts)`, then the same read kept current as the bucket is written (debounced by `opts.debounceMs`, 500 ms by default). Only what a write changes is read again; `opts.refetch: true` re-runs the whole read instead. `cb(data, err, { added, reset })`. ## Thinger.devices Devices: documents, properties, resources (read, call, poll, stream) and their events. ### devices.list ```ts list(query?: DeviceQuery): Promise; ``` Devices, all pages (the API returns 50 per page). `query` filters: product, asset_type, asset_group, type, name, sort, order, labels (`{ key: value }`, or `[key]` for "has label"), limit. ### devices.get ```ts get(deviceId: string): Promise; ``` One device, with its `connection` status. ### devices.locations ```ts locations(opts?: LocationsQuery): Promise; ``` Device locations for maps. Without options: every asset with a location. `{ group }` / `{ type }` narrow it to an asset group / type; `{ connected: true }` returns only connected devices. ### devices.stats ```ts stats(deviceId: string): Promise; ``` Traffic usage of one device over the last 30 days. ### devices.listProperties ```ts listProperties(deviceId: string, query?: PropertyQuery): Promise; ``` Properties of a device, inherited ones included: those carry `source` (`type`, `group` or `product`). `query.id` accepts a pattern ('temp\*'). ### devices.getProperty ```ts getProperty(deviceId: string, propertyId: string): Promise>; ``` One property: `{ property, value, source, created, modified, … }`. ### devices.setProperty ```ts setProperty(deviceId: string, propertyId: string, value: unknown): Promise; ``` Create or update a property. ### devices.deleteProperty ```ts deleteProperty(deviceId: string, propertyId: string): Promise; ``` Remove a property (true also when it did not exist). ### devices.getResource ```ts getResource(deviceId: string, resource: string, opts?: { shadow?: boolean; }): Promise; ``` Read a device resource. `shadow: true` returns the last value saved when the device disconnected. ### devices.callResource ```ts callResource(deviceId: string, resource: string, input?: unknown): Promise; ``` Call a device resource (actuation / RPC) with `input` as its JSON body: any serializable value. Returns the device's response, or null when it sends none. ### devices.pollResource ```ts pollResource(deviceId: string, resource: string, intervalMs: number, cb: (data: T | null, err: Error | null) => void): Unsubscribe; ``` Read a resource every `intervalMs`. `cb(data, err)` per read. ### devices.subscribeProperty ```ts subscribeProperty(deviceId: string, propertyId: string, cb: (event: PropertyUpdateEvent) => void): Unsubscribe; ``` Property update events of one property. ### devices.subscribeState ```ts subscribeState(deviceId: string, cb: (event: DeviceStateEvent) => void): Unsubscribe; ``` Connection events; `event.state` is connected, disconnected, resumed, awake or asleep. ### devices.streamResource ```ts streamResource(deviceId: string, resource: string, cb: (payload: T | null, err: Error | null, frame: StreamFrame) => void): Unsubscribe; streamResource(deviceId: string, resource: string, intervalMs: number, cb: (payload: T | null, err: Error | null, frame: StreamFrame) => void): Unsubscribe; ``` The device pushes the resource every `intervalMs` (0 or omitted: when it changes), over the device's resources WebSocket. Intervals go to the device in whole seconds. Subscribers of one resource share its stream, at the GCD of their intervals. When the device is offline, `cb` gets the error and then the last known value (`frame.signal === 'shadow'`). Reconnects with backoff. ## Thinger.alarms Alarm instances: list, live list, state changes. ### alarms.STATE ```ts readonly STATE: Readonly<{ readonly NONE: 0; readonly ACTIVATED: 1; readonly ACKNOWLEDGED: 2; readonly LATCHED: 3; readonly SHELVED: 4; readonly CLEARED: 5; }>; ``` Same as `Alarms.STATE`, reachable as `Thinger.alarms.STATE`. ### alarms.SEVERITY ```ts readonly SEVERITY: Readonly<{ readonly NONE: 0; readonly LOW: 1; readonly MEDIUM: 2; readonly HIGH: 3; readonly CRITICAL: 4; }>; ``` Same as `Alarms.SEVERITY`, reachable as `Thinger.alarms.SEVERITY`. ### alarms.list ```ts list(query?: AlarmQuery): Promise; ``` Alarm instances. `query` is sent as query params: exact values, nested fields with dots, an array matching any of its values (`{ state: 1 }`, `{ 'alarm.rule': 'r1', 'origin.id': ['d1', 'd2'] }`). ### alarms.get ```ts get(instanceId: string): Promise; ``` ### alarms.stats ```ts stats(): Promise; ``` Counts per state / severity. ### alarms.subscribe ```ts subscribe(cb: (instances: AlarmInstance[] | null, err: Error | null) => void): Unsubscribe; subscribe(query: AlarmSubscribeQuery, cb: (instances: AlarmInstance[] | null, err: Error | null) => void): Unsubscribe; ``` `list(query)` now, and again (debounced by `query.debounceMs`, 500 ms by default) whenever an instance is activated, normalized, updated (acknowledge, shelve, latch, clear, annotation; from this app or anywhere else), created or deleted. `cb(instances, err)`. ### alarms.onActivate ```ts onActivate(cb: (event: ServerEvent) => void): Unsubscribe; ``` Raw alarm_instance_activate events. ### alarms.onNormalize ```ts onNormalize(cb: (event: ServerEvent) => void): Unsubscribe; ``` Raw alarm_instance_normalize events. ### alarms.onUpdate ```ts onUpdate(cb: (event: ServerEvent) => void): Unsubscribe; ``` Raw alarm_instance_update events (state, annotation… changed). ### alarms.update ```ts update(instanceId: string, body: Record): Promise; ``` Update an instance: usually its `state` (see `STATE`), with `annotation` / `reactivation`. The server validates transitions (a CLEARED alarm cannot be reactivated). The helpers below only differ in the state they set. ### alarms.acknowledge ```ts acknowledge(instanceId: string, opts?: AlarmUpdateOptions): Promise; ``` ### alarms.shelve ```ts shelve(instanceId: string, opts?: AlarmUpdateOptions): Promise; ``` Shelve (usually with a reactivation timespan). ### alarms.latch ```ts latch(instanceId: string, opts?: AlarmUpdateOptions): Promise; ``` Latch (fires again after the configured timeout). ### alarms.clear ```ts clear(instanceId: string, opts?: AlarmUpdateOptions): Promise; ``` Clear (resolve). A cleared instance cannot be reactivated. ## Thinger.alarms.rules Alarm rules and their executions. ### alarms.rules.list ```ts list(query?: Record): Promise; ``` ### alarms.rules.get ```ts get(ruleId: string): Promise; ``` ### alarms.rules.subscribe ```ts subscribe(cb: (event: ServerEvent) => void): Unsubscribe; ``` alarm_rule_execute events (needs the account owner). ### alarms.rules.onExecute ```ts onExecute(cb: (event: ServerEvent) => void): Unsubscribe; ``` Same as `subscribe(cb)`. ## Thinger.resources Any kind of resource, listed or read by id. ### resources.list ```ts list(kind: ResourceKind, query?: ListQuery): Promise; ``` Resources of a kind, following pagination. `query` is sent as filters (`labels` as in `devices.list`); `query.limit` caps how many are returned. ### resources.get ```ts get(kind: ResourceKind, id: string): Promise; ``` One resource document. ## Thinger.properties Properties of devices, products, projects, groups and types. Also a place for the dashboard's own settings (e.g. a project or product property). ### properties.list ```ts list(kind: PropertyKind, id: string, query?: PropertyQuery): Promise; ``` `query.id` accepts a pattern matching several properties ('temp\*'). ### properties.get ```ts get(kind: PropertyKind, id: string, propertyId: string): Promise>; ``` The full document `{ property, value, created, modified, … }`. ### properties.set ```ts set(kind: PropertyKind, id: string, propertyId: string, value: unknown): Promise; ``` Create or update a property. ### properties.delete ```ts delete(kind: PropertyKind, id: string, propertyId: string): Promise; ``` Remove a property (true also when it did not exist). ## Thinger.products Products and their API. ### products.list ```ts list(query?: ListQuery): Promise; ``` ### products.get ```ts get(productId: string): Promise; ``` ### products.call ```ts call(productId: string, resource: string, input?: unknown): Promise; ``` Call a resource of the product API (the functions of the product profile) with `input` as its JSON body. It reaches a device only if the resource defines a `device_id_resolver`. ## Thinger.endpoints Endpoints: email, webhooks, notifications… ### endpoints.call ```ts call(endpointId: string, payload?: unknown): Promise; ``` Trigger an endpoint with an optional JSON payload. ## Thinger.storages Files in file storages. Every call carries the viewer's token, so private storages work too. A plain `` to a private file goes without the token: use `url()`. ### storages.list ```ts list(storageId: string, path?: string): Promise; ``` Files of a storage, optionally inside `path`. ### storages.read ```ts read(storageId: string, path: string, opts: { as: 'blob'; }): Promise; read(storageId: string, path: string, opts: { as: 'arrayBuffer'; }): Promise; read(storageId: string, path: string, opts: { as: 'text'; }): Promise; read(storageId: string, path: string, opts?: { as?: 'json'; }): Promise; ``` File contents. `opts.as`: 'json', 'text', 'blob' or 'arrayBuffer'; by default JSON when the server says so and text otherwise. Use 'blob' / 'arrayBuffer' for binary files (PDF, images…). ### storages.url ```ts url(storageId: string, path: string): Promise; ``` A temporary `blob:` URL with the file, for ``, `