Ttnctl with private networks

The Things Network include command line tool called ttnctl. The following guide will help you setup the command line tool for the public network and private networks. 

Download the latest version on the reference guide.

This guide will not explain how to use ttnctl for this, please head here. Before starting you should know that ttnctl can interact with any TTN/TTI server, it is only a matter of configuration. The standard configuration point to the European region server.


  1. Create a file called .ttnctl.yml in your home directory and fill it with the following information:

    auth-server: https://account.<domain_id>
    allow-insecure: false
    data: /home/<user_name>/.ttnctl
    router-id: <domain_id>-router
    mqtt-address: <domain_id>
    handler-id: <domain_id>-handler
    discovery-address: <domain_id>

    Now ttnctl is configured to use your private network !

    For windows user make sure to use the --config flag with the full path to the confifuration file 

    ttnctl.exe --config fullpath/config.yml
  2. Get the an access code https://<domain_id>
  3. Login: 

    ttnctl user login [access_code]
  4. You are now login on your private network ! You should now see a folder named /.ttnctl in your home directory with private files. Make sure this are protected.

    The following steps aren't necessary if you don't plan on using the public network

  5. Create a file called community.yml in /home/<user_name>/.ttnctl/ with the following (for other region use the respective region name instead of eu):

    data: /home/neugdae/.ttnctl/community
    allow-insecure: false
    gateway-id: dev
    router-id: ttn-router-eu
    handler-id: ttn-handler-eu
  6. Get the access code
  7. Login: 

    ttnctl --config /home/<user_name>/.ttnctl/community.yml user login [access_code]

    Define an alias on ttnctl --config /home/<user_name>/.ttnctl/community.yml to go faster !

In other articles when no configuration is specified it refer to your private networks. If there is an ambiguity on which configuration to use it will specified in the command line provided in the guide.