Fork a sandbox
curl --request POST \
--url https://api.bonya.ai/v1/sandbox/{sandbox_id}/fork \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"count": 2
}'import requests
url = "https://api.bonya.ai/v1/sandbox/{sandbox_id}/fork"
payload = { "count": 2 }
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({count: 2})
};
fetch('https://api.bonya.ai/v1/sandbox/{sandbox_id}/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.bonya.ai/v1/sandbox/{sandbox_id}/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([
'count' => 2
]),
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.bonya.ai/v1/sandbox/{sandbox_id}/fork"
payload := strings.NewReader("{\n \"count\": 2\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.bonya.ai/v1/sandbox/{sandbox_id}/fork")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"count\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bonya.ai/v1/sandbox/{sandbox_id}/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 \"count\": 2\n}"
response = http.request(request)
puts response.read_body{
"sandbox_id": "<string>",
"from_warm": true,
"sandboxes": [
{
"id": "<string>",
"name": "<string>",
"organization_id": "<string>",
"template_version": "<string>",
"state": "creating",
"generation": 123,
"vcpus": 123,
"memory_mib": 123,
"user_layer_bytes": 123,
"created_at": "2023-11-07T05:31:56Z",
"network": {
"mode": "open",
"allow": [
{
"domain": "<string>",
"cidr": "<string>"
}
]
},
"network_revision": 123,
"network_applied_revision": 123,
"failure_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"parent_snapshot_id": "<string>",
"forked_from_sandbox_id": "<string>",
"pause_source": "<string>",
"image": {
"reference": "<string>",
"digest": "<string>"
},
"gpu": {
"type": "<string>",
"count": 2
},
"exec_capability_jws": "<string>"
}
]
}{
"sandbox_id": "<string>",
"from_warm": true,
"sandboxes": [
{
"id": "<string>",
"name": "<string>",
"organization_id": "<string>",
"template_version": "<string>",
"state": "creating",
"generation": 123,
"vcpus": 123,
"memory_mib": 123,
"user_layer_bytes": 123,
"created_at": "2023-11-07T05:31:56Z",
"network": {
"mode": "open",
"allow": [
{
"domain": "<string>",
"cidr": "<string>"
}
]
},
"network_revision": 123,
"network_applied_revision": 123,
"failure_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"parent_snapshot_id": "<string>",
"forked_from_sandbox_id": "<string>",
"pause_source": "<string>",
"image": {
"reference": "<string>",
"digest": "<string>"
},
"gpu": {
"type": "<string>",
"count": 2
},
"exec_capability_jws": "<string>"
}
]
}{
"sandbox_id": "<string>",
"from_warm": true,
"sandboxes": [
{
"id": "<string>",
"name": "<string>",
"organization_id": "<string>",
"template_version": "<string>",
"state": "creating",
"generation": 123,
"vcpus": 123,
"memory_mib": 123,
"user_layer_bytes": 123,
"created_at": "2023-11-07T05:31:56Z",
"network": {
"mode": "open",
"allow": [
{
"domain": "<string>",
"cidr": "<string>"
}
]
},
"network_revision": 123,
"network_applied_revision": 123,
"failure_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"parent_snapshot_id": "<string>",
"forked_from_sandbox_id": "<string>",
"pause_source": "<string>",
"image": {
"reference": "<string>",
"digest": "<string>"
},
"gpu": {
"type": "<string>",
"count": 2
},
"exec_capability_jws": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>"
}Sandboxes
Fork a sandbox
Creates count new sandboxes with the source’s memory and disk, on the source’s node. 201 when every child is running, 200 when some failed (see each child’s state), 202 on a repeat whose first fork is still running.
POST
/
v1
/
sandbox
/
{sandbox_id}
/
fork
Fork a sandbox
curl --request POST \
--url https://api.bonya.ai/v1/sandbox/{sandbox_id}/fork \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"count": 2
}'import requests
url = "https://api.bonya.ai/v1/sandbox/{sandbox_id}/fork"
payload = { "count": 2 }
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({count: 2})
};
fetch('https://api.bonya.ai/v1/sandbox/{sandbox_id}/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.bonya.ai/v1/sandbox/{sandbox_id}/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([
'count' => 2
]),
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.bonya.ai/v1/sandbox/{sandbox_id}/fork"
payload := strings.NewReader("{\n \"count\": 2\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.bonya.ai/v1/sandbox/{sandbox_id}/fork")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"count\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bonya.ai/v1/sandbox/{sandbox_id}/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 \"count\": 2\n}"
response = http.request(request)
puts response.read_body{
"sandbox_id": "<string>",
"from_warm": true,
"sandboxes": [
{
"id": "<string>",
"name": "<string>",
"organization_id": "<string>",
"template_version": "<string>",
"state": "creating",
"generation": 123,
"vcpus": 123,
"memory_mib": 123,
"user_layer_bytes": 123,
"created_at": "2023-11-07T05:31:56Z",
"network": {
"mode": "open",
"allow": [
{
"domain": "<string>",
"cidr": "<string>"
}
]
},
"network_revision": 123,
"network_applied_revision": 123,
"failure_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"parent_snapshot_id": "<string>",
"forked_from_sandbox_id": "<string>",
"pause_source": "<string>",
"image": {
"reference": "<string>",
"digest": "<string>"
},
"gpu": {
"type": "<string>",
"count": 2
},
"exec_capability_jws": "<string>"
}
]
}{
"sandbox_id": "<string>",
"from_warm": true,
"sandboxes": [
{
"id": "<string>",
"name": "<string>",
"organization_id": "<string>",
"template_version": "<string>",
"state": "creating",
"generation": 123,
"vcpus": 123,
"memory_mib": 123,
"user_layer_bytes": 123,
"created_at": "2023-11-07T05:31:56Z",
"network": {
"mode": "open",
"allow": [
{
"domain": "<string>",
"cidr": "<string>"
}
]
},
"network_revision": 123,
"network_applied_revision": 123,
"failure_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"parent_snapshot_id": "<string>",
"forked_from_sandbox_id": "<string>",
"pause_source": "<string>",
"image": {
"reference": "<string>",
"digest": "<string>"
},
"gpu": {
"type": "<string>",
"count": 2
},
"exec_capability_jws": "<string>"
}
]
}{
"sandbox_id": "<string>",
"from_warm": true,
"sandboxes": [
{
"id": "<string>",
"name": "<string>",
"organization_id": "<string>",
"template_version": "<string>",
"state": "creating",
"generation": 123,
"vcpus": 123,
"memory_mib": 123,
"user_layer_bytes": 123,
"created_at": "2023-11-07T05:31:56Z",
"network": {
"mode": "open",
"allow": [
{
"domain": "<string>",
"cidr": "<string>"
}
]
},
"network_revision": 123,
"network_applied_revision": 123,
"failure_reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"parent_snapshot_id": "<string>",
"forked_from_sandbox_id": "<string>",
"pause_source": "<string>",
"image": {
"reference": "<string>",
"digest": "<string>"
},
"gpu": {
"type": "<string>",
"count": 2
},
"exec_capability_jws": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>"
}Authorizations
personalApiKeysupabaseJwt
Personal byk_ API key; user-principal, resolved to a tenant by org context.
Headers
Org context. Omitted means the caller's personal organization. A well-formed non-member org is 404; malformed is 400.
Absent means server-generated, which provides no deduplication; only client-supplied keys dedupe.
Maximum string length:
255Path Parameters
Body
application/json
Required range:
x >= 1