Skip to main content
Two questions decide a box’s network posture: who is allowed to reach it, and what it is allowed to reach. The inbound half is the public flag and preview URLs; the outbound half is NetworkSpec. Dialing a box port from your own code is a different job, and Network covers it.
The routes on this page live under /api/box/... — the platform API, which is a separate surface from the SDK REST API at /v1/boxes/... used everywhere else in these docs. The singular box and the missing version segment are intentional, not typos.

Prerequisites

  • An API key exported as BOXLITE_API_KEY, and the base URL as BOXLITE_REST_URL. See API keys.
  • A running box with a service listening on a TCP port, bound to 0.0.0.0.
  • Write access to boxes in your organization, for the public flag.

Inbound: who can reach a box

A box is private or public, and any single port on it can be shared through a preview URL. Those are two independent decisions: the flag governs the box, the URL governs one port.

A new box is private

Inbound access is disabled unless you ask for it. Create a box without saying anything about inbound and nothing outside it can reach its services — which is the posture you want for almost every box, and the reason you rarely need the public flag at all. Ask for the other posture at creation time with inbound:
mode takes "enabled" or "disabled", and "disabled" is what you get by omission. Writing it out explicitly sends the same request as leaving it off — it documents the intent for the next reader, nothing more.
The SDK does not read this back: BoxInfo.network is None on Cloud, so you cannot check a box’s inbound posture from await box.info(). Read it from the box’s row in the console instead.
This default changed in 0.10.5, and the old spelling for “public” no longer means that. NetworkSpec used to take a flat mode and allow_net; those now configure outbound only. Code that said:
produced a public box before 0.10.5 and produces a private one now, so a tunnel against it fails:
Add the inbound half:
InboundNetworkSpec carries an allow_net field for symmetry with the outbound side, but no layer enforces an inbound allowlist, so a non-empty value is refused before the request leaves your process:
Inbound is governed by mode alone. To let one audience in rather than everyone, keep the box private and share a signed URL. You are not locked in: the public flag below flips an existing box either way, without recreating it or losing its filesystem.

Where to do each of these

Most of this section is shown as HTTP because that is the only surface some of it has. Two of the four operations are also in the console, and those are the ones you will reach for by hand: The SDK’s network handle exposes tunnel(port) and nothing else, and boxlite network has only tunnel, so neither can change inbound or mint a preview URL. Reach for HTTP when you are automating; reach for the console when you are not.

A preview URL and an SDK tunnel are different tools

A preview URL is an HTTPS address for one port on one box, served by BoxLite’s preview proxy. Anything that speaks HTTPS can fetch it — a browser, curl, a webhook sender, a reviewer on their phone — and none of them needs the BoxLite SDK. An SDK tunnel is the other shape. Your code asks the box for a tunnel and dials it with your API key, and the tunnel carries any TCP protocol rather than only HTTP. Reach for a preview URL when something outside your own code has to fetch an HTTP service in the box: a browser preview, a webhook receiver, a link you send someone. Reach for a tunnel when your program is the client, or when the protocol is not HTTP — SSH, a database wire protocol, a raw byte stream. Tunnels are documented on Network.

Make a box public or private

Open the box, find the network panel, and use the Inbound access switch.The panel states the current posture in the terms that matter:Turning it on asks you to confirm — “Open this box’s preview URLs to anyone?” — because that is exactly what it does. outbound on the same panel is read-only: nothing changes a box’s egress after it is created.
Be clear-eyed about what you just did. A public box drops the credential requirement in front of it: anyone who has a URL to it can reach the service, from anywhere, with no API key and no token, and that holds until you set the flag back to false. A URL is a string — it travels in chat messages, tickets, browser history, referrer headers, and screenshots. Anything the service in that box can read or write is now guarded by the secrecy of a link, so treat the box’s files, its environment variables, and its network credentials as exposed for as long as the flag is on. Set it back to private the moment you no longer need it:
If what you actually want is to let one person see one port for a short while, do not touch this flag at all — use a signed preview URL instead.

Get a preview URL for a port

On the box’s network panel, choose get url and type the port.
That button is disabled while inbound is disabled. The HTTP route is not — it returns a URL and a token for a private box too, which is what the token flow below is for. If get url is greyed out and you expected otherwise, the box is private, not broken.
The port is part of the URL, so a preview URL addresses one port, not the whole box. A box running an app on 8080 and a metrics endpoint on 9090 has two preview URLs, and you fetch each one separately. Change the port your service listens on and the old URL no longer describes it.
Holding the URL is not enough — a tunnel has to be open on that port. The endpoint hands you a URL for any port you name, including one nothing is listening on. The proxy then checks, on every request, that the port has a live tunnel, and answers 404 when it does not:
A 404 here is therefore about the tunnel, not about your path. Open one for each port you intend to expose — box.network.tunnel(<PORT>) in the SDK — and a port without one stays unreachable no matter how well-formed its URL looks.

Present the token when the box is private

A private box’s preview URL is not open, so a request has to carry the token from the response above. The preview proxy accepts it three ways, and tries them in this order:
The query-parameter form is what makes a private preview URL openable in a browser: append it once, and the proxy strips the parameter before the request reaches your service, then sets a cookie so the following requests on that host carry the authorization for you. Because that form puts a credential in a URL, treat such a link like a password — it lands in browser history, server logs, and anything the recipient pastes it into. For sharing with a person, a signed URL is the better instrument: it expires on its own and you can revoke it. A request that carries no credential the proxy accepts is redirected to sign in, so a human reaching a private box in a browser can authenticate instead of being refused outright.

Share a port temporarily with a signed URL

Signed URLs are HTTP-only. There is no console control and no SDK or CLI method for issuing or revoking one, so the calls below are the whole of it.
This is the call to prefer when you want to hand someone a working link and keep the box private. The signature is what authorizes the request, so the recipient needs no API key and you never flip the public flag — the box stays closed to everyone who does not hold the link, and the link stops working on its own. expiresInSeconds is an optional query parameter, and the default is 60 seconds. Sixty seconds is the right size for a link your own code generates and redirects to immediately; pass a larger value when a person has to open it, read it, and click around.
A 200 returns: Generate a fresh signed URL per recipient and per sharing session rather than reusing one. Each is independently revocable, so one leaked link is one link you can kill.

Revoke a signed URL before it expires

The token in the path is the token field from the signed-URL response — that is the reason to keep it rather than discarding everything but the url. A 200 returns no body.
Revoke as soon as the review is over, the demo ends, or the link lands somewhere you did not intend. Waiting for an expiry you set generously is a choice to stay exposed.

Choose between the three

The order matters: start private, escalate to a signed URL when a human needs to see something, and reserve the public flag for a box whose contents you would publish deliberately.

Outbound: what the box can reach

Outbound is a per-box setting you make at creation, not a toggle you flip afterwards. Pass a NetworkSpec as the network field of BoxOptions, and the SDK sends that specification — the mode and the allowlist — to Cloud as part of the create call. There are exactly two modes, enabled and disabled, plus the allow_net allowlist that narrows egress to named hosts. The NetworkSpec parameter table, the useful mode and allowlist combinations, and the verification recipe live on Network access, which owns them. One property of the allowlist decides whether you can debug it. A host outside the allowlist is a DNS sinkhole, not a connection error: it resolves to 0.0.0.0. Your code therefore reports a failed connection to 0.0.0.0 rather than a refusal or a policy message, and a nslookup of a blocked host can still exit 0 because the lookup itself succeeded. Read the resolved address, never the exit code, when you want to know what a box’s DNS returned for a host.
mode="disabled" is the other end of the range. The mode means a box with no network interface at all: DNS and every outbound connection fail, while commands and file operations work as normal. That is the mode to ask for when a box’s only job is to run code you do not trust with a network. Network access documents both modes in full. One more thing to know about a box you did not configure yourself. A box created without a network field inherits your organization’s default, and that default can be limited egress rather than open egress — so a box that resolves fewer hosts than you expect may be following the organization default rather than misbehaving. That default is set at the platform level; it is not a field of BoxOptions and not part of the boxes API.

Troubleshooting

Next steps

Network

Dial a port inside a box from your own code with an SDK tunnel, for HTTP, WebSocket, or any TCP protocol.

Boxes on Cloud

Images, sizes, and the lifecycle controls that decide whether a shared URL still has a box behind it.

Network access

The NetworkSpec parameter table and the egress allowlist in full.