> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.qdrant.tech/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.qdrant.tech/_mcp/server.

# Update cluster setup

POST http://localhost:6333/collections/{collection_name}/cluster
Content-Type: application/json

Updates the cluster configuration for a specified collection.

Reference: https://api.qdrant.tech/api-reference/distributed/update-collection-cluster

## Authentication

- `api-key` header (required) — API Key authentication via header

## Servers

- `http://localhost:6333` (http, default)
- `https://localhost:6333` (https)

## Request

### Path parameters

- `collection_name` (string, required) — Name of the collection on which to to apply the cluster update operation

### Query parameters

- `timeout` (integer, optional) — Wait for operation commit timeout in seconds. If timeout is reached - request will return with service error.

### Body (application/json)

This endpoint expects a ClusterOperations.

- `ClusterOperations`

## Response

### 200

successful operation

- `time` (double, optional) — Time spent to process this request
- `status` (string, optional)
- `result` (boolean, optional)

## Types

### MoveShardOperation

- `move_shard` (MoveShard, required)

### ReplicateShardOperation

- `replicate_shard` (ReplicateShard, required)

### AbortTransferOperation

- `abort_transfer` (AbortShardTransfer, required)

### DropReplicaOperation

- `drop_replica` (Replica, required)

### CreateShardingKeyOperation

- `create_sharding_key` (CreateShardingKey, required)

### DropShardingKeyOperation

- `drop_sharding_key` (DropShardingKey, required)

### RestartTransferOperation

- `restart_transfer` (RestartTransfer, required)

### MoveShard

- `shard_id` (uint, required)
- `to_peer_id` (uint64, required)
- `from_peer_id` (uint64, required)
- `method` (MoveShardMethod, optional) — Method for transferring the shard from one node to another

### ReplicateShard

- `shard_id` (uint, required)
- `to_peer_id` (uint64, required)
- `from_peer_id` (uint64, required)
- `method` (ReplicateShardMethod, optional) — Method for transferring the shard from one node to another

### AbortShardTransfer

- `shard_id` (uint, required)
- `to_peer_id` (uint64, required)
- `from_peer_id` (uint64, required)

### Replica

- `shard_id` (uint, required)
- `peer_id` (uint64, required)

### CreateShardingKey

- `shard_key` (ShardKey, required)
- `shards_number` (uint, optional, nullable) — How many shards to create for this key If not specified, will use the default value from config
- `replication_factor` (uint, optional, nullable) — How many replicas to create for each shard If not specified, will use the default value from config
- `placement` (list of uint64, optional, nullable) — Placement of shards for this key List of peer ids, that can be used to place shards for this key If not specified, will be randomly placed among all peers

### DropShardingKey

- `shard_key` (ShardKey, required)

### RestartTransfer

- `shard_id` (uint, required)
- `from_peer_id` (uint64, required)
- `to_peer_id` (uint64, required)
- `method` (ShardTransferMethod, required) — Methods for transferring a shard from one node to another.

### MoveShardMethod

Method for transferring the shard from one node to another

### ReplicateShardMethod

Method for transferring the shard from one node to another

### ShardKey

### ShardTransferMethod

Methods for transferring a shard from one node to another.

## Examples

**Request**

```json
{
  "move_shard": {
    "shard_id": 1,
    "to_peer_id": 1,
    "from_peer_id": 1
  }
}
```

**Response**

```json
{
  "time": 1.1,
  "status": "string",
  "result": true
}
```

**SDK Code**

```python
import requests

url = "http://localhost:6333/collections/collection_name/cluster"

payload = { "move_shard": {
        "shard_id": 1,
        "to_peer_id": 1,
        "from_peer_id": 1
    } }
headers = {
    "api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'http://localhost:6333/collections/collection_name/cluster';
const options = {
  method: 'POST',
  headers: {'api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"move_shard":{"shard_id":1,"to_peer_id":1,"from_peer_id":1}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:6333/collections/collection_name/cluster"

	payload := strings.NewReader("{\n  \"move_shard\": {\n    \"shard_id\": 1,\n    \"to_peer_id\": 1,\n    \"from_peer_id\": 1\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:6333/collections/collection_name/cluster")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"move_shard\": {\n    \"shard_id\": 1,\n    \"to_peer_id\": 1,\n    \"from_peer_id\": 1\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:6333/collections/collection_name/cluster")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"move_shard\": {\n    \"shard_id\": 1,\n    \"to_peer_id\": 1,\n    \"from_peer_id\": 1\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:6333/collections/collection_name/cluster', [
  'body' => '{
  "move_shard": {
    "shard_id": 1,
    "to_peer_id": 1,
    "from_peer_id": 1
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:6333/collections/collection_name/cluster");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"move_shard\": {\n    \"shard_id\": 1,\n    \"to_peer_id\": 1,\n    \"from_peer_id\": 1\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["move_shard": [
    "shard_id": 1,
    "to_peer_id": 1,
    "from_peer_id": 1
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/collections/collection_name/cluster")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```