curl --request POST \
--url https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetName": "my-app",
"targetType": "application",
"customDomain": "<string>",
"envs": [
{
"name": "MY_ENV_VAR",
"secret": true,
"value": "my-value"
}
],
"port": 8080,
"prefix": "<string>",
"snapshotId": "<string>",
"traffic": 10
}
'import requests
url = "https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork"
payload = {
"targetName": "my-app",
"targetType": "application",
"customDomain": "<string>",
"envs": [
{
"name": "MY_ENV_VAR",
"secret": True,
"value": "my-value"
}
],
"port": 8080,
"prefix": "<string>",
"snapshotId": "<string>",
"traffic": 10
}
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({
targetName: 'my-app',
targetType: 'application',
customDomain: '<string>',
envs: [{name: 'MY_ENV_VAR', secret: true, value: 'my-value'}],
port: 8080,
prefix: '<string>',
snapshotId: '<string>',
traffic: 10
})
};
fetch('https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork', 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/{snapshotName}/fork",
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([
'targetName' => 'my-app',
'targetType' => 'application',
'customDomain' => '<string>',
'envs' => [
[
'name' => 'MY_ENV_VAR',
'secret' => true,
'value' => 'my-value'
]
],
'port' => 8080,
'prefix' => '<string>',
'snapshotId' => '<string>',
'traffic' => 10
]),
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/{snapshotName}/fork"
payload := strings.NewReader("{\n \"targetName\": \"my-app\",\n \"targetType\": \"application\",\n \"customDomain\": \"<string>\",\n \"envs\": [\n {\n \"name\": \"MY_ENV_VAR\",\n \"secret\": true,\n \"value\": \"my-value\"\n }\n ],\n \"port\": 8080,\n \"prefix\": \"<string>\",\n \"snapshotId\": \"<string>\",\n \"traffic\": 10\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/{snapshotName}/fork")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetName\": \"my-app\",\n \"targetType\": \"application\",\n \"customDomain\": \"<string>\",\n \"envs\": [\n {\n \"name\": \"MY_ENV_VAR\",\n \"secret\": true,\n \"value\": \"my-value\"\n }\n ],\n \"port\": 8080,\n \"prefix\": \"<string>\",\n \"snapshotId\": \"<string>\",\n \"traffic\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork")
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 \"targetName\": \"my-app\",\n \"targetType\": \"application\",\n \"customDomain\": \"<string>\",\n \"envs\": [\n {\n \"name\": \"MY_ENV_VAR\",\n \"secret\": true,\n \"value\": \"my-value\"\n }\n ],\n \"port\": 8080,\n \"prefix\": \"<string>\",\n \"snapshotId\": \"<string>\",\n \"traffic\": 10\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"snapshotId": "<string>",
"type": "sandbox"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}Fork snapshot
Creates a new sandbox or application from a snapshot. The snapshot is enough on its own, so this works after the object it was captured from has been deleted.
curl --request POST \
--url https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetName": "my-app",
"targetType": "application",
"customDomain": "<string>",
"envs": [
{
"name": "MY_ENV_VAR",
"secret": true,
"value": "my-value"
}
],
"port": 8080,
"prefix": "<string>",
"snapshotId": "<string>",
"traffic": 10
}
'import requests
url = "https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork"
payload = {
"targetName": "my-app",
"targetType": "application",
"customDomain": "<string>",
"envs": [
{
"name": "MY_ENV_VAR",
"secret": True,
"value": "my-value"
}
],
"port": 8080,
"prefix": "<string>",
"snapshotId": "<string>",
"traffic": 10
}
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({
targetName: 'my-app',
targetType: 'application',
customDomain: '<string>',
envs: [{name: 'MY_ENV_VAR', secret: true, value: 'my-value'}],
port: 8080,
prefix: '<string>',
snapshotId: '<string>',
traffic: 10
})
};
fetch('https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork', 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/{snapshotName}/fork",
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([
'targetName' => 'my-app',
'targetType' => 'application',
'customDomain' => '<string>',
'envs' => [
[
'name' => 'MY_ENV_VAR',
'secret' => true,
'value' => 'my-value'
]
],
'port' => 8080,
'prefix' => '<string>',
'snapshotId' => '<string>',
'traffic' => 10
]),
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/{snapshotName}/fork"
payload := strings.NewReader("{\n \"targetName\": \"my-app\",\n \"targetType\": \"application\",\n \"customDomain\": \"<string>\",\n \"envs\": [\n {\n \"name\": \"MY_ENV_VAR\",\n \"secret\": true,\n \"value\": \"my-value\"\n }\n ],\n \"port\": 8080,\n \"prefix\": \"<string>\",\n \"snapshotId\": \"<string>\",\n \"traffic\": 10\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/{snapshotName}/fork")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetName\": \"my-app\",\n \"targetType\": \"application\",\n \"customDomain\": \"<string>\",\n \"envs\": [\n {\n \"name\": \"MY_ENV_VAR\",\n \"secret\": true,\n \"value\": \"my-value\"\n }\n ],\n \"port\": 8080,\n \"prefix\": \"<string>\",\n \"snapshotId\": \"<string>\",\n \"traffic\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/snapshots/{snapshotName}/fork")
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 \"targetName\": \"my-app\",\n \"targetType\": \"application\",\n \"customDomain\": \"<string>\",\n \"envs\": [\n {\n \"name\": \"MY_ENV_VAR\",\n \"secret\": true,\n \"value\": \"my-value\"\n }\n ],\n \"port\": 8080,\n \"prefix\": \"<string>\",\n \"snapshotId\": \"<string>\",\n \"traffic\": 10\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"snapshotId": "<string>",
"type": "sandbox"
}{
"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
Path Parameters
ID of the snapshot to create the resource from
Body
Request body for forking a sandbox into an application. Creates a new application or adds a canary revision to an existing one.
Name of the target application to create or update
"my-app"
Target resource type to fork into
"application"
Custom domain for the application
Environment variables the fork runs with, on top of the ones the source has. A variable the source already carries takes this value in the fork, one it does not is added, and every other variable of the source is kept.
Show child attributes
Show child attributes
Port to expose from the sandbox
8080
URL prefix for the application
Snapshot ID to fork from. When set, the fork is created from that existing snapshot (and an application revision references it). When omitted, a fork to a sandbox copies the source sandbox's live state directly and no snapshot is persisted; a fork to an application still takes a snapshot, since its revision references one.
Traffic percentage for canary deployment (0-100). When set on an existing target, creates a new revision with this traffic percentage.
10
Response
Resource created successfully
Response returned after forking a sandbox. Contains either the new sandbox or application depending on the fork type.
Name of the created or updated resource
The snapshot ID the fork was created from. Set only when the fork went through a snapshot, meaning an explicit snapshotId was supplied or the fork target is an application. Empty when the fork copied the source sandbox's live state directly.
Type of resource that was created (sandbox or application)
sandbox, application Was this page helpful?