POST
/
v1
/
indexes
/
create
Create a new encrypted index with the specified configuration.

Request Body

{
  "index_name": "my_index",
  "index_key": "64_character_hex_string_representing_32_bytes",
  "index_config": {
    "type": "ivfflat",
    "dimension": 384,
    "n_lists": 1024,
    "metric": "euclidean"
  },
  "embedding_model": "all-MiniLM-L6-v2"
}

Index Types

Suitable for applications requiring high recall with moderate memory usage:
{
  "type": "ivfflat",
  "dimension": 384,
  "n_lists": 1024,
  "metric": "euclidean"
}
Speed: Fast | Recall: Highest | Index Size: Biggest

IVF

Ideal for large-scale datasets where fast retrieval is prioritized:
{
  "type": "ivf",
  "dimension": 384,
  "n_lists": 1024,
  "metric": "euclidean"
}
Speed: Fastest | Recall: Lowest | Index Size: Smallest

IVFPQ

Product Quantization compresses embeddings, balancing memory use and recall:
{
  "type": "ivfpq",
  "dimension": 384,
  "n_lists": 1024,
  "pq_dim": 64,
  "pq_bits": 8,
  "metric": "euclidean"
}
Speed: Fast | Recall: High | Index Size: Medium

Distance Metrics

  • "euclidean": Euclidean distance
  • "cosine": Cosine similarity
  • "squared_euclidean": Squared Euclidean distance

Response

{
  "status": "success",
  "message": "Index 'my_index' created successfully"
}

Exceptions

  • 401: Authentication failed (invalid API key)
  • 409: Index name already exists
  • 422: Invalid request parameters
  • 500: Internal server error

Example Usage

curl -X POST "http://localhost:8000/v1/indexes/create" \
     -H "X-API-Key: cyborg_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{
       "index_name": "my_index",
       "index_key": "your_64_character_hex_key_here",
       "index_config": {
         "type": "ivfflat",
         "dimension": 384,
         "n_lists": 1024,
         "metric": "euclidean"
       }
     }'

With Auto-Embedding

curl -X POST "http://localhost:8000/v1/indexes/create" \
     -H "X-API-Key: cyborg_your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{
       "index_name": "semantic_search_index",
       "index_key": "your_64_character_hex_key_here",
       "index_config": {
         "type": "ivfflat",
         "n_lists": 1024,
         "metric": "cosine"
       },
       "embedding_model": "all-MiniLM-L6-v2"
     }'
When embedding_model is specified, the dimension parameter in index_config is optional as it will be inferred from the embedding model.