Skip to main content
POST
/
api
/
vector
/
search
Semantic Search
curl --request POST \
  --url https://api.example.com/api/vector/search \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "k_limit": 123
}
'
{
  "collection_id": "<string>",
  "collection_name": "<string>",
  "similarity_score": 123
}

Authentication

Supports both Firebase and API Key authentication.

Request Body

query
string
required
Natural language search query
k_limit
integer
default:"10"
Maximum number of results (1-100)

Example Request

curl -X POST https://api.sari-platform.com/api/vector/search \
  -H "X-Client-ID: client_abc123" \
  -H "X-API-Key: <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "payment processing API",
    "k_limit": 10
  }'

Response

Returns matching collections ordered by similarity score.
collection_id
string
Collection UUID
collection_name
string
Collection display name
similarity_score
number
Cosine similarity score (0-1, higher is better)

Example Response

[
  {
    "collection_id": "550e8400-e29b-41d4-a716-446655440000",
    "collection_name": "Stripe Payment API",
    "similarity_score": 0.89
  },
  {
    "collection_id": "550e8400-e29b-41d4-a716-446655440001",
    "collection_name": "PayPal Checkout API",
    "similarity_score": 0.75
  },
  {
    "collection_id": "550e8400-e29b-41d4-a716-446655440002",
    "collection_name": "Square Payments API",
    "similarity_score": 0.72
  }
]

How It Works

  1. Query Embedding - Your query is converted to a 768-dimensional vector using Vertex AI
  2. Similarity Search - pgvector performs cosine similarity search against all collection embeddings
  3. Access Filtering - Results are filtered to collections you have access to
  4. Ranking - Results are ordered by similarity score (highest first)

Access Control

  • Admins: Search across all collections
  • Clients: Search only across collections they have access to

Errors

StatusDescription
400Invalid request body
401Invalid authentication
500Embedding service unavailable