Skip to main content

Volumes

Volume Schema

  • id String - A unique identifier for each volume. This is automatically generated.
  • name String - The human-readable name for the volume.
  • description String - The human-readable description for the volume.
  • size BigInt (String) - The storage size of this volume given in GiB.
  • region String - The identifier for the region this volume exists in (eg. NORD-NO-KRS-1).
  • type String - The storage type of the volume. Possible values are hdd and ssd. The ssd type is currently available only in NORD-NO-KRS-1 region.
  • instances Array - The attached instances.
  • status String - The volume status. Possible values are creating, created, pending_delete, deleting.
  • created_at String - A time value given in ISO8601 combined date and time format that represents when the volume was created.
  • updated_at String - A time value given in ISO8601 combined date and time format that represents when the volume was updated.

Create a Volume

To create a new volume, send a request to:

POST /compute/v1/volumes (HTTP 201 - Created)

The attribute values that must be set to successfully create a volume are:

Body parameters

  • name String Required - The human-readable name set for the volume.
  • description String Required - The human-readable description set for the volume.
  • size BigInt Required - The storage size of this volume given in GiB (Min: 1GiB).
  • region String Required - The identifier for the region in which this volume should be created in, see Regions.
  • type String Optional - The storage type of this volume. Defaults to hdd, see Volume Schema.
{
"name": "<volume name>",
"description": "<volume description>",
"size": 50,
"region": "NORD-NO-KRS-1",
"type": "hdd"
}

Response body

The volume will be created using the provided information. The response body will contain a JSON object with standard attributes for your new volume, see Volume Schema:

{
"volume": {
"id": "0580fb4c-de74-4b83-8bdb-1fd87d89f827",
"name": "<volume name>",
"description": "<volume description>",
"size": 50,
"region": "NORD-NO-KRS-1",
"type": "hdd",
"instances": [],
"status": "created",
"created_at": "2020-07-28T07:53:11.177Z"
}
}

List Volumes

Lists all volumes of an account.

GET /compute/v1/volumes (HTTP 200 - OK)

Query parameters

  • per_page Integer Optional - A positive integer lower than or equal to 100 to select the number of items to return (default: 50).
  • page Integer Optional - A positive integer to choose the page to return.

Response body

The response will be a JSON object with pagination details and a key called volumes. This will be set to an array of volume objects, each of which will contain the volume object, see Volume Schema:

{
"volumes": [
{
"id": "0580fb4c-de74-4b83-8bdb-1fd87d89f827",
"name": "<volume name>",
"description": "<volume description>",
"size": 50,
"region": "NORD-NO-KRS-1",
"type": "hdd",
"instances": [
{
"id": "4c177746-3565-4fa3-872c-d8c6863c285b",
"name": "<instance-name>"
}
],
"status": "created",
"created_at": "2020-07-28T07:53:11.177Z"
}
],
"total_count": 1,
"page": 1,
"per_page": 50
}

Get Volume

Get details of one volume with a given ID.

GET /compute/v1/volumes/<volume_id> (HTTP 200 - OK)

Path parameters:

  • volume_id String - volume id

Response body

The response will be a JSON object that contains the volume attributes, see Volume Schema:

{
"volume": {
"id": "0580fb4c-de74-4b83-8bdb-1fd87d89f827",
"name": "<volume name>",
"description": "<volume description>",
"size": 1,
"region": "NORD-NO-KRS-1",
"type": "hdd",
"instances": [
{
"id": "4c177746-3565-4fa3-872c-d8c6863c285b",
"name": "<instance-name>"
}
],
"status": "created",
"created_at": "2020-07-28T07:53:11.177Z"
}
}

Delete a Volume

Delete a volume with the given ID

DELETE /compute/v1/volumes/<volume_id>  (HTTP 204 - No content)

Path parameters:

  • volume_id String - volume id

Examples (cURL)

# Create a new volume
curl -H "Authorization: Bearer $TOKEN" \
-X POST "https://api.genesiscloud.com/compute/v1/volumes" \
-H "Content-Type: application/json" \
--data-raw '{
"name": "name",
"description": "description",
"size": 1,
"region": "NORD-NO-KRS-1",
"type": "hdd"
}'
# List all volumes
curl -H "Authorization: Bearer $TOKEN" \
"https://api.genesiscloud.com/compute/v1/volumes"
# Get a volume by id
curl -H "Authorization: Bearer $TOKEN" \
"https://api.genesiscloud.com/compute/v1/volumes/<volume_id>"
# Delete a volume by id
curl -H "Authorization: Bearer $TOKEN" \
-X DELETE "https://api.genesiscloud.com/compute/v1/volumes/<volume_id>"