Fork a sandbox
curl --request POST \
--url https://api.zode.dev/v1/sandboxes/{id}/fork \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"browser": true,
"desktop": true
}
'import requests
url = "https://api.zode.dev/v1/sandboxes/{id}/fork"
payload = {
"name": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"browser": True,
"desktop": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
git_branch: '<string>',
pr_number: 2,
max_cost_micros: 1,
browser: true,
desktop: true
})
};
fetch('https://api.zode.dev/v1/sandboxes/{id}/fork', 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}/fork",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'git_branch' => '<string>',
'pr_number' => 2,
'max_cost_micros' => 1,
'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}/fork"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"browser\": true,\n \"desktop\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.zode.dev/v1/sandboxes/{id}/fork")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"browser\": true,\n \"desktop\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/sandboxes/{id}/fork")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\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>"
}
}Sandboxes
Fork a sandbox
Fork a running or stopped sandbox.
The child is a ZFS clone on the parent’s host with the parent’s size,
region and repo. Body fields override metadata only. If the parent’s
host has no free RAM, 409 node_full.
POST
/
v1
/
sandboxes
/
{id}
/
fork
Fork a sandbox
curl --request POST \
--url https://api.zode.dev/v1/sandboxes/{id}/fork \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"browser": true,
"desktop": true
}
'import requests
url = "https://api.zode.dev/v1/sandboxes/{id}/fork"
payload = {
"name": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"browser": True,
"desktop": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
git_branch: '<string>',
pr_number: 2,
max_cost_micros: 1,
browser: true,
desktop: true
})
};
fetch('https://api.zode.dev/v1/sandboxes/{id}/fork', 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}/fork",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'git_branch' => '<string>',
'pr_number' => 2,
'max_cost_micros' => 1,
'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}/fork"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"browser\": true,\n \"desktop\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.zode.dev/v1/sandboxes/{id}/fork")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"browser\": true,\n \"desktop\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/sandboxes/{id}/fork")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\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.
Body
application/json
Response
Child created and running
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.
⌘I