Skip to main content
POST
Create Index
Create a new encrypted index.
There is a single index type. Configuration parameters (dimension, metric, embedding_model, storage_precision) are top-level fields; the index_config object and the IVFFlat/IVFPQ/IVFSQ distinction from earlier versions no longer apply.

Authentication

Required - admin (root) API key via X-API-Key header. Per-user (cdbk_) keys are rejected with 403 — a per-user credential operates on data, not index lifecycle:
When RBAC is not enabled (CYBORGDB_SERVICE_ROOT_KEY unset), no header is required.

Request Body

Key Management Modes

Exactly one of index_key / kms_name must be supplied:
  • SDK-supplied KEK (set index_key, omit kms_name) — the service records the index with provider: none. The same key must be re-supplied on every subsequent request (load, query, upsert, etc.).
  • KMS-backed (set kms_name, omit index_key) — the service generates the KEK, wraps it under the named registry slot, and persists the envelope. Subsequent requests omit index_key entirely; the service resolves it from the index’s stored key envelope.
Supplying both is rejected with 400, regardless of the registry slot’s provider type. (The none provider is not addressable by name — omit kms_name to use the SDK-supplied path.)

Metadata Schema

metadata_schema sets the per-field indexing policy. Metadata itself stays schemaless — this controls how each field is indexed, not what may be stored. Three knobs per field:
  • filterable (default true) — index the field so filters on it resolve from the index (pre-filter, and the only path /v1/vectors/query_metadata uses). false still stores the field but forces the dense post-filter path when /v1/vectors/query filters reference it — cheaper writes, slower filtered queries.
  • pattern (default false) — additionally build the field’s regex dictionary, needed for index-resolved $regex / $contains. Requires filterable: true.
  • full_text (default false) — route the field through the BM25 analyzer for full-text search instead of exact-match indexing. Implies filterable: false and is incompatible with pattern: true.
On /v1/vectors/query the schema is a performance hint: filters that miss the index fall back to a post-filter over the decrypted metadata, same rows either way. On /v1/vectors/query_metadata it is enforced — $regex / $contains on a non-pattern field, or any filter on a filterable: false field, is rejected with 400. The recorded policy is echoed back on POST /v1/indexes/describe under metadata_schema (empty object when the index uses the default posture).

Response

Exceptions

Index name already exists. Also raised for missing/conflicting key parameters (both index_key and kms_name supplied, or neither), and for BM25 parameter violations: bm25_k1 / bm25_b supplied for an index with no full_text field, bm25_k1 < 0, bm25_b outside [0, 1], or a text_fields entry naming a field the schema sets full_text=false
Authentication failed (invalid API key)
Authenticated with a per-user (cdbk_) key — this operation requires the admin (root) API key
Invalid request parameters — including metadata_schema with pattern=true but filterable=false, full_text=true combined with pattern=true or an explicit filterable=true, an empty field name, or an empty text_fields entry
Internal server error
KMS error (e.g. wrap operation failed)

Example Usage

Basic (SDK-supplied key):
KMS-backed:
With auto-embedding:
Float16 storage for reduced footprint:
With per-field metadata policy:
When embedding_model is specified, dimension is optional — the server infers it from the model. The index will automatically generate embeddings for text content during upsert operations.