Skip to main content
POST
/
api
/
v1
/
knowledge
/
search
Search Knowledge
curl --request POST \
  --url https://api.example.com/api/v1/knowledge/search \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "method": "hybrid",
  "top_k": 10,
  "score_threshold": 123,
  "include_content": false,
  "app_id": "default",
  "project_id": "default"
}
'
import requests

url = "https://api.example.com/api/v1/knowledge/search"

payload = {
"query": "<string>",
"method": "hybrid",
"top_k": 10,
"score_threshold": 123,
"include_content": False,
"app_id": "default",
"project_id": "default"
}
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>',
method: 'hybrid',
top_k: 10,
score_threshold: 123,
include_content: false,
app_id: 'default',
project_id: 'default'
})
};

fetch('https://api.example.com/api/v1/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/api/v1/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>',
'method' => 'hybrid',
'top_k' => 10,
'score_threshold' => 123,
'include_content' => false,
'app_id' => 'default',
'project_id' => 'default'
]),
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/v1/knowledge/search"

payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"method\": \"hybrid\",\n \"top_k\": 10,\n \"score_threshold\": 123,\n \"include_content\": false,\n \"app_id\": \"default\",\n \"project_id\": \"default\"\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/v1/knowledge/search")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"method\": \"hybrid\",\n \"top_k\": 10,\n \"score_threshold\": 123,\n \"include_content\": false,\n \"app_id\": \"default\",\n \"project_id\": \"default\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v1/knowledge/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 \"method\": \"hybrid\",\n \"top_k\": 10,\n \"score_threshold\": 123,\n \"include_content\": false,\n \"app_id\": \"default\",\n \"project_id\": \"default\"\n}"

response = http.request(request)
puts response.read_body
{
  "request_id": "<string>",
  "data": {
    "hits": [
      {
        "topic_id": "<string>",
        "category_id": "<string>",
        "topic_name": "<string>",
        "topic_path": "<string>",
        "depth": 123,
        "summary": "<string>",
        "content": "<string>",
        "score": 123,
        "retrieval_method": "<string>",
        "source": "<string>",
        "document": {
          "doc_id": "<string>",
          "title": "<string>",
          "summary": "<string>"
        }
      }
    ],
    "total": 123,
    "took_ms": 123
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Body

application/json

Request body for POST /search.

query
string
required
Required string length: 1 - 2000
method
enum<string>
default:hybrid
Available options:
keyword,
vector,
hybrid
top_k
integer
default:10
Required range: 1 <= x <= 100
score_threshold
number | null
include_content
boolean
default:false
app_id
string
default:default
project_id
string
default:default

Response

Successful Response

request_id
string
required
data
KnowledgeSearchResponse · object
required

Response for POST /search.