> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onyx.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle Send Chat Message

> 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 | None): 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.



## OpenAPI

````yaml POST /chat/send-chat-message
openapi: 3.1.0
info:
  title: Onyx API
  description: Onyx API for AI-powered enterprise search and chat
  version: Development
servers:
  - url: https://cloud.onyx.app/api
security: []
paths:
  /chat/send-chat-message:
    post:
      tags:
        - public
      summary: Handle Send Chat Message
      description: |-
        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 | None): 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.
      operationId: handle_send_chat_message
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    SendMessageRequest:
      properties:
        message:
          type: string
          title: Message
        llm_override:
          anyOf:
            - $ref: '#/components/schemas/LLMOverride'
            - type: 'null'
        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
        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
          description: >-
            A string of extra context injected into the LLM call for this
            request. The context is passed to the model but is not stored in the
            database and will not appear in the chat history. Use this to supply
            ephemeral, request-scoped information (e.g. the user's current page
            URL, session metadata, or any runtime context) without polluting the
            persistent conversation history. Pass null or omit the field to use
            no additional context.
      type: object
      required:
        - message
      title: SendMessageRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LLMOverride:
      properties:
        model_provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Provider
        model_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Version
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
      type: object
      title: LLMOverride
    FileDescriptor:
      properties:
        id:
          type: string
          title: Id
        type:
          $ref: '#/components/schemas/ChatFileType'
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        user_file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User File Id
      type: object
      required:
        - id
        - type
      title: FileDescriptor
      description: >-
        NOTE: is a `TypedDict` so it can be used as a type hint for a JSONB
        column

        in Postgres
    BaseFilters:
      properties:
        source_type:
          anyOf:
            - items:
                $ref: '#/components/schemas/DocumentSource'
              type: array
            - type: 'null'
          title: Source Type
        document_set:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Document Set
        time_cutoff:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Time Cutoff
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/Tag'
              type: array
            - type: 'null'
          title: Tags
      type: object
      title: BaseFilters
    MessageOrigin:
      type: string
      enum:
        - webapp
        - chrome_extension
        - api
        - slackbot
        - widget
        - unknown
        - unset
      title: MessageOrigin
      description: Origin of a chat message for telemetry tracking.
    ChatSessionCreationRequest:
      properties:
        persona_id:
          type: integer
          title: Persona Id
          default: 0
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        project_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Project Id
      type: object
      title: ChatSessionCreationRequest
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ChatFileType:
      type: string
      enum:
        - image
        - document
        - plain_text
        - csv
      title: ChatFileType
    DocumentSource:
      type: string
      enum:
        - ingestion_api
        - slack
        - web
        - google_drive
        - gmail
        - requesttracker
        - github
        - gitbook
        - gitlab
        - guru
        - bookstack
        - outline
        - confluence
        - jira
        - slab
        - productboard
        - file
        - coda
        - notion
        - zulip
        - linear
        - hubspot
        - document360
        - gong
        - google_sites
        - zendesk
        - loopio
        - dropbox
        - sharepoint
        - teams
        - salesforce
        - discourse
        - axero
        - clickup
        - mediawiki
        - wikipedia
        - asana
        - s3
        - r2
        - google_cloud_storage
        - oci_storage
        - xenforo
        - not_applicable
        - discord
        - freshdesk
        - fireflies
        - egnyte
        - airtable
        - highspot
        - drupal_wiki
        - imap
        - bitbucket
        - testrail
        - mock_connector
        - user_file
      title: DocumentSource
    Tag:
      properties:
        tag_key:
          type: string
          title: Tag Key
        tag_value:
          type: string
          title: Tag Value
      type: object
      required:
        - tag_key
        - tag_value
      title: Tag
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Authorization header with Bearer token

````