List VPS firewall rules
GET /api/v2/vps/{id}/firewall
Get the VPS firewall: whether it filters incoming traffic, its rules and how many more you can add. Use a rule’s pos as {pos} to change or delete it. Positions shift after every add or delete. Read the list again before the next change. Only rules with editable: true can be changed. Through the API those are the inbound (type: "in") rules. Outbound rules and group references are read-only here. available: false means the state could not be read or a stored rule needs repair by support. reason then says why and changes are blocked. actions.canAddRule and actions.canToggleFirewall say whether you can add a rule or switch the firewall on or off now.
Authentication: An API key with the scope read:vm. About keys and scopes
Request
Path parameters
idstringrequiredvps_…).Example
curl "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/firewall" \ -H "Authorization: Bearer $HOSTUP_API_KEY"Responses
200 Firewall state and rules.
{ "available": true, "reason": null, "enabled": true, "summary": "Firewall protection is on. Incoming traffic must match an allow rule to pass.", "detail": "Traffic that does not match one of the rules below is blocked on our side before it reaches the VM.", "limits": { "maxRules": 100, "currentRules": 1, "remainingRules": 99 }, "rules": [ { "pos": 0, "type": "in", "action": "ACCEPT", "enabled": true, "proto": "tcp", "dport": "22", "sport": null, "source": "198.51.100.10", "dest": null, "description": "Allow SSH from office", "isSystem": false, "editable": true } ], "ruleCount": 1, "actions": { "canAddRule": { "allowed": true, "reason": null }, "canToggleFirewall": { "allowed": true, "reason": null } }}Response fields
availablebooleanreasonstring or nullenabledbooleanplatformFilteringInbound on GET /api/v2/vps/{id}/firewall/options, not its enabled. Also false when the state could not be read. Check available first.summarystring or nulldetailstring or nulllimitsobjectmaxRulesintegercurrentRulesintegerremainingRulesintegerrulesarray of objectposinteger or nulltypestring or nullin: an inbound rule you can change. out (outbound) and group (a group reference) are read-only. One of in, out, group.actionstring or nullACCEPT lets matching traffic through. DROP discards it. REJECT refuses it. One of ACCEPT, DROP, REJECT.enabledbooleanprotostring or nulltcp, udp or icmp. Null for all protocols.dportstring or null8000:8100 or a comma-separated list. Null for all ports.sportstring or nullsourcestring or nulldeststring or nulldescriptionstring or nullisSystembooleaneditablebooleanruleCountintegeractionsobjectcanAddRuleobjectallowedbooleanreasonstring or nullcodestring or nullcanToggleFirewallobjectallowedbooleanreasonstring 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. |