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

# Get Conversation History

> Retrieves the conversation history for a given user type.

# Get Conversation History

Retrieves the conversation history for a given user type.

## Headers

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

## Query Parameters

| Parameter  | Type   | Required | Description                                           |
| ---------- | ------ | -------- | ----------------------------------------------------- |
| user\_type | string | Yes      | The type of user (Patient, Doctor, Coach, Researcher) |
| model\_id  | string | Yes      | The AI model identifier (openai, gemini)              |
| user\_id   | string | Yes      | The user identifier                                   |

## Responses

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

## Sample Request

```bash theme={null}
curl -X GET "https://api.covita.com/api/v1/conversation_history?user_type=Patient&model_id=openai&user_id=User1" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

## Sample Response

```json theme={null}
{
  "conversation_history": [
    {
      "timestamp": "2023-08-15T14:30:00.000Z",
      "message": "What is my average heart rate?",
      "response": "Based on your recent health data, your average heart rate is 72 beats per minute.",
      "user_type": "Patient"
    }
  ],
  "total_messages": 1
}
```


## OpenAPI

````yaml GET /api/v1/conversation_history
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/conversation_history:
    get:
      tags:
        - AI Assistant
      summary: Get Conversation History
      description: Retrieves the conversation history for a given user type.
      operationId: get_conversation_history_api_v1_conversation_history_get
      parameters:
        - name: user_type
          in: query
          required: true
          schema:
            type: string
            title: User Type
        - name: model_id
          in: query
          required: true
          schema:
            type: string
            title: Model Id
        - name: user_id
          in: query
          required: true
          schema:
            type: string
            title: User Id
      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:
    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

````