Skip to content
  • Auto
  • Light
  • Dark

List Policies

List Backup Policies for All Existing Droplets
client.gpuDroplets.backups.listPolicies(BackupListPoliciesParams { page, per_page } query?, RequestOptionsoptions?): BackupListPoliciesResponse { meta, links, policies }
get/v2/droplets/backups/policies

To list information about the backup policies for all Droplets in the account, send a GET request to /v2/droplets/backups/policies.

ParametersExpand Collapse
query: BackupListPoliciesParams { page, per_page }
page?: number

Which 'page' of paginated results to return.

minimum1
per_page?: number

Number of items returned per page

minimum1
maximum200
ReturnsExpand Collapse
BackupListPoliciesResponse { meta, links, policies }
meta: MetaProperties { total }

Information about the response itself.

total?: number

Number of objects returned by the request.

Accepts one of the following:

URI of the last page of the results.

URI of the next page of the results.

URI of the first page of the results.

URI of the previous page of the results.

policies?: Record<string, Policies>

A map where the keys are the Droplet IDs and the values are objects containing the backup policy information for each Droplet.

backup_enabled?: boolean

A boolean value indicating whether backups are enabled for the Droplet.

backup_policy?: DropletBackupPolicy { hour, plan, retention_period_days, 2 more }

An object specifying the backup policy for the Droplet.

hour?: 0 | 4 | 8 | 3 more

The hour of the day that the backup window will start.

Accepts one of the following:
0
4
8
12
16
20
plan?: "daily" | "weekly"

The backup plan used for the Droplet. The plan can be either daily or weekly.

Accepts one of the following:
"daily"
"weekly"
retention_period_days?: number

The number of days the backup will be retained.

weekday?: "SUN" | "MON" | "TUE" | 4 more

The day of the week on which the backup will occur.

Accepts one of the following:
"SUN"
"MON"
"TUE"
"WED"
"THU"
"FRI"
"SAT"
window_length_hours?: number

The length of the backup window starting from hour.

droplet_id?: number

The unique identifier for the Droplet.

next_backup_window?: DropletNextBackupWindow { end, start } | null

An object containing keys with the start and end times of the window during which the backup will occur.

end?: string

A time value given in ISO8601 combined date and time format specifying the end of the Droplet's backup window.

formatdate-time
start?: string

A time value given in ISO8601 combined date and time format specifying the start of the Droplet's backup window.

formatdate-time
List Backup Policies for All Existing Droplets
import Gradient from '@digitalocean/gradient';

const client = new Gradient();

const response = await client.gpuDroplets.backups.listPolicies();

console.log(response.meta);
{
  "meta": {
    "total": 1
  },
  "links": {
    "pages": {
      "last": "https://api.digitalocean.com/v2/images?page=2",
      "next": "https://api.digitalocean.com/v2/images?page=2"
    }
  },
  "policies": {
    "foo": {
      "backup_enabled": true,
      "backup_policy": {
        "hour": 0,
        "plan": "daily",
        "weekday": "SUN"
      },
      "droplet_id": 7101383,
      "next_backup_window": {
        "end": "2019-12-04T23:00:00Z",
        "start": "2019-12-04T00:00:00Z"
      }
    }
  }
}
Returns Examples
{
  "meta": {
    "total": 1
  },
  "links": {
    "pages": {
      "last": "https://api.digitalocean.com/v2/images?page=2",
      "next": "https://api.digitalocean.com/v2/images?page=2"
    }
  },
  "policies": {
    "foo": {
      "backup_enabled": true,
      "backup_policy": {
        "hour": 0,
        "plan": "daily",
        "weekday": "SUN"
      },
      "droplet_id": 7101383,
      "next_backup_window": {
        "end": "2019-12-04T23:00:00Z",
        "start": "2019-12-04T00:00:00Z"
      }
    }
  }
}