Sandbox SDK
API Reference

Ports

Expose sandbox services without serializing preview credentials.

Exposing a port

ports.ts
const preview = await sandbox.ports.expose(3000);
console.log(preview.url);

ExposedPort reports port, url, public, and authenticated.

Requesting an authenticated preview

ports.ts
const response = await preview.request?.("/health");

Authenticated adapters keep preview credentials inside request(). toJSON() never returns credential-bearing headers and redacts URL query values.

ProviderPort behavior
LocalReturns a private URL and bridges calls through request().
E2BReturns an E2B host and uses a native access token when required.
DaytonaReturns a public or token-authenticated preview URL.
Vercel SandboxRegisters the port and returns a public vercel.run route.
Upstash BoxReturns a public URL or keeps its bearer token inside request().

Compare provider preview behavior in Providers.

On this page