Tailscale offers an API to let you automate various aspects of your network.
You can find documentation for the API on GitHub →
Requests to the API are authenticated via an API Key, which can be generated from the keys page of the admin console.
This API key will automatically expire after 90 days, and must be manually regenerated. More details about authenticating with the API can be found on GitHub.