LibreLinkUp API Client (Rust)
Unofficial Rust client for the LibreLinkUp API - fetches CGM (Continuous Glucose Monitor) data from FreeStyle Libre 2/3 devices via Abbott's sharing service.
This is a Rust implementation inspired by TypeScript libre-link-up-api-client and LibreLinkUp Status Bar Extension.
Features
- ✅ Automatic authentication and token management
- ✅ Regional endpoint handling (US, EU, EU2, JP, DE, FR, AP, AU, AE)
- ✅ Read current and historical glucose data
- ✅ Raw API response access
- ✅ Averaged glucose readings over time
- ✅ Type-safe API with proper error handling
- ✅ Async/await support with Tokio
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= { = "1", = ["full"] }
Quick Start
Simple Usage
use LibreLinkUpClient;
async
Advanced Configuration
use ;
let config = ClientConfig ;
let client = new?;
Reading Raw Data
// Access raw API response with all details
let raw = client.read_raw.await?;
println!;
println!;
println!;
Averaged Readings
// Poll API and calculate averages over time
let handle = client.read_averaged.await?;
// Runs in background until cancelled
handle.abort;
API Methods
LibreLinkUpClient::simple(username, password)
Create a basic client with default settings.
LibreLinkUpClient::new(config)
Create a client with custom configuration.
client.read()
Returns current glucose reading + historical data.
Response:
ReadResponse
client.read_raw()
Returns raw API response with all details.
Response:
ReadRawResponse
client.read_averaged(amount, callback, interval_ms)
Polls the API repeatedly and calculates averages.
Parameters:
amount: Number of readings to collect before calculating averagecallback: Function called with (average, readings, history)interval_ms: Milliseconds between API calls
Data Types
LibreCgmData
TrendType
Connection Identifiers
By Name
ByName
By Custom Function
use Arc;
ByFunction
None (Default)
Uses the first available connection.
Error Handling
use LibreLinkUpError;
match client.read.await
Examples
Run the examples:
# Basic usage
# Averaged readings
Regional Support
The client automatically handles regional redirects. Supported regions:
- 🇺🇸 US (api-us.libreview.io)
- 🇪🇺 EU (api-eu.libreview.io)
- 🇪🇺 EU2 (api-eu2.libreview.io)
- 🇫🇷 FR (api-fr.libreview.io)
- 🇯🇵 JP (api-jp.libreview.io)
- 🇩🇪 DE (api-de.libreview.io)
- 🇦🇺 AU (api-au.libreview.io)
- 🇦🇪 AE (api-ae.libreview.io)
- 🌏 AP (Asia Pacific)
License
MIT License
Disclaimer
This is an unofficial client. Use at your own risk. The API is not officially documented and may change without notice.