Skip to content

Rust

The Rust SDK is two crates: oura-toolkit-api (the progenitor-generated data-plane client) and oura-toolkit-auth (the hand-written, non-interactive auth companion). The oura CLI depends on both directly, so this is the most exercised SDK in the toolkit.

Both crates are published on crates.io. Add them with cargo add:

Terminal window
cargo add oura-toolkit-api oura-toolkit-auth

…or add them to your Cargo.toml directly:

[dependencies]
oura-toolkit-api = "$PREFERRED_VERSION"
oura-toolkit-auth = "$PREFERRED_VERSION"

The client is auth-agnostic — attach a Bearer token (via the auth companion’s middleware, or a raw token for a one-shot). Fetch daily sleep for a date range:

// Pseudocode shape: a generated `Client` with one method per Oura operation,
// returning typed models. The auth companion supplies the Bearer middleware.
let client = oura_toolkit_api::Client::new_with_client(base_url, http_with_bearer);
let sleep = client.daily_sleep().start_date(start).end_date(end).send().await?;
for day in sleep.into_inner().data {
println!("{} {:?}", day.day, day.score);
}

The generated client is marked // @generated — never hand-edit it; regenerate from the spec instead. See the API reference for every operation and model, and Authentication for how the companion manages tokens.