Skip to content
The Things Stack documentation home
Getting Started Concepts Cloud Enterprise Integrations API Hardware
Getting Started Concepts
Cloud Enterprise
Integrations API Hardware
Get The Things Stack

    Recent searches

      Popular pages

      • Getting Started
      • Adding Gateways
      • Adding Devices
      • Payload Formatters
      • Webhooks
      • Authentication

      No results for “”.

      • Check the spelling, or try fewer or more general words.
      • Ask the community on The Things Network Forum
      • Contact support
      ↑↓ to navigate ↵ to open Esc to close

      Concepts

      • Overview
      • Architecture
      • Features
      • Networking
      • Migrate to The Things Stack
        • Export End Device Data
          • Export Devices from The Things Stack
          • Export End Devices from ChirpStack v3
          • Export End Devices from ChirpStack v4
          • Export End Devices from Wanesy
          • Export End Devices from Firefly
          • Export End Devices from AWS IoT
          • Troubleshooting
        • Migrating Gateways
        • Between The Things Stack distributions
        • Frequently Asked Questions
      • Packet Broker
      • Server Addresses
      • Advanced Topics
      • Troubleshooting
      • The Things Stack Sandbox

      Export Devices from The Things Stack

      Updated 13 February 2025 Edit on GitHub
      Copy page
      • View as MarkdownThis page as plain text
      • Open in ChatGPTAsk questions about this page
      • Open in ClaudeAsk questions about this page

      This section explains how to configure the migration tool and use it to export end devices from The Things Stack, that can later be imported in other The Things Stack deployments. This is a base for migrating end devices between The Things Stack distributions.

      Configuration

      First, configure the migration tool with environment variables or command-line arguments, like shown below. See --help for more details.

      export TTS_APP_ID="my-tts-app"                                                  # TTS App ID
      export TTS_APP_API_KEY="NNSXS.U..."                                             # TTS App API Key (needs `device` permissions)
      export TTS_APPLICATION_SERVER_GRPC_ADDRESS="eu1.cloud.thethings.network:8884"   # TTS Application Server URL Address
      export TTS_IDENTITY_SERVER_GRPC_ADDRESS="eu1.cloud.thethings.network:8884"      # TTS Identity Server URL Address
      export TTS_JOIN_SERVER_GRPC_ADDRESS="eu1.cloud.thethings.network:8884"          # TTS Join Server URL Address
      export TTS_NETWORK_SERVER_GRPC_ADDRESS="eu1.cloud.thethings.network:8884"       # TTS Network Server URL Address
      

      If using Windows OS, replace export with set and remove the double-quotes in commands above. For example, you would use:

      set TTS_APP_ID=my-tts-app
      

      Note:

      The export process will halt if any error occurs. Execute commands with the --dry-run flag to verify whether the outcome will be as expected.

      You can now proceed to exporting devices or applications.

      Export Devices and Applications

      • Export devices
      • Export applications

      To export a single device using it’s End Device ID (e.g. my-device):

      # dry run first, verify that no errors occur
      ttn-lw-migrate device --source tts 'my-device' --dry-run --verbose > devices.json
      # export device
      ttn-lw-migrate device --source tts 'my-device' > devices.json
      

      In order to export a large number of devices, create a file named device_ids.txt with one device ID per line:

      my-device-1
      my-device-2
      my-device-3
      

      And then export with:

      # dry run first, verify that no errors occur
      ttn-lw-migrate devices --source tts --dry-run --verbose < device_ids.txt > devices.json
      # export devices
      ttn-lw-migrate devices --source tts < device_ids.txt > devices.json
      

      To export all devices of an application using its Application ID (e.g. my-app-id):

      # dry run first, verify that no errors occur
      ttn-lw-migrate application --source tts 'my-app-id' --dry-run --verbose > devices.json
      # export application
      ttn-lw-migrate application --source tts 'my-app-id' > devices.json
      

      In order to export multiple applications, create a file named application_names.txt with one application ID per line:

      my-app-id-1
      my-app-id-2
      my-app-id-3
      

      And then export with:

      # dry run first, verify that no errors occur
      ttn-lw-migrate devices --source tts --dry-run --verbose < application_names.txt > devices.json
      # export applications
      ttn-lw-migrate devices --source tts < application_names.txt > devices.json
      

      Advanced setup

      If you are using a custom CA, you can provide a path to it by with an environment variable or by using --tts.ca-file flag.

      export TTS_CA_FILE="/path/to/ca.file"   # Path to a CA file (optional)
      

      After exporting, devices and applications can be imported in other The Things Stack deployments. See add end devices in bulk in The Things Stack for details about importing devices. See Migrating End Devices between The Things Stack Distributions to wrap up the whole process of migration between The Things Stack distributions.

      ← Export End Device Data Export End Devices from ChirpStack v3 →

      On this page

      • Configuration
      • Export Devices and Applications
      • Advanced setup

      Sections

      Getting Started

      Concepts

      Cloud

      Enterprise

      Integrations

      API

      Hardware

      Sitemap

      View our Sitemap

      Contributing

      GitHub

      About Us

      The Things Industries

      Privacy Policy

      Cookie settings

      Cookie Settings

      We use cookies to enhance your experience, analyze site traffic and deliver personalized content. Read our Privacy Policy.

      Cookie categories