Handle Send Search Message
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>",
"source_types": [
"ingestion_api"
],
"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": {}
}
]
}Search
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.
POST
/
search
/
send-search-message
Handle Send Search Message
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>",
"source_types": [
"ingestion_api"
],
"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": {}
}
]
}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.Body
application/json
Response
If stream=true, returns text/event-stream.
If stream=false (the default), returns application/json (SearchFullResponse).
Was this page helpful?