Stand with Ukraine flag
Try it now Pricing
Cloud
North America
API > REST APIs and clients > Administration REST API
Getting Started Documentation Devices Library Guides
FAQ
On this page

REST API

Interactive Documentation

ThingsBoard REST API interactive documentation is available via Swagger UI. For example, you may browse ThingsBoard Cloud API documentation using the Swagger UI link.

Documentation page will automatically use your credentials, if you have previously authorized on the main login page. You may use “Authorize” button in the top right corner of the documentation page to manually authorize. You may also use this button to authorize as a different user. See below:

The easiest way to get your account is to use ThingsBoard Cloud server.

JWT Tokens

ThingsBoard uses JWT tokens for representing claims securely between the API client (browser, scripts, etc) and the platform. When you login to the platform, your username and password is exchanged to the pair of tokens.

The main token is short-lived token you should use to perform the API calls. The refresh token is used to get new main token once it is expired. Default expiration time values are 2.5 hours and 1 week respectively.

See sample command below to get the token for user “your_user@company.com” and password “secret”:

1
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"username":"your_user@company.com", "password":"secret"}' 'https://thingsboard.cloud/api/auth/login'
1
{"token":"$YOUR_JWT_TOKEN", "refreshToken":"$YOUR_JWT_REFRESH_TOKEN"}
  • Now, you should set ‘X-Authorization’ header to “Bearer $YOUR_JWT_TOKEN”. Make sure you use main JWT token and not the refresh token.

Java REST API Client

ThingsBoard team provides client library written in Java to simplify consumption of the REST API. Please see Java REST API Client documentation page for more details.

Python REST API Client

ThingsBoard team provides client library written in Python to simplify consumption of the REST API. Please see Python REST API Client documentation page for more details.