Retrieve Chunks
curl --request POST \
--url https://api.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"data_source_id": "<string>",
"top_k": 5
}
'import requests
url = "https://api.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve"
payload = {
"query": "<string>",
"data_source_id": "<string>",
"top_k": 5
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', data_source_id: '<string>', top_k: 5})
};
fetch('https://api.getdecisional.ai/api/v1/knowledge-engines/{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.getdecisional.ai/api/v1/knowledge-engines/{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>',
'data_source_id' => '<string>',
'top_k' => 5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"data_source_id\": \"<string>\",\n \"top_k\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"data_source_id\": \"<string>\",\n \"top_k\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"data_source_id\": \"<string>\",\n \"top_k\": 5\n}"
response = http.request(request)
puts response.read_body{
"query": "<string>",
"knowledge_engine_id": "kng_abc123xyz789",
"data_source_id": "ds_abc123xyz789",
"chunks": [
{
"content": "<string>",
"filename": "<string>",
"chunk_id": "<string>",
"data_source_id": "<string>",
"page_number": -1
}
],
"total_chunks": 123
}
Knowledge Engines
Retrieve Chunks
Returns raw retrieved chunks from a knowledge engine without streaming or workflow creation
POST
/
api
/
v1
/
knowledge-engines
/
{id}
/
retrieve
Retrieve Chunks
curl --request POST \
--url https://api.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"data_source_id": "<string>",
"top_k": 5
}
'import requests
url = "https://api.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve"
payload = {
"query": "<string>",
"data_source_id": "<string>",
"top_k": 5
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', data_source_id: '<string>', top_k: 5})
};
fetch('https://api.getdecisional.ai/api/v1/knowledge-engines/{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.getdecisional.ai/api/v1/knowledge-engines/{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>',
'data_source_id' => '<string>',
'top_k' => 5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"data_source_id\": \"<string>\",\n \"top_k\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"data_source_id\": \"<string>\",\n \"top_k\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getdecisional.ai/api/v1/knowledge-engines/{id}/retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"data_source_id\": \"<string>\",\n \"top_k\": 5\n}"
response = http.request(request)
puts response.read_body{
"query": "<string>",
"knowledge_engine_id": "kng_abc123xyz789",
"data_source_id": "ds_abc123xyz789",
"chunks": [
{
"content": "<string>",
"filename": "<string>",
"chunk_id": "<string>",
"data_source_id": "<string>",
"page_number": -1
}
],
"total_chunks": 123
}
Retrieve raw chunks from a knowledge engine without creating a workflow or generating a synthesized LLM answer.
Request Format
string
required
The knowledge engine ID to search.
string
required
The natural language query used to retrieve the most relevant chunks.
string
Optional. Restrict retrieval to a single data source.
integer
Maximum chunks to return. Defaults to
5; values above 20 are clamped to 20.Response Format
string
The original query string.
string
The queried knowledge engine ID.
string
Returned when a single
data_source_id was provided in the request.array
Ranked chunks retrieved from the knowledge engine.
Show Chunk Object
Show Chunk Object
integer
Number of chunks returned.
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Path Parameters
Knowledge engine ID
Body
application/json
The natural language query used to retrieve relevant chunks
Optional data source ID to constrain retrieval to a single source
Maximum number of chunks to return. Defaults to 5; values above 20 are clamped to 20.
Required range:
1 <= x <= 20Response
Retrieved chunks for the knowledge engine
The original query string
Public ID of the queried knowledge engine
Example:
"kng_abc123xyz789"
Public ID of the queried data source when request was scoped to one source
Example:
"ds_abc123xyz789"
Show child attributes
Show child attributes
Number of chunks returned