List Sandboxes
curl --request GET \
--url https://api.declaw.ai/sandboxes \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.declaw.ai/sandboxes"
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', 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",
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"
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")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.declaw.ai/sandboxes")
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{
"sandboxes": [
{}
],
"next_token": {}
}Sandbox API
List Sandboxes
Return all sandboxes visible to the authenticated API key.
GET
/
sandboxes
List Sandboxes
curl --request GET \
--url https://api.declaw.ai/sandboxes \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.declaw.ai/sandboxes"
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', 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",
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"
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")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.declaw.ai/sandboxes")
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{
"sandboxes": [
{}
],
"next_token": {}
}Returns all sandboxes owned by the authenticated API key. Killed sandboxes are
hidden by default — pass
?state=all to include them. Results are wrapped in a
sandboxes array with a next_token pagination cursor.
Query Parameters
integer
default:"100"
Maximum number of sandboxes to return. Capped at
1000.integer
default:"0"
Zero-based offset for pagination.
string
Pass
"all" to include killed sandboxes in the results. Any other value (or
omission) filters them out.Response
string | null
Pagination cursor for the next page of results. Currently always
null —
full pagination is coming in a future release.Example
curl https://api.declaw.ai/sandboxes \
-H "X-API-Key: YOUR_API_KEY"
from declaw import Sandbox
sandboxes = Sandbox.list(api_key="YOUR_API_KEY", domain="api.declaw.ai")
for sbx in sandboxes:
print(sbx.sandbox_id, sbx.state)
import { Sandbox } from "@declaw/sdk";
const sandboxes = await Sandbox.list({
apiKey: "YOUR_API_KEY",
domain: "api.declaw.ai",
});
for (const sbx of sandboxes) {
console.log(sbx.sandboxId, sbx.state);
}
Response
{
"sandboxes": [
{
"sandbox_id": "sbx-a1b2c3d4",
"template_id": "tpl-base",
"name": "base",
"state": "live",
"timeout": 300,
"started_at": "2024-01-15T10:30:00Z"
},
{
"sandbox_id": "sbx-e5f6g7h8",
"template_id": "tpl-base",
"name": "base",
"state": "paused",
"timeout": 0,
"started_at": "2024-01-15T09:00:00Z"
}
],
"next_token": null
}
Error Responses
| Status | Cause |
|---|---|
401 | Missing or invalid API key |
500 | Internal error listing sandboxes |