Send Message
curl --request POST \
--url https://api.example.com/api/v1/send_message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"user_id": "User1",
"user_type": "Patient",
"model_id": "openai"
}
'import requests
url = "https://api.example.com/api/v1/send_message"
payload = {
"text": "<string>",
"user_id": "User1",
"user_type": "Patient",
"model_id": "openai"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', user_id: 'User1', user_type: 'Patient', model_id: 'openai'})
};
fetch('https://api.example.com/api/v1/send_message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/send_message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'user_id' => 'User1',
'user_type' => 'Patient',
'model_id' => 'openai'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/send_message"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"user_id\": \"User1\",\n \"user_type\": \"Patient\",\n \"model_id\": \"openai\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/send_message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"user_id\": \"User1\",\n \"user_type\": \"Patient\",\n \"model_id\": \"openai\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/send_message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"user_id\": \"User1\",\n \"user_type\": \"Patient\",\n \"model_id\": \"openai\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}API Reference
Send Message
Sends a message to the chatbot and receives a response.
POST
/
api
/
v1
/
send_message
Send Message
curl --request POST \
--url https://api.example.com/api/v1/send_message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"user_id": "User1",
"user_type": "Patient",
"model_id": "openai"
}
'import requests
url = "https://api.example.com/api/v1/send_message"
payload = {
"text": "<string>",
"user_id": "User1",
"user_type": "Patient",
"model_id": "openai"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', user_id: 'User1', user_type: 'Patient', model_id: 'openai'})
};
fetch('https://api.example.com/api/v1/send_message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/send_message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'user_id' => 'User1',
'user_type' => 'Patient',
'model_id' => 'openai'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/send_message"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"user_id\": \"User1\",\n \"user_type\": \"Patient\",\n \"model_id\": \"openai\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/send_message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"user_id\": \"User1\",\n \"user_type\": \"Patient\",\n \"model_id\": \"openai\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/send_message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"user_id\": \"User1\",\n \"user_type\": \"Patient\",\n \"model_id\": \"openai\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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
{
"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
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
{
"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"
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
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
Available options:
User1, User2, User3, User4, User5, User6, User7, User8, User9, User10, User11, User12, User13, User14, User15, User16, User17, User18, User19, User20 Available options:
Patient, Doctor, Coach, Researcher Available options:
openai, gemini Response
Successful Response
⌘I