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

# Network access

> Cut an instance off from the internet, or let it reach only the domains and addresses you list.

Every instance can reach the public internet by default. The `network` field limits where it can connect: set it when you [create](https://www.agent37.com/docs/agents-api/instances/create.md) the instance, or change it any time with [`PATCH /v1/instances/{id}`](https://www.agent37.com/docs/agents-api/instances/edit). A change applies to the running instance within seconds, with no restart, and connections it no longer allows are cut.

| Value | What the instance can reach |
| - | - |
| `"allow-all"` | The whole public internet. The default. |
| `"deny-all"` | Nothing, including DNS. |
| `{ "allow": [...] }` | Only the listed domains and IPv4 addresses and ranges, up to 100 entries. |

```bash theme={null}
curl -X PATCH https://api.agent37.com/v1/instances/ab12cd34ef \
  -H "Authorization: Bearer $AGENT37_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "network": { "allow": ["github.com", "*.npmjs.org", "203.0.113.0/24"] } }'
```

The response is the full [instance object](https://www.agent37.com/docs/agents-api/instances/object.md), with the list as stored: a domain comes back lowercase, a bare address comes back as `/32`, and a range is written as its network address (`203.0.113.9/24` becomes `203.0.113.0/24`).

A common pattern is to install dependencies with the internet open, then lock the instance down before it runs code you do not trust:

```bash theme={null}
curl -X POST https://sandbox.agent37.app/v1/instances/ab12cd34ef/exec \
  -H "X-Agent37-Key: $AGENT37_API_KEY" -H "Content-Type: application/json" \
  -d '{ "command": "npm install" }'

curl -X PATCH https://api.agent37.com/v1/instances/ab12cd34ef \
  -H "Authorization: Bearer $AGENT37_API_KEY" -H "Content-Type: application/json" \
  -d '{ "network": "deny-all" }'
```

When the `PATCH` returns `200`, the policy is in force. If it returns `503 try_again`, the new policy is saved and reaches the instance within two minutes; send the same request again to confirm it.

## Domains

A domain entry lets the instance make HTTPS connections to that name.

* `github.com` matches github.com only.
* `*.github.com` matches github.com and every name under it, such as api.github.com. The `*` must be a whole label at the start.
* Write the name alone, with no `https://`, path or port.

Domains cover HTTPS on port 443, which is how package registries, git over HTTPS and model APIs are reached. Plain HTTP and every other port follow the address entries only, so an `http://` URL or SSH to a listed domain stays blocked unless its address is on the list too.

A list with any domain on it can look names up on its own, with no resolver listed. A connection to a name that is not on the list is refused with a TLS access denied alert, so the client reports `tlsv1 alert access denied` (`ERR_SSL_TLSV1_ALERT_ACCESS_DENIED` in Node). An outage looks different: a timeout, a reset, or a DNS failure.

## What a policy covers

* **Outbound connections only.** Requests to the instance's own URLs, [public ports](https://www.agent37.com/docs/agents-api/public-ports.md), [exec](https://www.agent37.com/docs/agents-api/exec.md), [logs](https://www.agent37.com/docs/agents-api/logs.md), and [SSH](https://www.agent37.com/docs/agents-api/ssh.md) keep working under any policy.
* **DNS counts as a connection.** Under `deny-all` or a list of addresses only, names do not resolve unless a resolver is on the list. Add `1.1.1.1` and `8.8.8.8` to look names up. A list with any domain resolves names without them.
* **Managed services count too.** The built-in model and tools are reached at `api.agent37.com`, so add that domain to a list to keep them. Under `deny-all` they are unavailable.
* **Private ranges stay blocked.** Listing a private address (such as `10.0.0.0/8`), or a domain that points at one, has no effect: an instance can never reach private networks, other instances, or the machine it runs on.
* **Entries are domains and IPv4.** IPv6 returns `400 invalid_request`.

The policy stays with the instance through stop, start, restart, sleep, resize, update, backups and restores, and a [fork](https://www.agent37.com/docs/agents-api/instances/fork.md) starts with its source's policy. It works the same on [VM instances](https://www.agent37.com/docs/agents-api/vm-instances.md).

For a fixed outbound address that another service can put on its own allow list, see [Static outbound IP](https://www.agent37.com/docs/agents-api/static-ip.md).


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