Search in vector store's file
curl --request POST \
--url https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-selected-account-id: <api-key>' \
--data '
{
"query": "<string>",
"top_k": 123,
"filters": {},
"rerank_config": {
"model": "<string>",
"top_n": 2,
"instruction": "<string>"
}
}
'import requests
url = "https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search"
payload = {
"query": "<string>",
"top_k": 123,
"filters": {},
"rerank_config": {
"model": "<string>",
"top_n": 2,
"instruction": "<string>"
}
}
headers = {
"x-api-key": "<api-key>",
"x-selected-account-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-selected-account-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: '<string>',
top_k: 123,
filters: {},
rerank_config: {model: '<string>', top_n: 2, instruction: '<string>'}
})
};
fetch('https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/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/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/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>',
'top_k' => 123,
'filters' => [
],
'rerank_config' => [
'model' => '<string>',
'top_n' => 2,
'instruction' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-selected-account-id: <api-key>"
],
]);
$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/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"filters\": {},\n \"rerank_config\": {\n \"model\": \"<string>\",\n \"top_n\": 2,\n \"instruction\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-selected-account-id", "<api-key>")
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/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search")
.header("x-api-key", "<api-key>")
.header("x-selected-account-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"filters\": {},\n \"rerank_config\": {\n \"model\": \"<string>\",\n \"top_n\": 2,\n \"instruction\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-selected-account-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"filters\": {},\n \"rerank_config\": {\n \"model\": \"<string>\",\n \"top_n\": 2,\n \"instruction\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"chunks": [
{
"content": "<string>",
"blocks": [
{
"type": "<string>",
"content": "<string>",
"bbox": {
"left": 123,
"top": 123,
"width": 123,
"height": 123
},
"confidence": 123,
"page_number": 0,
"error": "<string>",
"row_bboxes": [
{
"left": 123,
"top": 123,
"width": 123,
"height": 123
}
],
"col_bboxes": [
{
"left": 123,
"top": 123,
"width": 123,
"height": 123
}
]
}
],
"score": 123,
"file_id": "<string>",
"parse_result_id": "<string>",
"metadata": {}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Vector Stores
Search in vector store's file
Perform semantic search within a vector store and filter down to a specific file. Provide the file_id to search within the file, don’t confuse it with parse_result_id, because the two are connected.
This endpoint performs vector-based semantic search to find the most relevant content based on the provided query. The search uses embeddings to find semantically similar content.
Search Parameters:
query: The search query texttop_k: Number of results to return (ranked by relevance)filters: Optional filters to narrow search scope (e.g., by file_id)
Authentication:
- Credentials can be provided either through project-level credentials or request-level credentials
- For SGP Knowledge Base, SGP credentials are required
Returns:
- Ranked list of relevant content chunks
- Each chunk includes content, source blocks, relevance score, and parse result ID
- Results are ordered by relevance score (highest first)
Example Request:
{
"query": "What are the main features of the product?",
"top_k": 5,
"filters": {
"file_id": "file_123"
},
"credentials": {
"sgp": {
"api_key": "your-api-key",
"base_url": "https://api.example.com"
}
}
}
Example Response:
{
"chunks": [
{
"content": "The product includes advanced analytics, real-time monitoring, and automated reporting features.",
"blocks": [
{
"id": "block_123",
"content": "The product includes advanced analytics...",
"type": "text"
}
],
"score": 0.95,
"parse_result_id": "parse_123"
}
]
}
POST
/
v1
/
projects
/
{project_id}
/
vector-stores
/
{vector_store_id}
/
files
/
{file_id}
/
search
Search in vector store's file
curl --request POST \
--url https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-selected-account-id: <api-key>' \
--data '
{
"query": "<string>",
"top_k": 123,
"filters": {},
"rerank_config": {
"model": "<string>",
"top_n": 2,
"instruction": "<string>"
}
}
'import requests
url = "https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search"
payload = {
"query": "<string>",
"top_k": 123,
"filters": {},
"rerank_config": {
"model": "<string>",
"top_n": 2,
"instruction": "<string>"
}
}
headers = {
"x-api-key": "<api-key>",
"x-selected-account-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-selected-account-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: '<string>',
top_k: 123,
filters: {},
rerank_config: {model: '<string>', top_n: 2, instruction: '<string>'}
})
};
fetch('https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/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/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/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>',
'top_k' => 123,
'filters' => [
],
'rerank_config' => [
'model' => '<string>',
'top_n' => 2,
'instruction' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-selected-account-id: <api-key>"
],
]);
$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/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"filters\": {},\n \"rerank_config\": {\n \"model\": \"<string>\",\n \"top_n\": 2,\n \"instruction\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-selected-account-id", "<api-key>")
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/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search")
.header("x-api-key", "<api-key>")
.header("x-selected-account-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"filters\": {},\n \"rerank_config\": {\n \"model\": \"<string>\",\n \"top_n\": 2,\n \"instruction\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_id}/vector-stores/{vector_store_id}/files/{file_id}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-selected-account-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"top_k\": 123,\n \"filters\": {},\n \"rerank_config\": {\n \"model\": \"<string>\",\n \"top_n\": 2,\n \"instruction\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"chunks": [
{
"content": "<string>",
"blocks": [
{
"type": "<string>",
"content": "<string>",
"bbox": {
"left": 123,
"top": 123,
"width": 123,
"height": 123
},
"confidence": 123,
"page_number": 0,
"error": "<string>",
"row_bboxes": [
{
"left": 123,
"top": 123,
"width": 123,
"height": 123
}
],
"col_bboxes": [
{
"left": 123,
"top": 123,
"width": 123,
"height": 123
}
]
}
],
"score": 123,
"file_id": "<string>",
"parse_result_id": "<string>",
"metadata": {}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
application/json
Search parameters for vector store engines. Extend this model to add new parameters without changing the engine interface.