Skip to main content
POST
Handle Send Search Message
Required permission: Search — Read (read:search), which basic includes, so any signed-in user has it. A limited Personal Access Token needs the Search — Read scope.
This is the endpoint behind the Onyx Search UI. Unlike POST /chat/send-chat-message, stream defaults to false here, so the default response is the aggregated SearchFullResponse. See Search with the API for the streaming packet format.
Requires a vector database: deployments running with DISABLE_VECTOR_DB set (Onyx Lite) answer with 501. Every query from a signed-in user is recorded in that user’s search history.

Authorizations

Authorization
string
header
required

Authorization header with Bearer token

Body

application/json
search_query
string
required

The query to search for.

filters
BaseFilters · object | null

Restrict which documents are searched. All fields are optional and combine with AND.

num_docs_fed_to_llm_selection
integer | null

When set to 1 or more, the top N merged sections are handed to an LLM that picks the most relevant ones, and their document ids come back in llm_selected_doc_ids. Omit it (or send null) to skip LLM selection and the extra LLM call it costs.

run_query_expansion
boolean
default:false

When true, an LLM generates extra keyword queries from search_query. Every query runs in parallel and the results are merged with weighted reciprocal-rank fusion, with the original query weighted twice as heavily as each expansion. The queries that actually ran come back in all_executed_queries. Expansion failures are non-fatal: the original query still runs on its own.

num_hits
integer
default:30

Maximum number of merged sections to return.

hybrid_alpha
number | null

Balance between vector and keyword matching, from 0.0 (pure keyword) to 1.0 (pure vector). Leave unset to use the deployment's HYBRID_ALPHA (0.5 by default) — except on deployments configured for OpenSearch keyword search, where leaving it unset runs a pure keyword search.

include_content
boolean
default:false

When true, each returned document carries the full text of the matched section in content. When false, content is null and only blurb is populated.

stream
boolean
default:false

When true, responds with a stream of newline-delimited JSON packets. When false (the default), returns the aggregated SearchFullResponse.

Response

If stream=true, returns text/event-stream. If stream=false (the default), returns application/json (SearchFullResponse).

all_executed_queries
string[]
required

Every query that was run, starting with the original. Contains more than one entry only when run_query_expansion was set.

search_docs
SearchDocWithContent · object[]
required

Matched sections, most relevant first.

doc_selection_reasoning
string | null

Reserved for the LLM's document-selection reasoning. Not currently populated — always null on this endpoint.

llm_selected_doc_ids
string[] | null

Document ids the LLM picked out of search_docs. null when LLM selection was not requested or failed, an empty list when it ran and chose nothing.

error
string | null

Set when the search failed partway through; the other fields hold whatever was gathered before the failure.