How can I get how much disk space is available on my Droplet using API

is there any method that i can get the size left on my Droplet using API

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


I don’t think that this is yet possible via the API directly. There is already a similar idea shared here that you could vote for:

In the meantime, I could suggest a couple of alternatives:

  • You could set up Monitoring Alerts so that you get a notification in case that your Disk usage is higher than let’s say 70%, for more information on how to do that you could have a look at the official documentation here:

  • You could use an SSH command and run a check remotely, it would look something like this:
ssh your_user@your_droplet_ip df -h

The output that you would get would look something like this:

Filesystem      Size  Used Avail Use% Mounted on
udev            478M     0  478M   0% /dev
tmpfs            99M  920K   98M   1% /run
/dev/vda1        25G   16G  9.0G  63% /

If you have multiple droplets you could use a loop to go through all droplets and run the command on each, here’s an example script:


# List of your Droplet IPs separated by space
list_of_droplets="droplet_ip_1 droplet_ip_2 droplet_ip_3"

for droplet in $list_of_droplets ; do
    echo "Disk Usage for ${droplet}"
    ssh your_user@${droplet} df -h

You could add your SSH key to each Droplet and that way you would not have to type your password each time.

  • Another solution would be to use a monitoring tool like Nginx or NewRelic but this requires more upfront configuration

Hope that this helps! Regards, Bobby