Skip to main content
 print this page

Query an unstructured knowledge base

POST 

/ai/knowledgebases/:id/query

Vector-retrieves relevant chunks and generates an answer. Unstructured knowledge bases only. Structured knowledge bases are not queried on this path (they have no embedding model and this handler does not call the structured retrieve-and-generate flow). Requires at least read-only access. modelId must be a TEXT model assigned to knowledge bases. Optional SourceId (Bedrock data source ID) and FileName (source URI) scope retrieval. Citations are not returned on this REST path. Fails if no sources are attached or the embedding model is not assigned.

Request

Responses

Answer plus ChunksRetrieved. GuardRailIntervention fields are included when the model returns. Metrics is included when present on the model response. ChunksRetrieved is empty when no accessible content is found or a guard rail blocks the answer.

Response Headers
    Access-Control-Allow-Origin
    Access-Control-Allow-Methods
    Access-Control-Allow-Headers