Skip to main content

Set Session Egress Policy

POST /v1/egress/session/{session_id}

Set the outbound network policy for a session, replacing any previous session policy, and apply it to the session's current VM if it has one. A policy set on the VM itself (POST /v1/egress/vm/{vm_id}) takes precedence over the session policy. On plans other than Pro and Enterprise only allow_public_repos (package registries) and tls_interception take effect: allow_http, allow_https, allowed_domains and allowed_cidrs are saved as off or empty. On Pro and Enterprise, * in allowed_domains allows any destination. Set tls_interception to false to exempt the VM's HTTPS (port 443) from the platform's interception proxy; vault secrets are then not injected. allowed_cidrs takes public IP addresses or networks; private, shared, loopback, link-local, multicast, reserved and documentation ranges are refused (422), and 0.0.0.0/0 means the whole internet. Returns the stored policy.

Authentication​

Requires authentication via: OAuth2PasswordBearer.

Parameters​

NameInTypeRequiredDescriptionConstraints
session_idpathstringYes
X-API-Keyheaderstring | nullNonullable

Request Body​

Required: Yes

application/json​

Resolved schema:

{
"properties": {
"allow_public_repos": {
"type": "boolean",
"title": "Allow Public Repos",
"default": true
},
"allow_http": {
"type": "boolean",
"title": "Allow Http",
"default": true
},
"allow_https": {
"type": "boolean",
"title": "Allow Https",
"default": true
},
"tls_interception": {
"type": "boolean",
"title": "Tls Interception",
"default": true
},
"allowed_domains": {
"items": {
"type": "string"
},
"type": "array",
"title": "Allowed Domains"
},
"allowed_cidrs": {
"items": {
"type": "string"
},
"type": "array",
"title": "Allowed Cidrs"
}
},
"type": "object",
"title": "EgressPolicyRequest"
}

Field details:

FieldTypeRequiredDescriptionConstraints
allow_public_reposbooleanNodefault=true
allow_httpbooleanNodefault=true
allow_httpsbooleanNodefault=true
tls_interceptionbooleanNodefault=true
allowed_domainsarray<string>No
allowed_domains[]stringNo
allowed_cidrsarray<string>No
allowed_cidrs[]stringNo

Responses​

200​

Successful Response

application/json​

Resolved schema:

{}

400​

session_id is not a valid UUID.

No response body.

401​

No credentials, or the Bearer token / X-API-Key is invalid.

No response body.

403​

The account is disabled, or a guest token was used; or the session belongs to another account.

No response body.

404​

Session not found.

No response body.

422​

Validation Error

application/json​

Resolved schema:

{
"properties": {
"detail": {
"items": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}

Field details:

FieldTypeRequiredDescriptionConstraints
detailarray<object>No
detail[]objectNo
detail[].locarray<string | integer>No
detail[].loc[]string | integerNo
detail[].msgstringNo
detail[].typestringNo

429​

Rate limit exceeded. Retry later.

No response body.