curl --request POST \
--url https://api.blaxel.ai/v0/snapshots \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-snapshot"
}
'import requests
url = "https://api.blaxel.ai/v0/snapshots"
payload = { "name": "my-snapshot" }
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: 'my-snapshot'})
};
fetch('https://api.blaxel.ai/v0/snapshots', 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/snapshots",
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' => 'my-snapshot'
]),
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.blaxel.ai/v0/snapshots"
payload := strings.NewReader("{\n \"name\": \"my-snapshot\"\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.blaxel.ai/v0/snapshots")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-snapshot\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/snapshots")
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\": \"my-snapshot\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "<string>",
"id": "snap_abc123",
"name": "my-snapshot",
"status": "ready",
"workspace": "<string>",
"createdBy": "<string>",
"sandboxName": "<string>",
"source": {
"name": "<string>",
"deleted": true,
"kind": "sandbox"
},
"spec": {
"generation": "mk2",
"image": "<string>",
"memory": 123,
"ports": [
{
"target": 8080,
"name": "http",
"protocol": "HTTP"
}
],
"region": "<string>",
"volumes": [
{
"mountPath": "/mnt/data",
"name": "my-volume",
"readOnly": false,
"sizeMb": 102400,
"type": "persistent"
}
]
}
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}Create snapshot
Captures a snapshot from a source object. The snapshot belongs to the workspace rather than to its source, so it survives the deletion of the object it was captured from, and carries what creating a sandbox or an application from it needs.
curl --request POST \
--url https://api.blaxel.ai/v0/snapshots \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-snapshot"
}
'import requests
url = "https://api.blaxel.ai/v0/snapshots"
payload = { "name": "my-snapshot" }
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: 'my-snapshot'})
};
fetch('https://api.blaxel.ai/v0/snapshots', 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/snapshots",
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' => 'my-snapshot'
]),
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.blaxel.ai/v0/snapshots"
payload := strings.NewReader("{\n \"name\": \"my-snapshot\"\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.blaxel.ai/v0/snapshots")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-snapshot\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/snapshots")
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\": \"my-snapshot\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "<string>",
"id": "snap_abc123",
"name": "my-snapshot",
"status": "ready",
"workspace": "<string>",
"createdBy": "<string>",
"sandboxName": "<string>",
"source": {
"name": "<string>",
"deleted": true,
"kind": "sandbox"
},
"spec": {
"generation": "mk2",
"image": "<string>",
"memory": 123,
"ports": [
{
"target": 8080,
"name": "http",
"protocol": "HTTP"
}
],
"region": "<string>",
"volumes": [
{
"mountPath": "/mnt/data",
"name": "my-volume",
"readOnly": false,
"sizeMb": 102400,
"type": "persistent"
}
]
}
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}Authorizations
OAuth2 authentication with JWT tokens
Body
Request body for creating a snapshot. The source object is required at the root endpoint and implied by the path on the nested one.
Response
Snapshot created successfully
A point-in-time snapshot of a sandbox. It is a workspace-level object: it outlives the sandbox it was captured from, and can be restored onto a sandbox or forked into a new sandbox or application on its own.
When the snapshot was created
Identifier of the snapshot, unique in the workspace. Workspace-level routes address the snapshot by it.
"snap_abc123"
Display name of the snapshot, unique among the snapshots of the sandbox it was captured from. Defaults to the identifier.
"my-snapshot"
Status of the snapshot (pending, ready, failed)
"ready"
Workspace owning the snapshot
Who created the snapshot
Name of the source sandbox. Kept for compatibility, read source.name instead.
The object a snapshot was captured from.
Show child attributes
Show child attributes
The configuration a snapshot carries, so a sandbox or an application can be created from it once its source object is gone.
Show child attributes
Show child attributes
Was this page helpful?