Howto join node to network via API?

Is it possible to join a node to a network using the API instead of the zerotier-cli??

Working on an ansible integration, and generally prefer an http call over a commandline utility.

I’m assuming that that’s what the zerotier-cli app does under the covers, but can’t figure out how.

Thanks in advance!


Yes there is an API. You can read the documentation here

You’ll need the backend authorization token in the header X-ZT1-Auth. Then you can post to localhost:9993/network/${network_id} with payload {"allowManaged": true} and you’ll join the network. (There’s also allowGlobal, allowDNS, allowDefault options)

Great information!

The core problem was I was referencing the “central” API docs and not the service API.



If you want to authorize the node on the network, you’ll still need the Central API as well. The one I pointed you at will just have the client attempt to join the network.

Bingo - got it.



Almost got it.

What is the endpoint and payload for the central authorization.

I’ve tried network//member/ and a payload of { config: { authorized: true }} but on the dashboard the node’s ip is not displayed and there is not zt interface on the node itself.

Almost there

Sounds like you did the central authorization just fine. Central API docs are found here

You cannot just post to the Central API and have the node join a network. You have to use the local Service API described above for it to join the network

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.