hevy
An async Rust client library for the Hevy API — the public REST API for the Hevy workout tracking app.
Hevy's public API is only available to Hevy Pro users. Grab an API key from your developer settings before using this crate.
Per Hevy's own docs: "we make no guarantees that we won't completely change the structure or abandon the project entirely, so use it at your own risk." This crate follows the documented
0.0.1OpenAPI spec as closely as possible and deserializes leniently where the docs are inconsistent.
Features
- Full coverage of the documented API surface:
- Workouts — list, get, create, update, count, and sync via events
- Routines — list, get, create, update
- Routine folders — list, get, create
- Exercise templates — list, get, create custom exercises
- Exercise history — fetch historical sets for an exercise, with optional date filtering
- Body measurements — list, get, create, update
- User info — fetch the authenticated user's profile
- Fully async, built on
reqwest+tokio - Typed request/response models with
serde - Ergonomic builders for constructing workouts and routines
- Structured error type ([
HevyError]) distinguishing transport errors, decode errors, and API errors (with status code + message)
Installation
Or add it to your Cargo.toml manually:
[]
= "0.1"
= { = "1", = ["rt-multi-thread", "macros"] }
Usage
use ;
async
See examples/basic_usage.rs for a more complete tour (fetching your profile, listing workouts, and logging a new one). Run it with:
HEVY_API_KEY=your-key
Error handling
Every fallible method returns [hevy::Result<T>], where errors are represented by [hevy::HevyError]:
HevyError::Request— the HTTP request itself failed (network, TLS, timeout, etc.)HevyError::Decode— the response body couldn't be parsed into the expected typeHevyError::Api { status, message }— the API responded with a non-2xx status;messageis extracted from the response'serrorfield when presentHevyError::Config— the client was misconfigured
Testing
The test suite uses wiremock to mock the Hevy API over HTTP, so no real API key or network access is required:
License
MIT