# "Update a volume. Valid only for Swarm cluster volumes"



[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`PUT /volumes/{name}`



## Connection and access

[API connection and authentication guidance](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request PUT \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data-binary @request-body \
  'http://localhost/v1.57/volumes/<NAME>?version=%3CVERSION%3E'
```


Prepare request-body using the selected media type and schema.


## Parameters

### name

Location: path. Required: yes.

The name or ID of the volume

```json
{
  "description": "The name or ID of the volume",
  "in": "path",
  "name": "name",
  "pointer": "/paths/~1volumes~1{name}/put/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

### version

Location: query. Required: yes.

The version number of the volume being updated. This is required to
avoid conflicting writes. Found in the volume's `ClusterVolume`
field.


```json
{
  "description": "The version number of the volume being updated. This is required to\navoid conflicting writes. Found in the volume's `ClusterVolume`\nfield.\n",
  "in": "query",
  "name": "version",
  "pointer": "/paths/~1volumes~1{name}/put/parameters/1",
  "required": true,
  "schema": {
    "format": "int64",
    "type": "integer"
  }
}
```

## Request and responses

### Request  application/json

The spec of the volume to update. Currently, only Availability may
change. All other fields must remain unchanged.



Schema:

```json
{
  "description": "Volume configuration",
  "properties": {
    "Spec": {
      "$ref": "#/components/schemas/ClusterVolumeSpec"
    }
  },
  "type": "object"
}
```










### Response 200 application/json

no error











### Response 400 application/json

bad parameter


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 404 application/json

no such volume


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 500 application/json

server error


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 503 application/json

node is not part of a swarm


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "operationId": "VolumeUpdate",
  "parameters": [
    {
      "description": "The name or ID of the volume",
      "in": "path",
      "name": "name",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "The version number of the volume being updated. This is required to\navoid conflicting writes. Found in the volume's `ClusterVolume`\nfield.\n",
      "in": "query",
      "name": "version",
      "required": true,
      "schema": {
        "format": "int64",
        "type": "integer"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "description": "Volume configuration",
          "properties": {
            "Spec": {
              "$ref": "#/components/schemas/ClusterVolumeSpec"
            }
          },
          "type": "object"
        }
      }
    },
    "description": "The spec of the volume to update. Currently, only Availability may\nchange. All other fields must remain unchanged.\n",
    "x-codegen-request-body-name": "body"
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {}
      },
      "description": "no error"
    },
    "400": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "bad parameter"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "no such volume"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "server error"
    },
    "503": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "node is not part of a swarm"
    }
  },
  "summary": "\"Update a volume. Valid only for Swarm cluster volumes\"\n",
  "tags": [
    "Volume"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ClusterVolumeSpec](/reference/api/engine/version/v1.57/schemas/ClusterVolumeSpec/)

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)




