curl --request POST \
--url https://cloud.onyx.app/api/search/send-search-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"search_query": "<string>",
"filters": {
"source_type": [],
"document_set": [
"<string>"
],
"created_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"updated_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"tags": [
{
"tag_key": "<string>",
"tag_value": "<string>"
}
],
"time_cutoff": "2023-11-07T05:31:56Z"
},
"num_docs_fed_to_llm_selection": 123,
"run_query_expansion": false,
"num_hits": 30,
"hybrid_alpha": 123,
"include_content": false,
"stream": false
}
'import requests
url = "https://cloud.onyx.app/api/search/send-search-message"
payload = {
"search_query": "<string>",
"filters": {
"source_type": [],
"document_set": ["<string>"],
"created_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"updated_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"tags": [
{
"tag_key": "<string>",
"tag_value": "<string>"
}
],
"time_cutoff": "2023-11-07T05:31:56Z"
},
"num_docs_fed_to_llm_selection": 123,
"run_query_expansion": False,
"num_hits": 30,
"hybrid_alpha": 123,
"include_content": False,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
search_query: '<string>',
filters: {
source_type: [],
document_set: ['<string>'],
created_at_range: {start: '2023-11-07T05:31:56Z', end: '2023-11-07T05:31:56Z'},
updated_at_range: {start: '2023-11-07T05:31:56Z', end: '2023-11-07T05:31:56Z'},
tags: [{tag_key: '<string>', tag_value: '<string>'}],
time_cutoff: '2023-11-07T05:31:56Z'
},
num_docs_fed_to_llm_selection: 123,
run_query_expansion: false,
num_hits: 30,
hybrid_alpha: 123,
include_content: false,
stream: false
})
};
fetch('https://cloud.onyx.app/api/search/send-search-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.onyx.app/api/search/send-search-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'search_query' => '<string>',
'filters' => [
'source_type' => [
],
'document_set' => [
'<string>'
],
'created_at_range' => [
'start' => '2023-11-07T05:31:56Z',
'end' => '2023-11-07T05:31:56Z'
],
'updated_at_range' => [
'start' => '2023-11-07T05:31:56Z',
'end' => '2023-11-07T05:31:56Z'
],
'tags' => [
[
'tag_key' => '<string>',
'tag_value' => '<string>'
]
],
'time_cutoff' => '2023-11-07T05:31:56Z'
],
'num_docs_fed_to_llm_selection' => 123,
'run_query_expansion' => false,
'num_hits' => 30,
'hybrid_alpha' => 123,
'include_content' => false,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.onyx.app/api/search/send-search-message"
payload := strings.NewReader("{\n \"search_query\": \"<string>\",\n \"filters\": {\n \"source_type\": [],\n \"document_set\": [\n \"<string>\"\n ],\n \"created_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"updated_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"tags\": [\n {\n \"tag_key\": \"<string>\",\n \"tag_value\": \"<string>\"\n }\n ],\n \"time_cutoff\": \"2023-11-07T05:31:56Z\"\n },\n \"num_docs_fed_to_llm_selection\": 123,\n \"run_query_expansion\": false,\n \"num_hits\": 30,\n \"hybrid_alpha\": 123,\n \"include_content\": false,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.onyx.app/api/search/send-search-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"search_query\": \"<string>\",\n \"filters\": {\n \"source_type\": [],\n \"document_set\": [\n \"<string>\"\n ],\n \"created_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"updated_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"tags\": [\n {\n \"tag_key\": \"<string>\",\n \"tag_value\": \"<string>\"\n }\n ],\n \"time_cutoff\": \"2023-11-07T05:31:56Z\"\n },\n \"num_docs_fed_to_llm_selection\": 123,\n \"run_query_expansion\": false,\n \"num_hits\": 30,\n \"hybrid_alpha\": 123,\n \"include_content\": false,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.onyx.app/api/search/send-search-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"search_query\": \"<string>\",\n \"filters\": {\n \"source_type\": [],\n \"document_set\": [\n \"<string>\"\n ],\n \"created_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"updated_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"tags\": [\n {\n \"tag_key\": \"<string>\",\n \"tag_value\": \"<string>\"\n }\n ],\n \"time_cutoff\": \"2023-11-07T05:31:56Z\"\n },\n \"num_docs_fed_to_llm_selection\": 123,\n \"run_query_expansion\": false,\n \"num_hits\": 30,\n \"hybrid_alpha\": 123,\n \"include_content\": false,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"all_executed_queries": [
"<string>"
],
"search_docs": [
{
"document_id": "<string>",
"chunk_ind": 123,
"semantic_identifier": "<string>",
"blurb": "<string>",
"source_type": "ingestion_api",
"boost": 123,
"hidden": true,
"metadata": {},
"match_highlights": [
"<string>"
],
"content": "<string>",
"link": "<string>",
"score": 123,
"is_relevant": true,
"relevance_explanation": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"primary_owners": [
"<string>"
],
"secondary_owners": [
"<string>"
],
"is_internet": false,
"file_id": "<string>"
}
],
"doc_selection_reasoning": "<string>",
"llm_selected_doc_ids": [
"<string>"
],
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Handle Send Search Message
Executes a search query with optional streaming.
If hybrid_alpha is unset and ONYX_SEARCH_UI_USES_OPENSEARCH_KEYWORD_SEARCH is True, executes pure keyword search.
Returns: StreamingResponse with SSE if stream=True, otherwise SearchFullResponse.
curl --request POST \
--url https://cloud.onyx.app/api/search/send-search-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"search_query": "<string>",
"filters": {
"source_type": [],
"document_set": [
"<string>"
],
"created_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"updated_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"tags": [
{
"tag_key": "<string>",
"tag_value": "<string>"
}
],
"time_cutoff": "2023-11-07T05:31:56Z"
},
"num_docs_fed_to_llm_selection": 123,
"run_query_expansion": false,
"num_hits": 30,
"hybrid_alpha": 123,
"include_content": false,
"stream": false
}
'import requests
url = "https://cloud.onyx.app/api/search/send-search-message"
payload = {
"search_query": "<string>",
"filters": {
"source_type": [],
"document_set": ["<string>"],
"created_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"updated_at_range": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"tags": [
{
"tag_key": "<string>",
"tag_value": "<string>"
}
],
"time_cutoff": "2023-11-07T05:31:56Z"
},
"num_docs_fed_to_llm_selection": 123,
"run_query_expansion": False,
"num_hits": 30,
"hybrid_alpha": 123,
"include_content": False,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
search_query: '<string>',
filters: {
source_type: [],
document_set: ['<string>'],
created_at_range: {start: '2023-11-07T05:31:56Z', end: '2023-11-07T05:31:56Z'},
updated_at_range: {start: '2023-11-07T05:31:56Z', end: '2023-11-07T05:31:56Z'},
tags: [{tag_key: '<string>', tag_value: '<string>'}],
time_cutoff: '2023-11-07T05:31:56Z'
},
num_docs_fed_to_llm_selection: 123,
run_query_expansion: false,
num_hits: 30,
hybrid_alpha: 123,
include_content: false,
stream: false
})
};
fetch('https://cloud.onyx.app/api/search/send-search-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.onyx.app/api/search/send-search-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'search_query' => '<string>',
'filters' => [
'source_type' => [
],
'document_set' => [
'<string>'
],
'created_at_range' => [
'start' => '2023-11-07T05:31:56Z',
'end' => '2023-11-07T05:31:56Z'
],
'updated_at_range' => [
'start' => '2023-11-07T05:31:56Z',
'end' => '2023-11-07T05:31:56Z'
],
'tags' => [
[
'tag_key' => '<string>',
'tag_value' => '<string>'
]
],
'time_cutoff' => '2023-11-07T05:31:56Z'
],
'num_docs_fed_to_llm_selection' => 123,
'run_query_expansion' => false,
'num_hits' => 30,
'hybrid_alpha' => 123,
'include_content' => false,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud.onyx.app/api/search/send-search-message"
payload := strings.NewReader("{\n \"search_query\": \"<string>\",\n \"filters\": {\n \"source_type\": [],\n \"document_set\": [\n \"<string>\"\n ],\n \"created_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"updated_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"tags\": [\n {\n \"tag_key\": \"<string>\",\n \"tag_value\": \"<string>\"\n }\n ],\n \"time_cutoff\": \"2023-11-07T05:31:56Z\"\n },\n \"num_docs_fed_to_llm_selection\": 123,\n \"run_query_expansion\": false,\n \"num_hits\": 30,\n \"hybrid_alpha\": 123,\n \"include_content\": false,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud.onyx.app/api/search/send-search-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"search_query\": \"<string>\",\n \"filters\": {\n \"source_type\": [],\n \"document_set\": [\n \"<string>\"\n ],\n \"created_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"updated_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"tags\": [\n {\n \"tag_key\": \"<string>\",\n \"tag_value\": \"<string>\"\n }\n ],\n \"time_cutoff\": \"2023-11-07T05:31:56Z\"\n },\n \"num_docs_fed_to_llm_selection\": 123,\n \"run_query_expansion\": false,\n \"num_hits\": 30,\n \"hybrid_alpha\": 123,\n \"include_content\": false,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.onyx.app/api/search/send-search-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"search_query\": \"<string>\",\n \"filters\": {\n \"source_type\": [],\n \"document_set\": [\n \"<string>\"\n ],\n \"created_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"updated_at_range\": {\n \"start\": \"2023-11-07T05:31:56Z\",\n \"end\": \"2023-11-07T05:31:56Z\"\n },\n \"tags\": [\n {\n \"tag_key\": \"<string>\",\n \"tag_value\": \"<string>\"\n }\n ],\n \"time_cutoff\": \"2023-11-07T05:31:56Z\"\n },\n \"num_docs_fed_to_llm_selection\": 123,\n \"run_query_expansion\": false,\n \"num_hits\": 30,\n \"hybrid_alpha\": 123,\n \"include_content\": false,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"all_executed_queries": [
"<string>"
],
"search_docs": [
{
"document_id": "<string>",
"chunk_ind": 123,
"semantic_identifier": "<string>",
"blurb": "<string>",
"source_type": "ingestion_api",
"boost": 123,
"hidden": true,
"metadata": {},
"match_highlights": [
"<string>"
],
"content": "<string>",
"link": "<string>",
"score": 123,
"is_relevant": true,
"relevance_explanation": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"primary_owners": [
"<string>"
],
"secondary_owners": [
"<string>"
],
"is_internet": false,
"file_id": "<string>"
}
],
"doc_selection_reasoning": "<string>",
"llm_selected_doc_ids": [
"<string>"
],
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}read:search), which basic includes, so any signed-in user has it.
A limited Personal Access Token needs the Search — Read scope.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.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 header with Bearer token
Body
The query to search for.
Restrict which documents are searched. All fields are optional and combine with AND.
Show child attributes
Show child attributes
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.
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.
Maximum number of merged sections to return.
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.
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.
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).
Every query that was run, starting with the original. Contains more than one entry only when run_query_expansion was set.
Matched sections, most relevant first.
Show child attributes
Show child attributes
Reserved for the LLM's document-selection reasoning. Not currently populated — always null on this endpoint.
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.
Set when the search failed partway through; the other fields hold whatever was gathered before the failure.
Was this page helpful?