# Hevy

Connect Hevy with your own API key to sync strength training into VitalTrends.

## What syncs

- Workouts with title, notes, start/end time, duration, and Hevy update time.
- Exercises, exercise template IDs, notes, supersets, and set ordering.
- Sets with type, reps, weight, distance, duration, and RPE.
- Derived volume, set counts, exercise counts, PRs, frequency, and muscle-group rollups.

## Connect

1. Create or copy your Hevy API key from Hevy developer settings.
2. Open VitalTrends Connections -> Hevy.
3. Paste the key and save.

VitalTrends validates the key, encrypts it at rest, subscribes the webhook when available, and starts the initial backfill.

## Sync behavior

The first backfill paginates all Hevy workouts. Later syncs use webhook events and an hourly delta job to pick up updates and deletes. Authentication failures mark the connection as needing reconnection.

## Workouts

Hevy sessions appear in the unified workout feed and on the dedicated Hevy workouts page. For likely duplicates, Hevy strength workouts merge with Apple Health strength workouts within a two-minute start window and compatible duration, with Hevy preferred as the primary strength log.

## API and export

- `GET /api/v1/workouts/hevy` returns Hevy workouts with exercises and sets.
- `GET /api/v1/workouts/unified` includes Hevy in the merged cross-source feed.
- Export includes a Hevy CSV with one row per set.

## Webhooks

VitalTrends registers `POST /webhooks/hevy/{secret}` as the callback URL for Hevy workout events. The secret is generated per connection and can be rotated from the Hevy connection page.
