Skip to content
  • Auto
  • Light
  • Dark

Create

Create a Custom Image
client.gpuDroplets.images.create(ImageCreateParams { description, distribution, name, 3 more } body, RequestOptionsoptions?): ImageCreateResponse { 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.

ParametersExpand Collapse
body: ImageCreateParams { description, distribution, name, 3 more }
description?: string

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

distribution?: "Arch Linux" | "CentOS" | "CoreOS" | 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.

Accepts one of the following:
"Arch Linux"
"CentOS"
"CoreOS"
"Debian"
"Fedora"
"Fedora Atomic"
"FreeBSD"
"Gentoo"
"openSUSE"
"RancherOS"
"Rocky Linux"
"Ubuntu"
"Unknown"
name?: string

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.

region?: "ams1" | "ams2" | "ams3" | 12 more

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

Accepts one of the following:
"ams1"
"ams2"
"ams3"
"blr1"
"fra1"
"lon1"
"nyc1"
"nyc2"
"nyc3"
"sfo1"
"sfo2"
"sfo3"
"sgp1"
"tor1"
"syd1"
tags?: Array<string> | null

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.

url?: string

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.

ReturnsExpand Collapse
ImageCreateResponse { image }
image?: Image { id, created_at, description, 11 more }
id?: number

A unique number that can be used to identify and reference a specific image.

created_at?: string

A time value given in ISO8601 combined date and time format that represents when the image was created.

formatdate-time
description?: string

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

distribution?: "Arch Linux" | "CentOS" | "CoreOS" | 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.

Accepts one of the following:
"Arch Linux"
"CentOS"
"CoreOS"
"Debian"
"Fedora"
"Fedora Atomic"
"FreeBSD"
"Gentoo"
"openSUSE"
"RancherOS"
"Rocky Linux"
"Ubuntu"
"Unknown"
error_message?: string

A string containing information about errors that may occur when importing a custom image.

min_disk_size?: number | null

The minimum disk size in GB required for a Droplet to use this image.

minimum0
name?: string

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.

public?: boolean

This is a boolean value that indicates whether the image in question is public or not. An image that is public is available to all accounts. A non-public image is only accessible from your account.

regions?: Array<"ams1" | "ams2" | "ams3" | 12 more>

This attribute is an array of the regions that the image is available in. The regions are represented by their identifying slug values.

Accepts one of the following:
"ams1"
"ams2"
"ams3"
"blr1"
"fra1"
"lon1"
"nyc1"
"nyc2"
"nyc3"
"sfo1"
"sfo2"
"sfo3"
"sgp1"
"tor1"
"syd1"
size_gigabytes?: number | null

The size of the image in gigabytes.

formatfloat
slug?: string | null

A uniquely identifying string that is associated with each of the DigitalOcean-provided public images. These can be used to reference a public image as an alternative to the numeric id.

status?: "NEW" | "available" | "pending" | 2 more

A status string indicating the state of a custom image. This may be NEW, available, pending, deleted, or retired.

Accepts one of the following:
"NEW"
"available"
"pending"
"deleted"
"retired"
tags?: Array<string> | null

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.

type?: "base" | "snapshot" | "backup" | 2 more

Describes the kind of image. It may be one of base, snapshot, backup, custom, or admin. Respectively, this specifies whether an image is a DigitalOcean base OS image, user-generated Droplet snapshot, automatically created Droplet backup, user-provided virtual machine image, or an image used for DigitalOcean managed resources (e.g. DOKS worker nodes).

Accepts one of the following:
"base"
"snapshot"
"backup"
"custom"
"admin"
Create a Custom Image
import Gradient from '@digitalocean/gradient';

const client = new Gradient();

const image = await client.gpuDroplets.images.create();

console.log(image.image);
{
  "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"
  }
}
Returns Examples
{
  "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"
  }
}