# Update a swarm


[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





`POST /swarm/update`



## 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 POST \
  --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/swarm/update?version=%3CVERSION%3E'
```


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


## Parameters

### version

Location: query. Required: yes.

The version number of the swarm object being updated. This is
required to avoid conflicting writes.


```json
{
  "description": "The version number of the swarm object being updated. This is\nrequired to avoid conflicting writes.\n",
  "in": "query",
  "name": "version",
  "pointer": "/paths/~1swarm~1update/post/parameters/0",
  "required": true,
  "schema": {
    "format": "int64",
    "type": "integer"
  }
}
```

### rotateWorkerToken

Location: query. Required: no.

Rotate the worker join token.

```json
{
  "description": "Rotate the worker join token.",
  "in": "query",
  "name": "rotateWorkerToken",
  "pointer": "/paths/~1swarm~1update/post/parameters/1",
  "schema": {
    "default": false,
    "type": "boolean"
  }
}
```

### rotateManagerToken

Location: query. Required: no.

Rotate the manager join token.

```json
{
  "description": "Rotate the manager join token.",
  "in": "query",
  "name": "rotateManagerToken",
  "pointer": "/paths/~1swarm~1update/post/parameters/2",
  "schema": {
    "default": false,
    "type": "boolean"
  }
}
```

### rotateManagerUnlockKey

Location: query. Required: no.

Rotate the manager unlock key.

```json
{
  "description": "Rotate the manager unlock key.",
  "in": "query",
  "name": "rotateManagerUnlockKey",
  "pointer": "/paths/~1swarm~1update/post/parameters/3",
  "schema": {
    "default": false,
    "type": "boolean"
  }
}
```

## Request and responses

### Request  application/json




Schema:

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










### Request  text/plain




Schema:

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










### Response 200 application/json

no error











### Response 200 text/plain

no error











### Response 400 application/json

bad parameter


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": "SwarmUpdate",
  "parameters": [
    {
      "description": "The version number of the swarm object being updated. This is\nrequired to avoid conflicting writes.\n",
      "in": "query",
      "name": "version",
      "required": true,
      "schema": {
        "format": "int64",
        "type": "integer"
      }
    },
    {
      "description": "Rotate the worker join token.",
      "in": "query",
      "name": "rotateWorkerToken",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Rotate the manager join token.",
      "in": "query",
      "name": "rotateManagerToken",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Rotate the manager unlock key.",
      "in": "query",
      "name": "rotateManagerUnlockKey",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SwarmSpec"
        }
      },
      "text/plain": {
        "schema": {
          "$ref": "#/components/schemas/SwarmSpec"
        }
      }
    },
    "required": true,
    "x-codegen-request-body-name": "body"
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {},
        "text/plain": {}
      },
      "description": "no error"
    },
    "400": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "bad parameter"
    },
    "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 swarm",
  "tags": [
    "Swarm"
  ]
}
```

## Referenced schemas

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

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




