# Update volume

Update the volume's name and description.

```text
POST $CLOUDSIGMA_API_BASE/catalog/volume/update
```

## Before you call this API

Configure the [regional API endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md), and select the target workspace.

First [query the object](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/catalog/list-database-objects.html.md) in the database to obtain the target volume ID.

Set the operation-specific values used in the request:

- `$VOLUME_ID`: Volume ID to be updated.

## Request example

```bash
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/volume/update" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": '"$VOLUME_ID"',
    "name": "<VOLUME_NAME>",
    "description": "<VOLUME_DESCRIPTION>"
  }'
```

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | Yes | Volume ID. |
| `name` | string | Yes | New name, must be a valid identifier. |
| `description` | string | No | New description. |

## Successful response

Returns `200` and the ID of the updated volume on success.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": 789
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.id` | integer | The ID of the updated volume. |

## Error response

```json
{
  "code": "ErrAlreadyExists",
  "msg": "对象已存在",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - `id`, `name` are missing, or the new names are invalid.
  - Check volume ID and name.
* - `403`
  - `ErrForbidden`
  - The current identity does not have write permissions for the volume.
  - Use credentials with write access, or contact your administrator for authorization.
* - `409`
  - `ErrAlreadyExists`
  - There is already a volume with the same name under the same database.
  - Use another name.
* - `500`
  - `ErrServer`
  - The service cannot update the volume.
  - Record the request time and error message and try again; if it continues to fail, contact support.
```

## Follow-up operations

Use the same resource identifier [Query volume details](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/resource-center/catalog/get-volume.html.md) to confirm the update result.
