Reading time: 6 – 10 minutes
Zerotier offers a powerful REST API that allows for seamless integration and management of your network. By default, the API is accessible on TCP port 9993
. To securely interact with this API, an authentication token is required.
The authentication token is stored in the following file:
/var/lib/zerotier-one/authtoken.secret
To check if the Zerotier service is running correctly, you can use the curl
command with the necessary authentication header. Here’s how to do it:
curl -Lv -H "X-ZT1-Auth: $(cat /var/lib/zerotier-one/authtoken.secret)" http://localhost:9993/status 2>&1|less
Breaking Down the Command:
curl -Lv
-L
: Follows any redirects the server might issue.-v
: Enables verbose mode, providing detailed information about the request and response.
-H "X-ZT1-Auth: $(cat /var/lib/zerotier-one/authtoken.secret)"
- Adds a custom header
X-ZT1-Auth
with the value of your authentication token. This is essential for authorized access to the API.
- Adds a custom header
http://localhost:9993/status
- The endpoint to check the current status of the Zerotier service.
2>&1 | less
- Redirects both standard output and standard error to
less
for easy reading and navigation of the output.
- Redirects both standard output and standard error to
I hope you found this guide helpful in navigating Zerotier’s REST API.