Skip to content
  • Auto
  • Light
  • Dark

Update

Update a Firewall
put/v2/firewalls/{firewall_id}

To update the configuration of an existing firewall, send a PUT request to /v2/firewalls/$FIREWALL_ID. The request should contain a full representation of the firewall including existing attributes. Note that any attributes that are not provided will be reset to their default values.

You must have read access (e.g. droplet:read) to all resources attached to the firewall to successfully update the firewall.

Path Parameters
firewall_idstring
formatuuid
Body Parameters
firewallidstringcreated_atstringdroplet_idsarray of numberinbound_rulesarray of objectnamestringoutbound_rulesarray of objectpending_changesarray of objectstatusenumtagsarray of stringFirewall
Returns
firewallidstringcreated_atstringdroplet_idsarray of numberinbound_rulesarray of objectnamestringoutbound_rulesarray of objectpending_changesarray of objectstatusenumtagsarray of stringFirewall
optional
curl https://api.digitalocean.com//v2/firewalls/$FIREWALL_ID \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $GRADIENTAI_API_KEY" \
    -d '{
      "droplet_ids": [
        8043964
      ],
      "inbound_rules": [
        {
          "ports": "8080",
          "protocol": "tcp",
          "sources": {
            "addresses": [
              "1.2.3.4",
              "18.0.0.0/8"
            ],
            "droplet_ids": [
              8043964
            ],
            "kubernetes_ids": [
              "41b74c5d-9bd0-5555-5555-a57c495b81a3"
            ],
            "load_balancer_uids": [
              "4de7ac8b-495b-4884-9a69-1050c6793cd6"
            ],
            "tags": [
              "base-image",
              "prod"
            ]
          }
        },
        {
          "ports": "22",
          "protocol": "tcp",
          "sources": {
            "addresses": [
              "18.0.0.0/8"
            ],
            "droplet_ids": [
              8043964
            ],
            "kubernetes_ids": [
              "41b74c5d-9bd0-5555-5555-a57c495b81a3"
            ],
            "load_balancer_uids": [
              "4de7ac8b-495b-4884-9a69-1050c6793cd6"
            ],
            "tags": [
              "gateway"
            ]
          }
        }
      ],
      "name": "frontend-firewall",
      "outbound_rules": [
        {
          "destinations": {
            "addresses": [
              "0.0.0.0/0",
              "::/0"
            ],
            "droplet_ids": [
              8043964
            ],
            "kubernetes_ids": [
              "41b74c5d-9bd0-5555-5555-a57c495b81a3"
            ],
            "load_balancer_uids": [
              "4de7ac8b-495b-4884-9a69-1050c6793cd6"
            ],
            "tags": [
              "base-image",
              "prod"
            ]
          },
          "ports": "8080",
          "protocol": "tcp"
        }
      ],
      "tags": [
        "frontend"
      ]
    }'
200 Example
{
  "firewall": {
    "droplet_ids": [
      8043964
    ],
    "inbound_rules": [
      {
        "ports": "8000",
        "protocol": "tcp",
        "sources": {
          "addresses": [
            "1.2.3.4",
            "18.0.0.0/8"
          ],
          "droplet_ids": [
            8043964
          ],
          "kubernetes_ids": [
            "41b74c5d-9bd0-5555-5555-a57c495b81a3"
          ],
          "load_balancer_uids": [
            "4de7ac8b-495b-4884-9a69-1050c6793cd6"
          ],
          "tags": [
            "base-image",
            "prod"
          ]
        }
      }
    ],
    "name": "firewall",
    "outbound_rules": [
      {
        "destinations": {
          "addresses": [
            "1.2.3.4",
            "18.0.0.0/8"
          ],
          "droplet_ids": [
            8043964
          ],
          "kubernetes_ids": [
            "41b74c5d-9bd0-5555-5555-a57c495b81a3"
          ],
          "load_balancer_uids": [
            "4de7ac8b-495b-4884-9a69-1050c6793cd6"
          ],
          "tags": [
            "base-image",
            "prod"
          ]
        },
        "ports": "8000",
        "protocol": "tcp"
      }
    ],
    "tags": [
      "base-image",
      "prod"
    ]
  }
}