Skip to main content
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
}
'
{
  "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

id
string
required
The knowledge engine ID to search.
query
string
required
The natural language query used to retrieve the most relevant chunks.
data_source_id
string
Optional. Restrict retrieval to a single data source.
top_k
integer
Maximum chunks to return. Defaults to 5; values above 20 are clamped to 20.

Response Format

query
string
The original query string.
knowledge_engine_id
string
The queried knowledge engine ID.
data_source_id
string
Returned when a single data_source_id was provided in the request.
chunks
array
Ranked chunks retrieved from the knowledge engine.
total_chunks
integer
Number of chunks returned.

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Path Parameters

id
string
required

Knowledge engine ID

Body

application/json
query
string
required

The natural language query used to retrieve relevant chunks

data_source_id
string

Optional data source ID to constrain retrieval to a single source

top_k
integer
default:5

Maximum number of chunks to return. Defaults to 5; values above 20 are clamped to 20.

Required range: 1 <= x <= 20

Response

Retrieved chunks for the knowledge engine

query
string

The original query string

knowledge_engine_id
string

Public ID of the queried knowledge engine

Example:

"kng_abc123xyz789"

data_source_id
string

Public ID of the queried data source when request was scoped to one source

Example:

"ds_abc123xyz789"

chunks
object[]
total_chunks
integer

Number of chunks returned