Grant access
In Settings > API, a workspace owner or admin can generate a key, expand its permissions, and explicitly select Read network policies (network:read) and, when needed, Manage network policies (network:write). Both are excluded from default permissions and the permission presets. Existing keys do not gain either scope automatically.
- Reading a saved policy requires
network:readand access to that workspace. - Replacing a policy requires
network:writeand a current workspace owner/admin role. network:writeis elevated: only owners/admins can mint or manage keys carrying it. A key cannot grant itself additional authority.org:writeorrunalone does not authorize a network-policy write.- To rotate a key, generate a replacement with the required permissions, update its consumers, then delete the old key in Settings > API to revoke it. Revoking a key does not undo policies it already saved.
Authorization: Bearer $REASON_API_KEY. Resolve the workspace’s organization ID with GET /v3/self.
Endpoints
Both endpoints return the saved custom list and whether the network is restricted to it:
network_allowed_hosts replaces the entire list, not an incremental merge. Use {"network_allowed_hosts":[]} to clear that policy’s custom entries.
network_restricted is the same switch as Settings › Network rules. false (the default) allows every public host on any port, so no host needs adding. true holds Sessions to the platform allowlist and the saved hosts.
network:read even when the same key already has network:write.
Accepted hosts
Each policy supports at most 50 entries. Values are trimmed and lowercased. Use an exact public DNS hostname, optionally followed by a port from 1 to 65535. A bare host allows port 443 only;db.example.com:5432 allows exactly port 5432.
Wildcards, URLs, paths, IP literals, private/local names, trailing-dot names, and path-tenant registries under gcr.io or pkg.dev are rejected. Duplicate effective rules are rejected: api.example.com and api.example.com:443 are the same rule. Normalization also makes casing and surrounding whitespace irrelevant for duplicate detection. Existing DNS and private-network protections still apply; adding a hostname does not authorize private addresses.
What changes at runtime
Workspace custom hosts are added to Reason’s platform allowlist; clearing them does not disable the platform’s base destinations. Removing a host from one policy cannot override permission from another applicable source. This API does not provide deny rules or a way to disable confinement. Legacy project network hosts are saved configuration only in the current runtime. Projects group sessions and no longer contribute their network hosts to session execution. There is no current workspace/project union and no dedicated project network-policy endpoint: use the workspace endpoint to change custom hosts used by cloud sessions. Clearing a legacy project list does not remove a workspace grant. The custom hosts are read when a new confined Hands execution starts. An existing execution lease keeps its frozen policy, including during recovery; saving a policy is not an immediate update or revocation on a running machine. Start a fresh execution after changing the policy and verify the destination there. These cloud confinement settings do not reconfigure a connected device’s own network.Databases and other TCP services
A confined cloud computer has no DNS resolver. Commands in Bash, and dev servers started withpreview_start, reach the network only through the proxy in $HTTPS_PROXY, which looks names up itself. Proxy-aware HTTP(S) clients work: curl, git, npm, pip, and Node’s fetch and https. A client that looks a name up itself, such as a PostgreSQL, MySQL or Redis driver or Next.js’s image optimizer, fails with getaddrinfo EAI_AGAIN even for an allowed host. Allowing the host again or retrying does not change that.
Direct PostgreSQL (and other TCP services) is supported through the proxy:
- In a restricted network, allow the host with its port (an open network already allows it), for example
aws-0-eu-west-1.pooler.supabase.com:6543for a Supabase transaction pooler ordb.example.com:5432. - Forward a local port to it through the proxy with
socat, in the same command that starts the client (a dev server’s command, or the same Bash call: a background process ends with the call). - Connect to
127.0.0.1on that port, keeping TLS verified against the real host name.
127.0.0.1 and pass ssl: { servername: DB_HOST }. When a lookup fails, the command’s output carries a [sandbox] line with this command for that computer.
Next.js’s image optimizer (/_next/image) looks remote image hosts up itself, so optimized images fail while the page’s other requests work. Set images.unoptimized: true in development.
Errors
A missing scope returns403 with missing_scope and the required scope. Scope possession does not bypass current role, workspace, or project permissions. Invalid hosts or an invalid body return 400; a missing or expired key returns 401. Inspect the response before retrying rather than broadening the allowed hosts.
