Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors
22.5k Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Getting Started with ThingsBoard CLI

In this guide, you tell your AI agent what your sensor sends. The agent creates the device and a dashboard in ThingsBoard. Then you see the data. This takes approximately 10 minutes.

You need:

The setup creates a project folder. The project folder contains the ThingsBoard skills for your agent and all your solutions. The agent creates one folder for each solution in solutions/. You need only one project folder for many solutions.

Select one option. Both options give the same result.

  1. Create an empty project folder and start your agent in it:

    Terminal window
    mkdir thingsboard-project && cd thingsboard-project && claude
  2. Send this prompt to the agent:

    Set up ThingsBoard CLI in this folder:
    1. Install or upgrade it. On macOS or Linux, run: curl -LsSf https://thingsboard.io/cli/install.sh | sh
    On Windows, run: powershell -ExecutionPolicy ByPass -c "irm https://thingsboard.io/cli/install.ps1 | iex"
    2. Run "tb init --agent-format <agent> --browser". Use "claude" for Claude Code or "antigravity" for Antigravity. It opens a page where I enter my ThingsBoard URL and API key. Tell me to complete the page, then wait. Never ask me for the API key in the chat, and never print secrets.
    3. Check the connection with "tb device list".
    If everything works, reply with one sentence: the setup is complete, and I must restart you to load the ThingsBoard skills. Then show the restart commands for you only. Claude Code: type /exit, then run claude --continue. Antigravity: close it, then run agy in this folder. If a step fails, tell me what failed and how to fix it.
  3. The agent asks for permission to run commands. Allow them.

  4. Your browser opens the page Connect ThingsBoard CLI. Select ThingsBoard Cloud (North America) or ThingsBoard Cloud (Europe). For your own server, select Your own server, enter its address (like iot.example.com or 192.168.1.10:8080), and click Continue.

  5. Click Create an API key. ThingsBoard opens the Security page. In the API keys section, click Manage, then + Generate. Copy the key.

  6. Paste the key on the Connect ThingsBoard CLI page and click Connect. The page shows Connected. Go back to your agent.

  7. The agent tells you that the setup is complete and asks you to restart it. Restart the agent in the same folder. The conversation continues:

    Type /exit, then run:

    Terminal window
    claude --continue

The agent now has the ThingsBoard skills. Continue with Step 2.

Send this prompt to the agent:

My office has a sensor that sends {"temperature": 22.5, "humidity": 41, "co2": 650} every minute. Create the device and a dashboard for it. Alert me when CO2 goes above 1000.

The agent does these steps:

  1. It can ask you a question. Answer it, or tell the agent to use a default.
  2. It creates the device, the dashboard, and the CO2 alarm as files in your project.
  3. It creates an emulator. The emulator makes demo data for your sensor.
  4. It checks the files against your ThingsBoard.
  1. The agent asks: Deploy to ThingsBoard and stream live demo data for 5 minutes? Select Deploy and stream live data.

    The agent does these steps:

    • It sends the files to ThingsBoard.
    • It adds seven days of demo data.
    • It starts the emulator. The emulator sends new values every 5 seconds.
    • It shows the dashboard link:
    Dashboards:
    Office Climate: https://thingsboard.cloud/dashboards/all/…
  2. Click the link. The dashboard shows the temperature, the humidity, and the CO2 level for the last seven days. The latest values change every 5 seconds. If CO2 goes above 1000, the alarm appears.

To stream demo data again later, run this command in the project folder:

Terminal window
tb emulator run --duration 5m

Change the prompt from Step 2. Tell the agent what your device is and paste the data that it sends:

My device is a <device type>. It sends this JSON: <paste your payload>. Show the values on a dashboard.
The connection failed

The CLI shows the reason and lets you try again.

  • The API key is not valid: Copy the key again, or create a new key.
  • The CLI cannot reach the server: Check the address. For Cloud EU, select ThingsBoard Cloud (Europe).
The browser does not open

The CLI shows a link. Copy the link and open it in your browser.

tb: command not found

Open a new terminal window and try again. If the problem continues, run uv tool update-shell.

The agent does not know ThingsBoard CLI

Start the agent in the project folder. The agent loads the ThingsBoard skills from this folder.

Share your experience with tb feedback.