Skip to content

Add a firewall rule

POST/firewall-groups/{firewallGroup}/rules

Overview

Adds a rule to the end of the group. Rules are evaluated from top to bottom. Use either source or source_ip_group, not both, and either dest or dest_ip_group, not both. A macro defines its own protocol and ports, so proto, sport and dport are ignored when a macro is selected. Without a macro or protocol, a source or destination is required.

source and dest each take one address or CIDR range, one span such as 203.0.113.10-203.0.113.20, or a comma-separated list of addresses and CIDR ranges. Everything in a rule must be IPv4, or everything IPv6. A CIDR range must start at its network's first address, such as 203.0.113.0/24 rather than 203.0.113.9/24. Spaces are removed and IPv6 addresses are saved in their short form. sport and dport apply to tcp and udp only, and icmp matches IPv4 only; for IPv6 ping use the Ping macro.

Returns the updated group. Assigned servers remain pending until the rules are applied in the background.

Permissions

Requires the firewall.update (Change the firewall) permission for the selected team. Resources outside that team return 404.

curl --request POST \
  --url 'https://console.advinservers.com/api/v1/client/firewall-groups/{firewallGroup}/rules' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "in",
  "action": "ACCEPT",
  "macro": null,
  "proto": "udp",
  "sport": null,
  "dport": "27015",
  "source": null,
  "source_ip_group": null,
  "dest": null,
  "dest_ip_group": null,
  "enabled": true
}'
{
  "id": "72a4a737-236f-456f-827f-6145d9c95727",
  "uuid_short": "Uuid short",
  "name": "Lambda Complex ingress",
  "applied": false,
  "rules": [
    {
      "id": "986f78ba-68f7-4dd3-8f15-1bac745f5ab1",
      "position": 0,
      "type": "in",
      "action": "ACCEPT",
      "macro": "Web",
      "proto": null,
      "sport": null,
      "dport": null,
      "source": null,
      "source_ip_group": null,
      "dest": null,
      "dest_ip_group": null,
      "enabled": true
    },
    {
      "id": "23f9fb19-d43a-4144-af19-95348d88c247",
      "position": 1,
      "type": "in",
      "action": "ACCEPT",
      "macro": "SSH",
      "proto": null,
      "sport": null,
      "dport": null,
      "source": null,
      "source_ip_group": {
        "id": "145e6e6f-a6b0-4b9e-9060-2d4f017baff8",
        "name": "Sector C lab"
      },
      "dest": null,
      "dest_ip_group": null,
      "enabled": true
    },
    {
      "id": "97fd3850-8315-4eae-be31-4ef1211f6d76",
      "position": 2,
      "type": "in",
      "action": "ACCEPT",
      "macro": null,
      "proto": "tcp",
      "sport": null,
      "dport": "9100",
      "source": "10.24.0.0/24",
      "source_ip_group": null,
      "dest": null,
      "dest_ip_group": null,
      "enabled": true
    },
    {
      "id": "c54fb379-1b07-45d2-8229-9c69dcecb4a5",
      "position": 3,
      "type": "in",
      "action": "ACCEPT",
      "macro": null,
      "proto": "udp",
      "sport": null,
      "dport": "27015",
      "source": null,
      "source_ip_group": null,
      "dest": null,
      "dest_ip_group": null,
      "enabled": true
    }
  ],
  "servers": [
    {
      "id": "ecc6f4f1-c89b-4dce-a20b-a330641c5b0b",
      "uuid_short": "ecc6f4f1",
      "name": "lambda-core",
      "hostname": "lambda-core.blackmesa.example.com",
      "template_name": "Ubuntu 24.04",
      "template_icon_url": "/assets/icons/ubuntu.png",
      "windows": false,
      "location": "Kansas City, MO",
      "address": "203.0.113.24",
      "synced_at": "2026-09-14T15:58:21+00:00",
      "sync_state": "pending",
      "sync_error": null,
      "is_current": false
    }
  ],
  "created_at": "2026-03-02T19:31:08+00:00"
}

Authorization

Authorizationstringheaderrequired

Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

Send it as Bearer <token>.

Path parameters

firewallGroupstringrequired

The firewall group uuid short

Body

application/json
typestringrequired

The type of operation or resource.

One of: in, out

actionstringrequired

The value of action.

One of: ACCEPT, DROP

macrostring | null

The value of macro.

One of: SSH, HTTP, HTTPS, DNS, DHCPfwd, DHCPv6, NTP, Mail, POP3, IMAP, MySQL, PostgreSQL, SMB, RDP, Ping, Web, null

protostring | null

The value of proto.

One of: tcp, udp, icmp, gre, null

sportstring | null

The source port or port range this rule matches.

At most 20 characters

Must match ^\d{1,5}(:\d{1,5})?(,\d{1,5}(:\d{1,5})?)*$

dportstring | null

The destination port or port range this rule matches.

At most 20 characters

Must match ^\d{1,5}(:\d{1,5})?(,\d{1,5}(:\d{1,5})?)*$

sourcestring | null

The source address or network this rule matches.

At most 100 characters

source_ip_groupstring | null

The value of source_ip_group.

Exactly 36 characters

deststring | null

The value of dest.

At most 100 characters

dest_ip_groupstring | null

The value of dest_ip_group.

Exactly 36 characters

enabledboolean

The value of enabled.

Response 200

application/json

The record, as a JSON object. There is no envelope.

idstringrequired

The id ID.

uuid_shortstringrequired

The first eight characters of the UUID. Either form can identify the group.

namestringrequired

The name shown to customers.

appliedbooleanrequired

Whether the group is applied to the requested server. Always false when no server was requested.

rulesobject[]required

The value of rules.

Show child attributes
idstringrequired

The id ID.

uuid_shortstringrequired

The first eight characters of the UUID. Either form can identify the rule.

positionintegerrequired

Where the rule sits in its group's top-down evaluation order.

typestringrequired

The type of operation or resource.

One of: in, out

actionstringrequired

The value of action.

One of: ACCEPT, DROP

macrostring | nullrequired

The value of macro.

protostring | nullrequired

The value of proto.

sportstring | nullrequired

The source port or port range this rule matches.

dportstring | nullrequired

The destination port or port range this rule matches.

sourcestring | nullrequired

The source address or network this rule matches.

source_ip_groupobject | nullrequired

The value of source_ip_group.

Show child attributes
idstringrequired

The id ID.

uuid_shortstringrequired

The value of uuid_short.

namestringrequired

The name shown to customers.

deststring | nullrequired

The value of dest.

dest_ip_groupobject | nullrequired

Set instead of dest when the rule's destination is an IP group.

Show child attributes
idstringrequired

The id ID.

uuid_shortstringrequired

The value of uuid_short.

namestringrequired

The name shown to customers.

enabledbooleanrequired

The value of enabled.

serversobject[]required

The value of servers.

Show child attributes
idstringrequired

The id ID.

uuid_shortstringrequired

The value of uuid_short.

namestringrequired

The name shown to customers.

hostnamestringrequired

The fully qualified hostname.

template_namestring | nullrequired

The value of template_name.

template_icon_urlstring | nullrequired

The value of template_icon_url.

windowsbooleanrequired

The value of windows.

locationstring | nullrequired

The value of location.

addressstring | nullrequired

The IP address assigned to the resource.

synced_atstring | nullrequired

The date and time for synced at, in UTC.

sync_statestringrequired

The value of sync_state.

One of: pending, synced, failed

sync_errorstring | nullrequired

The value of sync_error.

is_currentbooleanrequired

Whether this is the requested server.

created_atstring | nullrequired

The date and time for created at, in UTC.

Errors

401
The key was missing, malformed, revoked, or belongs to an account that no longer exists.
403
Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
404
The resource was not found in the selected team. Resources in another account or team also return 404.
422
A field is missing or invalid, or the resource cannot accept this change in its current state. Check message for details. Field validation also includes an errors object keyed by field name.
429
Too many requests. The Retry-After header says how many seconds to wait. Limits are per account, so several keys on one account share them.