# Bare Metal Cloud › VPS › Additional disk API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Bare Metal Cloud product's sections: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 3 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/additional-disk/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/bare-metal-cloud/vps/additional-disk.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/bare-metal-cloud/vps/additional-disk.json?format=openapi3

## Operations

- `GET /vps/{serviceName}/disks` — List disks attached to this VPS
- `GET /vps/{serviceName}/disks/{id}` — Retrieve details about a specific disk attached to this VPS
- `PUT /vps/{serviceName}/disks/{id}` — Update disk properties for this VPS

## List disks attached to this VPS

`GET /1.0/vps/{serviceName}/disks`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/additional-disk/#listVpsDisks

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:disks/get`

Returns the IDs of the disks attached to the VPS.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | integer[] | successful operation |

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/vps/{serviceName}/disks" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/vps/{serviceName}/disks")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/vps/{serviceName}/disks");

print_r($result);
?>
```

## Retrieve details about a specific disk attached to this VPS

`GET /1.0/vps/{serviceName}/disks/{id}`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/additional-disk/#getVpsDisk

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:disks/get`

Returns the type, size, state, monitoring, bandwidth limit and low free space threshold of a disk of the VPS.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vps.Disk | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bandwidthLimit` | integer | read-only |  |
| `id` | integer | read-only |  |
| `lowFreeSpaceThreshold` | integer |  | The low disk free space threshold in MiB |
| `monitoring` | boolean |  | The monitoring state of this disk |
| `serviceName` | string | read-only | Service name |
| `size` | integer | read-only |  |
| `state` | vps.disk.StateEnum | read-only | Possible states the disk can be in — one of `connected`, `disconnected`, `pending` |
| `type` | vps.disk.TypeEnum | read-only | Possible type a disk can be in — one of `additional`, `primary` |

```json
{
  "bandwidthLimit": 0,
  "id": 0,
  "lowFreeSpaceThreshold": 0,
  "monitoring": true,
  "serviceName": "string",
  "size": 0,
  "state": "connected",
  "type": "additional"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/vps/{serviceName}/disks/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/vps/{serviceName}/disks/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/vps/{serviceName}/disks/{id}");

print_r($result);
?>
```

## Update disk properties for this VPS

`PUT /1.0/vps/{serviceName}/disks/{id}`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/additional-disk/#editVpsDisk

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:disks/edit`

Updates the monitoring state and the low free space threshold of a disk of the VPS.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `vps.Disk`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bandwidthLimit` | integer | read-only |  |
| `id` | integer | read-only |  |
| `lowFreeSpaceThreshold` | integer |  | The low disk free space threshold in MiB |
| `monitoring` | boolean |  | The monitoring state of this disk |
| `serviceName` | string | read-only | Service name |
| `size` | integer | read-only |  |
| `state` | vps.disk.StateEnum | read-only | Possible states the disk can be in — one of `connected`, `disconnected`, `pending` |
| `type` | vps.disk.TypeEnum | read-only | Possible type a disk can be in — one of `additional`, `primary` |

```json
{
  "lowFreeSpaceThreshold": 0,
  "monitoring": true
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/vps/{serviceName}/disks/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: vps.Disk
result = client.put("/vps/{serviceName}/disks/{id}",
	lowFreeSpaceThreshold = None, # The low disk free space threshold in MiB (type: integer, nullable)
	monitoring = None, # The monitoring state of this disk (type: boolean, nullable)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: vps.Disk
$result = $ovh->put("/vps/{serviceName}/disks/{id}", array(
	lowFreeSpaceThreshold => null, // The low disk free space threshold in MiB (type: integer, nullable)
	monitoring => null, // The monitoring state of this disk (type: boolean, nullable)
));

print_r($result);
?>
```
