curl --request PUT \
--url https://api.zode.dev/v1/environments/{id}/egress \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": [
"*.example.com"
],
"route": "<string>"
}
],
"default": "direct"
}
'import requests
url = "https://api.zode.dev/v1/environments/{id}/egress"
payload = {
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": ["*.example.com"],
"route": "<string>"
}
],
"default": "direct"
}
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({
routes: [{name: 'home', url: 'socks5://alice:****@proxy.example.net:1080'}],
rules: [{hosts: ['*.example.com'], route: '<string>'}],
default: 'direct'
})
};
fetch('https://api.zode.dev/v1/environments/{id}/egress', 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}/egress",
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([
'routes' => [
[
'name' => 'home',
'url' => 'socks5://alice:****@proxy.example.net:1080'
]
],
'rules' => [
[
'hosts' => [
'*.example.com'
],
'route' => '<string>'
]
],
'default' => 'direct'
]),
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}/egress"
payload := strings.NewReader("{\n \"routes\": [\n {\n \"name\": \"home\",\n \"url\": \"socks5://alice:****@proxy.example.net:1080\"\n }\n ],\n \"rules\": [\n {\n \"hosts\": [\n \"*.example.com\"\n ],\n \"route\": \"<string>\"\n }\n ],\n \"default\": \"direct\"\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}/egress")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"routes\": [\n {\n \"name\": \"home\",\n \"url\": \"socks5://alice:****@proxy.example.net:1080\"\n }\n ],\n \"rules\": [\n {\n \"hosts\": [\n \"*.example.com\"\n ],\n \"route\": \"<string>\"\n }\n ],\n \"default\": \"direct\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/environments/{id}/egress")
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 \"routes\": [\n {\n \"name\": \"home\",\n \"url\": \"socks5://alice:****@proxy.example.net:1080\"\n }\n ],\n \"rules\": [\n {\n \"hosts\": [\n \"*.example.com\"\n ],\n \"route\": \"<string>\"\n }\n ],\n \"default\": \"direct\"\n}"
response = http.request(request)
puts response.read_body{
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": [
"*.example.com"
],
"route": "<string>"
}
],
"default": "direct",
"pending_sandboxes": [
"<string>"
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": [
"*.example.com"
],
"route": "<string>"
}
],
"default": "direct",
"pending_sandboxes": [
"<string>"
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}Set outbound routes
Replace the environment’s routes and rules (owner, admin).
Routes are http://, https:// or socks5:// proxies on public
addresses, with optional user:password, or exit://<id> naming one
of the workspace’s exits (/v1/exits). A route sent back with the
password **** (as read) keeps the stored password when its name,
host and user are unchanged. Rules send shop.example.com or
*.example.com through a route; default is the route for every
other host (direct when absent). Git hosts, package registries,
AI providers and hosts a secret may be sent to stay direct unless a
rule names them. A route that fails is an error, never a direct
connection. Changes are pushed to live sandboxes with a five-second
acknowledgement budget. A 202 response names pending sandboxes;
their old policy remains until a successful refresh. 409
egress_unavailable, with nothing saved, when no host can enforce
routes yet. Audited environment.egress.set without credentials.
curl --request PUT \
--url https://api.zode.dev/v1/environments/{id}/egress \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": [
"*.example.com"
],
"route": "<string>"
}
],
"default": "direct"
}
'import requests
url = "https://api.zode.dev/v1/environments/{id}/egress"
payload = {
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": ["*.example.com"],
"route": "<string>"
}
],
"default": "direct"
}
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({
routes: [{name: 'home', url: 'socks5://alice:****@proxy.example.net:1080'}],
rules: [{hosts: ['*.example.com'], route: '<string>'}],
default: 'direct'
})
};
fetch('https://api.zode.dev/v1/environments/{id}/egress', 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}/egress",
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([
'routes' => [
[
'name' => 'home',
'url' => 'socks5://alice:****@proxy.example.net:1080'
]
],
'rules' => [
[
'hosts' => [
'*.example.com'
],
'route' => '<string>'
]
],
'default' => 'direct'
]),
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}/egress"
payload := strings.NewReader("{\n \"routes\": [\n {\n \"name\": \"home\",\n \"url\": \"socks5://alice:****@proxy.example.net:1080\"\n }\n ],\n \"rules\": [\n {\n \"hosts\": [\n \"*.example.com\"\n ],\n \"route\": \"<string>\"\n }\n ],\n \"default\": \"direct\"\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}/egress")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"routes\": [\n {\n \"name\": \"home\",\n \"url\": \"socks5://alice:****@proxy.example.net:1080\"\n }\n ],\n \"rules\": [\n {\n \"hosts\": [\n \"*.example.com\"\n ],\n \"route\": \"<string>\"\n }\n ],\n \"default\": \"direct\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/environments/{id}/egress")
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 \"routes\": [\n {\n \"name\": \"home\",\n \"url\": \"socks5://alice:****@proxy.example.net:1080\"\n }\n ],\n \"rules\": [\n {\n \"hosts\": [\n \"*.example.com\"\n ],\n \"route\": \"<string>\"\n }\n ],\n \"default\": \"direct\"\n}"
response = http.request(request)
puts response.read_body{
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": [
"*.example.com"
],
"route": "<string>"
}
],
"default": "direct",
"pending_sandboxes": [
"<string>"
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"routes": [
{
"name": "home",
"url": "socks5://alice:****@proxy.example.net:1080"
}
],
"rules": [
{
"hosts": [
"*.example.com"
],
"route": "<string>"
}
],
"default": "direct",
"pending_sandboxes": [
"<string>"
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<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.
Body
Response
Saved