Skip to Content
WearablesLibre CGM

Libre CGM Integration

FreeStyle Libre continuous glucose monitors provide glucose data through LibreView or Terra API integration.

OAuth Setup

Prerequisites

  1. Set up a LibreView or Terra API account
  2. Register your application for CGM data access
  3. Set the redirect URI to https://my.loop.health/api/cgm/libre/callback

Environment Variables

LIBRE_CLIENT_ID=your-libre-client-id LIBRE_CLIENT_SECRET=your-libre-secret LIBRE_REDIRECT_URI=https://my.loop.health/api/cgm/libre/callback

Supported Devices

DeviceStatus
FreeStyle Libre 1Supported
FreeStyle Libre 2Supported
FreeStyle Libre 3Supported

Connection Flow

Step 1: Initiate Connection

curl -X GET "https://my.loop.health/api/cgm/libre/connect" \ -H "Authorization: Bearer $CLERK_JWT"

Redirects the user to the LibreView/Terra authorization page.

Step 2: OAuth Callback

GET /api/cgm/libre/callback?code=AUTH_CODE&state=STATE_TOKEN

Data Collected

Glucose Readings

{ "metricType": "glucose", "source": "libre", "metrics": { "value": 98, "unit": "mg/dL", "trend": "flat", "scanType": "automatic" } }

Reading Types

TypeDescription
automaticAutomatic readings every 1–5 minutes
scanManual scan by user
historicBackfilled historical data

Data Sync

Libre data is synced on the same schedule as Dexcom — every 30 minutes via the syncCgmReadings Trigger.dev job.

Libre vs. Dexcom

FeatureLibreDexcom
Real-time alertsLibre 3 onlyAll models
Scan requiredLibre 1/2No
Sensor duration14 days10 days (G6), 10–15 days (G7)
Warm-up1 hour2 hours
Reading interval1–5 min5 min