Open a web preview of a port at https://<sandbox-id>-<port>.<region>.<domain>
PUT
/sandboxes/{id}/previews/{port}
const url = 'https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/previews/1';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"visibility":"private"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/previews/1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "visibility": "private" }'Ports are closed until a preview opens them. A private preview (the default) needs your API key in an
Authorization: Bearer header; the gateway removes the key before relaying. A public preview is open to
anyone with its address. Port 49100 is reserved.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
port
required
integer
Request Body
Section titled “Request Body”Media typeapplication/json
object
visibility
string
Responses
Section titled “Responses”The preview
Media typeapplication/json
object
port
required
integer
visibility
required
string
url
The preview’s address; absent while the region has no domain yet.
string
Example
{ "visibility": "private"}The request is invalid
Media typeapplication/json
object
code
required
string
message
required
string
Example
{ "code": "not_found"}The API key is missing or invalid
Media typeapplication/json
object
code
required
string
message
required
string
Example
{ "code": "not_found"}No such sandbox in your organization (or no such file)
Media typeapplication/json
object
code
required
string
message
required
string
Example
{ "code": "not_found"}