curl --request POST \
--url https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"top_k": 5
}
'import requests
url = "https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve"
payload = {
"query": "<string>",
"top_k": 5
}
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>', top_k: 5})
};
fetch('https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve', 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.streamkap.com/knowledge-bases/{kb_id}/retrieve",
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' => 5
]),
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.streamkap.com/knowledge-bases/{kb_id}/retrieve"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"top_k\": 5\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.streamkap.com/knowledge-bases/{kb_id}/retrieve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"top_k\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve")
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 \"top_k\": 5\n}"
response = http.request(request)
puts response.read_body{
"matches": [
{
"chunk_id": "<string>",
"score": 123,
"text": "<string>",
"metadata": {}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Retrieve Knowledge Base
Embed query and return the top-k matching chunks from the KB.
Auth: write:agents. Chunks are customer data, same threat
model as /agents/{id}/logs.
Tenant scoping: a kb_id from another tenant returns 404 just
like the read endpoint — no existence leak.
Rate limit: BUCKET_KB_RETRIEVAL at 30 req/min/tenant — same
budget as the other outbound-call endpoints (MCP discovery,
validate-llm, models-live).
Dual-surface model: this endpoint is one of three KB retrieval
paths. The Java agent runtime queries Pinecone directly at deploy
time via its own mirror (off the hot path through this BE); the
streamkap-tools MCP server exposes streamkap_kb_retrieve and
proxies through this endpoint for third-party agents.
curl --request POST \
--url https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"top_k": 5
}
'import requests
url = "https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve"
payload = {
"query": "<string>",
"top_k": 5
}
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>', top_k: 5})
};
fetch('https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve', 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.streamkap.com/knowledge-bases/{kb_id}/retrieve",
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' => 5
]),
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.streamkap.com/knowledge-bases/{kb_id}/retrieve"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"top_k\": 5\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.streamkap.com/knowledge-bases/{kb_id}/retrieve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"top_k\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.streamkap.com/knowledge-bases/{kb_id}/retrieve")
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 \"top_k\": 5\n}"
response = http.request(request)
puts response.read_body{
"matches": [
{
"chunk_id": "<string>",
"score": 123,
"text": "<string>",
"metadata": {}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Request body for POST /knowledge-bases/{kb_id}/retrieve.
query is the user's text; the BE embeds it against the KB's
saved embedding connection and runs a similarity search against
the saved vector-store connection. top_k caps the number of
matches returned.
Response
Successful Response
Response envelope for KB retrieval — ordered list of matches.
Show child attributes
Show child attributes
Was this page helpful?