Whoop Integration
Whoop provides recovery, strain, sleep, and workout data through the Whoop Developer API.
OAuth Setup
Prerequisites
- Apply for Whoop API access at developer.whoop.com
- Register an OAuth application
- Set the redirect URI to
https://my.loop.health/api/integrations/whoop/callback
Environment Variables
WHOOP_CLIENT_ID=your-whoop-client-id
WHOOP_CLIENT_SECRET=your-whoop-secret
WHOOP_REDIRECT_URI=https://my.loop.health/api/integrations/whoop/callbackOAuth Scopes
| Scope | Data Access |
|---|---|
read:recovery | Recovery scores |
read:cycles | Physiological cycles |
read:workout | Workout data |
read:sleep | Sleep performance |
read:profile | User profile info |
Connection Flow
Step 1: Initiate Authorization
curl -X POST "https://my.loop.health/api/integrations/whoop/authorize" \
-H "Authorization: Bearer $CLERK_JWT"Response:
{
"success": true,
"data": {
"authUrl": "https://api.prod.whoop.com/oauth/oauth2/auth?client_id=...&redirect_uri=...&scope=read:recovery+read:cycles+read:workout+read:sleep+read:profile&response_type=code&state=..."
}
}Step 2: OAuth Callback
After authorization, Whoop redirects to:
GET /api/integrations/whoop/callback?code=AUTH_CODE&state=STATE_TOKENStep 3: Disconnect
curl -X POST "https://my.loop.health/api/integrations/whoop/disconnect" \
-H "Authorization: Bearer $CLERK_JWT"Data Collected
Recovery
{
"metricType": "recovery",
"source": "whoop",
"metrics": {
"score": 75,
"restingHeartRate": 52,
"hrvRmssd": 48.5,
"spo2": 97.2,
"skinTemperature": 33.1
}
}Strain
{
"metricType": "strain",
"source": "whoop",
"metrics": {
"score": 12.5,
"averageHeartRate": 72,
"maxHeartRate": 165,
"kilojoules": 8500
}
}Sleep
{
"metricType": "sleep",
"source": "whoop",
"metrics": {
"score": 88,
"qualityDuration": 25200,
"latency": 480,
"remDuration": 5400,
"slowWaveDuration": 6000,
"lightDuration": 13800,
"awakeDuration": 1200,
"efficiency": 93,
"respiratoryRate": 15.2
}
}HRV
{
"metricType": "hrv",
"source": "whoop",
"metrics": {
"hrvRmssd": 48.5
}
}Automatic Sync
The syncWhoopData Trigger.dev job runs daily to:
- Find all users with active Whoop connections
- Refresh OAuth tokens if needed
- Fetch recovery, strain, sleep, and workout data
- Store normalized data in Patient Graph
- Update daily stats
Whoop-Specific Notes
Strain Scale
Whoop strain is measured on a 0–21 logarithmic scale:
| Range | Level |
|---|---|
| 0–9 | Light |
| 10–13 | Moderate |
| 14–17 | High |
| 18–21 | Overreaching |
Recovery Zones
| Range | Zone | Color |
|---|---|---|
| 0–33% | Red | Under-recovered |
| 34–66% | Yellow | Recovering |
| 67–100% | Green | Well-recovered |