Made a new CLI tool

I manage a large fleet of Syncthing machines over remote links often slow and high latency. Web UI became somewhat of a burden so I wrote this quick and simple CLI tool in Go using Syncthing API. For now it just displays a dashboard/status of folders and devices.

$ stc --apikey=XXXXXX --target=
Host      Uptime    CPU%      Version
homenas   2 weeks   0.0%      v1.19.0

Folder     Paused    State     Global    Local
pics       false     idle      37 GB     37 GB
docs       false     idle      4 GB      4 GB
backups    false     idle      86 GB     86 GB

Device          Paused    Conn   Sync%   Download  Upload
office          false     true   100.0%  11 kB     11 kB
laptop          false     false  100.0%  0 B       0 B
jakob-home      false     true   100.0%  89 MB     447 kB
backupnas       false     true   100.0%  6.3 kB    7.0 kB
homenas         false     true   100.0%  0 B       0 B

Planning to add various actions available in the API as POST in a subsequent release.

Please send comments, remarks, bugs/issues, etc.



I like the simplicity of the output :slight_smile:.

Just two comments:

  1. Windows binaries need to end with .exe in order to be executable.

  2. This doesn’t work with HTTPS, does it? I get the following output when trying to access Syncthing.

    Get "": x509: certificate signed by unknown authority

You could add this to the contribution section in our documentation. Feel free to make a PR for this at

Right, I forgot about that. I will fix .exes later… Also thanks for the cert info. I can add a flag to ignore cert errors.

The cert error is fixed now with a new flag --ignore_cert_errors.

I’m trying out the new release right now, but I only keep getting the following error.

invalid character 'N' looking for beginning of value

This is under Windows 10 and happens with both 386 and amd64 versions.

Edit: I’ve just seen there are arm64-android versions too. Is there a specific reason for limiting Android releases to arm64 only?

TBH I have not tested it under Windows yet. I probably should do it now.

As for Android and iOS I think they just built because go has targets for them. I don’t really support them and will probably remove the binaries. These are not phone apps as there is no UI.

The error invalid character 'N' looking for beginning of value comes up when invalid API key is specified, I need to see why it’s not saying “Not Authorized”, which comes from the REST API. I suspect that N is beginning of “Not…”

Tested again, and that was my mistake. The API key was correct, but the GUI port was not. The current binaries do work in Windows.

For the record, the standard linux binaries can be executed in Android from the command line and they do run fine there :wink:.

Okay bugs fixed, tested on Windows too.

Stc can now find apikey and target on it’s own if it’s placed in Syncthing home dir, or you specify it as a flag --homedir=.

I’m also wondering perhaps instead of developing this on it’s own I should be adding this stuff to syncthings own cli command?


Congrats on the v1.3 release @tenox. I noticed among the commands you added, there is some duplication regarding the built-in syncthing cli command. Could be worth aligning with that, or just leaving out those commands that are already in the official CLI? Stuff like restart and shutdown.

Ideally, one should be able to add an alias stc=syncthing cli and use the same commands. Or just leave them out of stc and refer to the already implemented ones. Some nice additions of yours would certainly be welcome in the official repo as PRs. That would also make eventual integration into the main CLI easier.

One more nit: The APIKEY environment variable you introduced could be aligned to the official (but undocumented!) STGUIAPIKEY / STGUIADDRESS variable names. So if you start Syncthing and then use stc in the same environment, things work magically when the variables were specified.

On Windows, you can install stc via

scoop bucket add rasa
scoop update
scoop install rasa/stc