Skip to content

Fitbit

import { Steps, Aside, Tabs, TabItem } from ‘@astrojs/starlight/components’;

Fitbit is the most data-rich provider in VitaSync. It supports a wide range of metrics including intraday heart rate, sleep stages, body composition, and SpO2.

Fitbit uses OAuth 2.0 with PKCE (Proof Key for Code Exchange), making it safe to use from server-side applications without exposing the client secret in a redirect.

  • Authorization URL: https://www.fitbit.com/oauth2/authorize
  • Token URL: https://api.fitbit.com/oauth2/token
  • Code challenge method: S256
  1. Go to the Fitbit Developer Portal

    Visit dev.fitbit.com/apps/new and sign in with your Fitbit account.

  2. Create a new app

    Fill in the registration form:

    • Application Name: Your app name (e.g. “VitaSync Integration”)
    • Description: Brief description of your integration
    • Application Website URL: Your app URL (or http://localhost:3000 for development)
    • Organization: Your org name
    • Organization Website URL: Your org URL
    • Terms of Service URL: Required — use a placeholder for development
    • Privacy Policy URL: Required — use a placeholder for development
    • OAuth 2.0 Application Type: Server (not Personal or Browser)
    • Callback URL: https://api.yourdomain.com/v1/oauth/fitbit/callback For development: http://localhost:3001/v1/oauth/fitbit/callback
  3. Copy your credentials

    After saving, note the OAuth 2.0 Client ID and Client Secret from the app detail page.

  4. Add to environment

    Terminal window
    FITBIT_CLIENT_ID=your_client_id
    FITBIT_CLIENT_SECRET=your_client_secret

When a user connects their Fitbit account, VitaSync requests the following scopes:

ScopeData Access
activitySteps, distance, calories, active minutes, floors, intraday activity
heartrateHeart rate (continuous + resting), heart rate zones
sleepSleep sessions with stages (deep, light, REM, awake)
weightWeight and body fat percentage
oxygen_saturationSpO2 readings
cardio_fitnessCardio fitness score (VO2 max estimate)
Metric TypeUnitNotes
stepscountDaily step total
distancemetersDaily distance
calorieskcalActive calories
active_minutesminutesMinutes in fat burn + cardio + peak zones
floorscountFloors climbed (requires Fitbit with altimeter)
heart_ratebpmIntraday 1-minute resolution; includes min/max/zones in data
resting_heart_ratebpmCalculated daily resting HR
sleephoursDuration + stage breakdown (deep, light, rem, awake in minutes) in data
weightkgBody weight from Fitbit scale or manual entry
body_fatpercentBody fat from scale
blood_oxygenpercentSpO2 from wrist sensor
heart_rate_variabilitymsOvernight HRV (RMSSD)
SettingValue
Minimum sync interval15 minutes (900 seconds)
Initial sync windowLast 30 days
Intraday resolution1 minute (heart rate)
API base URLhttps://api.fitbit.com/1 or 1.2 for some endpoints
  • Intraday heart rate is available at 1-minute resolution if your Fitbit account grants intraday access. Personal app registrations (non-partner) do not receive intraday data through the standard API.
  • Sleep stages are available for Fitbit trackers with heart rate sensors (Charge series, Versa, Sense, etc.). Older trackers without HR sensors only report sleep duration.
  • SpO2 requires a Fitbit device with blood oxygen sensor (Charge 4+, Versa 2+, Sense, etc.).
  • Body fat requires a Fitbit Aria smart scale.

VitaSync works with all Fitbit devices that support the Fitbit Web API, including:

  • Charge series (Charge 4, 5, 6)
  • Versa series (Versa 2, 3, 4)
  • Sense and Sense 2
  • Luxe, Inspire series
SymptomLikely Cause
Connection fails at OAuthCallback URL not registered in Fitbit app settings
No intraday heart rate dataAccount is not a Fitbit partner — intraday access requires a partner application
Missing sleep stagesDevice does not have a heart rate sensor
401 Unauthorized on syncAccess token expired and refresh failed — user should reconnect