# Reorder firewall rules

`PUT https://console.advinservers.com/api/v1/client/firewall-groups/{firewallGroup}/rules/reorder`

### Overview

Changes rule evaluation order. Send `rules` containing every rule ID exactly once, from first to last. Missing or duplicate IDs return 422 and leave the order unchanged. Returns the updated group. Changes are applied to assigned servers in the background.

### Permissions

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

## Authorization

Send `Authorization: Bearer <token>` with the request. 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.

## Path parameters

- `firewallGroup` (string, required): The firewall group uuid short

## Body

Sent as `application/json`.

- `rules` (string[], required): The value of `rules`. At least 1 items

## Response 200

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

- `id` (string, required): The id ID.
- `uuid_short` (string, required): The first eight characters of the UUID. Either form can identify the group.
- `name` (string, required): The name shown to customers.
- `applied` (boolean, required): Whether the group is applied to the requested server. Always false when no server was requested.
- `rules` (object[], required): The value of `rules`.
  - `id` (string, required): The id ID.
  - `uuid_short` (string, required): The first eight characters of the UUID. Either form can identify the rule.
  - `position` (integer, required): Where the rule sits in its group's top-down evaluation order.
  - `type` (string, required): The type of operation or resource. One of: `in`, `out`.
  - `action` (string, required): The value of `action`. One of: `ACCEPT`, `DROP`.
  - `macro` (string | null, required): The value of `macro`.
  - `proto` (string | null, required): The value of `proto`.
  - `sport` (string | null, required): The source port or port range this rule matches.
  - `dport` (string | null, required): The destination port or port range this rule matches.
  - `source` (string | null, required): The source address or network this rule matches.
  - `source_ip_group` (object | null, required): The value of `source_ip_group`.
    - `id` (string, required): The id ID.
    - `uuid_short` (string, required): The value of `uuid_short`.
    - `name` (string, required): The name shown to customers.
  - `dest` (string | null, required): The value of `dest`.
  - `dest_ip_group` (object | null, required): Set instead of `dest` when the rule's destination is an IP group.
    - `id` (string, required): The id ID.
    - `uuid_short` (string, required): The value of `uuid_short`.
    - `name` (string, required): The name shown to customers.
  - `enabled` (boolean, required): The value of `enabled`.
- `servers` (object[], required): The value of `servers`.
  - `id` (string, required): The id ID.
  - `uuid_short` (string, required): The value of `uuid_short`.
  - `name` (string, required): The name shown to customers.
  - `hostname` (string, required): The fully qualified hostname.
  - `template_name` (string | null, required): The value of `template_name`.
  - `template_icon_url` (string | null, required): The value of `template_icon_url`.
  - `windows` (boolean, required): The value of `windows`.
  - `location` (string | null, required): The value of `location`.
  - `address` (string | null, required): The IP address assigned to the resource.
  - `synced_at` (string | null, required): The date and time for synced at, in UTC.
  - `sync_state` (string, required): The value of `sync_state`. One of: `pending`, `synced`, `failed`.
  - `sync_error` (string | null, required): The value of `sync_error`.
  - `is_current` (boolean, required): Whether this is the requested server.
- `created_at` (string | null, required): The date and time for created at, in UTC.

```json
{
  "id": "72a4a737-236f-456f-827f-6145d9c95727",
  "uuid_short": "Uuid short",
  "name": "Lambda Complex ingress",
  "applied": false,
  "rules": [
    {
      "id": "23f9fb19-d43a-4144-af19-95348d88c247",
      "position": 0,
      "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": "986f78ba-68f7-4dd3-8f15-1bac745f5ab1",
      "position": 1,
      "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": "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
    }
  ],
  "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"
}
```

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

## Example request

```bash
curl --request PUT \
  --url 'https://console.advinservers.com/api/v1/client/firewall-groups/{firewallGroup}/rules/reorder' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "rules": [
    "23f9fb19-d43a-4144-af19-95348d88c247",
    "986f78ba-68f7-4dd3-8f15-1bac745f5ab1",
    "97fd3850-8315-4eae-be31-4ef1211f6d76"
  ]
}'
```
