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

# Send Message

> Send a message to a conversation and receive an AI-generated response. The AI analyzes the form's response data to answer your question. Full conversation history is maintained for context.



## OpenAPI

````yaml openapi.json post /forms/{id}/chat/{conversationId}/messages
openapi: 3.1.0
info:
  title: GeniusForms API
  description: >-
    AI-powered form builder API. Create forms manually or generate them from
    natural language prompts.
  version: 1.0.0
  contact:
    name: GeniusForms Support
    email: support@geniusforms.ai
    url: https://geniusforms.ai
servers:
  - url: https://geniusforms.ai/api/v1
    description: Production
  - url: http://localhost:8000/api/v1
    description: Local Development
security:
  - ApiKeyAuth: []
paths:
  /forms/{id}/chat/{conversationId}/messages:
    post:
      tags:
        - Chat
      summary: Send Message
      description: >-
        Send a message to a conversation and receive an AI-generated response.
        The AI analyzes the form's response data to answer your question. Full
        conversation history is maintained for context.
      operationId: sendMessage
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Form ID
        - name: conversationId
          in: path
          required: true
          schema:
            type: integer
          description: Conversation ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
      responses:
        '200':
          description: Message sent and AI response received
          content:
            application/json:
              schema:
                type: object
                properties:
                  userMessage:
                    $ref: '#/components/schemas/ChatMessage'
                  assistantMessage:
                    $ref: '#/components/schemas/ChatMessage'
        '400':
          description: Invalid message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Access denied to this conversation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: AI service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SendMessageRequest:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          maxLength: 5000
          example: What are the most common responses?
    ChatMessage:
      type: object
      properties:
        id:
          type: integer
          example: 1
        role:
          type: string
          enum:
            - user
            - assistant
          example: assistant
        message:
          type: string
          example: Based on the 42 responses, the most common feedback theme is...
        createdAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          example: validation_error
        message:
          type: string
          example: Invalid request
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key obtained from your GeniusForms dashboard

````