Skip to main content

Query

The query endpoint performs semantic search against a vector table.

POST /v1/vector-tables/{vector_table_id}/query

Request Body:

FieldTypeRequiredDefaultDescription
querystringYesNatural language search query
limitintegerNo10Number of results (1-100)
min_similarity_scorefloatNonullMinimum cosine similarity (0.0-1.0)
filtersobjectNonullMetadata filters

Example:

curl -X POST https://api.embedd.to/v1/vector-tables/{id}/query \
-H "Authorization: Bearer sk_your_key" \
-H "X-Environment-Id: env_abc123" \
-H "Content-Type: application/json" \
-d '{
"query": "machine learning for beginners",
"limit": 5,
"min_similarity_score": 0.7,
"filters": {
"category": {"$eq": "education"},
"price": {"$lte": 50}
}
}'

Response (200):

{
"results": [
{
"id": 42,
"similarity_score": 0.91,
"metadata": {
"category": "education",
"price": 29.99
},
"embedded_text": "Introduction to Machine Learning..."
}
],
"query": "machine learning for beginners",
"model": "text-embedding-3-small",
"total_results": 1
}

Filter Operators

OperatorDescriptionExample
$eqEquals{"status": {"$eq": "active"}}
$neNot equals{"status": {"$ne": "archived"}}
$gtGreater than{"price": {"$gt": 10}}
$gteGreater than or equal{"price": {"$gte": 10}}
$ltLess than{"price": {"$lt": 100}}
$lteLess than or equal{"price": {"$lte": 100}}
$inIn array{"category": {"$in": ["a", "b"]}}
$ninNot in array{"category": {"$nin": ["x"]}}
$existsField exists{"notes": {"$exists": true}}

Multiple filters are combined with AND logic:

{
"filters": {
"category": {"$eq": "electronics"},
"price": {"$gte": 10, "$lte": 500},
"in_stock": {"$eq": true}
}
}

How It Works

  1. Your query text is embedded using the same model configured for the vector table
  2. The resulting vector is compared against stored vectors using cosine similarity
  3. Results are ranked by similarity score (highest first)
  4. Metadata filters are applied to narrow results

The query endpoint requires the vector table to be in synced or backfilling status.