Skip to content

Update VPS firewall options

PUT /api/v2/vps/{id}/firewall/options

Switch the protection of the VPS firewall on or off. Protection decides what happens to incoming traffic that matches no rule. To turn it on, send enabled: true with inboundPolicy: "DROP". Only traffic that matches an allow rule then gets in. To turn it off, send enabled: true with inboundPolicy: "ACCEPT". The client area switch does the same. Keep enabled at true. It is the firewall’s main switch. false switches off the whole firewall, not only protection. A field you leave out keeps its value. Add the allow rules first with POST /api/v2/vps/{id}/firewall, for example for SSH. Without them you can lock yourself out. REJECT is refused as the inbound policy. The response is the state read back after the change. platformFilteringInbound in it, not enabled, says whether protection is on.

Authentication: An API key with the scope write:vm. About keys and scopes

Request

Path parameters

idstringrequired
The VPS ID (vps_…).

Body

enabledboolean
The firewall’s main switch. It is already true on a new VPS. Keep it true. false switches off the whole firewall, not only protection.
inboundPolicystring
For incoming traffic that matches no rule. DROP discards it. ACCEPT lets it in. REJECT is refused (inbound_reject_forbidden). One of ACCEPT, DROP.

Example

PUT /api/v2/vps/{id}/firewall/options
curl -X PUT "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/firewall/options" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"inboundPolicy": "DROP"
}'

Responses

200 Firewall options after the change.

Response 200
{
"enabled": true,
"inboundPolicy": "DROP",
"platformFilteringInbound": true,
"available": true,
"reason": null,
"source": "live",
"mode": "enabled_restrictive",
"summary": "Firewall protection is on. Incoming traffic must match an allow rule to pass.",
"detail": "Traffic that does not match an allow rule is blocked on our side before it reaches the VM.",
"actions": {
"canUpdate": {
"allowed": true,
"reason": null
}
}
}
Response fields
enabledboolean
The firewall’s main switch. It is true on a new VPS even while protection is off. platformFilteringInbound says whether incoming traffic is filtered.
inboundPolicystring
What happens to incoming traffic that matches no rule. ACCEPT lets it in. DROP discards it. REJECT refuses it. One of ACCEPT, DROP, REJECT.
platformFilteringInboundboolean
True when the firewall is on and incoming traffic that matches no rule is kept out.
availableboolean
Whether the live state could be read.
reasonstring or null
Why the state is unavailable. Null when it is available.
sourcestring or null
live when read from the VPS now. fallback when the live state could not be read and defaults are shown.
modestring or null
disabled, enabled_allow_all (on and unmatched traffic still gets in) or enabled_restrictive (on and only allowed traffic gets in).
summarystring or null
The state in one sentence.
detailstring or null
What the state means for incoming traffic.
actionsobject
What you can do with the options now.
canUpdateobject
Whether the options can be changed now.
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400Invalid request. The response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller; code is vps_not_found.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.