Skip to main content
POST
Query Vectors
Retrieve the nearest neighbors for a given query vector.

Authentication

Required - API key via X-API-Key header:
You can get an API key from the CyborgDB Admin Dashboard. For more info, follow this guide.

Request Body

Single Query Request

Batch Query Request

Semantic Search Request (with embedding model)

Response

Single Query Response

When query_vectors is a 1D array or query_contents is used:

Batch Query Response

When query_vectors is a 2D array (array of arrays):
The response format automatically matches the request format:
  • Single query → flat array of results
  • Batch query → nested array with results for each query

Metadata Filtering

Use MongoDB-style query operators:
Supported operators: $and, $or, $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin

Exceptions

  • 401: Authentication failed (invalid API key) or wrong index_key on SDK-supplied indexes — see error model
  • 404: Index not found
  • 422: Invalid request parameters or vector dimensions
  • 500: Internal server error

Example Usage

Basic Query:
With Filters:
Semantic Search:
Batch Query:
High Recall Query:
If embedding_model is configured for the index, you can use either query_vectors for direct vector search or query_contents for text-based semantic search.
Higher n_probes, rerank_mult, and greedy=true all increase recall but reduce query performance. Start with defaults and adjust based on your recall requirements.