---
title: "POST /swarm/init"
method: POST
path: "/swarm/init"
---

# POST /swarm/init

`POST /swarm/init`

Initialize a new swarm

## Request body

- object
  - `ListenAddr` string
  - `AdvertiseAddr` string
  - `DataPathAddr` string
  - `DataPathPort` integer
  - `DefaultAddrPool` string[]
  - `ForceNewCluster` boolean
  - `SubnetSize` integer
  - `Spec` SwarmSpec — User modifiable swarm configuration.
    - `Name` string — Name of the swarm.
    - `Labels` object — User-defined key/value metadata.
    - `Orchestration` object, nullable — Orchestration configuration.
      - `TaskHistoryRetentionLimit` integer
    - `Raft` object — Raft configuration.
      - `SnapshotInterval` integer
      - `KeepOldSnapshots` integer
      - `LogEntriesForSlowFollowers` integer
      - `ElectionTick` integer
      - `HeartbeatTick` integer
    - `Dispatcher` object, nullable — Dispatcher configuration.
      - `HeartbeatPeriod` integer
    - `CAConfig` object, nullable — CA configuration.
      - `NodeCertExpiry` integer
      - `ExternalCAs` object[]
        - `Protocol` 'cfssl'
        - `URL` string
        - `Options` object
        - `CACert` string
      - `SigningCACert` string
      - `SigningCAKey` string
      - `ForceRotate` integer
    - `EncryptionConfig` object — Parameters related to encryption-at-rest.
      - `AutoLockManagers` boolean
    - `TaskDefaults` object — Defaults for creating tasks in this cluster.
      - `LogDriver` object
        - `Name` string
        - `Options` object

## Response `200`

The request has succeeded.

## Changes

- **2026-02-14** `31f80d10d31a` — 4 breaking, 5 info
  - removed the media type `text/plain` from the request body
  - the `Spec/Raft/ElectionTick` request property type/format changed from `integer`/`` to `integer`/`int32`
  - the `Spec/Raft/HeartbeatTick` request property type/format changed from `integer`/`` to `integer`/`int32`
  - removed the media type `application/json` for the response with the status `200`
  - …5 more

[Change history](https://skmtc.dev/hexlet/apis/docker-engine-api/changes/swarm/init/post.md)

---

[API](https://skmtc.dev/hexlet/apis/docker-engine-api.md) · [All operations](https://skmtc.dev/hexlet/apis/docker-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hexlet/docker-engine-api/revisions/7dbd508c79cf/schema)
