Publish or update a preview port
Adds a port to the sandbox’s published set, optionally with an explicit
public or private mode. On a new row, omitted access inherits the
sandbox’s current preview_access default. On an existing row, omitted
access preserves that row’s current mode; only an explicit value
changes it. An explicit private publication is rejected while the
sandbox remains legacy_public, because legacy routing exposes all ports.
curl --request POST \
--url https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"port": 33279
}'import requests
url = "https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports"
payload = { "port": 33279 }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({port: 33279})
};
fetch('https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports', 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.superserve.ai/sandboxes/{sandbox_id}/preview-ports",
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([
'port' => 33279
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.superserve.ai/sandboxes/{sandbox_id}/preview-ports"
payload := strings.NewReader("{\n \"port\": 33279\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.superserve.ai/sandboxes/{sandbox_id}/preview-ports")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"port\": 33279\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"port\": 33279\n}"
response = http.request(request)
puts response.read_body{
"port": 33279,
"access": "public",
"token_version": 2
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Path Parameters
The unique identifier of the sandbox.
Public sandbox ID: a bare UUID, or the region-tagged form sb-<region>-<uuid> (e.g. sb-use-1b4e28ba-…). Treat as an opaque string; the tagged form routes the request to the sandbox's home region. Endpoints accept both forms interchangeably.
^(sb-[a-z0-9]+-)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$Body
Port to publish. Port 49983 is reserved for Superserve's sandbox service.
1024 <= x <= 65535Explicit per-port mode. When omitted for a new row, inherits the sandbox preview_access default. When omitted for an existing row, preserves that row's current mode.
public, private Response
Published port
Published port. Port 49983 is reserved for Superserve's sandbox service.
1024 <= x <= 65535Independent access mode for this published port. Requests to a
private port must present its preview token using the header named
by the token-mint response's header field, the signed-link query
parameter named by query_param, or the cookie established by a
successful signed-link GET bootstrap.
public, private Durable generation used to scope credentials for this port. Rotation, access changes, and unpublish/re-publish advance it.
x >= 1curl --request POST \
--url https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"port": 33279
}'import requests
url = "https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports"
payload = { "port": 33279 }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({port: 33279})
};
fetch('https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports', 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.superserve.ai/sandboxes/{sandbox_id}/preview-ports",
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([
'port' => 33279
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.superserve.ai/sandboxes/{sandbox_id}/preview-ports"
payload := strings.NewReader("{\n \"port\": 33279\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.superserve.ai/sandboxes/{sandbox_id}/preview-ports")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"port\": 33279\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.superserve.ai/sandboxes/{sandbox_id}/preview-ports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"port\": 33279\n}"
response = http.request(request)
puts response.read_body{
"port": 33279,
"access": "public",
"token_version": 2
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}