# 📦 Volumes

A Volume is a highly-available, scalable, and SSD-based block storage for Servers.

Pricing for Volumes depends on the Volume size and Location, not the actual used storage.

Please see [Hetzner Docs](https://docs.hetzner.com/cloud/#Volumes) for more details about Volumes.

## Get all Volumes

Gets all existing Volumes that you have available.

```csharp
HetznerCloudClient hetznerCloudClient = new HetznerCloudClient("ApiKey");

// Get All
List<Volume> listVolume = await hetznerCloudClient.Volume.Get();
```

## Get a Volume

Gets a specific Volume object.

```csharp
HetznerCloudClient hetznerCloudClient = new HetznerCloudClient("ApiKey");

long volumeId = 100051904;

// Get
Volume volume = await hetznerCloudClient.Volume.Get(volumeId);
```

## Update a Volume

Updates the Volume properties.

```csharp
HetznerCloudClient hetznerCloudClient = new HetznerCloudClient("ApiKey");

// Get
Volume volume = await hetznerCloudClient.Volume.Get(100051904);

// Change name
volume.Name = "new-name";

// Set
volume = await hetznerCloudClient.Volume.Update(volume);
```

## Delete a Volume

Deletes a volume. All Volume data is irreversibly destroyed. The Volume must not be attached to a Server and it must not have delete protection enabled.

```csharp
HetznerCloudClient hetznerCloudClient = new HetznerCloudClient("ApiKey");

// Get
Volume volume = await hetznerCloudClient.Volume.Get(100051904);

// You can delete it by passing the Volume as a parameter
await hetznerCloudClient.Volume.Delete(volume);

// You can also delete it by passing the Volume ID as a parameter.
await hetznerCloudClient.Volume.Delete(100051904);
```

## **JSON**

```json
{
    "volume": {
        "created": "2023-11-05T14:36:19Z",
        "format": "ext4",
        "id": 100056342,
        "labels": {},
        "linux_device": "/dev/disk/by-id/scsi-0HC_Volume_100056342",
        "location": {
            "city": "Ashburn, VA",
            "country": "US",
            "description": "Ashburn, VA",
            "id": 4,
            "latitude": 39.045821,
            "longitude": -77.487073,
            "name": "ash",
            "network_zone": "us-east"
        },
        "name": "volume-ash-1",
        "protection": {
            "delete": false
        },
        "server": 38976603,
        "size": 101,
        "status": "available"
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hetzner.ljchuello.com/functions-and-methods/volumes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
