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
idstringrequiredvps_…).Body
enabledbooleantrue on a new VPS. Keep it true. false switches off the whole firewall, not only protection.inboundPolicystringDROP discards it. ACCEPT lets it in. REJECT is refused (inbound_reject_forbidden). One of ACCEPT, DROP.Example
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.
{ "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
enabledbooleantrue on a new VPS even while protection is off. platformFilteringInbound says whether incoming traffic is filtered.inboundPolicystringACCEPT lets it in. DROP discards it. REJECT refuses it. One of ACCEPT, DROP, REJECT.platformFilteringInboundbooleanavailablebooleanreasonstring or nullsourcestring or nulllive when read from the VPS now. fallback when the live state could not be read and defaults are shown.modestring or nulldisabled, enabled_allow_all (on and unmatched traffic still gets in) or enabled_restrictive (on and only allowed traffic gets in).summarystring or nulldetailstring or nullactionsobjectcanUpdateobjectallowedbooleanreasonstring or nullcodestring or nullErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is vps_not_found. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |