Skip to main content
PATCH
/
sandboxes
/
{sandbox_id}
Update a sandbox
curl --request PATCH \
  --url https://api.tensorlake.ai/sandboxes/{sandbox_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "allow_unauthenticated_access": true,
  "exposed_ports": [
    32768
  ]
}
'
import requests

url = "https://api.tensorlake.ai/sandboxes/{sandbox_id}"

payload = {
"allow_unauthenticated_access": True,
"exposed_ports": [32768]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({allow_unauthenticated_access: true, exposed_ports: [32768]})
};

fetch('https://api.tensorlake.ai/sandboxes/{sandbox_id}', 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.tensorlake.ai/sandboxes/{sandbox_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'allow_unauthenticated_access' => true,
'exposed_ports' => [
32768
]
]),
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.tensorlake.ai/sandboxes/{sandbox_id}"

payload := strings.NewReader("{\n \"allow_unauthenticated_access\": true,\n \"exposed_ports\": [\n 32768\n ]\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://api.tensorlake.ai/sandboxes/{sandbox_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"allow_unauthenticated_access\": true,\n \"exposed_ports\": [\n 32768\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.tensorlake.ai/sandboxes/{sandbox_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allow_unauthenticated_access\": true,\n \"exposed_ports\": [\n 32768\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "namespace": "<string>",
  "created_at": 123,
  "resources": {
    "cpus": 123,
    "memory_mb": 123,
    "disk_mb": 123
  },
  "timeout_secs": 123,
  "allow_unauthenticated_access": true,
  "image": "<string>",
  "pending_reason": "<string>",
  "outcome": "<string>",
  "container_id": "<string>",
  "executor_id": "<string>",
  "ingress_endpoint": "<string>",
  "sandbox_url": "<string>",
  "pool_id": "<string>",
  "network_policy": {
    "allow_internet_access": true,
    "allow_out": [
      "<string>"
    ],
    "deny_out": [
      "<string>"
    ]
  },
  "exposed_ports": [
    32768
  ],
  "template_id": "<string>",
  "name": "<string>"
}
Update public ingress settings for a sandbox. This endpoint controls the sandbox proxy allowlist, including exposed_ports and allow_unauthenticated_access.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

sandbox_id
string
required

The ID of the sandbox.

Body

application/json
allow_unauthenticated_access
boolean

Set or clear unauthenticated ingress routing for this sandbox.

exposed_ports
integer<int32>[]

Replace the exposed port allowlist. Pass an empty array to clear it and revert to the default management port only.

Required range: 1 <= x <= 65535

Response

Sandbox updated successfully

id
string
required
namespace
string
required
status
enum<string>
required
Available options:
pending,
running,
snapshotting,
suspending,
suspended,
terminated
created_at
integer<int64>
required

Milliseconds since Unix epoch.

resources
object
required
timeout_secs
integer<int64>
required
allow_unauthenticated_access
boolean
required

Whether sandbox ingress may route requests without auth validation.

image
string
pending_reason
string | null

Present when status is pending.

outcome
string | null

Platform-specific termination outcome string returned for completed sandboxes.

container_id
string | null
executor_id
string | null
ingress_endpoint
string | null

Canonical server-provided base for sandbox-specific ingress.

sandbox_url
string | null

Sandbox-specific management URL derived from ingress_endpoint.

pool_id
string | null
network_policy
null | object
exposed_ports
integer<int32>[] | null

Additional routable ingress ports. When null, only the management port 9501 is routable.

Required range: 1 <= x <= 65535
template_id
string | null
name
string | null