ChatMed API Documentation

The ChatMed API gives your application access to enterprise-grade medical AI capabilities — conversational diagnosis support, medical image analysis, video teleconsultation, voice interaction, health monitoring, prescriptions, and emergency detection — through a single, unified REST interface.

HIPAA Compliant 99.9% Uptime SLA <200ms P95 Latency TLS 1.3 Encrypted
Base URL: https://api.chatmed.site/api/v1
All requests must be made over HTTPS. HTTP requests will be automatically redirected.
New here? Jump to the Quick Start guide and make your first API call in under 5 minutes.

Quick Start

Get up and running with the ChatMed API in minutes.

1
Create your account
Sign up at /register and confirm your email address.
2
Generate an API key
From your developer portal, create a new API key. Keys are prefixed with sk_live_ for production and sk_test_ for sandbox.
3
Make your first request
Pass your key in the X-API-Key header and call any endpoint.
cURL
# Your first ChatMed API call
curl -X POST "https://api.chatmed.site/api/v1/chat/message" \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "What are symptoms of hypertension?"}'
4
Handle the response
All responses are JSON. Successful responses return HTTP 200. Check the Error Codes section for failure scenarios.

Authentication

The ChatMed API uses API keys for authentication. Include your key in every request using the X-API-Key header.

Keep your API key secret. Never expose it in client-side JavaScript, public repositories, or logs. Use environment variables or a secrets manager.
cURL
curl -X GET "https://api.chatmed.site/api/v1/users/me" \
  -H "X-API-Key: sk_live_YOUR_KEY_HERE"
JavaScript
const response = await fetch('https://api.chatmed.site/api/v1/users/me', {
  method: 'GET',
  headers: {
    'X-API-Key': 'sk_live_YOUR_KEY_HERE',
    'Content-Type': 'application/json'
  }
});
const data = await response.json();
console.log(data);
Python
import requests

headers = {
    "X-API-Key": "sk_live_YOUR_KEY_HERE",
    "Content-Type": "application/json"
}

response = requests.get(
    "https://api.chatmed.site/api/v1/users/me",
    headers=headers
)
print(response.json())
PHP
<?php
$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL           => "https://api.chatmed.site/api/v1/users/me",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER    => [
        "X-API-Key: sk_live_YOUR_KEY_HERE",
        "Content-Type: application/json"
    ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>

Rate Limits

Rate limits are applied per API key. When a limit is exceeded the API returns HTTP 429 Too Many Requests.

Plan Requests / min Requests / day Concurrent
Starter 60 1,000 5
Professional 300 50,000 25
Enterprise Unlimited Unlimited Unlimited
Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

Medical Chat

Send a medical question or symptom description and receive a structured AI-powered response with recommendations, disclaimers, and follow-up suggestions.

POST /api/v1/chat/message Send a medical message

Sends a conversational message to the medical AI. Maintains session context via session_id.

Request Body
Parameter Type Required Description
message string required The user's question or symptom description.
session_id string optional Conversation session ID for context continuity.
language string optional Response language code (e.g. en, fr, ar). Defaults to en.
profile_id string optional Patient health profile ID for personalised context.
cURL
curl -X POST "https://api.chatmed.site/api/v1/chat/message" \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "I have had a headache for 3 days with sensitivity to light.",
    "session_id": "sess_abc123",
    "language": "en"
  }'
JavaScript
const res = await fetch('https://api.chatmed.site/api/v1/chat/message', {
  method: 'POST',
  headers: {
    'X-API-Key': 'sk_live_YOUR_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'I have had a headache for 3 days with sensitivity to light.',
    session_id: 'sess_abc123',
    language: 'en'
  })
});
const data = await res.json();
console.log(data.response);
Python
import requests

payload = {
    "message": "I have had a headache for 3 days with sensitivity to light.",
    "session_id": "sess_abc123",
    "language": "en"
}

res = requests.post(
    "https://api.chatmed.site/api/v1/chat/message",
    json=payload,
    headers={"X-API-Key": "sk_live_YOUR_KEY"}
)
data = res.json()
print(data["response"])
PHP
<?php
$payload = json_encode([
    'message'  => 'I have had a headache for 3 days with sensitivity to light.',
    'session_id' => 'sess_abc123',
    'language' => 'en'
]);
$ch = curl_init('https://api.chatmed.site/api/v1/chat/message');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => $payload,
    CURLOPT_HTTPHEADER     => [
        'X-API-Key: sk_live_YOUR_KEY',
        'Content-Type: application/json'
    ],
]);
$data = json_decode(curl_exec($ch), true);
echo $data['response'];
curl_close($ch);
?>
200 Response
JSON
{
  "response": "The symptoms you describe — persistent headache with photosensitivity — may indicate migraine or tension headache. Recommended: rest in a dark room, hydration, and OTC analgesics. If symptoms worsen or are accompanied by fever or stiff neck, seek immediate medical attention.",
  "session_id": "sess_abc123",
  "disclaimer": "This is AI-generated health information and does not constitute medical advice.",
  "urgency_level": "moderate",
  "follow_up_questions": ["Do you experience nausea?", "Any recent head trauma?"],
  "timestamp": "2025-01-15T10:30:00Z"
}

Medical Imaging

Upload medical images (X-rays, MRIs, dermatology photos) for AI-powered analysis and structured diagnostic insights.

POST /api/v1/medical-vision/analyze Analyze a medical image

Video Teleconsultation

Create and manage real-time video consultation sessions between patients and healthcare providers. Includes waiting room management, session signalling, and recording.

POST /api/v1/consultations/video/create Create a video session
GET /api/v1/consultations/video/{session_id}/status Get session status
POST /api/v1/consultations/waiting-room/join Add patient to waiting room

Voice Assistant

Convert spoken medical queries to text, process them through the medical AI, and receive a synthesised voice response.

POST /api/v1/speech/transcribe Transcribe audio + get AI response

Health Monitoring

Submit health metrics and receive AI-powered trend analysis, anomaly alerts, and actionable recommendations.

POST /api/v1/health/heart-rate Record heart rate measurement

Prescriptions

Generate structured prescription documents, check drug interactions, and retrieve prescription history for a patient profile.

POST /api/v1/prescriptions/generate Generate a prescription

Emergency Detection

Real-time analysis of symptoms for life-threatening conditions. Returns urgency level, recommended actions, and nearest emergency resources.

POST /api/v1/emergency/detect Analyse for emergency conditions

Error Codes

All errors return a JSON body with error, message, and code fields.

Error Response Shape
{
  "error": "unauthorized",
  "message": "Invalid or missing API key.",
  "code": 401,
  "request_id": "req_01H9XYZ_abc"
}
HTTP Status Error Description
400 bad_request Missing or invalid request parameters.
401 unauthorized API key is missing, invalid, or revoked.
403 forbidden Your plan does not have access to this endpoint.
404 not_found Requested resource does not exist.
413 payload_too_large File upload exceeds the maximum allowed size.
422 validation_error Request body failed schema validation.
429 rate_limit_exceeded Too many requests. Check X-RateLimit-Reset header.
500 internal_error Unexpected server error. Retry with exponential backoff.
503 service_unavailable Temporary downtime. Check status page.
Implement exponential backoff for 429 and 503 errors. Start with a 1s delay, double it each retry, cap at 32s. Include the request_id when contacting support.

Live API Tester

Test the ChatMed API directly from this page. Enter your API key and choose an endpoint to make a live request.

API Playground
Requests are made directly from your browser to the live API.
No key
Sending request…