Search Knowledge
curl --request POST \
--url https://api.example.com/knowledge/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"db_id": "<string>",
"knowledge_id": "<string>",
"vector_db_ids": [
"<string>"
],
"search_type": "<string>",
"max_results": 500,
"filters": {},
"meta": {
"limit": 20,
"page": 1
}
}
'import requests
url = "https://api.example.com/knowledge/search"
payload = {
"query": "<string>",
"db_id": "<string>",
"knowledge_id": "<string>",
"vector_db_ids": ["<string>"],
"search_type": "<string>",
"max_results": 500,
"filters": {},
"meta": {
"limit": 20,
"page": 1
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
db_id: '<string>',
knowledge_id: '<string>',
vector_db_ids: ['<string>'],
search_type: '<string>',
max_results: 500,
filters: {},
meta: {limit: 20, page: 1}
})
};
fetch('https://api.example.com/knowledge/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/knowledge/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>',
'db_id' => '<string>',
'knowledge_id' => '<string>',
'vector_db_ids' => [
'<string>'
],
'search_type' => '<string>',
'max_results' => 500,
'filters' => [
],
'meta' => [
'limit' => 20,
'page' => 1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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/knowledge/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"db_id\": \"<string>\",\n \"knowledge_id\": \"<string>\",\n \"vector_db_ids\": [\n \"<string>\"\n ],\n \"search_type\": \"<string>\",\n \"max_results\": 500,\n \"filters\": {},\n \"meta\": {\n \"limit\": 20,\n \"page\": 1\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/knowledge/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"db_id\": \"<string>\",\n \"knowledge_id\": \"<string>\",\n \"vector_db_ids\": [\n \"<string>\"\n ],\n \"search_type\": \"<string>\",\n \"max_results\": 500,\n \"filters\": {},\n \"meta\": {\n \"limit\": 20,\n \"page\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/knowledge/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"db_id\": \"<string>\",\n \"knowledge_id\": \"<string>\",\n \"vector_db_ids\": [\n \"<string>\"\n ],\n \"search_type\": \"<string>\",\n \"max_results\": 500,\n \"filters\": {},\n \"meta\": {\n \"limit\": 20,\n \"page\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "doc_123",
"content": "Jordan Mitchell - Software Engineer with skills in JavaScript, React, Python",
"name": "cv_1",
"meta_data": {
"page": 1,
"chunk": 1
},
"usage": {
"total_tokens": 14
},
"reranking_score": 0.95,
"content_id": "content_456"
}
],
"meta": {
"page": 1,
"limit": 20,
"total_pages": 2,
"total_count": 35
}
}{
"detail": "Unauthenticated access",
"error_code": "UNAUTHENTICATED"
}{
"detail": "Validation error",
"error_code": "VALIDATION_ERROR"
}{
"detail": "Internal server error",
"error_code": "INTERNAL_SERVER_ERROR"
}Knowledge
Search Knowledge
Search the knowledge base for relevant documents using query, filters and search type.
POST
/
knowledge
/
search
Search Knowledge
curl --request POST \
--url https://api.example.com/knowledge/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"db_id": "<string>",
"knowledge_id": "<string>",
"vector_db_ids": [
"<string>"
],
"search_type": "<string>",
"max_results": 500,
"filters": {},
"meta": {
"limit": 20,
"page": 1
}
}
'import requests
url = "https://api.example.com/knowledge/search"
payload = {
"query": "<string>",
"db_id": "<string>",
"knowledge_id": "<string>",
"vector_db_ids": ["<string>"],
"search_type": "<string>",
"max_results": 500,
"filters": {},
"meta": {
"limit": 20,
"page": 1
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
db_id: '<string>',
knowledge_id: '<string>',
vector_db_ids: ['<string>'],
search_type: '<string>',
max_results: 500,
filters: {},
meta: {limit: 20, page: 1}
})
};
fetch('https://api.example.com/knowledge/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/knowledge/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>',
'db_id' => '<string>',
'knowledge_id' => '<string>',
'vector_db_ids' => [
'<string>'
],
'search_type' => '<string>',
'max_results' => 500,
'filters' => [
],
'meta' => [
'limit' => 20,
'page' => 1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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/knowledge/search"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"db_id\": \"<string>\",\n \"knowledge_id\": \"<string>\",\n \"vector_db_ids\": [\n \"<string>\"\n ],\n \"search_type\": \"<string>\",\n \"max_results\": 500,\n \"filters\": {},\n \"meta\": {\n \"limit\": 20,\n \"page\": 1\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/knowledge/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"db_id\": \"<string>\",\n \"knowledge_id\": \"<string>\",\n \"vector_db_ids\": [\n \"<string>\"\n ],\n \"search_type\": \"<string>\",\n \"max_results\": 500,\n \"filters\": {},\n \"meta\": {\n \"limit\": 20,\n \"page\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/knowledge/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"db_id\": \"<string>\",\n \"knowledge_id\": \"<string>\",\n \"vector_db_ids\": [\n \"<string>\"\n ],\n \"search_type\": \"<string>\",\n \"max_results\": 500,\n \"filters\": {},\n \"meta\": {\n \"limit\": 20,\n \"page\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "doc_123",
"content": "Jordan Mitchell - Software Engineer with skills in JavaScript, React, Python",
"name": "cv_1",
"meta_data": {
"page": 1,
"chunk": 1
},
"usage": {
"total_tokens": 14
},
"reranking_score": 0.95,
"content_id": "content_456"
}
],
"meta": {
"page": 1,
"limit": 20,
"total_pages": 2,
"total_count": 35
}
}{
"detail": "Unauthenticated access",
"error_code": "UNAUTHENTICATED"
}{
"detail": "Validation error",
"error_code": "VALIDATION_ERROR"
}{
"detail": "Internal server error",
"error_code": "INTERNAL_SERVER_ERROR"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Schema for vector search request.
The search query text
Database ID to search in
Knowledge base ID to search in
List of vector database IDs to search in
The type of search to perform (vector, keyword, hybrid)
The maximum number of results to return
Required range:
1 <= x <= 1000Filters to apply to the search results
Pagination metadata. Limit and page number to return a subset of results.
Show child attributes
Show child attributes
Was this page helpful?
⌘I