Skip to content
  • Auto
  • Light
  • Dark

Create

Create a Custom Image
post/v2/images

To create a new custom image, send a POST request to /v2/images. The body must contain a url attribute pointing to a Linux virtual machine image to be imported into DigitalOcean. The image must be in the raw, qcow2, vhdx, vdi, or vmdk format. It may be compressed using gzip or bzip2 and must be smaller than 100 GB after being decompressed.

Body Parameters
descriptionstring
optional

An optional free-form text field to describe an image.

distributionenum
optional
"Arch Linux" OR "CentOS" OR "CoreOS" OR 10 more

The name of a custom image's distribution. Currently, the valid values are Arch Linux, CentOS, CoreOS, Debian, Fedora, Fedora Atomic, FreeBSD, Gentoo, openSUSE, RancherOS, Rocky Linux, Ubuntu, and Unknown. Any other value will be accepted but ignored, and Unknown will be used in its place.

Hide ParametersShow Parameters
"Arch Linux"
"CentOS"
"CoreOS"
"Debian"
"Fedora"
"Fedora Atomic"
"FreeBSD"
"Gentoo"
"openSUSE"
"RancherOS"
"Rocky Linux"
"Ubuntu"
"Unknown"
namestring
optional

The display name that has been given to an image. This is what is shown in the control panel and is generally a descriptive title for the image in question.

regionenum
optional
"ams1" OR "ams2" OR "ams3" OR 12 more

The slug identifier for the region where the resource will initially be available.

Hide ParametersShow Parameters
"ams1"
"ams2"
"ams3"
"blr1"
"fra1"
"lon1"
"nyc1"
"nyc2"
"nyc3"
"sfo1"
"sfo2"
"sfo3"
"sgp1"
"tor1"
"syd1"
tagsarray of string
optional

A flat array of tag names as strings to be applied to the resource. Tag names may be for either existing or new tags.

Requires tag:create scope.

urlstring
optional

A URL from which the custom Linux virtual machine image may be retrieved. The image it points to must be in the raw, qcow2, vhdx, vdi, or vmdk format. It may be compressed using gzip or bzip2 and must be smaller than 100 GB after being decompressed.

Returns
imageidnumbercreated_atstringdescriptionstringdistributionenumerror_messagestringmin_disk_sizenumbernamestringpublicbooleanregionsarray of enumsize_gigabytesnumberslugstringstatusenumtagsarray of stringtypeenumImage
optional
curl https://api.digitalocean.com//v2/images \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $GRADIENTAI_API_KEY" \
    -d '{
      "description": " ",
      "distribution": "Ubuntu",
      "name": "Nifty New Snapshot",
      "region": "nyc3",
      "tags": [
        "base-image",
        "prod"
      ],
      "url": "http://cloud-images.ubuntu.com/minimal/releases/bionic/release/ubuntu-18.04-minimal-cloudimg-amd64.img"
    }'
200 Example
{
  "image": {
    "created_at": "2020-05-04T22:23:02Z",
    "description": " ",
    "distribution": "Ubuntu",
    "error_message": " ",
    "min_disk_size": 20,
    "name": "Nifty New Snapshot",
    "public": true,
    "regions": [
      "nyc1",
      "nyc2"
    ],
    "size_gigabytes": 2.34,
    "slug": "nifty1",
    "status": "NEW",
    "tags": [
      "base-image",
      "prod"
    ],
    "type": "snapshot"
  }
}