Get Sandbox
curl --request GET \
--url https://api.declaw.ai/sandboxes/{sandbox_id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.declaw.ai/sandboxes/{sandbox_id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.declaw.ai/sandboxes/{sandbox_id}', 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.declaw.ai/sandboxes/{sandbox_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.declaw.ai/sandboxes/{sandbox_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.declaw.ai/sandboxes/{sandbox_id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.declaw.ai/sandboxes/{sandbox_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"sandbox_id": "<string>",
"template_id": "<string>",
"name": "<string>",
"state": "<string>",
"timeout": 123,
"metadata": {},
"envs": {},
"network": {},
"resources": {},
"envd_access_token": "<string>",
"traffic_access_token": "<string>",
"guest_ip": "<string>",
"envd_port": 123,
"started_at": "<string>",
"end_at": {}
}Sandbox API
Get Sandbox
Retrieve the full details of a single sandbox by its ID.
GET
/
sandboxes
/
{sandbox_id}
Get Sandbox
curl --request GET \
--url https://api.declaw.ai/sandboxes/{sandbox_id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.declaw.ai/sandboxes/{sandbox_id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.declaw.ai/sandboxes/{sandbox_id}', 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.declaw.ai/sandboxes/{sandbox_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.declaw.ai/sandboxes/{sandbox_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.declaw.ai/sandboxes/{sandbox_id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.declaw.ai/sandboxes/{sandbox_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"sandbox_id": "<string>",
"template_id": "<string>",
"name": "<string>",
"state": "<string>",
"timeout": 123,
"metadata": {},
"envs": {},
"network": {},
"resources": {},
"envd_access_token": "<string>",
"traffic_access_token": "<string>",
"guest_ip": "<string>",
"envd_port": 123,
"started_at": "<string>",
"end_at": {}
}Returns the complete sandbox object including state, configuration, resource
allocation, and connection details.
Path Parameters
string
required
The sandbox identifier. Format:
sbx-<8 chars>.Example: sbx-a1b2c3d4Response
string
Unique sandbox identifier.
string
Template the sandbox was created from.
string
Human-readable name derived from the template.
string
Current lifecycle state:
live, paused, or killed.integer
Auto-kill timeout in seconds.
0 means no timeout is set.object
Key-value metadata attached at creation time.
object
Environment variables injected into the sandbox.
object
Network access configuration (if specified at creation).
object
CPU and memory allocation (
vcpus, memory_mb).string
Bearer token for envd daemon access.
string
Bearer token for the security/traffic proxy.
string
Internal IP address of the sandbox VM.
integer
Port on which envd listens inside the VM.
string
UTC timestamp of sandbox creation.
string | null
UTC timestamp when the sandbox will be or was killed.
null if no timeout.Example
curl https://api.declaw.ai/sandboxes/sbx-a1b2c3d4 \
-H "X-API-Key: YOUR_API_KEY"
from declaw import Sandbox
sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
print(sbx.state) # running
import { Sandbox } from "@declaw/sdk";
const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
apiKey: "YOUR_API_KEY",
domain: "api.declaw.ai",
});
console.log(sbx.state); // running
Response
{
"sandbox_id": "sbx-a1b2c3d4",
"template_id": "tpl-base",
"name": "base",
"state": "live",
"timeout": 300,
"metadata": { "project": "my-agent" },
"resources": { "vcpus": 1, "memory_mb": 512 },
"envd_access_token": "envd-ab12cd34",
"sandbox_domain": "declaw.dev",
"traffic_access_token": "traffic-ef56gh78",
"guest_ip": "172.16.0.5",
"envd_port": 49983,
"started_at": "2024-01-15T10:30:00Z",
"end_at": "2024-01-15T10:35:00Z"
}
Error Responses
| Status | Cause |
|---|---|
401 | Missing or invalid API key |
404 | Sandbox not found |