API v2 - You specified an invalid image for Droplet creation.

June 23, 2014 7.2k views

As you read the title when i make request with PHP cURL i get the response message of invalid image.

I can see all the image listings "/v2/images/" including the one i request with JSON data which looks like this:
<pre>
{
"name": "My-Droplet",
"region": "nyc1",
"size": "4gb",
"image": 4201396
}
</pre>
Now the image 4201396 is totally exist and I also able to get image details "/v2/images/4201396".

Why the droplet creation API method didn't recognize the image id? How can i prevent the error? And why the error occurred?

10 Answers

Are you trying to create the droplet in the NYC1 datacenter? Notice that's the only region that it is listed as being available in.

  • You don't mean that i have to physically be located in "NYC1" data-center right? If you mean I need to define it as a region, then I've already done that.

    By the way I've following regions for the image

    <pre>
    "regions": [
    "ams2",
    "ams1",
    "nyc1",
    "nyc2",
    "sfo1",
    "sgp1",
    "ams2"
    ]
    </pre>

    I have chosen <code>nyc1</code> I tried all the regions but none of them solved the issue.

  • No. I read your question as saying that the JSON you shared was what was returned when you queried <code>/v2/images</code> not what you were trying to create. Sorry.

    Can you share exactly how you're trying to call the API? Remember on POSTs you need to set <code>Content-Type: application/json</code> on the request headers. So it would look like:

    <pre>
    curl -X POST "https://api.digitalocean.com/v2/droplets" \
    -d'{"name":"My-Droplet","region":"nyc1","size":"512mb","image":4201396}' \
    -H "Authorization: Bearer $DOAPIv2KEY" \
    -H "Content-Type: application/json"
    </pre>

I'm having the same issue. Did you you resolve this? What was the solution?

I'm also having this same issue. I've tried using both a slug as a string and an image id as a number when posting to the API. I'm also only using regions where the image is available. Any idea what's going on?

Yep, I have the same problem. Sometimes you need to call the API a few times before it is successful.

Did anyone solve the issue? "Sometimes you need to call the API a few times before it is successful."
This sounds like "voodoo" and i don't like it. :)

I have same issue.. Did anybody get any solution?

I have same issue..

I tried with id, name and slug and no ones work

Did anybody get any solution?

I have same issue. Not able to create droplet using image from web api call.

hey guys,

same here,
1) have created a droplet D1
2) done a snapshot S1
3) was able to spin new worker droplets off the S1 snapshot via API dozen of times
4) have tweaked the D1 droplet into D1'
5) redid snapshotting of D1' into S2
6) removed S1
7) now NOT able to spin up any new workers with all the same properties as before, via API based on the S2 snapshot
the error:
digitalocean.DataReadError: You specified an invalid image for Droplet creation.
em using this wrapper: https://github.com/koalalorenzo/python-digitalocean

listing all images does return the said S2 snapshot , and its statuses looking correct.

fetching the S2 directly via its ID (obtained when listing all) returns the image with exactly the same name I'm trying to use to spin up a new droplet.
Tried renaming the hell out of it, to no avail.
what the ?

EDIT:
I can't be sure but this looks like an issue with private snapshots altogether. None of my old snapshots work anymore. Sadly the one that I used right before this all collapsed had been disposed, so can't compare with thing that I know worked literally yesterday. But even 10month old snapshots are no go currently, if that is an indication to anything...

Have another answer? Share your knowledge.