Glucose
VitalTrends can show and expose blood glucose data when a CGM or glucose app writes blood_glucose samples into Apple Health and the VitalTrends iOS companion app has permission to sync them.
Current source path: CGM or glucose app → Apple Health → VitalTrends iOS app → VitalTrends. Direct Dexcom, FreeStyle Libre, Levels, or Lingo connections are not required for the current glucose API.
What syncs
- Raw blood glucose readings from Apple Health, stored as
blood_glucosesamples inapple_health_samples. - Daily processed glucose aggregates in
apple_health_samples_processed, including average, min, max, sample count, unit, and source. - Source labels from HealthKit, such as the CGM app or device that wrote the sample.
- Optional HealthKit metadata when present.
Dashboard
The web glucose dashboard appears at /glucose.
- Average glucose, weighted by raw sample count when daily rows are available.
- GMI estimate when at least 7 days of data are present.
- Time in range using raw readings when available, with 70-140 and 70-180 bands.
- Glucose variability using raw CV when available, with a daily-range fallback.
- Raw short-range charts for 24-hour and 7-day windows.
- Daily average plus min-max envelope for longer ranges.
- AGP 24-hour percentile profile when enough raw readings exist.
- Day explorer context with glucose trace, sleep, workouts, and activity annotations.
API
Use the REST API when you want glucose data in scripts, notebooks, automations, or AI tools.
| Method | Path | Use |
|---|---|---|
| GET | /api/v1/glucose | Glucose analytics payload with stats, daily rows, time in range, AGP, and day explorer context |
| GET | /api/v1/glucose/readings | Paginated raw CGM glucose readings |
| GET | /api/v1/apple-health?type=blood_glucose | Processed Apple Health glucose aggregate rows |
Analytics endpoint
curl -s "https://vitaltrends.net/api/v1/glucose?days=30" \
-H "Authorization: Bearer YOUR_API_KEY" | jq .
| Parameter | Type | Default | Description |
|---|---|---|---|
range | string | none | Use 24h for the trailing 24-hour raw window |
days | integer | 30 | Rolling window, 1-365 days |
start | date | none | Custom range start, interpreted in the user's profile timezone |
end | date | now | Custom range end, interpreted in the user's profile timezone |
selected_date | date | latest raw date | Day explorer date, YYYY-MM-DD |
Raw readings endpoint
curl -s "https://vitaltrends.net/api/v1/glucose/readings?start=2026-05-01&end=2026-05-07&per_page=200" \
-H "Authorization: Bearer YOUR_API_KEY" | jq .
| Parameter | Type | Default | Description |
|---|---|---|---|
start | date or datetime | none | Inclusive lower bound on reading time |
end | date or datetime | none | Inclusive upper bound on reading time |
per_page | integer | 50 | Records per page, max 200 |
page | integer | 1 | Page number |
include | csv | none | Add metadata or hk_device |
Raw readings exclude samples that were deleted from Apple Health or superseded by VitalTrends deduplication.
Field notes
| Field | Meaning |
|---|---|
value | Glucose value in the returned unit, usually mg/dL |
source | HealthKit source app or device label |
sample_count | Number of raw readings represented by a daily aggregate row |
value_min and value_max | Lowest and highest reading inside a processed aggregate row |
recorded_at | UTC timestamp for an individual raw glucose reading |
Troubleshooting
If the dashboard or API returns empty: true, confirm that your CGM app writes glucose to Apple Health and that VitalTrends has Apple Health permission for blood glucose. Open the iOS companion app and tap Sync now after changing permissions.