Search knowledge base
curl --request POST \
--url https://web-api.clerk.chat/public/knowledge-base/search \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"query": "What is RCS?",
"sourceIds": [
123
],
"limit": 10,
"similarity": 0.77
}
'import requests
url = "https://web-api.clerk.chat/public/knowledge-base/search"
payload = {
"query": "What is RCS?",
"sourceIds": [123],
"limit": 10,
"similarity": 0.77
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'What is RCS?', sourceIds: [123], limit: 10, similarity: 0.77})
};
fetch('https://web-api.clerk.chat/public/knowledge-base/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://web-api.clerk.chat/public/knowledge-base/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' => 'What is RCS?',
'sourceIds' => [
123
],
'limit' => 10,
'similarity' => 0.77
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <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://web-api.clerk.chat/public/knowledge-base/search"
payload := strings.NewReader("{\n \"query\": \"What is RCS?\",\n \"sourceIds\": [\n 123\n ],\n \"limit\": 10,\n \"similarity\": 0.77\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://web-api.clerk.chat/public/knowledge-base/search")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"What is RCS?\",\n \"sourceIds\": [\n 123\n ],\n \"limit\": 10,\n \"similarity\": 0.77\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/knowledge-base/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"What is RCS?\",\n \"sourceIds\": [\n 123\n ],\n \"limit\": 10,\n \"similarity\": 0.77\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": 123,
"content": "<string>",
"similarity": 0.85
}
],
"total": 5,
"query": "What is RCS?"
}Knowledge Base
Search knowledge base
Search for relevant sections in the knowledge base using semantic search
POST
/
public
/
knowledge-base
/
search
Search knowledge base
curl --request POST \
--url https://web-api.clerk.chat/public/knowledge-base/search \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"query": "What is RCS?",
"sourceIds": [
123
],
"limit": 10,
"similarity": 0.77
}
'import requests
url = "https://web-api.clerk.chat/public/knowledge-base/search"
payload = {
"query": "What is RCS?",
"sourceIds": [123],
"limit": 10,
"similarity": 0.77
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'What is RCS?', sourceIds: [123], limit: 10, similarity: 0.77})
};
fetch('https://web-api.clerk.chat/public/knowledge-base/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://web-api.clerk.chat/public/knowledge-base/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' => 'What is RCS?',
'sourceIds' => [
123
],
'limit' => 10,
'similarity' => 0.77
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <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://web-api.clerk.chat/public/knowledge-base/search"
payload := strings.NewReader("{\n \"query\": \"What is RCS?\",\n \"sourceIds\": [\n 123\n ],\n \"limit\": 10,\n \"similarity\": 0.77\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://web-api.clerk.chat/public/knowledge-base/search")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"What is RCS?\",\n \"sourceIds\": [\n 123\n ],\n \"limit\": 10,\n \"similarity\": 0.77\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web-api.clerk.chat/public/knowledge-base/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"What is RCS?\",\n \"sourceIds\": [\n 123\n ],\n \"limit\": 10,\n \"similarity\": 0.77\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": 123,
"content": "<string>",
"similarity": 0.85
}
],
"total": 5,
"query": "What is RCS?"
}Authorizations
Body
application/json
The search query
Example:
"What is RCS?"
Optional list of source IDs to search within
Maximum number of sections to return (1-50)
Required range:
1 <= x <= 50Example:
10
Minimum similarity threshold (0-1)
Required range:
0 <= x <= 1Example:
0.77
⌘I