> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# ThingsBoard

> Client-mode REST API connector for a curated ThingsBoard slice: device HTTP telemetry, server timeseries POST/GET, one-way RPC, and JWT login

Technical Preview

## Overview

A client-mode connector for a **curated cloud-IoT** slice of [ThingsBoard](https://thingsboard.io/docs/reference/rest-api/) (CE, PE, Cloud, and compatible Edge) covering JWT login, device HTTP telemetry, server-side timeseries, and one-way RPC:

| Catalog connector event | Entity / path | Notes |
| - | - | - |
| POST v1/\{token}/telemetry | `POST /v1/{accessToken}/telemetry` | Device HTTP API — access token in path |
| POST plugins/telemetry/.../timeseries/ANY | `POST /plugins/telemetry/{entityType}/{entityId}/timeseries/ANY` | Server-side write (JWT or ApiKey) |
| GET plugins/telemetry/.../values/timeseries | `GET /plugins/telemetry/{entityType}/{entityId}/values/timeseries?keys=…` | Latest / ranged values |
| POST rpc/oneway/\{id} | `POST /rpc/oneway/{deviceId}` | Server-side one-way RPC |
| (auth helper) | `POST /auth/login` · `GET /auth/user` | JWT obtain + connectivity smoke |

Default `BASE_ADDRESS` is `https://demo.thingsboard.io/api` (no trailing slash; substitute `{host}`). Topics use `cloud-iot/thingsboard/<object>/<verb>`.

See the base guide: [REST API Connectors](/latest/lot-language/routes/rest-api-routes).

> [!NOTE]
>
> **Auth header:** ThingsBoard uses `X-Authorization` (not `Authorization`). Pass the full value (`Bearer {JWT}` or `ApiKey {key}`) via MQTT JSON field `x_authorization`. Device telemetry uses the access token in the URL only.

> [!NOTE]
>
> Prefer Hub secrets for JWT / device tokens (`THINGSBOARD_JWT`, `THINGSBOARD_DEVICE_TOKEN`). This template has not been verified against a live authenticated ThingsBoard tenant. Status remains blocked until an authenticated live smoke succeeds.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — ThingsBoard curated slice
# Auth: X-Authorization via {value.json.x_authorization} (Bearer JWT or ApiKey)
# Device telemetry: access token in path — no JWT header
# BASE_ADDRESS: https://demo.thingsboard.io/api

DEFINE ROUTE ThingsboardRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://demo.thingsboard.io/api"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Login
        WITH SOURCE_TOPIC "cloud-iot/thingsboard/auth/login"
        WITH DESTINATION_TOPIC "cloud-iot/thingsboard/auth/login/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/auth/login"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
        WITH BODY "{payload}"
    ADD EVENT GetCurrentUser
        WITH SOURCE_TOPIC "cloud-iot/thingsboard/auth/user"
        WITH DESTINATION_TOPIC "cloud-iot/thingsboard/auth/user/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/auth/user"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "X-Authorization" "{value.json.x_authorization}"
    ADD EVENT PostDeviceTelemetry
        WITH SOURCE_TOPIC "cloud-iot/thingsboard/device/telemetry"
        WITH DESTINATION_TOPIC "cloud-iot/thingsboard/device/telemetry/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/v1/{value.json.access_token}/telemetry"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
        WITH BODY "{payload}"
    ADD EVENT SaveTimeseries
        WITH SOURCE_TOPIC "cloud-iot/thingsboard/telemetry/save"
        WITH DESTINATION_TOPIC "cloud-iot/thingsboard/telemetry/save/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/plugins/telemetry/{value.json.entity_type}/{value.json.entity_id}/timeseries/ANY"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "X-Authorization" "{value.json.x_authorization}"
        WITH BODY "{payload}"
    ADD EVENT GetTimeseriesValues
        WITH SOURCE_TOPIC "cloud-iot/thingsboard/telemetry/values"
        WITH DESTINATION_TOPIC "cloud-iot/thingsboard/telemetry/values/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/plugins/telemetry/{value.json.entity_type}/{value.json.entity_id}/values/timeseries?keys={value.json.keys}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "X-Authorization" "{value.json.x_authorization}"
    ADD EVENT OneWayRpc
        WITH SOURCE_TOPIC "cloud-iot/thingsboard/rpc/oneway"
        WITH DESTINATION_TOPIC "cloud-iot/thingsboard/rpc/oneway/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/rpc/oneway/{value.json.device_id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "X-Authorization" "{value.json.x_authorization}"
        WITH BODY "{payload}"
```

## References

* [ThingsBoard REST API](https://thingsboard.io/docs/reference/rest-api/)
* [Device HTTP telemetry](https://thingsboard.io/docs/reference/http-api/telemetry/)
* [Swagger UI (demo)](https://demo.thingsboard.io/swagger-ui/)
* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.