Skip to Content

Whoop Integration

Whoop provides recovery, strain, sleep, and workout data through the Whoop Developer API.

OAuth Setup

Prerequisites

  1. Apply for Whoop API access at developer.whoop.com 
  2. Register an OAuth application
  3. 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/callback

OAuth Scopes

ScopeData Access
read:recoveryRecovery scores
read:cyclesPhysiological cycles
read:workoutWorkout data
read:sleepSleep performance
read:profileUser 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_TOKEN

Step 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:

  1. Find all users with active Whoop connections
  2. Refresh OAuth tokens if needed
  3. Fetch recovery, strain, sleep, and workout data
  4. Store normalized data in Patient Graph
  5. Update daily stats

Whoop-Specific Notes

Strain Scale

Whoop strain is measured on a 0–21 logarithmic scale:

RangeLevel
0–9Light
10–13Moderate
14–17High
18–21Overreaching

Recovery Zones

RangeZoneColor
0–33%RedUnder-recovered
34–66%YellowRecovering
67–100%GreenWell-recovered