Restore sandbox from snapshot
curl --request POST \
--url https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore', 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.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"snapshotId": "<string>"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}compute
Restore sandbox from snapshot
Restores a sandbox to one of its own snapshots. The running sandbox is torn down and rebuilt from the snapshot under the same name and URLs, so everything it held since the snapshot was taken is lost unless it was itself snapshotted.
POST
/
sandboxes
/
{sandboxName}
/
snapshots
/
{snapshotId}
/
restore
Restore sandbox from snapshot
curl --request POST \
--url https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore', 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.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/sandboxes/{sandboxName}/snapshots/{snapshotId}/restore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"snapshotId": "<string>"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}Authorizations
OAuth2ApiKeyAuth
OAuth2 authentication with JWT tokens
Path Parameters
Name of the sandbox to restore
Name of the snapshot among the sandbox's snapshots. A snapshot ID is also accepted and resolves within the whole workspace, so it reaches a snapshot whose source sandbox is another one or was deleted.
Last modified on September 14, 2026
Was this page helpful?