NOT MEDICAL ADVICE.  For information only. In an emergency, call your local emergency number immediately.

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.

Base URL: https://api.viruswatch.health Status: Operational

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

{ "status": "ok", "service": "VirusWatch API", "version": "1.0", "timestamp": "2025-01-15T10:30:00.000Z" }

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

{ "fetchedAt": 1716900000000, // Unix timestamp (ms) of when data was fetched "diseases": { "covid": { "cases": 703284416, "deaths": 7010681, "recovered": 691500000, "source": "disease.sh (aggregates WHO, JHU)", "dataType": "live", "lastUpdated": "2025-01-15T10:30:00.000Z" }, "malaria": { "cases": 249000000, "deaths": 608000, "source": "WHO Global Health Observatory", "dataType": "official", "lastUpdated": "2023-12-31" }, "tuberculosis": { "cases": 10600000, "source": "WHO Global Health Observatory", "dataType": "official" }, "hiv-aids": { "cases": 39000000, "deaths": 630000, "source": "WHO Global Health Observatory", "dataType": "official" }, "measles": { "cases": 320000, "source": "WHO Global Health Observatory", "dataType": "official" }, "hepatitis-b": { "cases": 254000000, "source": "WHO Global Health Observatory", "dataType": "official" } } }

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

{ "fetchedAt": 1716900000000, "countries": [ { "country": "USA", "cases": 103436829, "deaths": 1124882, "lat": 37.09, "lon": -95.71 }, { "country": "India", "cases": 44690440, "deaths": 530779, "lat": 20.59, "lon": 78.96 } // ... up to 20 countries ] }

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.

ParamTypeDefaultDescription
countrystringoptionalCountry name as returned by disease.sh (e.g. USA, India)
daysnumber30Number of days to return (max 90)

Response

{ "scope": "global", "history": [ { "date": "2025-01-14", "cases": 703100000, "deaths": 7010500, "recovered": 691400000, "active": 689500 }, { "date": "2025-01-15", "cases": 703284416, "deaths": 7010681, "recovered": 691500000, "active": 773735 } ] }

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.

ParamTypeDefaultDescription
diseasestringcovidOne of: covid, malaria, tuberculosis, hiv-aids, measles, hepatitis-b
daysnumber30Number of days to return (max 90)

Response

{ "disease": "malaria", "history": [ { "date": "2025-01-15", "cases": 249000000, "deaths": 608000, "data_year": 2023, "source": "WHO GHO" } ] }

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

FieldTypeRequiredDescription
questionstringrequiredHealth question (3–1000 characters)

Response

{ "answer": "Dengue fever is caused by the DENV virus...", "source": "groq", // "groq" | "openai" | "cache" "cached": false }

Note: AI responses are for educational purposes only. Never use for medical decisions.

Code Examples

JavaScript (fetch)

// Get all disease data const res = await fetch('https://api.viruswatch.health/v1/diseases'); const data = await res.json(); console.log(data.diseases.covid.cases); // 703284416 // Ask the AI assistant const aiRes = await fetch('https://api.viruswatch.health/v1/ai/ask', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ question: 'What are the symptoms of dengue fever?' }) }); const aiData = await aiRes.json(); console.log(aiData.answer);

Python (requests)

import requests # Get disease data resp = requests.get('https://api.viruswatch.health/v1/diseases') data = resp.json() print(data['diseases']['covid']['cases']) # Ask AI assistant ai_resp = requests.post( 'https://api.viruswatch.health/v1/ai/ask', json={'question': 'How does Ebola spread?'} ) print(ai_resp.json()['answer'])

curl

# Status check curl https://api.viruswatch.health/v1/status # All live disease data curl https://api.viruswatch.health/v1/diseases # Top 20 COVID countries with lat/lon curl https://api.viruswatch.health/v1/covid-countries # COVID global history (last 30 days) curl https://api.viruswatch.health/v1/covid/history # Malaria history curl "https://api.viruswatch.health/v1/disease-history?disease=malaria" # AI question curl -X POST https://api.viruswatch.health/v1/ai/ask \ -H "Content-Type: application/json" \ -d '{"question":"What is the incubation period of H5N1?"}'

Rate Limits & Fair Use

EndpointRate LimitCache
/v1/statusUnlimitedNone
/v1/diseasesNo per-IP limit1 hour (Cloudflare KV)
/v1/covid-countriesNo per-IP limit1 hour (Cloudflare KV)
/v1/covid/historyNo per-IP limit1 hour (Cloudflare CDN)
/v1/disease-historyNo per-IP limit1 hour (Cloudflare CDN)
/v1/ai/ask100 req/min per IPNone
/v1/geocodeNo per-IP limit1 hour (Cloudflare CDN)
/v1/nearbyNo per-IP limit5 min (Cloudflare CDN)

If you need higher limits for a research or humanitarian project, contact us at [email protected].

Error Responses

StatusMeaningWhen
400Bad RequestInvalid question (too short/long) for AI endpoint
404Not FoundUnknown endpoint
429Too Many RequestsRate limit exceeded
503Service UnavailableUpstream 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:

Data source: VirusWatch (viruswatch.health) via WHO, CDC, and disease.sh

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.

By submitting this form, your email address and project details will be processed by Formspree so VirusWatch can contact you about API updates. See our Privacy Policy.