VECTOR-STORES
Search a Vector Store
Search a vector store using a text query or raw embedding vector. At least one of query or vector must be provided.
POST/v1/vector-stores/{store_id}/search
Authorization
AuthorizationstringheaderrequiredBearer token — your API key. Example: Bearer sk-...
Request body
application/jsonquerystringText query to search for. At least one of query or vector is required.
vectornumber[]Raw embedding vector to search with. At least one of query or vector is required.
limitintegerdefault: 10Maximum number of results to return (1-100, default 10).
scoreThresholdnumberMinimum similarity score threshold for results.
Response
dataobject[]requiredArray of search results ordered by relevance.
Request
const response = await fetch("https://api.scx.ai/v1/vector-stores/a1b2c3d4-e5f6-7890-abcd-ef1234567890/search", {
method: "POST",
headers: {
"Authorization": "Bearer your-scx-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
query: "How does authentication work?",
limit: 5,
}),
});
const { data } = await response.json();
console.log(data);const response = await fetch("https://api.scx.ai/v1/vector-stores/a1b2c3d4-e5f6-7890-abcd-ef1234567890/search", {
method: "POST",
headers: {
"Authorization": "Bearer your-scx-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
query: "How does authentication work?",
limit: 5,
}),
});
const { data } = await response.json();
console.log(data);Response
{
"data": [
{
"id": "abc123",
"score": 0.92,
"payload": {
"text": "Authentication is handled via API keys passed in the Authorization header...",
"filename": "auth-docs.pdf"
}
},
{
"id": "def456",
"score": 0.87,
"payload": {
"text": "OAuth 2.0 providers can be configured for single sign-on...",
"filename": "sso-guide.pdf"
}
}
]
}{
"data": [
{
"id": "abc123",
"score": 0.92,
"payload": {
"text": "Authentication is handled via API keys passed in the Authorization header...",
"filename": "auth-docs.pdf"
}
},
{
"id": "def456",
"score": 0.87,
"payload": {
"text": "OAuth 2.0 providers can be configured for single sign-on...",
"filename": "sso-guide.pdf"
}
}
]
}