> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boat.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Outbound

> Block every connection that a sandbox opens, or allow only the domains and IP ranges that you list.

| Mode | The sandbox can connect to |
| - | - |
| `open` (default) | Everything |
| `deny` | Nothing |
| `allow` | Only the entries that you list, at most 100 |

In every mode, boat keeps what the sandbox needs from boat: snapshots, restores, the [boat API](#the-boat-api) and the AI credentials proxy. `boat exec` and files work in every mode.

## Set the mode

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat new --network deny
boat new --network allow --allow github.com --allow '*.npmjs.org'

boat network set bx_f7k2q9hd allow --allow github.com --allow 192.0.43.0/24
boat network set bx_f7k2q9hd open
boat network set bx_f7k2q9hd deny --wait      # wait until the host enforces it
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X PUT "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd/network" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode":"allow","allow":["github.com","*.npmjs.org"]}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.create({ ttlSeconds: 3600, network: { mode: "deny" } });
await sandbox.setNetworkPolicy({ sandboxId, mode: "allow", allow: ["github.com"] });
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
from boat_sdk.models.create_sandbox_request import CreateSandboxRequest
from boat_sdk.models.network_policy_request import NetworkPolicyRequest

sandbox.create(create_sandbox_request=CreateSandboxRequest(ttl_seconds=3600, network=NetworkPolicyRequest(mode="deny")))
sandbox.set_network_policy(sandbox_id, NetworkPolicyRequest(mode="allow", allow=["github.com"]))
```

`$BOAT_API_BASE` is `https://boat.dev/api/v1`.

* A new sandbox has its policy before anyone can use it.
* A change on a running sandbox also ends the open connections that the new mode does not allow.
* A change of the mode keeps the [inbound](https://docs.boat.dev/network-policy/inbound.md) setting.
* For many sandboxes, set the mode on an [environment](https://docs.boat.dev/network-policy/environments.md).

> [!WARNING]
>
> Public URLs and the desktop use a tunnel that the sandbox opens. `deny` and `allow` block that tunnel today. The sandbox can then show `"health": "degraded"`.

## Entries of an allow list

| Entry | Example | Allows |
| - | - | - |
| Domain | `github.com` | TCP 443 and 80 to that name |
| Wildcard | `*.github.com` | The same, for `github.com` and every subdomain |
| IP address or CIDR range | `192.0.43.0/24` | Every protocol and port |

* Write a domain without a scheme, a port or a path. Use punycode (`xn--...`) for an international name.
* An IP address or a range must be public.
* A domain entry does not allow SSH. For `git` over SSH or a database, add the IP range, or use HTTPS.
* DNS in the sandbox answers only for the names that you allow.
* Do not list `boat.dev`. boat refuses an entry that covers the boat API.

boat refuses a bad policy with `400 invalid_network_policy`. The message names the entry.

## What common tools need

| Tool | Entries |
| - | - |
| Git and GitHub | `github.com`, `*.githubusercontent.com` |
| npm | `registry.npmjs.org` |
| pip | `pypi.org`, `files.pythonhosted.org` |
| apt | The mirror in `/etc/apt/sources.list.d` |
| Docker Hub | `registry-1.docker.io`, `auth.docker.io`, `production.cloudfront.docker.com` |
| Claude Code | `api.anthropic.com` |
| Codex | `api.openai.com`, `chatgpt.com` |

With the [AI credentials proxy](https://docs.boat.dev/ai-credentials.md#the-ai-credentials-proxy) on, agents reach the model through boat. Then do not list the AI provider.

## The boat API

A sandbox with `deny` or `allow` still reaches the boat API. boat limits what code inside can do there. `network.apiBound` shows it.

| `apiBound` | The sandbox | Code inside can |
| - | - | - |
| `true` | Started with `deny` or `allow` | Act only as this sandbox. Any other key gets `403 sandbox_bound`. |
| `false` | Got `deny` or `allow` while it ran | Use any boat key, until the next start |
| `null` | Is stopped or still starts | Nothing yet |

To bind a sandbox that shows `false`, restart it:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat stop bx_f7k2q9hd && boat resume bx_f7k2q9hd
```

Inside a bound sandbox, use the `boat` CLI or `$ASCII_API_URL`. `https://boat.dev` does not answer there. Your keys work as before from every other place. This includes [a key for one sandbox](https://docs.boat.dev/api-keys/create-and-list.md#a-key-for-one-sandbox).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.