Lens
Search & ask
Two endpoints answer questions about the knowledge base, at two different altitudes. GET /api/v1/search hands you the raw chunks — scored, ranked, no model in the loop — for you to render or feed into your own reasoning. POST /api/v1/query runs the whole pipeline and hands back a grounded, dual-cited answer. Pick by whether you or eli.ai does the synthesis.
Prerequisites
- A key with
kb:readfor/search./queryinvokes the chat model, so it needsagents:run. See Getting started. - For
/query, an enabled chat model in the workspace — otherwise409 no-model-configured.
Raw chunks — GET /search
Hybrid retrieval — full-text and vector fused — over the workspace's documents. No LLM call, so it is fast and cheap, and you get the underlying evidence unedited: chunk text, the document it came from, and a relevance score. Use it to build your own search UI, to power autocomplete, or as the retrieval step in a pipeline you control.
/api/v1/searchBearer · kb:readHybrid lexical + semantic search over the workspace KB. Returns scored chunks with document metadata. No model call.
Query parameters
By default /search returns the raw reciprocal-rank-fused order — cheapest, and model-free. Pass ?rerank=true to have the fused candidates cross-encoder-reranked server-side before they come back, when precision matters more than the extra round-trip. It is a no-op (and free) if the workspace reranker resolves to none. The full pipeline behind grounded answers — query understanding, graph fusion, and a token-budget assembler on top of that rerank — is described in Retrieval pipeline.
Grounded answer — POST /query
The full pipeline in one call: retrieval, deterministic entity detection, one chat-model generation, and a best-effort groundedness check. You get an answer with inline [Sn] citation markers, the answer decomposed into atomic claims, and a sources registry mapping each marker back to the exact chunk. With includeData: true it also runs governed live-data lookups and adds [Dn] data citations — see Query live data.
/api/v1/queryBearer · agents:runRun the grounded query pipeline: retrieval + entity detection + one generation + a groundedness check. Returns a dual-cited answer. The workspace comes from the key — never the body.
Request body
The complete field-by-field schema — including how claims are derived and what groundedness means — is in Structured query (v1).
Which one?
- Reach for
/searchwhen you want to control synthesis — a search box, a retrieval-augmented pipeline with your own model, re-ranking, or when you simply need to show a user the source passages. It is cheaper and has no model dependency. - Reach for
/querywhen you want a finished, defensible answer — a chatbot reply, a report sentence, an alert body — with citations you can click through to prove it. Theclaimsarray makes every sentence individually auditable. - Compose them — call
/searchto preview evidence and/queryto commit to an answer, or run/searchand hand the chunks to your own agent.
Errors
400 on a malformed request, 401 / 403 on key/scope problems. Only /query can return 409 no-model-configured, because only it invokes the chat model. See Errors & rate limits.The leverage
The same corpus answers at whatever altitude your product needs — evidence for a human, or a cited conclusion for a machine — from one key and one index. If the consumer is itself an agent, the identical pipeline is a native tool over MCP. Try both endpoints live in the API playground.