dots.v2.droplets.byDroplet_id().firewalls.get()

Generated on 5 Nov 2026 from DoTs version v1.23.0

Usage

client.v2.droplets.byDroplet_id(droplet_id).firewalls.get(requestConfiguration?: RequestConfiguration<FirewallsRequestBuilderGetQueryParameters>): Promise<undefined | FirewallsGetResponse>

Description

To retrieve a list of all firewalls available to a Droplet, send a GET request to /v2/droplets/{droplet_id}/firewalls

The response will be a JSON object that has a key called firewalls. This will be set to an array of firewall objects, each of which contain the standard firewall attributes.

Parameters

Path Parameters

droplet_id integer required

Example: 3164444

A unique identifier for a Droplet instance.

Min: 1

Query Parameters

perPage integer optional

Example: 2

Number of items returned per page

Default: 20

Min: 1

Max: 200

page integer optional

Example: 1

Which 'page' of paginated results to return.

Default: 1

Min: 1

Request Sample

Show Request Sample
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.droplets
    .byDroplet_id(3164444).firewalls.get();

Pagination

This method returns paginated results. The response includes a links.pages object with URLs for navigating between pages. To retrieve the next page, parse the next URL and pass the page query parameter:

let response = await client.v2.droplets
    .byDroplet_id(3164444).firewalls.get();
let pages = response?.links?.pages;

while (pages && "next" in pages && typeof pages.next === "string") {
    const page = Number(new URL(pages.next).searchParams.get("page"));
    response = await client.v2.droplets
        .byDroplet_id(3164444).firewalls.get({
        queryParameters: {
            page,
        },
    });
    pages = response?.links?.pages;
}

Response Example

Show Response Example
{
  "firewalls": [
    {
      "id": "bb4b2611-3d72-467b-8602-280330ecd65c",
      "status": "succeeded",
      "created_at": "2020-05-23T21:24:00Z",
      "pending_changes": [
        {
          "droplet_id": 8043964,
          "removing": true,
          "status": "waiting"
        }
      ],
      "name": "firewall",
      "droplet_ids": [
        89989,
        33322
      ],
      "tags": [
        "base-image",
        "prod"
      ],
      "inbound_rules": [
        {
          "protocol": "udp",
          "ports": "8000-9000",
          "action": "allow",
          "sources": {
            "addresses": [
              "1.2.3.4",
              "18.0.0.0/8"
            ],
            "droplet_ids": [
              8282823,
              3930392
            ],
            "load_balancer_uids": [
              "4de7ac8b-495b-4884-9a69-1050c6793cd6"
            ],
            "tags": [
              "base-image",
              "dev"
            ]
          }
        }
      ],
      "outbound_rules": [
        {
          "protocol": "tcp",
          "ports": "7000-9000",
          "action": "allow",
          "destinations": {
            "addresses": [
              "1.2.3.4",
              "18.0.0.0/8"
            ],
            "droplet_ids": [
              3827493,
              213213
            ],
            "load_balancer_uids": [
              "4de7ac8b-495b-4884-9a69-1050c6793cd6"
            ],
            "tags": [
              "base-image",
              "prod"
            ]
          }
        }
      ]
    }
  ],
  "links": {
    "pages": {}
  },
  "meta": {
    "total": 1
  }
}

More Information

See /v2/droplets/{droplet_id}/firewalls in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.