Skip to content

Stats & Insights

Beyond raw readings, the public API offers precomputed analytics. All endpoints are GET under /api/v1/public/patients/:patientId/, need the read scope and a key linked to the patient.

Endpoints

EndpointWindowReturns
…/statsLast 7 days (fixed)Advanced stats: TIR, CV, patterns, stability, milestones
…/insightsLast 30 days (fixed)Longer-horizon patterns and observations
…/readings/resampledLast 24h (or startTime/endTime)15-minute resampled series
…/daily/:dateOne day (YYYY-MM-DD)That day’s readings + { min, max, avg, tir, count } (stats: null when empty)
…/eventsLast 7 days (or startTime/endTime), paginated max 100Meals, insulin, exercise, notes, medication
…/custom-levels—Patient thresholds { veryLow, low, high, veryHigh }, or null when unset
Terminal window
curl "https://api.levelcast.org/api/v1/public/patients/PATIENT_ID/stats" \
-H "X-API-KEY: lc_your_key_here"
curl "https://api.levelcast.org/api/v1/public/patients/PATIENT_ID/daily/2026-10-01" \
-H "X-API-KEY: lc_your_key_here"
curl "https://api.levelcast.org/api/v1/public/patients/PATIENT_ID/events?startTime=2026-09-01T00:00:00.000Z&page=1&limit=50" \
-H "X-API-KEY: lc_your_key_here"

Pagination

List endpoints accept page (1-based) and limit and return { success: true, data: […], pagination: { page, limit, total } }. Per-endpoint caps: readings history 50, most lists 100.

Patient events (CRUD)

Events are also writable (write scope) — see the API reference:

  • POST …/events — eventTime, eventType (meal|insulin|exercise|note|medication), optional subType, value, valueUnit, notes, metadata → 201 { data: { id } }
  • GET/PUT/DELETE …/events/:eventId — the event must belong to the patient in the path