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

# Send message to session

> Send a message to a chat session (history managed by server)



## OpenAPI

````yaml /openapi.yaml post /v1/chat/sessions/{id}/messages
openapi: 3.1.0
info:
  title: Co-mind.ai Private AI Platform API
  version: 1.2.4
  description: >
    Co-mind.ai Private AI Platform API.


    ## Features

    - OpenAI-compatible endpoints

    - Tool/function calling support

    - Streaming responses

    - Multiple backend support

    - Personal Access Tokens (PAT) for programmatic access


    ## Authentication

    The API supports two authentication methods:


    **1. JWT Authentication** — Login with email/password to get short-lived
    access tokens.

    Use for interactive sessions (web apps, Postman).


    **2. Personal Access Tokens (PAT)** — Long-lived tokens for programmatic/API
    access.

    Create via `POST /v1/api-tokens` after authenticating with JWT.

    PAT format: `cmnd_<tokenId>.<secret>`


    Both methods use the `Authorization: Bearer <token>` header.
  contact:
    email: support@co-mind.ai
servers:
  - url: http://co-mind-platform-host
    description: Co-mind.ai AI Platform
security:
  - BearerAuth: []
tags:
  - name: Discovery
    description: List available models
  - name: Authentication
    description: >-
      JWT login, refresh, logout, SSO, registration, password reset, and
      `/v1/auth/me`
  - name: API Tokens
    description: Personal Access Token (PAT) management
  - name: Completions
    description: Text completion endpoints (single-shot, no conversation state)
  - name: Chat
    description: >
      OpenAI-compatible chat completions. **Stateless** — the client sends the
      full conversation history on every request; the server does not persist
      messages.
  - name: Responses
    description: >
      OpenAI-Responses-compatible endpoint. Wire-shape passthrough to the
      Inference Engine — every field the caller sends flows through, so the
      caller can use the full Responses API surface. The server does not persist
      responses server-side; use the `/v1/responses/{resp_id}/continue` variant
      to extend a prior response by id.
  - name: Embeddings
    description: >
      Text-embedding endpoint. Runs against the platform's configured embedding
      model (see `GET /v1/models`); the resulting vectors are returned to the
      caller and are not persisted server-side.
  - name: Translation
    description: >
      Text translation between languages. Ships with `POST /v1/translate/text`;
      async document translation is on the roadmap for a future release.
  - name: Knowledge Base
    description: >
      Knowledge base management (create / update / delete KBs, upload files,
      query for context) and **stateless** retrieval-augmented chat
      (`/v1/knowledgebase/chat/completions`). The RAG chat endpoint is stateless
      — the client sends the full conversation history on every request; the
      server injects retrieved KB context and returns the completion.
  - name: Chat Sessions (Preview)
    description: >
      **Preview — not currently enabled.**


      **Stateful** chat sessions. The server manages conversation history and
      supports tool orchestration (knowledge base retrieval, research, agents).
      These endpoints are documented for integrator preparation but are not
      exposed on any deployment today; they will be enabled in an upcoming
      release. Request and response schemas may change before general
      availability.
  - name: Researcher
    description: Web search, research sessions, analysis, synthesis, and source credibility
  - name: Quota
    description: Usage quota tracking
paths:
  /v1/chat/sessions/{id}/messages:
    post:
      tags:
        - Chat Sessions (Preview)
      summary: Send message to session
      description: Send a message to a chat session (history managed by server)
      operationId: sendMessageToSession
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The session ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatSessionMessageRequest'
      responses:
        '200':
          description: Message sent successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSessionMessage'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    ChatSessionMessageRequest:
      type: object
      required:
        - content
      properties:
        content:
          type: string
          description: The user message content
          example: What are the main features?
        stream:
          type: boolean
          default: false
          description: Enable streaming responses
    ChatSessionMessage:
      type: object
      properties:
        id:
          type: string
          example: msg_abc123
        object:
          type: string
          example: chat.message
        session_id:
          type: string
          example: session_xyz789
        role:
          type: string
          enum:
            - user
            - assistant
            - system
          example: assistant
        content:
          type: string
          example: The main features include...
        created_at:
          type: integer
          description: Unix timestamp
          example: 1699564800
        knowledge_base_context:
          type: object
          properties:
            sources:
              type: array
              items:
                type: object
                properties:
                  knowledgebase_id:
                    type: string
                  document_id:
                    type: string
                  title:
                    type: string
                  content:
                    type: string
                  page:
                    type: integer
                  relevance_score:
                    type: number
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid request parameters
              type: invalid_request_error
              code: bad_request
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or PAT
      description: >
        Bearer token authentication. Supports two token types:

        - **JWT Access Token** — obtained via `POST /v1/auth/login`

        - **Personal Access Token (PAT)** — created via `POST /v1/api-tokens`,
        format: `cmnd_<tokenId>.<secret>`

````