Skip to main content
A box running a web app, a dev server, or an API is only useful once something outside can reach it. Ask the box for a tunnel to the port your server listens on, and the tunnel hands you a public URL.

Prerequisites

  • An API key from the console, exported as BOXLITE_API_KEY. See API keys.
  • pip install boxlite, and the REST URL exported as BOXLITE_REST_URL. See Quickstart.
  • A box you can start, and a service inside it that listens on a TCP port.
  • The box must be created with inbound enabled. A tunnel against a private box is refused, and inbound has defaulted to disabled since 0.10.5 — see Network policy.
Every example reads both values from the environment, so nothing hard-codes a credential.

Get the URL

If a box is already running your service, one command prints its URL:
Expected output:

Read the URL without spending the tunnel

uri() returns the public URL of a tunnel served remotely, which is what a Cloud tunnel is. On a local runtime the same call returns None, because a local tunnel is already a live connection with no address to publish. Reading uri() leaves the tunnel usable — only connect() and forward() spend it. Build a fresh tunnel for each of those.

Troubleshooting

Next steps

Network

How tunnels work, the full parameter reference, and the outbound boundary.

Network policy

Control what the box itself is allowed to reach.