Skip to content

Delete a VPS firewall rule

DELETE /api/v2/vps/{id}/firewall/{pos}

Delete the firewall rule at position pos. Read GET /api/v2/vps/{id}/firewall right before and take pos from the rule you mean. Rules have no ID and the call does not check for changes. If another client changed the list in between, it deletes whatever rule is at pos now. Delete only rules with editable: true. Outbound rules and group references answer 403. A key that also holds write:network and write:services skips that check. It deletes any rule at pos. The rules below it move up one place. A position with no rule answers 404.

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

Request

Path parameters

idstringrequired
The VPS ID (vps_…).
posintegerrequired
Position of the rule, rules[].pos in the rule list. The first rule is 0. At least 0.

Example

DELETE /api/v2/vps/{id}/firewall/{pos}
curl -X DELETE "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/firewall/0" \
-H "Authorization: Bearer $HOSTUP_API_KEY"

Responses

204 Rule deleted.

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 key lacks the scope, or the rule at pos is an outbound rule or a group reference. The body is the same in both cases. Check editable in the rule list.
404vps_not_found: no VPS with this ID in your account. not_found: no rule at this position.
409upstream_failed: the VPS is still being set up. Nothing was deleted. Try again when serviceStatus is active.
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.
503upstream_failed: the current rules could not be read. Nothing was deleted. Try again shortly.