Create Snapshot
curl --request POST \
--url https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot', 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}/snapshot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/snapshot"
req, _ := http.NewRequest("POST", 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.post("https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"snapshot_id": "<string>",
"sandbox_id": "<string>",
"created_at": "<string>"
}Sandbox API
Create Snapshot
Create a snapshot of the current sandbox state for later restoration.
POST
/
sandboxes
/
{sandbox_id}
/
snapshot
Create Snapshot
curl --request POST \
--url https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot', 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}/snapshot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/snapshot"
req, _ := http.NewRequest("POST", 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.post("https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.declaw.ai/sandboxes/{sandbox_id}/snapshot")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"snapshot_id": "<string>",
"sandbox_id": "<string>",
"created_at": "<string>"
}Takes a point-in-time snapshot of the sandbox VM. Snapshots capture the full
memory and filesystem state, allowing you to restore a sandbox to a known-good
checkpoint. Returns a
Snapshot object with the new snapshot ID.
Use snapshots to checkpoint long-running agent workflows, save expensive setup
steps, or create reusable starting points.
Path Parameters
string
required
The sandbox identifier. Format:
sbx-<8 chars>.Response
string
Unique snapshot identifier. Format:
snap-<8 chars>.string
The sandbox this snapshot was taken from.
string
UTC timestamp when the snapshot was created.
Example
curl -X POST https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/snapshot \
-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")
snapshot = sbx.snapshot()
print(snapshot.snapshot_id) # snap-a1b2c3d4
import { Sandbox } from "@declaw/sdk";
const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
apiKey: "YOUR_API_KEY",
domain: "api.declaw.ai",
});
const snapshot = await sbx.snapshot();
console.log(snapshot.snapshotId); // snap-a1b2c3d4
Response
{
"snapshot_id": "snap-a1b2c3d4",
"sandbox_id": "sbx-a1b2c3d4",
"created_at": "2024-01-15T10:30:00Z",
"source": "manual"
}
Error Responses
| Status | Cause |
|---|---|
401 | Missing or invalid API key |
404 | Sandbox not found |
502 | Orchestrator unreachable or returned non-200 |
503 | Sandbox node unreachable |
⌘I