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

# Send Message

> Sends a message to the chatbot and receives a response.

Args:
    message: The user message containing text and user_type
    db: Database session dependency
    token: Verified API token
    
Returns:
    JSON response with user_type and the agent's response

Raises:
    HTTPException: If the user_type is invalid or token is invalid

# Send Message

Sends a message to the chatbot and receives a response.

## Headers

| Parameter     | Type   | Required | Description             |
| ------------- | ------ | -------- | ----------------------- |
| authorization | string | Yes      | API authorization token |

## Request Body

```json theme={null}
{
  "text": "string",
  "user_type": "Patient",
  "model_id": "openai"
}
```

| Property   | Type   | Required | Description                                                 |
| ---------- | ------ | -------- | ----------------------------------------------------------- |
| text       | string | Yes      | The message text to send                                    |
| user\_type | string | No       | The type of user (Patient, Doctor, Coach). Default: Patient |
| model\_id  | string | No       | The model ID (openai, gemini). Default: openai              |

## Responses

| Status | Description      | Content Type     |
| ------ | ---------------- | ---------------- |
| 200    | Chatbot response | application/json |
| 422    | Validation Error | application/json |


## OpenAPI

````yaml POST /v1/send_message
openapi: 3.1.0
info:
  title: Chatbot Backend
  description: A FastAPI backend for the Covita chatbot application
  version: 1.0.0
servers: []
security: []
paths:
  /v1/send_message:
    post:
      tags:
        - chatbot
      summary: Send Message
      description: Sends a message to the chatbot and receives a response.
      operationId: send_message_v1_send_message_post
      parameters:
        - name: authorization
          in: header
          required: true
          schema:
            type: string
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Message'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Message:
      properties:
        text:
          type: string
          title: Text
        user_type:
          type: string
          enum:
            - Patient
            - Doctor
            - Coach
          title: User Type
          default: Patient
        model_id:
          type: string
          enum:
            - openai
            - gemini
          title: Model Id
          default: openai
      type: object
      required:
        - text
      title: Message
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````