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, CA, LA, RU, CN)
- ✅ 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
- ✅ Support for authenticated and unauthenticated endpoints
Documentation
- API Authentication: Authentication details are documented in the LibreView Unofficial API Documentation (external resource).
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?;
API Methods
Client Creation
LibreLinkUpClient::simple(username, password, region)
Create a basic client with default settings.
LibreLinkUpClient::new(config)
Create a client with custom configuration.
Authenticated Endpoints
All authenticated endpoints automatically handle login and token refresh.
client.read() -> Result<ReadResponse>
Returns current glucose reading + historical data.
Response:
ReadResponse
client.read_raw() -> Result<ReadRawResponse>
Returns raw API response with all details.
Response:
ReadRawResponse
client.get_user() -> Result<UserResponse>
Get current user profile with messages, notifications, and auth ticket.
Response:
UserResponse
client.get_account() -> Result<AccountResponse>
Get account information with user profile and current auth ticket.
Response:
AccountResponse
client.get_logbook(patient_id: &str) -> Result<LogbookResponse>
Get logbook (glucose events/alarms) for a patient.
Response:
LogbookResponse
client.get_notification_settings(connection_id: &str) -> Result<NotificationSettingsResponse>
Get notification settings for a connection.
Response:
NotificationSettingsResponse
client.read_averaged(amount, callback, interval_ms) -> Result<JoinHandle>
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
Returns: JoinHandle that can be aborted to stop polling.
Unauthenticated Endpoints
client.get_country_config(country: &str, version: Option<&str>) -> Result<CountryConfigResponse>
Fetch country/region configuration (does not require login).
Example:
let config = client.get_country_config.await?;
println!;
get_country_config(country: &str, version: &str) -> Result<CountryConfigResponse>
Standalone function to fetch country config without creating a client.
Example:
use get_country_config;
let config = get_country_config.await?;
Data Types
LibreCgmData
TrendType
Region
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 (api-ap.libreview.io)
- 🇨🇦 CA (api-ca.libreview.io)
- 🌎 LA (api-la.libreview.io)
- 🇷🇺 RU (api.libreview.ru)
- 🇨🇳 CN (api-cn.myfreestyle.cn)
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.