Configure the workspace
Outbound network access
Restrict Environment destinations and configure default-deny access.
On this page
Configure outbound access
An Environment's network policy applies to every Session, native Harness, shell and background process in its Sandbox. Sandbox0 enforces the policy outside the guest. Use Environment → Configuration → Outbound network access in the console, or the public operations below.
Choose Block outbound access (block-all) for a restricted workload and
add only the domains it needs. In this mode, domain exceptions allow access.
With allow-all, exceptions block access. Exact names do not include
subdomains; *.example.com is a wildcard suffix. Enter domain names without a
URL, path, IP address or port. Domain exception rules cover all ports; the
Platform editor does not expose Sandbox0 CIDR, port or protocol-operation rules.
New Environments default to allow-all with no exceptions. You can set
networkPolicy when creating an Environment through the API or console. It is
stored before Sandbox provisioning, so repository initialization is subject to
the same policy. Allow any repository, redirect and dependency hosts required
for setup. A model connection URL never adds a network exception automatically.
Read the current policy
Reads return the configured base policy without waking a paused Sandbox. Use a personal token for a personal Environment, or the owning Project's token for a Project Environment. Cross-owner and cross-Project requests return 404.
Read Environment outbound policy
/v1/environments/{environmentId}/network-policyRequires a personal token for a personal Environment or a token scoped to its owning Project. Reads stored configuration without resuming a paused Sandbox.
Authentication: Platform API bearer token
Parameters and headers
| Field | Type and constraints | Required | Description |
|---|---|---|---|
path: environmentId | string · min length 1 | Yes | Environment identifier. It must belong to the caller’s account or Project. |
Request example
curl \
"https://api.sandpi.ai/v1/environments/$ENVIRONMENT_ID/network-policy" \
-H "Authorization: Bearer $SANDPI_API_TOKEN"No request body.
Responses
200 Configured base outbound policy. Enabled egress credentials are composed separately.Response body application/json
| Field | Type and constraints | Required | Description |
|---|---|---|---|
data | object · extra fields rejected | Yes | Environment-wide outbound policy, enforced by Sandbox0. Domain exceptions allow destinations in block-all mode and deny destinations in allow-all mode. Enabled egress credentials also allow their destinations in block-all mode. This policy does not restrict HTTP methods, paths, or local commands. |
data.mode | string · values: "allow-all" | "block-all" | Yeswithin data | Default for outbound traffic not matched by a domain exception or enabled credential destination. |
data.domainExceptions | array · max 500 items | Yeswithin data | Domains allowed in block-all mode or denied in allow-all mode. Exact names do not automatically include subdomains. |
data.domainExceptions[] | string · min length 1; max length 255 | Yeseach array item | Exact domain or wildcard suffix such as *.example.com. URLs, paths, ports and IP literals are not supported. Names are normalized to lowercase and deduplicated. |
Example
{
"data": {
"mode": "allow-all",
"domainExceptions": [
"example"
]
}
}Error responses
400 Invalid request.application/json
401 Missing or invalid Platform API token.application/json
404 Resource not found or outside token scope.application/json
default Sandpi error.Error body application/json
Standard error envelope containing a stable code, diagnostic message and request identity.
| Field | Type and constraints | Required | Description |
|---|---|---|---|
error | object · extra fields rejected | Yes | Structured failure information. Inspect the stable code and retain the request ID for investigation. |
error.code | string | Yeswithin error | Stable error code used to distinguish failures programmatically. |
error.message | string | Yeswithin error | Human-readable diagnostic text. |
error.requestId | string | Yeswithin error | Request identifier for correlating diagnostics and support investigations. |
error.details | any | Nowithin error | Optional structured error context. Its shape is specific to the service failure. |
error.loginUrl | string | Nowithin error | Authentication URL supplied when a browser login is required. |
error.registrationOpen | boolean | Nowithin error | Whether new account registration is enabled for this deployment. |
Example
{
"error": {
"code": "platform_balance_insufficient",
"message": "Top up Platform credits before submitting a Run.",
"requestId": "req_example"
}
}Enabled egress credentials are composed
into this policy separately. In block-all, each enabled credential with a
current source version also allows its configured domain and port destinations.
Review these bindings as well as the base policy when checking outbound access.
Replace the policy
Replacement changes the complete base policy and preserves existing credential bindings. The Environment must be ready. A paused Sandbox can be updated without resuming it or starting a model request.
Replace Environment outbound policy
/v1/environments/{environmentId}/network-policyReplace the complete base policy under the Environment lifecycle lock. Requires a ready Environment and exact token scope. Paused Sandboxes are supported without resuming. A Run, initialization, checkpoint, rollback or lifecycle transition holding the lock returns 409 platform_environment_busy; stop active work and retry. Success follows Sandbox0 acknowledgement and configuration persistence. Updates reconcile existing Sandbox connections, so permitted clients may need to reconnect. Enabled egress credentials remain composed into the policy. Forks inherit the base policy; RootFS rollback does not revert it. An ambiguous failure must be retried with the same desired policy.
Authentication: Platform API bearer token
Parameters and headers
| Field | Type and constraints | Required | Description |
|---|---|---|---|
path: environmentId | string · min length 1 | Yes | Environment identifier. It must belong to the caller’s account or Project. |
Request example
curl -X PUT \
"https://api.sandpi.ai/v1/environments/$ENVIRONMENT_ID/network-policy" \
-H "Authorization: Bearer $SANDPI_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mode": "block-all",
"domainExceptions": [
"gateway.example.com"
]
}'Request body · required application/json
Environment-wide outbound policy, enforced by Sandbox0. Domain exceptions allow destinations in block-all mode and deny destinations in allow-all mode. Enabled egress credentials also allow their destinations in block-all mode. This policy does not restrict HTTP methods, paths, or local commands.
| Field | Type and constraints | Required | Description |
|---|---|---|---|
mode | string · values: "allow-all" | "block-all" | Yes | Default for outbound traffic not matched by a domain exception or enabled credential destination. |
domainExceptions | array · max 500 items | Yes | Domains allowed in block-all mode or denied in allow-all mode. Exact names do not automatically include subdomains. |
domainExceptions[] | string · min length 1; max length 255 | Yeseach array item | Exact domain or wildcard suffix such as *.example.com. URLs, paths, ports and IP literals are not supported. Names are normalized to lowercase and deduplicated. |
Example
{
"mode": "block-all",
"domainExceptions": [
"gateway.example.com"
]
}Responses
200 Configured base outbound policy. Enabled egress credentials are composed separately.Response body application/json
| Field | Type and constraints | Required | Description |
|---|---|---|---|
data | object · extra fields rejected | Yes | Environment-wide outbound policy, enforced by Sandbox0. Domain exceptions allow destinations in block-all mode and deny destinations in allow-all mode. Enabled egress credentials also allow their destinations in block-all mode. This policy does not restrict HTTP methods, paths, or local commands. |
data.mode | string · values: "allow-all" | "block-all" | Yeswithin data | Default for outbound traffic not matched by a domain exception or enabled credential destination. |
data.domainExceptions | array · max 500 items | Yeswithin data | Domains allowed in block-all mode or denied in allow-all mode. Exact names do not automatically include subdomains. |
data.domainExceptions[] | string · min length 1; max length 255 | Yeseach array item | Exact domain or wildcard suffix such as *.example.com. URLs, paths, ports and IP literals are not supported. Names are normalized to lowercase and deduplicated. |
Example
{
"data": {
"mode": "allow-all",
"domainExceptions": [
"example"
]
}
}Error responses
400 Invalid request.application/json
401 Missing or invalid Platform API token.application/json
404 Resource not found or outside token scope.application/json
409 Environment is not ready, is being deleted, or a Run or lifecycle operation holds its lock. Wait for conflicting work to settle and retry.application/json
415 Unsupported request media type.application/json
503 Sandbox network control is unavailable or the policy update could not be confirmed. Retry the same desired policy.application/json
default Sandpi error.Error body application/json
Standard error envelope containing a stable code, diagnostic message and request identity.
| Field | Type and constraints | Required | Description |
|---|---|---|---|
error | object · extra fields rejected | Yes | Structured failure information. Inspect the stable code and retain the request ID for investigation. |
error.code | string | Yeswithin error | Stable error code used to distinguish failures programmatically. |
error.message | string | Yeswithin error | Human-readable diagnostic text. |
error.requestId | string | Yeswithin error | Request identifier for correlating diagnostics and support investigations. |
error.details | any | Nowithin error | Optional structured error context. Its shape is specific to the service failure. |
error.loginUrl | string | Nowithin error | Authentication URL supplied when a browser login is required. |
error.registrationOpen | boolean | Nowithin error | Whether new account registration is enabled for this deployment. |
Example
{
"error": {
"code": "platform_balance_insufficient",
"message": "Top up Platform credits before submitting a Run.",
"requestId": "req_example"
}
}Runs, initialization, checkpoint work, rollback and lifecycle changes hold the
Environment lock. A conflicting update returns HTTP 409
platform_environment_busy. Stop active work if necessary, wait for checkpoint
and pause work to settle, then retry. Policy changes are not queued behind a Run.
A successful response follows Sandbox0 acknowledgement and persistence of the configuration. Active-policy updates reconcile existing Sandbox connections; even permitted clients may need to reconnect. If the request fails ambiguously, retry the same desired policy before starting more work; a configuration read alone does not prove that an interrupted update finished applying.
Keep pilot boundaries explicit
For an isolated validation pilot, configure the policy before starting work, prepare the public repository and dependencies, and then narrow access to the model endpoint and any remaining required hosts. Verify a permitted destination and a blocked destination in the actual Environment.
Allowing a domain does not make its requests read-only. This control does not
filter HTTP methods, repository paths or local commands such as git commit.
Keep GitHub write credentials, production credentials and Controller access
tokens out of the Sandbox. Use separate controls for those permissions and for
BYOK spending limits.
Forks and rollback
A fork copies its source's base network policy but has no inherited egress credential bindings. Later policy edits are independent. RootFS rollback does not revert network policy; deleting an Environment removes its Sandbox.