Question

How to create an Image that works with API to create a new Droplet

I created a Snapshot of a Droplet thinking that it would be the Image I can use in the API to create a new Droplet, but this does not seem to be the case.

So my question is, how do I create an Image I can use to create a Droplet from the API.

If I try to use the Snapshot it gives me this error:

{“id”:“unprocessable_entity”,“message”:“You specified an invalid image for Droplet creation.”}

The snapshot exists on the same region as where I am trying to create the new Droplet.


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.

Andrew SB
DigitalOcean Employee
DigitalOcean Employee badge
March 26, 2018
Accepted Answer

You should be able to create a new Droplet via the API using a Snapshot as the base image. A minimal example would look like:

curl -X POST -H "Content-Type: application/json" \
    -H "Authorization: Bearer $DO_TOKEN" \
    -d '{"name":"example.com","region":"nyc3","size":"s-1vcpu-1gb","image":123456}' \ 
    "https://api.digitalocean.com/v2/droplets" 

One thing that sometimes trips people up is that the Snapshot’s unique ID, not its name, must be used in for the image attribute. You can find that ID by querying the API or from the command line:

  1. doctl compute image list-user

If you’re still running into problems, can you share a snippet of the code you are using to create the Droplet?

I made a mistake in my request to this API. Thanks for the help.

Thanks for the assistance. The strange thing is if I query the API for a Snapshot I get no results

{“snapshots”:[],“links”:{},“meta”:{“total”:0}}

https://api.digitalocean.com/v2/snapshots

But under my profile I definitely have a Snapshot, so I am a bit confused.

Where do I get the command line? It is not on a droplet console right?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel