Skip to content

Update a firewall rule

PATCH/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

uidstringRequired

The firewall policy's uid.

rule_uidstringRequired

The rule's uid.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

Request body

directionstring

Traffic direction. An empty string means inbound.

One ofinboundoutbound

actionstring

Only allow is supported.

One ofallow

protocolstring

IP protocol to match. An empty string means tcp.

One oftcpudpall

port_startinteger

First port of the range. See above for how ports are combined.

min 0 · max 65535

port_endinteger

Last port of the range.

min 0 · max 65535

cidrstring

Source address range in CIDR notation. Cannot be blank.

descriptionstring

New note. Send an empty string to clear it.

Response

200

The updated rule.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

On 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.

uidstringRequired

Unique identifier of the rule.

directionstringRequired

Traffic direction the rule applies to.

One ofinboundoutbound

actionstringRequired

What happens to matching traffic. Always allow.

One ofallow

protocolstringRequired

IP protocol the rule matches.

One oftcpudpall

port_startintegerRequired

First port of the range. 0 with port_end 0 means all ports.

port_endintegerRequired

Last port of the range.

cidrstringRequired

Source address range in CIDR notation.

descriptionstring

Note about the rule. Omitted when empty.

is_defaultbooleanRequired

true for the SSH and app-port rules added automatically when the policy was created.

Errors

StatusMeaning
400Validation 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.
401The API key is missing, invalid, expired or revoked.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
404The policy, or the rule within it, does not exist.

Errors use the standard error format.