Semantic Search
curl --request POST \
--url https://api.example.com/api/vector/search \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"k_limit": 123
}
'import requests
url = "https://api.example.com/api/vector/search"
payload = {
"query": "<string>",
"k_limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', k_limit: 123})
};
fetch('https://api.example.com/api/vector/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/vector/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'k_limit' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/vector/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"k_limit\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/vector/search")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"k_limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/vector/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"k_limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"collection_id": "<string>",
"collection_name": "<string>",
"similarity_score": 123
}Vector Search
Semantic Search
Search for API collections using natural language
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
}
'import requests
url = "https://api.example.com/api/vector/search"
payload = {
"query": "<string>",
"k_limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', k_limit: 123})
};
fetch('https://api.example.com/api/vector/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/vector/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'k_limit' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/vector/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"k_limit\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/vector/search")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"k_limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/vector/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"k_limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"collection_id": "<string>",
"collection_name": "<string>",
"similarity_score": 123
}Authentication
Supports both Firebase and API Key authentication.Request Body
string
required
Natural language search query
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.string
Collection UUID
string
Collection display name
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
- Query Embedding - Your query is converted to a 768-dimensional vector using Vertex AI
- Similarity Search - pgvector performs cosine similarity search against all collection embeddings
- Access Filtering - Results are filtered to collections you have access to
- 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
| Status | Description |
|---|---|
| 400 | Invalid request body |
| 401 | Invalid authentication |
| 500 | Embedding service unavailable |

