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

# Send Task Message

> Send a message to a task's chat.
Saves the user message, calls the agent on the K8s pod, proxies the 
SSE stream back to the frontend, and saves the assistant response on completion.

Architecture: Frontend -> Backend (this) -> Agent (K8s pod) -> Backend -> Frontend
The database is only accessed here in the orchestration API.



## OpenAPI

````yaml /openapi.json post /api/tasks/{task_id}/messages
openapi: 3.1.0
info:
  description: >-
    Public CodeCobra API. Authenticate by sending a personal API key in the
    `Authorization: Bearer <key>` header. Generate keys from Settings → API keys
    in the CodeCobra dashboard.
  title: CodeCobra Public API
  version: 1.0.0
servers: []
security: []
paths:
  /api/tasks/{task_id}/messages:
    post:
      tags:
        - public
      summary: Send Task Message
      description: >-
        Send a message to a task's chat.

        Saves the user message, calls the agent on the K8s pod, proxies the 

        SSE stream back to the frontend, and saves the assistant response on
        completion.


        Architecture: Frontend -> Backend (this) -> Agent (K8s pod) -> Backend
        -> Frontend

        The database is only accessed here in the orchestration API.
      operationId: send_task_message_api_tasks__task_id__messages_post
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            format: uuid
            title: Task Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskMessageCreate'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema: {}
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    TaskMessageCreate:
      properties:
        attachment_ids:
          anyOf:
            - items:
                format: uuid
                type: string
              type: array
            - type: 'null'
          title: Attachment Ids
        content:
          title: Content
          type: string
        develop_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Develop Enabled
        display_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Content
        is_retry:
          default: false
          title: Is Retry
          type: boolean
        kind:
          anyOf:
            - enum:
                - chat
                - system_event
              type: string
            - type: 'null'
          title: Kind
        mode:
          anyOf:
            - enum:
                - plan
                - build
              type: string
            - type: 'null'
          title: Mode
        model_tier:
          anyOf:
            - enum:
                - auto
                - hatchling
                - striker
                - apex
              type: string
            - type: 'null'
          title: Model Tier
        plan_first_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Plan First Enabled
        selected_branches:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Selected Branches
      required:
        - content
      title: TaskMessageCreate
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http

````