Retrieve Knowledge Base
Embed query and return the top-k matching chunks from the KB.
Requires write:agents, because chunks contain your data (the same
gate as /agents/{id}/logs).
A kb_id from another tenant returns 404, like the read endpoint, so
the response never reveals whether it exists.
Rate limit: 30 req/min per tenant -> 429.
The Streamkap MCP server’s streamkap_kb_retrieve tool calls this
endpoint, so external agents get the same results. Deployed Streamkap
agents query the knowledge base’s vector store directly rather than
through this endpoint.
POST
/knowledge-bases/{kb_id}/retrieveAuthorization
AuthorizationBearer token · headerrequiredPath parameters
kb_idstringrequiredRequest body
requiredapplication/jsonquerystringrequiredmin length 1 · max length 4096
top_kintegermin 1 · max 50 · default: 5
Responses
200
Successful Response
matchesKbRetrieveMatch[]requiredShow propertiesHide properties
Array of
KbRetrieveMatchchunk_idstringrequiredtextstring | nullShow propertiesHide properties
Any of:
string
stringnull
nullscorenumberrequiredmetadataobject | nullShow propertiesHide properties
Any of:
object
objectnull
null422
Validation Error
detailValidationError[]Show propertiesHide properties
Array of
ValidationErrorlocstring | integer[]requiredShow propertiesHide properties
Array of
string | integerAny of:
string
stringinteger
integermsgstringrequiredtypestringrequiredinputanyctxobject