curl --request POST \
--url https://api.zode.dev/v1/sandboxes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"region": "eu-central",
"git_repo": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"image": "<string>",
"browser": true,
"desktop": true
}
'import requests
url = "https://api.zode.dev/v1/sandboxes"
payload = {
"name": "<string>",
"region": "eu-central",
"git_repo": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"image": "<string>",
"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>',
region: 'eu-central',
git_repo: '<string>',
git_branch: '<string>',
pr_number: 2,
max_cost_micros: 1,
image: '<string>',
browser: true,
desktop: true
})
};
fetch('https://api.zode.dev/v1/sandboxes', 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",
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>',
'region' => 'eu-central',
'git_repo' => '<string>',
'git_branch' => '<string>',
'pr_number' => 2,
'max_cost_micros' => 1,
'image' => '<string>',
'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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"region\": \"eu-central\",\n \"git_repo\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"image\": \"<string>\",\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"region\": \"eu-central\",\n \"git_repo\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"image\": \"<string>\",\n \"browser\": true,\n \"desktop\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/sandboxes")
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 \"region\": \"eu-central\",\n \"git_repo\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"image\": \"<string>\",\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>"
}
}Create a sandbox
Placed at random among active nodes in the region with enough free
RAM (weighted by free RAM). Returns once the node reports the
sandbox running. An empty body creates a small sandbox.
The sandbox reads its variables from ?environment= (an id or a
name; the workspace’s default when absent) at the start of every
exec and attach session; unknown is 400 unknown_environment.
A fork keeps its parent’s environment.
curl --request POST \
--url https://api.zode.dev/v1/sandboxes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"region": "eu-central",
"git_repo": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"image": "<string>",
"browser": true,
"desktop": true
}
'import requests
url = "https://api.zode.dev/v1/sandboxes"
payload = {
"name": "<string>",
"region": "eu-central",
"git_repo": "<string>",
"git_branch": "<string>",
"pr_number": 2,
"max_cost_micros": 1,
"image": "<string>",
"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>',
region: 'eu-central',
git_repo: '<string>',
git_branch: '<string>',
pr_number: 2,
max_cost_micros: 1,
image: '<string>',
browser: true,
desktop: true
})
};
fetch('https://api.zode.dev/v1/sandboxes', 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",
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>',
'region' => 'eu-central',
'git_repo' => '<string>',
'git_branch' => '<string>',
'pr_number' => 2,
'max_cost_micros' => 1,
'image' => '<string>',
'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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"region\": \"eu-central\",\n \"git_repo\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"image\": \"<string>\",\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"region\": \"eu-central\",\n \"git_repo\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"image\": \"<string>\",\n \"browser\": true,\n \"desktop\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zode.dev/v1/sandboxes")
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 \"region\": \"eu-central\",\n \"git_repo\": \"<string>\",\n \"git_branch\": \"<string>\",\n \"pr_number\": 2,\n \"max_cost_micros\": 1,\n \"image\": \"<string>\",\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>"
}
}Authorizations
An API key (zode_tok_...). Create one in the console under API keys (https://console.zode.dev/tokens), or with zode login.
Body
A sandbox is one of the server's sizes, listed by GET /v1/images
(images, the first is the default). The hosted API has four:
| Size | vcpus | ram_mb | disk_gb |
|---|---|---|---|
| small (the default) | 2 | 4096 | 50 |
| default | 4 | 8192 | 50 |
| large | 8 | 16384 | 110 |
| xlarge | 16 | 32768 | 250 |
Leave out vcpus, ram_mb and disk_gb for small. Otherwise send
vcpus, ram_mb or both, plus disk_gb if you like: every field
sent must match the same size, else 400 invalid_request naming the
sizes. disk_gb alone is 400. The size named default (as in the
CLI and pricing) is not what an empty request gets.
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. Omitted means the workspace's per-sandbox default.
x >= 0Response
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.