curl --request PATCH \
--url https://api.zode.dev/v1/sandboxes/{id}/features \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"browser": true,
"desktop": true
}
'import requests
url = "https://api.zode.dev/v1/sandboxes/{id}/features"
payload = {
"browser": True,
"desktop": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({browser: true, desktop: true})
};
fetch('https://api.zode.dev/v1/sandboxes/{id}/features', 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/sandboxes/{id}/features",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'browser' => true,
'desktop' => true
]),
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/sandboxes/{id}/features"
payload := strings.NewReader("{\n \"browser\": true,\n \"desktop\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.zode.dev/v1/sandboxes/{id}/features")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"browser\": true,\n \"desktop\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/sandboxes/{id}/features")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"browser\": true,\n \"desktop\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "sbx_ilvsd743b36wqi26",
"name": "<string>",
"status": "creating",
"vcpus": 123,
"ram_mb": 123,
"disk_gb": 123,
"region": "eu-central",
"git_repo": "<string>",
"git_branch": "<string>",
"pr_number": 123,
"max_cost_micros": 123,
"parent_sandbox_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"created_by": {
"member_id": "mem_ilvsd743b36wqi26",
"email": "<string>"
},
"browser": true,
"desktop": true,
"feature_error": "<string>"
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}Switch browser or desktop
Switch the browser or the desktop on or off in a running sandbox.
Off by default; processes run only while
on. Each change is audited (sandbox.browser.enable, .disable,
sandbox.desktop.enable, .disable, detail source: toggle).
Switching off is never gated; switching on needs the plan and a host
that runs it.
curl --request PATCH \
--url https://api.zode.dev/v1/sandboxes/{id}/features \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"browser": true,
"desktop": true
}
'import requests
url = "https://api.zode.dev/v1/sandboxes/{id}/features"
payload = {
"browser": True,
"desktop": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({browser: true, desktop: true})
};
fetch('https://api.zode.dev/v1/sandboxes/{id}/features', 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/sandboxes/{id}/features",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'browser' => true,
'desktop' => true
]),
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/sandboxes/{id}/features"
payload := strings.NewReader("{\n \"browser\": true,\n \"desktop\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.zode.dev/v1/sandboxes/{id}/features")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"browser\": true,\n \"desktop\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/sandboxes/{id}/features")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"browser\": true,\n \"desktop\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "sbx_ilvsd743b36wqi26",
"name": "<string>",
"status": "creating",
"vcpus": 123,
"ram_mb": 123,
"disk_gb": 123,
"region": "eu-central",
"git_repo": "<string>",
"git_branch": "<string>",
"pr_number": 123,
"max_cost_micros": 123,
"parent_sandbox_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"created_by": {
"member_id": "mem_ilvsd743b36wqi26",
"email": "<string>"
},
"browser": true,
"desktop": true,
"feature_error": "<string>"
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<string>"
}
}{
"error": {
"code": "not_found",
"message": "<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.
Response
The sandbox with its switches.
AI spend cap for this sandbox, in micro-dollars. Counts only AI calls made on the workspace's keys through the node's AI proxy, not compute or storage. The total is kept in the node daemon's memory, so a node daemon restart starts it again from zero. Reaching it refuses further AI calls (402 zode_spend_cap) and sends spend.cap_reached; the sandbox keeps running.