Skip to main content
PUT
Replace a sandbox's network policy

Authorizations

Authorization
string
header
required

Boat bearer token in the form boat_.... Service API keys authenticate sandbox operations.

Path Parameters

sandboxId
string
required

Public Sandbox id returned by create/list/get sandbox calls.

Pattern: ^bx_[23456789abcdefghjkmnpqrstuvwxyz]{8}$

Body

application/json

What the sandbox may connect to. Send mode, inbound or both: at least one. The side that the request does not name stays as it is. A sandbox that sets one side has its own policy and no longer follows its environment; mode: environment makes it follow again. On create, omitted means the policy of its environment; with from, the policy that the saved snapshot's sandbox had. On fork, omitted means what the source sandbox has. An API key without the network.write action always gets the policy that the sandbox would have without this field, a tighter one included: any other value is refused with 403 api_key_action_forbidden. A bad policy is refused with 400 invalid_network_policy. When no host can enforce a policy now, create and fork answer 409 network_policy_unsupported. A CI runner is always open and follows no environment.

mode
enum<string>

open: no limit. deny: the sandbox opens no connection. allow: it connects only to the entries of allow. environment: no policy of its own; the sandbox follows the policy of its environment (open when the environment sets none). This is the default on create. In an organization environment that sets a policy, only owners and admins can give a sandbox another policy: members get 403 network_policy_managed.

Available options:
open,
deny,
allow,
environment
allow
string[]

With mode allow, 1 to 100 entries; empty or omitted with any other mode. Each entry is a domain (github.com), a wildcard (*.github.com, which covers the domain itself and every subdomain), a public IP address or a public CIDR range. No scheme, port or path. A domain entry allows TCP 443 (matched by TLS SNI) and TCP 80 (matched by HTTP Host). An IP or CIDR entry allows every protocol and port.

Maximum array length: 100
Example:
inbound
enum<string>

Who can connect to the sandbox. open: anyone on the internet, on the ports that the sandbox opens. boat-only: only boat. The host drops every other connection to the sandbox, so code inside cannot make a port public. SSH, editors, port forwards, the desktop and raw ports stop: their routes answer 403 inbound_closed. A caller outside the sandbox (a session, or an API key that does not live in a sandbox) can still publish a port with POST /sandboxes/{id}/host. Commands and files through the API keep working. Omitted on PUT: the sandbox keeps what it has. Omitted on create or fork: what the sandbox inherits, else open. A change of inbound is a change of the policy: the same rules on keys and on organization environments apply.

Available options:
open,
boat-only

Response

Enforced now, or saved on a stopped sandbox and applied before its next start (status is then pending).

ok
boolean
required
Example:

true

type
enum<string>
required

Stable success envelope discriminator added by v1.

Available options:
network.info,
network.updated
network
object
required

The sandbox's outbound network policy.

sandbox
object

The sandbox of this policy and its state now.