curl --request POST \
--url https://api.blaxel.ai/v0/sandboxes/{sandboxName}/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"
}
],
"lifecycle": {
"expirationPolicies": [
{
"action": "delete",
"type": "ttl-idle",
"value": "24h"
}
],
"terminatedRetention": "24h"
},
"port": 8080,
"prefix": "<string>",
"snapshotId": "<string>",
"traffic": 10
}
'import requests
url = "https://api.blaxel.ai/v0/sandboxes/{sandboxName}/fork"
payload = {
"targetName": "my-app",
"targetType": "application",
"customDomain": "<string>",
"envs": [
{
"name": "MY_ENV_VAR",
"secret": True,
"value": "my-value"
}
],
"lifecycle": {
"expirationPolicies": [
{
"action": "delete",
"type": "ttl-idle",
"value": "24h"
}
],
"terminatedRetention": "24h"
},
"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'}],
lifecycle: {
expirationPolicies: [{action: 'delete', type: 'ttl-idle', value: '24h'}],
terminatedRetention: '24h'
},
port: 8080,
prefix: '<string>',
snapshotId: '<string>',
traffic: 10
})
};
fetch('https://api.blaxel.ai/v0/sandboxes/{sandboxName}/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/sandboxes/{sandboxName}/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'
]
],
'lifecycle' => [
'expirationPolicies' => [
[
'action' => 'delete',
'type' => 'ttl-idle',
'value' => '24h'
]
],
'terminatedRetention' => '24h'
],
'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/sandboxes/{sandboxName}/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 \"lifecycle\": {\n \"expirationPolicies\": [\n {\n \"action\": \"delete\",\n \"type\": \"ttl-idle\",\n \"value\": \"24h\"\n }\n ],\n \"terminatedRetention\": \"24h\"\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/sandboxes/{sandboxName}/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 \"lifecycle\": {\n \"expirationPolicies\": [\n {\n \"action\": \"delete\",\n \"type\": \"ttl-idle\",\n \"value\": \"24h\"\n }\n ],\n \"terminatedRetention\": \"24h\"\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/sandboxes/{sandboxName}/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 \"lifecycle\": {\n \"expirationPolicies\": [\n {\n \"action\": \"delete\",\n \"type\": \"ttl-idle\",\n \"value\": \"24h\"\n }\n ],\n \"terminatedRetention\": \"24h\"\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"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}Fork sandbox
Forks a sandbox into a new sandbox or application. When forking to a sandbox, the target must not already exist (409 if it does). When forking to an application, a new revision is added if the app already exists, or a new application is created. With no snapshotId, a fork to a sandbox copies the source sandbox’s live state directly and no snapshot is persisted, while a fork to an application takes a snapshot its revision then references. This is a WIP endpoint — the full implementation depends on the execution plane.
curl --request POST \
--url https://api.blaxel.ai/v0/sandboxes/{sandboxName}/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"
}
],
"lifecycle": {
"expirationPolicies": [
{
"action": "delete",
"type": "ttl-idle",
"value": "24h"
}
],
"terminatedRetention": "24h"
},
"port": 8080,
"prefix": "<string>",
"snapshotId": "<string>",
"traffic": 10
}
'import requests
url = "https://api.blaxel.ai/v0/sandboxes/{sandboxName}/fork"
payload = {
"targetName": "my-app",
"targetType": "application",
"customDomain": "<string>",
"envs": [
{
"name": "MY_ENV_VAR",
"secret": True,
"value": "my-value"
}
],
"lifecycle": {
"expirationPolicies": [
{
"action": "delete",
"type": "ttl-idle",
"value": "24h"
}
],
"terminatedRetention": "24h"
},
"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'}],
lifecycle: {
expirationPolicies: [{action: 'delete', type: 'ttl-idle', value: '24h'}],
terminatedRetention: '24h'
},
port: 8080,
prefix: '<string>',
snapshotId: '<string>',
traffic: 10
})
};
fetch('https://api.blaxel.ai/v0/sandboxes/{sandboxName}/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/sandboxes/{sandboxName}/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'
]
],
'lifecycle' => [
'expirationPolicies' => [
[
'action' => 'delete',
'type' => 'ttl-idle',
'value' => '24h'
]
],
'terminatedRetention' => '24h'
],
'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/sandboxes/{sandboxName}/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 \"lifecycle\": {\n \"expirationPolicies\": [\n {\n \"action\": \"delete\",\n \"type\": \"ttl-idle\",\n \"value\": \"24h\"\n }\n ],\n \"terminatedRetention\": \"24h\"\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/sandboxes/{sandboxName}/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 \"lifecycle\": {\n \"expirationPolicies\": [\n {\n \"action\": \"delete\",\n \"type\": \"ttl-idle\",\n \"value\": \"24h\"\n }\n ],\n \"terminatedRetention\": \"24h\"\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/sandboxes/{sandboxName}/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 \"lifecycle\": {\n \"expirationPolicies\": [\n {\n \"action\": \"delete\",\n \"type\": \"ttl-idle\",\n \"value\": \"24h\"\n }\n ],\n \"terminatedRetention\": \"24h\"\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"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}{
"error": "Resource already exists",
"code": 409,
"message": "Invalid request body"
}Authorizations
Body
Request body for forking a sandbox into an application. Creates a new application or adds a canary revision to an existing one.
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.
Response
Fork created successfully
Response returned after forking a sandbox. Contains either the new sandbox or application depending on the fork type.
Was this page helpful?