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

# Create Message

> Create one or more messages.

Accepts either:
- Single message object: { message object }
- Array of message objects: [ { message object }, ... ]

The workspace_id will be automatically set from the current session context.



## OpenAPI

````yaml api-reference/openapi.json post /api/v1/messages
openapi: 3.1.0
info:
  title: FastAPI app
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/messages:
    post:
      tags:
        - Messages
      summary: Create Message
      description: >-
        Create one or more messages.


        Accepts either:

        - Single message object: { message object }

        - Array of message objects: [ { message object }, ... ]


        The workspace_id will be automatically set from the current session
        context.
      operationId: create_message_api_v1_messages_post
      parameters:
        - name: X-Workspace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The workspace ID
            title: X-Workspace-Id
          description: The workspace ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessages'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MessageRead'
                title: Response Create Message Api V1 Messages Post
        '404':
          description: Message not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - DualAuthScheme: []
components:
  schemas:
    CreateMessages:
      properties:
        conversation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Conversation Id
          description: Conversation ID
        content:
          anyOf:
            - $ref: '#/components/schemas/MessageCreateRequest'
            - items:
                $ref: '#/components/schemas/MessageCreateRequest'
              type: array
          title: Content
          description: Message content
        enable_memories:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enable Memories
          description: Enable memories
          default: false
      type: object
      required:
        - content
      title: CreateMessages
      description: Schema for creating messages.
    MessageRead:
      properties:
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
        id:
          type: string
          title: Id
        conversation_id:
          type: string
          title: Conversation Id
          description: Reference to conversation
        sender_id:
          type: string
          title: Sender Id
          description: ID of the message sender
        role:
          type: string
          title: Role
          description: Message role (user, assistant, system, etc.)
          default: user
        content:
          type: string
          title: Content
          description: Message content
        tool_calls:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tool Calls
          description: Tool calls made in this message
        message_type:
          type: string
          title: Message Type
          description: Type of message
          default: text
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
          description: Message tags
        checksum:
          anyOf:
            - type: string
            - type: 'null'
          title: Checksum
          description: Message checksum
        attachments:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Attachments
          description: Message attachments
        parent_message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Message Id
          description: Parent message ID for threading
        meta_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta Data
          description: Additional metadata
        sent_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Sent At
          description: When the message was sent
        owner_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner Id
          description: Owner ID
        workspace_id:
          type: string
          title: Workspace Id
          description: Reference to workspace
      type: object
      required:
        - conversation_id
        - sender_id
        - content
        - workspace_id
      title: MessageRead
      description: Schema for reading message data.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MessageCreateRequest:
      properties:
        sender_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Sender Id
          description: Sender/User ID
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: When the message was sent
        content:
          type: string
          title: Content
          description: Message content
        role:
          type: string
          title: Role
          description: Message role
          default: user
        message_type:
          type: string
          title: Message Type
          description: Message type
          default: text
        tool_calls:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tool Calls
          description: Tool calls made in this message
        parent_message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Message Id
          description: Parent message ID for threading
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
          description: Message tags
        meta_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta Data
          description: Additional metadata
        attachments:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Attachments
          description: Message attachments
      type: object
      required:
        - content
      title: MessageCreateRequest
      description: Schema for message creation request.
    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
  securitySchemes:
    DualAuthScheme:
      type: http
      scheme: bearer

````