/v1/firewall-policies/{uid}/rules/{rule_uid}Changes a rule. Send only the fields you want to change. Values are validated the same way as in Add a firewall rule, and the policy's default rules can be changed too.
If you send either port, the range is rebuilt from the ports in this request only: a missing
port_end becomes port_start, and a missing port_start is treated as 0, which fails
validation. To change a range, send both port_start and port_end.
A firewall.apply operation is queued for every resource the policy is attached to. The
response's operation_id is the first of those, or an empty string when the policy is not
attached to anything.
Authentication
Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.
Path parameters
uidstringRequiredThe firewall policy's uid.
rule_uidstringRequiredThe rule's uid.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
Request body
directionstringTraffic direction. An empty string means inbound.
One ofinboundoutbound
actionstringOnly allow is supported.
One ofallow
protocolstringIP protocol to match. An empty string means tcp.
One oftcpudpall
port_startintegerFirst port of the range. See above for how ports are combined.
min 0 · max 65535
port_endintegerLast port of the range.
min 0 · max 65535
cidrstringSource address range in CIDR notation. Cannot be blank.
descriptionstringNew note. Send an empty string to clear it.
Response
The updated rule.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredOn Add a firewall rule and
Update a firewall rule, the UID of the
first firewall.apply operation queued for the change. An empty string when no
operation was queued, and always empty when rules are returned inside a policy.
uidstringRequiredUnique identifier of the rule.
directionstringRequiredTraffic direction the rule applies to.
One ofinboundoutbound
actionstringRequiredWhat happens to matching traffic. Always allow.
One ofallow
protocolstringRequiredIP protocol the rule matches.
One oftcpudpall
port_startintegerRequiredFirst port of the range. 0 with port_end 0 means all ports.
port_endintegerRequiredLast port of the range.
cidrstringRequiredSource address range in CIDR notation.
descriptionstringNote about the rule. Omitted when empty.
is_defaultbooleanRequiredtrue for the SSH and app-port rules added automatically when the policy was created.
Errors
| Status | Meaning |
|---|---|
400 | Validation failed. Possible messages: invalid request (malformed JSON), direction must be inbound or outbound, only allow firewall rules are supported, protocol must be tcp, udp, or all, port range must be between 1 and 65535, cidr is required, or cidr must be a valid CIDR block. |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The policy, or the rule within it, does not exist. |
Errors use the standard error format.