---
title: "Create or update a KV bucket"
method: PUT
path: "/storage/kv/{bucket}"
tags: ["KV Buckets"]
---

# Create or update a KV bucket

`PUT /storage/kv/{bucket}`

Creates a new key-value bucket with optional indexing or updates it if one does not exist

## Path parameters

- `bucket` string, required

## Request body

- UpdateKVBucketRequest
  - `description` string — Updated description of the bucket
  - `max_bytes` integer — Updated maximum size of the bucket in bytes
  - `max_value_size` integer — Updated maximum size of individual values in bytes
  - `indexing` IndexRequest
    - `mappings` IndexMapping[], required — Field mappings for indexing
      - `field` string, required — Field name to be indexed
      - `field_type` 'text' | 'number' | 'date' | 'boolean' | 'keyword', required — Type of the field
    - `partitions` integer, required — Number of partitions for the index
    - `replicas` integer, required — Number of replicas for the index
    - `storage_type` 'file' | 'memory', required
    - `stream` string — Optional stream name for the index

## Response `200`

Bad Request

- SuccessMessage
  - `message` string

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.net/quivaworks/apis/quiva-ai-gateway-5.md) · [All operations](https://skmtc.net/quivaworks/apis/quiva-ai-gateway-5/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/quivaworks/quiva-ai-gateway-5/revisions/072de10ada5e/schema)
