External integrations
Search a Knowledge Group from your own backend, straight over HTTP or with the npm client.
The RAG Service exposes one endpoint for external integrations: search. It is
plain HTTP with JSON, so any backend that can make a request can use it, and
the x-api-key header is the only requirement, see
Prerequisites.
Endpoint
resourceGroupId is the Group ID of the Knowledge Group
to search.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | The text to search for. |
limit | number | No | Maximum number of chunks to return, from 1 to 20. Defaults to 3. |
role | string | No | Only match resources tagged with this role, or with none, see Role Filter. |
Response
results is already sorted by score, highest first. Each entry is one
chunk, not a whole resource, see Understanding chunks.
notes can carry short explanations about the search itself, e.g. that
nothing matched closely, see Search and ranking.
Every field and status code is listed in the
Request reference.
An API key is a credential for your account. Never call this endpoint straight from the browser with your key, keep it on a server you control, see API keys.
Example
Client package
Our npm client package wraps the same endpoint with generated types.
Configure it with your base URL and API key:
Then search with apiSearchResourceGroup: