Skip to content

List Snapshots for a Droplet

client.GPUDroplets.ListSnapshots(ctx, dropletID, query) (*GPUDropletListSnapshotsResponse, error)
get/v2/droplets/{droplet_id}/snapshots

To retrieve the snapshots that have been created from a Droplet, send a GET request to /v2/droplets/$DROPLET_ID/snapshots.

You will get back a JSON object that has a snapshots key. This will be set to an array of snapshot objects, each of which contain the standard Droplet snapshot attributes.

ParametersExpand Collapse
dropletID int64
minimum1
query GPUDropletListSnapshotsParams
Page param.Field[int64]optional

Which 'page' of paginated results to return.

minimum1
PerPage param.Field[int64]optional

Number of items returned per page

minimum1
maximum200
ReturnsExpand Collapse
type GPUDropletListSnapshotsResponse struct{…}

Information about the response itself.

Total int64optional

Number of objects returned by the request.

Accepts one of the following:
Snapshots []GPUDropletListSnapshotsResponseSnapshotoptional
ID int64

The unique identifier for the snapshot or backup.

CreatedAt Time

A time value given in ISO8601 combined date and time format that represents when the snapshot was created.

formatdate-time
MinDiskSize int64

The minimum size in GB required for a volume or Droplet to use this snapshot.

Name string

A human-readable name for the snapshot.

Regions []string

An array of the regions that the snapshot is available in. The regions are represented by their identifying slug values.

SizeGigabytes float64

The billable size of the snapshot in gigabytes.

formatfloat
Type GPUDropletListSnapshotsResponseSnapshotsType

Describes the kind of image. It may be one of snapshot or backup. This specifies whether an image is a user-generated Droplet snapshot or automatically created Droplet backup.

Accepts one of the following:
const GPUDropletListSnapshotsResponseSnapshotsTypeSnapshot GPUDropletListSnapshotsResponseSnapshotsType = "snapshot"
const GPUDropletListSnapshotsResponseSnapshotsTypeBackup GPUDropletListSnapshotsResponseSnapshotsType = "backup"
List Snapshots for a Droplet
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.GPUDroplets.ListSnapshots(
    context.TODO(),
    int64(3164444),
    gradient.GPUDropletListSnapshotsParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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"
    }
  },
  "snapshots": [
    {
      "id": 6372321,
      "created_at": "2020-07-28T16:47:44Z",
      "min_disk_size": 25,
      "name": "web-01-1595954862243",
      "regions": [
        "nyc3",
        "sfo3"
      ],
      "size_gigabytes": 2.34,
      "type": "snapshot"
    }
  ]
}
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"
    }
  },
  "snapshots": [
    {
      "id": 6372321,
      "created_at": "2020-07-28T16:47:44Z",
      "min_disk_size": 25,
      "name": "web-01-1595954862243",
      "regions": [
        "nyc3",
        "sfo3"
      ],
      "size_gigabytes": 2.34,
      "type": "snapshot"
    }
  ]
}