curl --request PUT \
--url https://api.zode.dev/v1/environments/{id}/mesh \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"control_url": "https://headscale.example.com",
"auth_key": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"setup_key": "<string>",
"api_token": "<string>"
}
'import requests
url = "https://api.zode.dev/v1/environments/{id}/mesh"
payload = {
"control_url": "https://headscale.example.com",
"auth_key": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"setup_key": "<string>",
"api_token": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
control_url: 'https://headscale.example.com',
auth_key: '<string>',
oauth_client_id: '<string>',
oauth_client_secret: '<string>',
setup_key: '<string>',
api_token: '<string>'
})
};
fetch('https://api.zode.dev/v1/environments/{id}/mesh', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zode.dev/v1/environments/{id}/mesh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'control_url' => 'https://headscale.example.com',
'auth_key' => '<string>',
'oauth_client_id' => '<string>',
'oauth_client_secret' => '<string>',
'setup_key' => '<string>',
'api_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zode.dev/v1/environments/{id}/mesh"
payload := strings.NewReader("{\n \"control_url\": \"https://headscale.example.com\",\n \"auth_key\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"setup_key\": \"<string>\",\n \"api_token\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.zode.dev/v1/environments/{id}/mesh")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"control_url\": \"https://headscale.example.com\",\n \"auth_key\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"setup_key\": \"<string>\",\n \"api_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/environments/{id}/mesh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"control_url\": \"https://headscale.example.com\",\n \"auth_key\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"setup_key\": \"<string>\",\n \"api_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"connected": true,
"provider": "<string>",
"cidr": "<string>",
"setup": {
"tailscale_policy": "<string>",
"note": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}Connect a mesh
Connect the environment to Tailscale, Headscale or NetBird (owner, admin).
Tailscale: an OAuth client with the auth_keys scope that may assign
tag:zode (recommended: Zode mints a single-use key for each node’s
router) or a reusable tagged auth_key. Headscale: control_url
and a reusable tagged auth_key. NetBird: a reusable setup_key,
control_url for a self-hosted server, and an optional api_token
so Zode adds each node’s network route itself. Credentials are
checked where the vendor allows (400 mesh_credential_refused),
sealed with the server key and never returned. Routers come up on
every node that hosts the environment within a minute. Audited
environment.mesh.connect without any credential.
curl --request PUT \
--url https://api.zode.dev/v1/environments/{id}/mesh \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"control_url": "https://headscale.example.com",
"auth_key": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"setup_key": "<string>",
"api_token": "<string>"
}
'import requests
url = "https://api.zode.dev/v1/environments/{id}/mesh"
payload = {
"control_url": "https://headscale.example.com",
"auth_key": "<string>",
"oauth_client_id": "<string>",
"oauth_client_secret": "<string>",
"setup_key": "<string>",
"api_token": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
control_url: 'https://headscale.example.com',
auth_key: '<string>',
oauth_client_id: '<string>',
oauth_client_secret: '<string>',
setup_key: '<string>',
api_token: '<string>'
})
};
fetch('https://api.zode.dev/v1/environments/{id}/mesh', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zode.dev/v1/environments/{id}/mesh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'control_url' => 'https://headscale.example.com',
'auth_key' => '<string>',
'oauth_client_id' => '<string>',
'oauth_client_secret' => '<string>',
'setup_key' => '<string>',
'api_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zode.dev/v1/environments/{id}/mesh"
payload := strings.NewReader("{\n \"control_url\": \"https://headscale.example.com\",\n \"auth_key\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"setup_key\": \"<string>\",\n \"api_token\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.zode.dev/v1/environments/{id}/mesh")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"control_url\": \"https://headscale.example.com\",\n \"auth_key\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"setup_key\": \"<string>\",\n \"api_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/environments/{id}/mesh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"control_url\": \"https://headscale.example.com\",\n \"auth_key\": \"<string>\",\n \"oauth_client_id\": \"<string>\",\n \"oauth_client_secret\": \"<string>\",\n \"setup_key\": \"<string>\",\n \"api_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"connected": true,
"provider": "<string>",
"cidr": "<string>",
"setup": {
"tailscale_policy": "<string>",
"note": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}Authorizations
An API key (zode_tok_...). Create one in the console under API keys (https://console.zode.dev/tokens), or with zode login.