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

# Create Message

> Create a new message 



## OpenAPI

````yaml POST /messages/create
openapi: 3.1.0
info:
  title: duohub Retriever API
  description: >-
    Retrieve assisted or non-assisted memory from a duohub knowledge graph. For
    best performance, use the official `duohub` Python package.
  version: 1.0.0
servers:
  - url: https://api.duohub.ai
security:
  - APIKeyHeader: []
paths:
  /messages/create:
    post:
      tags:
        - Messages
      summary: Create Message
      description: 'Create a new message '
      operationId: createMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - content
                - role
              properties:
                id:
                  type: string
                  description: >-
                    Optional unique identifier for the message. If not provided,
                    a UUID will be generated.
                sessionID:
                  type: string
                  description: ID of the session this message belongs to
                role:
                  type: string
                  enum:
                    - norole
                    - system
                    - assistant
                    - user
                    - function
                    - tool
                  description: Role of the message sender
                content:
                  type: string
                  description: Content of the message
                customerUserID:
                  type: string
                  description: Optional ID of the customer user
              example:
                sessionID: 123e4567-e89b-12d3-a456-426614174000
                role: user
                content: Hello, how can I help you today?
      responses:
        '201':
          description: Message created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Unique identifier for the message
                      sessionID:
                        type: string
                        description: ID of the session this message belongs to
                      role:
                        type: string
                        enum:
                          - norole
                          - system
                          - assistant
                          - user
                          - function
                          - tool
                      content:
                        type: string
                        description: Content of the message
                      userID:
                        type: string
                        description: ID of the user who created the message
                      customerUserID:
                        type: string
                        description: ID of the customer user
                      createdAt:
                        type: string
                        format: date-time
                        description: Timestamp of message creation
                      updatedAt:
                        type: string
                        format: date-time
                        description: Timestamp of last update
                example:
                  status: success
                  data:
                    id: 123e4567-e89b-12d3-a456-426614174000
                    sessionID: 987fcdeb-51a2-43b7-91fa-987654321000
                    role: user
                    content: Hello, how can I help you today?
                    userID: d99e7428-40e1-7073-aa50-94cee086b518
                    customerUserID: cust-123
                    createdAt: '2024-01-01T00:00:00.000Z'
                    updatedAt: '2024-01-01T00:00:00.000Z'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  status:
                    type: string
                    enum:
                      - bad_request
                required:
                  - error
                  - status
                examples:
                  invalid_json:
                    value:
                      error: Invalid JSON in request body
                      status: bad_request
                  missing_required:
                    value:
                      error: sessionID is required
                      status: bad_request
                  invalid_role:
                    value:
                      error: >-
                        Invalid role. Must be one of: norole, system, assistant,
                        user, function, tool
                      status: bad_request
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  status:
                    type: string
                    enum:
                      - unauthorized
                required:
                  - error
                  - status
                example:
                  error: API key is required
                  status: unauthorized
components:
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'Your duohub API key. Type: str'

````