Public API
Free access to regularly updated infectious disease data. No API key required for disease data. Built on Cloudflare Workers for global low-latency access.
Overview
The VirusWatch API provides regularly updated and cached disease surveillance data sourced from WHO, CDC, and disease.sh. It is free to use for non-commercial, educational, and research purposes. See our Terms of Service for usage guidelines.
- No authentication required for disease data endpoints
- CORS enabled — works from browser-based applications
- Rate limit: 60 requests per minute per IP
- Response format: JSON
- Infrastructure: Cloudflare Workers (global edge, ~10ms latency)
- Data cache: Disease data cached 1 hour; AI responses cached 24 hours
Endpoints
GET/v1/status
API health check. Returns service status and available routes.
Response
GET/v1/diseases
Returns live global disease statistics for diseases with active public API sources, cached hourly in Cloudflare KV. Currently 6 diseases return live figures: COVID-19 (disease.sh), Malaria, Tuberculosis, HIV/AIDS, Measles, and Hepatitis B (WHO GHO). All other diseases in the frontend fall back to WHO-published baselines stored in the client.
Response
Note: Only diseases with active public APIs appear in diseases. The frontend merges these with WHO-published baselines for all 20 diseases.
GET/v1/covid-countries
Returns the top 20 countries by total COVID-19 cases, with latitude/longitude for map rendering. Sourced from disease.sh, cached 1 hour.
Response
GET/v1/covid/history
Returns daily COVID-19 snapshots stored in D1. Global totals by default; pass ?country= for a specific country. Data is captured once per day at midnight UTC.
| Param | Type | Default | Description |
|---|---|---|---|
country | string | optional | Country name as returned by disease.sh (e.g. USA, India) |
days | number | 30 | Number of days to return (max 90) |
Response
GET/v1/disease-history
Returns daily global snapshots for any of the 6 live-tracked diseases. COVID figures change daily; WHO diseases (malaria, TB, HIV, measles, hepatitis-b) change when WHO publishes new annual estimates.
| Param | Type | Default | Description |
|---|---|---|---|
disease | string | covid | One of: covid, malaria, tuberculosis, hiv-aids, measles, hepatitis-b |
days | number | 30 | Number of days to return (max 90) |
Response
data_year is the year the WHO estimate refers to, which may differ from the snapshot date.
POST/v1/ai/ask
Submit a health education question. Returns an AI-generated educational response. Powered by Groq (llama-3.1-8b-instant) with OpenAI GPT-4o fallback. Responses cached 24 hours.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
question | string | required | Health question (3–1000 characters) |
Response
Note: AI responses are for educational purposes only. Never use for medical decisions.
Code Examples
JavaScript (fetch)
Python (requests)
curl
Rate Limits & Fair Use
| Endpoint | Rate Limit | Cache |
|---|---|---|
/v1/status | Unlimited | None |
/v1/diseases | No per-IP limit | 1 hour (Cloudflare KV) |
/v1/covid-countries | No per-IP limit | 1 hour (Cloudflare KV) |
/v1/covid/history | No per-IP limit | 1 hour (Cloudflare CDN) |
/v1/disease-history | No per-IP limit | 1 hour (Cloudflare CDN) |
/v1/ai/ask | 100 req/min per IP | None |
/v1/geocode | No per-IP limit | 1 hour (Cloudflare CDN) |
/v1/nearby | No per-IP limit | 5 min (Cloudflare CDN) |
If you need higher limits for a research or humanitarian project, contact us at [email protected].
Error Responses
| Status | Meaning | When |
|---|---|---|
400 | Bad Request | Invalid question (too short/long) for AI endpoint |
404 | Not Found | Unknown endpoint |
429 | Too Many Requests | Rate limit exceeded |
503 | Service Unavailable | Upstream API failure (returns cached data or error) |
Data Attribution
If you use VirusWatch API data in a project, please attribute your data source. Suggested attribution:
Underlying data sources: disease.sh, WHO GHO, WHO Disease Outbreak News.
Request API Access Notification
The API requires no key for standard usage. If you are building an app that will make significant use of our API, we'd love to know about it. Register your project below and we'll notify you of any breaking changes.