Handle Send Chat Message
This endpoint is used to send a new chat message.
This page uses Nexus's generated request and response schema. Requests still require the correct account, workspace, and resource permissions.
/chat/send-chat-messagecurl --request POST 'https://school.narb.cc/api/chat/send-chat-message' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"message": "example"
}'This builds a request example. Fill in required query values, then replace path placeholders and YOUR_TOKEN in your own environment. Use a token for a user with access to this workspace. Responses and permissions depend on your account and deployment. Never paste a private token into documentation.
Download the Nexus OpenAPI schema ↗
Import the schema into your API client. It describes the backend source; enabled routes depend on your workspace.
Authentication and scope#
Send requests to the workspace that owns the resource. Authentication does not by itself grant a school membership, class assignment, or administrator permission. School endpoints apply their role and class checks on the server.
Use a credential issued for that workspace with only the permissions your integration needs. Keep it on your server. Do not place credentials in a public website or a shared skill.
This endpoint is used to send a new chat message.
Args: chat_message_req (SendMessageRequest): Details about the new chat message. - When stream=True (default): Returns StreamingResponse with SSE - When stream=False: Returns ChatFullResponse with complete data request (Request): The current HTTP request context. user (User): The current user, obtained via dependency injection. _ (None): Rate limit check is run if user/group/global rate limits are enabled.
Returns: StreamingResponse | ChatFullResponse: Either streams or returns complete response.
Parameters#
| Name | Location | Required | Type |
|---|---|---|---|
tenant_id | query | No | string or null |
The tenant_id parameter is part of the engine schema. It does not authorize a caller to another school. Use the workspace and permissions assigned to your account.
Request body#
Content type: application/json.
| Field | Type | Required | Details |
|---|---|---|---|
message | string | Yes | See Request schema. |
llm_override | object or null | No | See Request schema. |
llm_overrides | array of object or null | No | See Request schema. |
mock_llm_response | string or null | No | See Request schema. |
allowed_tool_ids | array of integer or null | No | See Request schema. |
forced_tool_id | integer or null | No | See Request schema. |
file_descriptors | array of object | No | Default: []. |
internal_search_filters | object or null | No | See Request schema. |
deep_research | boolean | No | Default: false. |
mcp_headers | object or null | No | See Request schema. |
origin | string | No | Origin of a chat message for telemetry tracking. Allowed: "webapp", "chrome_extension", "api", "slackbot", "widget", "discordbot", "mobile", "unknown", "unset". |
parent_message_id | integer or null | No | Default: -1. |
chat_session_id | string or null | No | See Request schema. |
chat_session_info | object or null | No | See Request schema. |
stream | boolean | No | Default: true. |
include_citations | boolean | No | Default: true. |
additional_context | string or null | No | See Request schema. |
Request schema#
The schema includes field limits and required values. Referenced types are included in the downloadable OpenAPI file. Replace example identifiers with IDs from your workspace.
{
"properties": {
"message": {
"type": "string",
"title": "Message"
},
"llm_override": {
"anyOf": [
{
"$ref": "#/components/schemas/LLMOverride"
},
{
"type": "null"
}
]
},
"llm_overrides": {
"anyOf": [
{
"items": {
"$ref": "#/components/schemas/LLMOverride"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Llm Overrides"
},
"mock_llm_response": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Mock Llm Response"
},
"allowed_tool_ids": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Allowed Tool Ids"
},
"forced_tool_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Forced Tool Id"
},
"file_descriptors": {
"items": {
"$ref": "#/components/schemas/FileDescriptor"
},
"type": "array",
"title": "File Descriptors",
"default": []
},
"internal_search_filters": {
"anyOf": [
{
"$ref": "#/components/schemas/BaseFilters"
},
{
"type": "null"
}
]
},
"deep_research": {
"type": "boolean",
"title": "Deep Research",
"default": false
},
"mcp_headers": {
"anyOf": [
{
"additionalProperties": {
"type": "string"
},
"type": "object"
},
{
"type": "null"
}
],
"title": "Mcp Headers"
},
"origin": {
"$ref": "#/components/schemas/MessageOrigin",
"default": "unset"
},
"parent_message_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Parent Message Id",
"default": -1
},
"chat_session_id": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "Chat Session Id"
},
"chat_session_info": {
"anyOf": [
{
"$ref": "#/components/schemas/ChatSessionCreationRequest"
},
{
"type": "null"
}
]
},
"stream": {
"type": "boolean",
"title": "Stream",
"default": true
},
"include_citations": {
"type": "boolean",
"title": "Include Citations",
"default": true
},
"additional_context": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Additional Context"
}
},
"type": "object",
"required": [
"message"
],
"title": "SendMessageRequest"
}Responses#
200#
If stream=true, returns text/event-stream.
If stream=false, returns application/json (ChatFullResponse).
{
"properties": {
"answer": {
"type": "string",
"title": "Answer"
},
"answer_citationless": {
"type": "string",
"title": "Answer Citationless"
},
"pre_answer_reasoning": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Pre Answer Reasoning"
},
"tool_calls": {
"items": {
"$ref": "#/components/schemas/ToolCallResponse"
},
"type": "array",
"title": "Tool Calls",
"default": []
},
"top_documents": {
"items": {
"$ref": "#/components/schemas/SearchDoc"
},
"type": "array",
"title": "Top Documents"
},
"citation_info": {
"items": {
"$ref": "#/components/schemas/CitationInfo"
},
"type": "array",
"title": "Citation Info"
},
"message_id": {
"type": "integer",
"title": "Message Id"
},
"chat_session_id": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "Chat Session Id"
},
"incognito": {
"type": "boolean",
"title": "Incognito",
"default": false
},
"error_msg": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Error Msg"
}
},
"type": "object",
"required": [
"answer",
"answer_citationless",
"top_documents",
"citation_info",
"message_id"
],
"title": "ChatFullResponse",
"description": "Complete non-streaming response with all available data.\nNOTE: This model is used for the core flow of the Onyx application, any changes to it should be reviewed and approved by an\nexperienced team member. It is very important to 1. avoid bloat and 2. that this remains backwards compatible across versions."
}422#
Validation Error
{
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}Access and error handling#
A signed-out or expired session needs authentication. A denied request can mean the account lacks permission, class membership, an approved model, or an available allowance. Do not retry a write blindly after a network failure; first check whether it was recorded.
Treat validation errors as a request problem. Use the returned field details to correct the request. Resource identifiers do not confer access.
Schema version#
Generated from Nexus backend source fe1c3a07c793029d3d87191a68f89e481afd6bc8. Check your deployed version before integrating. Schema coverage is not a live acceptance test.