Skip to content

Create a firewall policy

POST/v1/firewall-policies

Creates a firewall policy. The policy is not attached to anything yet, so it has no effect until you attach it to a resource.

Every new policy starts with two default rules, so attaching it does not lock you out:

  • TCP port 22 from 0.0.0.0/0 (SSH, needed by rumpty ssh and the CLI).
  • TCP port 8080 from 0.0.0.0/0 (the default VM app port).

You can update or delete these rules like any other.

Policy names must be unique in the workspace. A name already used by another policy is rejected with 409. The check is on the exact name (after trimming spaces) and is case-sensitive, so Web servers and web servers can both exist. Names of deleted policies can be reused.

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

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

namestringRequired

Name of the policy. Leading and trailing spaces are trimmed. Must be unique in the workspace.

descriptionstring

Optional free-text description. Leading and trailing spaces are trimmed.

is_defaultboolean

Marks the policy as a workspace default. This is a label only. The API does not attach default policies to resources automatically.

Default false

Response

201

The policy was created with its default rules. attached_resources is omitted because a new policy has no attachments.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
uidstringRequired

Unique identifier of the policy.

namestringRequired

Name of the policy, unique in the workspace.

slugstringRequired

URL-friendly form of the name.

descriptionstring

Free-text description. Omitted when empty.

is_defaultbooleanRequired

Whether the policy is labelled as a workspace default. It is not applied automatically.

rulesarray of objects

The policy's rules, oldest first. Omitted when the policy has no rules.

Show item 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.

attached_resourcesarray of objects

Resources the policy is attached to, newest first. Omitted when there are none.

Show item attributes
operation_idstringRequired

On Attach a firewall policy, the UID of the firewall.apply operation queued for the resource. An empty string when the policy was already attached or no operation could be queued, and always empty when attachments are returned inside a policy.

uidstringRequired

Unique identifier of the attachment. Use it to detach the policy.

resource_typestringRequired

Kind of resource the policy is attached to.

One ofvmdatabasedeployment

resourceobjectRequired

Short description of the attached resource. All fields are empty strings if the resource no longer exists.

Show attributes
uidstringRequired

UID of the VM, database or deployment.

namestringRequired

Name of the resource.

slugstringRequired

Slug of the resource.

statusstringRequired

Current status of the resource. For VMs and databases this is the display status.

created_atstring (date-time)Required

When the policy was created (RFC 3339).

updated_atstring (date-time)Required

When the policy itself was last changed. Rule changes do not update it.

Errors

StatusMeaning
400Validation failed: the body is not valid JSON (invalid request) or name is missing or blank (policy name is required).
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.
409Another policy in the workspace already has this name.

Errors use the standard error format.