Skip to main content
POST
/
v1
/
sandboxes
/
{id}
/
ports
/
{port}
/
signed-preview-url
Create a signed browser preview URL
import requests

url = "https://api.13-215-85-171.sslip.io/v1/sandboxes/{id}/ports/{port}/signed-preview-url"

payload = { "expires_in_seconds": 43230 }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
{ "grant": { "id": "<string>", "sandbox_id": "<string>", "port": 123, "token_kinds": [], "principal_kind": "user", "issued_at": "2023-11-07T05:31:56Z", "expires_at": "2023-11-07T05:31:56Z", "use_count": 123, "http_request_count": 123, "websocket_connection_count": 123, "bytes_in_count": 123, "bytes_out_count": 123, "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z", "principal_id": "<string>", "revoked_at": "2023-11-07T05:31:56Z", "first_used_at": "2023-11-07T05:31:56Z", "last_used_at": "2023-11-07T05:31:56Z", "last_error_code": "<string>", "last_error_at": "2023-11-07T05:31:56Z", "disabled_at": "2023-11-07T05:31:56Z" }, "url": "<string>", "websocket_url": "<string>", "access_token_expires_at": "2023-11-07T05:31:56Z", "access_token_transport": "query" }

Authorizations

Authorization
string
header
required

API key passed as Bearer token

Path Parameters

id
string
required

Sandbox ID (e.g. sb_a1b2c3d4)

port
integer<uint16>
required

Sandbox guest port to expose through browser preview. Reserved generic-preview ports are rejected: 22 is SSH-specific and 5900-5999 are desktop/VNC-specific.

Required range: 1 <= x <= 65535

Body

application/json
expires_in_seconds
integer<uint64>

Requested preview grant lifetime. Defaults to the deployment edge token TTL, clamped between 60 seconds and 24 hours.

Required range: 60 <= x <= 86400

Response

Signed browser preview URL and durable grant metadata

grant
object
required
url
string<uri>
required

Signed HTTP preview URL containing a short-lived query token.

websocket_url
string
required

Signed WebSocket preview URL containing a short-lived query token.

access_token_expires_at
string<date-time>
required
access_token_transport
enum<string>
required
Available options:
query