---
title: "Create shard key"
method: PUT
path: "/collections/{collection_name}/shards"
tags: ["Distributed"]
---

# Create shard key

`PUT /collections/{collection_name}/shards`

## Path parameters

- `collection_name` string, required

## Query parameters

- `timeout` integer

## Request body

- CreateShardingKey
  - `shard_key` union, required
    - string
    - integer
  - `shards_number` integer, nullable — How many shards to create for this key If not specified, will use the default value from config
  - `replication_factor` integer, nullable — How many replicas to create for each shard If not specified, will use the default value from config
  - `placement` integer[], 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
  - `initial_state` union — Initial state of the shards for this key If not specified, will be `Initializing` first and then `Active` Warning: do not change this unless you know what you are doing
    - 'Active' | 'Dead' | 'Partial' | 'Initializing' | 'Listener' | 'PartialSnapshot' | 'Recovery' | 'Resharding' | 'ReshardingScaleDown' | 'ActiveRead' | 'ManualRecovery' — State of the single shard within a replica set.
    - unknown

## Response `200`

successful operation

- object
  - `usage` union
    - Usage — Usage of the hardware resources, spent to process the request
      - `hardware` union
        - HardwareUsage — Usage of the hardware resources, spent to process the request
          - `cpu` integer, required
          - `payload_io_read` integer, required
          - `payload_io_write` integer, required
          - `payload_index_io_read` integer, required
          - `payload_index_io_write` integer, required
          - `vector_io_read` integer, required
          - `vector_io_write` integer, required
        - unknown
      - `inference` union
        - InferenceUsage
          - `models` object, required
        - unknown
    - unknown
  - `time` number, float — Time spent to process this request
  - `status` string
  - `result` boolean

## Other responses

- `default` — error
- `4XX` — error

---

[API](https://skmtc.net/qdrant/apis/qdrant-api.md) · [All operations](https://skmtc.net/qdrant/apis/qdrant-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/qdrant/qdrant-api/revisions/d08b1f613f29/schema)
