API Reference
Ports
Expose sandbox services without serializing preview credentials.
Exposing a port
const preview = await sandbox.ports.expose(3000);
console.log(preview.url);ExposedPort reports port, url, public, and authenticated.
Requesting an authenticated preview
const response = await preview.request?.("/health");Authenticated adapters keep preview credentials inside request(). toJSON() never returns credential-bearing headers and redacts URL query values.
| Provider | Port behavior |
|---|---|
| Local | Returns a private URL and bridges calls through request(). |
| E2B | Returns an E2B host and uses a native access token when required. |
| Daytona | Returns a public or token-authenticated preview URL. |
| Vercel Sandbox | Registers the port and returns a public vercel.run route. |
| Upstash Box | Returns a public URL or keeps its bearer token inside request(). |
Compare provider preview behavior in Providers.