Replace an API key's sandbox network policy
Replaces an API key's layer over the version the policy was read at. A key may only narrow it, its own or another key's. Network policy access must be enabled for the organization. Host egress, DNS and bandwidth enforcement is not yet available. Creates requiring an unsupported restriction return 503 NETWORK_POLICY_UNSUPPORTED. Only the organization layer's preview source restrictions are enforced. Host policy updates are not pushed to running sandboxes. The router applies updated organization preview restrictions on each new request, including previews of existing sandboxes, after receiving the new policy version.
Required permission
Requires the sandboxes.network_admin permission. See Permissions for the roles and API key permissions that include it.
Command line
The orl CLI wraps this endpoint:
Guided workflow: orl sandbox network-policy set
orl sandbox network-policy set --expected-version <expected-version> --file <file> --key <key>apiKeyAuthorizationBearer <token>OpenRelay API key. Send it as Authorization: Bearer or_… (legacy vl_… keys still work).
keyId*stringapplication/json- body
layer*One level's network policy. A missing field restricts nothing. Every level (organization, user, key, sandbox) is a ceiling on the ones below it: a destination is reachable only if every layer admits it.
expectedVersion*integerThe version the policy was read at.
int640 <= valueThe written layer, at the bundle's new version
application/json- response
version*integerThe policy's version. Send it as expectedVersion on a write.
int64layer?One level's network policy. A missing field restricts nothing. Every level (organization, user, key, sandbox) is a ceiling on the ones below it: a destination is reachable only if every layer admits it.
defaults?The organization's only. The sandbox layer of a create that names neither network nor egress.
updatedAt?stringdate-timeupdatedBy?stringuser: for a session, key: for an API key.
curl -X PUT 'https://api.openrelay.inc/v1/sandbox-network-policy/keys/string' \ -H 'Content-Type: application/json' \ -d '{ "layer": {}, "expectedVersion": 0}'{ "version": 0, "layer": { "egress": { "mode": "open", "allow": [ { "cidr": "string", "domain": "string", "protocol": "any", "ports": [ 0 ] } ], "deny": [ { "cidr": "string", "domain": "string", "protocol": "any", "ports": [ 0 ] } ] }, "dns": { "blockBypass": true }, "ingress": { "previewSources": [ "string" ] }, "bandwidth": { "egressMbps": 0, "ingressMbps": 0 } }, "defaults": { "egress": { "mode": "open", "allow": [ { "cidr": "string", "domain": "string", "protocol": "any", "ports": [ 0 ] } ], "deny": [ { "cidr": "string", "domain": "string", "protocol": "any", "ports": [ 0 ] } ] }, "dns": { "blockBypass": true }, "ingress": { "previewSources": [ "string" ] }, "bandwidth": { "egressMbps": 0, "ingressMbps": 0 } }, "updatedAt": "2019-08-24T14:15:22Z", "updatedBy": "string"}Delete an API key's sandbox network policy DELETE
Removes an API key's sandbox network layer using its read version. An API key may delete the layer only when it restricts nothing. A layer outlives its key until it is deleted. Network policy access must be enabled for the organization. Host egress, DNS and bandwidth enforcement is not yet available. Creates requiring an unsupported restriction return 503 NETWORK_POLICY_UNSUPPORTED. Only the organization layer's preview source restrictions are enforced. Host policy updates are not pushed to running sandboxes. The router applies updated organization preview restrictions on each new request, including previews of existing sandboxes, after receiving the new policy version.
Get the current sandbox fleet observation GET
Read active sandbox counts and configured vCPUs for your organization, with observation timestamps and host coverage. Returns the organization's active sandbox sessions and their configured vCPUs from fresh host observations. Active sessions include paused sessions; these counts do not describe currently executing commands or physically reserved CPU. Incomplete observations identify the reporting and expected host counts. Availability is enabled per organization; unavailable organizations receive 404.