/v1/firewall-policies/{uid}/rulesAdds an allow rule to the policy and queues a firewall.apply operation for every resource
the policy is attached to. The response's operation_id is the first of those operations,
or an empty string when the policy is not attached to anything.
Defaults and limits:
directiondefaults toinbound,actiontoallowandprotocoltotcp.- Leave out both ports (or send
0for both) to match all ports. - Send only
port_startto match a single port. cidris required. A single address needs a prefix length, such as198.51.100.7/32.
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.
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 the rule applies to. Case-insensitive.
Default inboundOne ofinboundoutbound
actionstringWhat to do with matching traffic. Only allow is supported.
Default allowOne ofallow
protocolstringIP protocol to match. Case-insensitive.
Default tcpOne oftcpudpall
port_startintegerFirst port of the range, from 1 to 65535. 0 together with port_end 0 (or both omitted) matches all ports.
min 0 · max 65535
port_endintegerLast port of the range. Defaults to port_start. Must not be lower than port_start.
min 0 · max 65535
cidrstringRequiredSource address range in CIDR notation, IPv4 or IPv6. Use 0.0.0.0/0 to allow any IPv4 source.
descriptionstringOptional note about what the rule is for. Leading and trailing spaces are trimmed.
Response
The rule was created.
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 | No firewall policy with this uid exists in the workspace. |
Errors use the standard error format.