Skip to main content
Onyx exposes two search endpoints, and which one you want depends on what you are building. Neither endpoint generates an answer. To have a model read the results and write a response, use POST /chat/send-chat-message instead.
Both endpoints search only the documents the calling user is allowed to see, so the same query run by two users can return different results. Both also need a vector database: on deployments running with DISABLE_VECTOR_DB set (Onyx Lite), they answer with 501.

POST /search

The request needs nothing but a query. Everything else narrows the search or changes how the query is interpreted. Results come back most relevant first:
citation_id identifies the source document, not the result: several results share one citation_id when the search returned multiple non-overlapping sections of the same document.

POST /search/send-search-message

This endpoint takes a different set of parameters, aimed at a search interface rather than a retrieval pipeline. Both LLM-backed options are optional and each costs an LLM call, so leave them off for a plain lexical/semantic search. Query expansion widens recall on short keyword queries; document selection narrows a long result list down to what actually answers the query, reporting its picks in llm_selected_doc_ids without dropping the other results.

Non-streaming response

all_executed_queries holds more than one entry only when run_query_expansion was set. llm_selected_doc_ids is null when LLM selection was not requested or failed, and an empty list when it ran and chose nothing. If the search fails partway through, error is set and the other fields hold whatever was gathered before the failure.

Streaming response

With stream: true the response is text/event-stream, one JSON object per line, in this order:

Search history

Every query sent through POST /search/send-search-message by a signed-in user is recorded, and GET /search/search-history reads back that user’s own queries, most recent first. Pass limit (1–1000, default 100) and filter_days to narrow the window. Queries sent to POST /search and to the chat API are not recorded there.

Next Steps

Guide: Send a Message to Onyx

Have an Agent read the results and answer, instead of ranking documents

Guide: Use the Ingestion API

Index your own documents so they show up in search