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

# Covita v0.2 API Reference

> Complete API reference for the Covita v0.2 application.

<Callout type="info" emoji="ℹ️">
  This documentation provides comprehensive details about all available endpoints, request parameters, and response formats for the Covita v0.2 API.
</Callout>

## 🌐 Base URL

<div className="p-4 border rounded-md bg-gray-50 dark:bg-gray-800">
  All API endpoints are relative to the base URL:
  <code className="px-2 py-1 font-mono bg-gray-100 dark:bg-gray-700 rounded">[https://covita.nivara.io](https://covita.nivara.io)</code>
</div>

## 🔐 Authentication

<div className="p-4 border rounded-md bg-gray-50 dark:bg-gray-800 mb-4">
  <p className="mb-2">
    <strong>New in v0.2:</strong> Covita now implements a whitelisted login system for enhanced security.
  </p>

  <p>
    All API requests require an authorization token which is provided to whitelisted users.
  </p>

  <p className="mt-2">
    Contact the administration team to get your user credentials added to the whitelist.
  </p>
</div>

## 🤖 Chatbot API

The Chatbot API provides the following endpoints:

### Send Message

`POST /v1/send_message`

Sends a message to the chatbot and receives a response.

**Request Parameters:**

* `text` (string, required): The message text
* `user_id` (string, optional, default: "User1"): User identifier, one of: "User1" through "User20"
* `user_type` (string, optional, default: "Patient"): User type, one of: "Patient", "Doctor", "Coach"
* `model_id` (string, optional, default: "openai"): Model to use, one of: "openai", "gemini"

### Get Conversation History

`GET /v1/conversation_history`

Retrieves the conversation history for a given user type.

**Query Parameters:**

* `user_type` (string, required): User type
* `model_id` (string, required): Model ID
* `user_id` (string, required): User identifier

### Reset Conversation History

`GET /v1/reset_conversation_history`

Resets the conversation history for a given user type.

**Query Parameters:**

* `user_type` (string, required): User type
* `model_id` (string, required): Model ID
* `user_id` (string, required): User identifier

## ⚠️ Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests.

| Status Code | Description      |
| ----------- | ---------------- |
| 200         | Success          |
| 201         | Created          |
| 400         | Bad Request      |
| 401         | Unauthorized     |
| 403         | Forbidden        |
| 404         | Not Found        |
| 422         | Validation Error |
| 500         | Server Error     |

<Callout type="warning" emoji="🚨">
  When an error occurs, the response will include details about what went wrong in a standardized format.
</Callout>

```json theme={null}
{
  "error": {
    "code": "error_code",
    "message": "A descriptive error message",
    "details": {
      // Additional error details if available
    }
  }
}
```
