> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quiva.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new KV bucket

> Creates a new key-value bucket with optional indexing configuration



## OpenAPI

````yaml /api-reference/endpoint/storage/openapi.json post /storage/kv
openapi: 3.0.3
info:
  title: quiva.ai Gateway
  description: >-
    A comprehensive interface for managing key-value stores, object stores,
    streams, and search indexing
  contact:
    name: quiva.ai Support
    url: https://quiva.ai/help-center/
  version: 1.0.0
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /storage/kv:
    post:
      tags:
        - KV Buckets
      summary: Create a new KV bucket
      description: Creates a new key-value bucket with optional indexing configuration
      operationId: createKVBucket
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKVBucketRequest'
            examples:
              simple:
                summary: Simple bucket without indexing
                value:
                  bucket: user-preferences
                  description: Stores user preference settings
                  compression: false
                  history: 1
                  replicas: 1
                  storage: file
              with-indexing:
                summary: Bucket with full-text indexing
                value:
                  bucket: products
                  description: Product catalog with search
                  compression: true
                  history: 5
                  max_bytes: 10737418240
                  max_value_size: 1048576
                  replicas: 3
                  storage: file
                  indexing:
                    mappings:
                      - field: name
                        field_type: text
                      - field: price
                        field_type: number
                    partitions: 3
                    replicas: 2
                    storage_type: file
              memory-cache:
                summary: In-memory bucket for caching
                value:
                  bucket: rate-limits
                  description: Rate limiting counters
                  compression: false
                  history: 1
                  max_bytes: 104857600
                  replicas: 1
                  storage: memory
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CreateKVBucketRequest:
      type: object
      required:
        - bucket
      properties:
        bucket:
          type: string
          description: Name of the bucket to create
        compression:
          type: boolean
          description: Whether to enable compression
          default: false
        description:
          type: string
          description: Description of the bucket
        history:
          type: integer
          description: Number of historical versions to keep
          minimum: 1
          default: 1
        indexing:
          $ref: '#/components/schemas/IndexRequest'
        max_bytes:
          type: integer
          description: Maximum size of the bucket in bytes
          minimum: 1
          format: int64
        max_value_size:
          type: integer
          description: Maximum size of individual values in bytes
          minimum: 1
          format: int32
        replicas:
          type: integer
          description: Number of replicas
          minimum: 1
          default: 1
        storage:
          $ref: '#/components/schemas/StorageType'
    IndexRequest:
      type: object
      required:
        - mappings
        - partitions
        - replicas
        - storage_type
      properties:
        mappings:
          type: array
          description: Field mappings for indexing
          items:
            $ref: '#/components/schemas/IndexMapping'
        partitions:
          type: integer
          description: Number of partitions for the index
          minimum: 1
        replicas:
          type: integer
          description: Number of replicas for the index
          minimum: 1
        storage_type:
          $ref: '#/components/schemas/StorageType'
        stream:
          type: string
          description: Optional stream name for the index
    StorageType:
      type: string
      enum:
        - file
        - memory
    SuccessMessage:
      type: object
      properties:
        message:
          type: string
          example: success
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message
    IndexMapping:
      type: object
      required:
        - field
        - field_type
      properties:
        field:
          type: string
          description: Field name to be indexed
        field_type:
          type: string
          description: Type of the field
          enum:
            - text
            - number
            - date
            - boolean
            - keyword
  responses:
    SuccessResponse:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SuccessMessage'
          example:
            message: success
    BadRequestError:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: validation_error
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: unauthorized
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: internal_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````