> ## 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.

# Send Message

Sends a message to the chatbot and receives a response.

## Headers

| Parameter     | Type   | Required | Description                            |
| ------------- | ------ | -------- | -------------------------------------- |
| authorization | string | Yes      | API authorization token (Bearer token) |

## Request Body

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

| Property   | Type   | Required | Description                                                             |
| ---------- | ------ | -------- | ----------------------------------------------------------------------- |
| text       | string | Yes      | The message text to send                                                |
| user\_id   | string | No       | User identifier, one of: "User1" through "User20". Default: User1       |
| user\_type | string | No       | The type of user (Patient, Doctor, Coach, Researcher). Default: Patient |
| model\_id  | string | No       | The AI model to use (openai, gemini). Default: openai                   |

## Responses

| Status | Description         | Content Type     |
| ------ | ------------------- | ---------------- |
| 200    | Successful Response | application/json |
| 422    | Validation Error    | application/json |

## Sample Request

```bash theme={null}
curl -X POST "https://api.covita.com/api/v1/send_message" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
    "text": "What is my average heart rate?",
    "user_id": "User1",
    "user_type": "Patient",
    "model_id": "openai"
  }'
```

## Sample Response

```json theme={null}
{
  "response": "Based on your recent health data, your average heart rate is 72 beats per minute, which falls within the normal range for adults.",
  "user_type": "Patient"
}
```


## OpenAPI

````yaml POST /api/v1/send_message
openapi: 3.1.0
info:
  title: Covita API
  description: API for Covita health monitoring system
  version: 1.0.0
servers: []
security: []
tags:
  - name: AI Assistant
    description: >-
      Endpoints for interacting with the AI assistant, including sending
      messages and managing conversation history
  - name: Patient Data
    description: >-
      Endpoints for accessing and managing patient health data, including
      medical history, vitals, and demographic information
paths:
  /api/v1/send_message:
    post:
      tags:
        - AI Assistant
      summary: Send Message
      description: Sends a message to the chatbot and receives a response.
      operationId: send_message_api_v1_send_message_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Message'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    Message:
      properties:
        text:
          type: string
          title: Text
        user_id:
          type: string
          enum:
            - User1
            - User2
            - User3
            - User4
            - User5
            - User6
            - User7
            - User8
            - User9
            - User10
            - User11
            - User12
            - User13
            - User14
            - User15
            - User16
            - User17
            - User18
            - User19
            - User20
          title: User Id
          default: User1
        user_type:
          type: string
          enum:
            - Patient
            - Doctor
            - Coach
            - Researcher
          title: User Type
          default: Patient
        model_id:
          type: string
          enum:
            - openai
            - gemini
          title: Model Id
          default: openai
      type: object
      required:
        - text
      title: Message
      description: >-
        Represents a message in the chat system with user identification and
        model selection.


        Attributes:
            text: The content of the message
            user_id: Identifier for the user sending the message
            user_type: The role of the user (Patient, Doctor, Coach, or Researcher)
            model_id: The AI model to use for generating responses
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````