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

# Send message

> Send a message to a task



## OpenAPI

````yaml api-reference/openapi.json post /api/task/v1/{task_id}/message
openapi: 3.1.0
info:
  title: soma
  version: v1
servers: []
security: []
tags:
  - name: task
    description: >-
      Task management endpoints for creating, listing, and managing tasks and
      their messages
  - name: secret
    description: Secret management endpoints for storing and retrieving encrypted secrets
  - name: encryption
    description: >-
      Encryption key management endpoints for envelope keys, data encryption
      keys, and aliases
  - name: bridge
    description: >-
      Bridge endpoints for managing providers, credentials, functions, and MCP
      protocol communication
  - name: _internal
    description: >-
      Internal endpoints for health checks, runtime configuration, and SDK code
      generation
  - name: a2a
    description: >-
      Agent-to-agent communication endpoints for agent cards, definitions, and
      JSON-RPC requests
  - name: v1
    description: API version v1 endpoints
paths:
  /api/task/v1/{task_id}/message:
    post:
      tags:
        - task
        - v1
      summary: Send message
      description: Send a message to a task
      operationId: send-message
      parameters:
        - name: task_id
          in: path
          description: Task ID
          required: true
          schema:
            $ref: '#/components/schemas/WrappedUuidV4'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
        required: true
      responses:
        '200':
          description: Create message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateMessageResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    WrappedUuidV4:
      type: string
      format: uuid
    CreateMessageRequest:
      type: object
      required:
        - reference_task_ids
        - role
        - metadata
        - parts
      properties:
        metadata:
          $ref: '#/components/schemas/Metadata'
        parts:
          type: array
          items:
            $ref: '#/components/schemas/MessagePart'
        reference_task_ids:
          type: array
          items:
            $ref: '#/components/schemas/WrappedUuidV4'
        role:
          $ref: '#/components/schemas/MessageRole'
    CreateMessageResponse:
      type: object
      required:
        - message
        - timeline_item
      properties:
        message:
          $ref: '#/components/schemas/Message'
        timeline_item:
          $ref: '#/components/schemas/TaskTimelineItem'
    Error:
      type: object
      required:
        - message
      properties:
        data: {}
        message:
          type: string
    Metadata:
      type: object
      additionalProperties: {}
      propertyNames:
        type: string
    MessagePart:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/TextPart'
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - text-part
    MessageRole:
      type: string
      enum:
        - user
        - agent
    Message:
      type: object
      required:
        - id
        - task_id
        - reference_task_ids
        - role
        - metadata
        - parts
        - created_at
      properties:
        created_at:
          $ref: '#/components/schemas/WrappedChronoDateTime'
        id:
          $ref: '#/components/schemas/WrappedUuidV4'
        metadata:
          $ref: '#/components/schemas/Metadata'
        parts:
          type: array
          items:
            $ref: '#/components/schemas/MessagePart'
        reference_task_ids:
          type: array
          items:
            $ref: '#/components/schemas/WrappedUuidV4'
        role:
          $ref: '#/components/schemas/MessageRole'
        task_id:
          $ref: '#/components/schemas/WrappedUuidV4'
    TaskTimelineItem:
      type: object
      required:
        - id
        - task_id
        - event_payload
        - created_at
      properties:
        created_at:
          $ref: '#/components/schemas/WrappedChronoDateTime'
        event_payload:
          $ref: '#/components/schemas/TaskTimelineItemPayload'
        id:
          $ref: '#/components/schemas/WrappedUuidV4'
        task_id:
          $ref: '#/components/schemas/WrappedUuidV4'
    TextPart:
      type: object
      required:
        - text
        - metadata
      properties:
        metadata:
          $ref: '#/components/schemas/Metadata'
        text:
          type: string
    WrappedChronoDateTime:
      type: string
      format: date-time
    TaskTimelineItemPayload:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/TaskStatusUpdateTaskTimelineItem'
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - task-status-update
        - allOf:
            - $ref: '#/components/schemas/MessageTaskTimelineItem'
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - message
    TaskStatusUpdateTaskTimelineItem:
      type: object
      required:
        - status
      properties:
        status:
          $ref: '#/components/schemas/TaskStatus'
        status_message_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/WrappedUuidV4'
    MessageTaskTimelineItem:
      type: object
      required:
        - message
      properties:
        message:
          $ref: '#/components/schemas/Message'
    TaskStatus:
      type: string
      enum:
        - submitted
        - working
        - input-required
        - completed
        - canceled
        - failed
        - rejected
        - auth-required
        - unknown

````