API - How to list snapshots

July 24, 2014 4k views

Does the API provide a method to list all snapshots with their details?

GET https://api.digitalocean.com/v2/images/<snapshot-id> responds correctly with snapshot details of the specified snapshot-id.

But how to get a list of snapshots?

GET https://api.digitalocean.com/v2/images/ responds with a list of all images but it does not seem to include snapshots.

Is there a way to list all snapshots with their details?

Since snapshot ids are listed in a droplet’s info, one solution to the question would be to first GET all droplets, extract all snapshot ids and then make multiple GET requests for each snapshot’s details.

Just checking if there’s a direct way to list all snapshots with their details.


3 Answers

https://api.digitalocean.com/v2/images/ does appear to list snapshots for me, backups, images and snapshots are all being listed.

The /images call does list all snapshots. Make sure you’ve covered all the pages as the response is paginated. For example, here’s the response I got:

    "images": [
    "links": {
        "pages": {
            "last": "https://api.digitalocean.com/v2/images?page=2", 
            "next": "https://api.digitalocean.com/v2/images?page=2"
    "meta": {
        "total": 39

As you said /images correctly list all images including snapshots.

I wasn’t checking for pagination.

Thanks for your replies.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!