Quickstart
Create a public URL
Start a web server inside your box and create a public URL to access it.Add authentication
Protect your public URL with bearer token or basic authentication.API
Create Public URL
Creates a public URL that exposes a port on your box. Returns the URL and authentication credentials if requested.With Bearer Token
AddbearerToken: true to require an authorization header when accessing the public URL.
With Basic Authentication
AddbasicAuth: true to require username and password when accessing the public URL.
With Both Auth Methods
Enable both authentication methods. Either one will work when accessing the public URL.List Public URLs
Get all active public URLs for this box.Delete Public URL
Remove a public URL by port number.Behavior
One Public URL Per Port
Creating a public URL for a port that already has one will overwrite the previous one, including any auth credentials.Public URL Lifecycle
A public URL outlives a pause. While the box is paused, a request to the URL resumes it. See Waking a Paused Box. Public URLs are removed when the box is deleted.Waking a Paused Box
An incoming HTTP request to a public URL resumes its box if the box is paused. The request is held while the box comes back and until the app’s port is listening, so the caller gets the app’s real response instead of an error. If the public URL requires authentication, the credentials are checked before the box is woken. After container resume and configuration finish, the proxy waits up to 30 additional seconds for the app to become ready. The total HTTP request can take longer than 30 seconds. If the app is still not ready when that wait expires, the request returns503 with a Retry-After: 5 header: a browser gets a page that refreshes itself, and any other client gets a plain 503 to retry. The box is already resumed, and the app can continue starting in the background. Move slow dependency installation, such as a cold npm install, into the image or a snapshot so the init command only needs to start the app.
Set a client timeout that allows for both container resume and the app readiness wait. Both examples below use 90 seconds; increase it if your environment needs more time. Some clients, including httpx, default to a shorter timeout than a cold start takes.
Auto-Resume
Creating a public URL on a paused box automatically resumes it.Examples
Expose an agent-built app
Let an agent build a web app, then create a public URL to test it.Share a secure public URL
Create a public URL with authentication for sharing with team members.Multi-port application
Create multiple public URLs for different services in the same box.Temporary testing public URL
Create a public URL, run tests against it, then clean up.The SDK still supports
getPreviewUrl, listPreviews, and deletePreview, but they are deprecated aliases for getPublicURL, listPublicURLs, and deletePublicURL.