Skip to content

veerendra2/fitbit-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fitbit CLI

Release PyPI - Status PyPI - Version

This is not an official Fitbit CLI

Access your Fitbit data directly from your terminal πŸ’». View πŸ’€ sleep logs, ❀️ heart rate, πŸ‹οΈβ€β™‚οΈ activity levels, 🩸 SpO2, and more, all presented in a simple, easy-to-read table format!

Fitbit logo

asciicast

Supported Web APIs

Only GET APIs are supported!

API Status
Get Profile βœ…
Get Devices βœ…
Get Sleep Log by Date Range βœ…
Get SpO2 Summary by Interval βœ…
Get Heart Rate Time Series by Date Range βœ…
Get AZM Time Series by Interval βœ…
Get Breathing Rate Summary by Interval βœ…
Get Daily Activity Summary ⏳

Usage Guide

  1. Install the Fitbit CLI
python -m pip install fitbit-cli
  1. See Help
$ fitbit-cli -h
usage: fitbit-cli [-h] [-i] [-s [DATE[,DATE]|RELATIVE]] [-o [DATE[,DATE]|RELATIVE]] [-e [DATE[,DATE]|RELATIVE]] [-a [DATE[,DATE]|RELATIVE]] [-b [DATE[,DATE]|RELATIVE]] [-u] [-d] [-v]

Fitbit CLI -- Access your Fitbit data at your terminal.

options:
  -h, --help            show this help message and exit
  -i, --init-auth       Initialize Fitbit iterative authentication setup
  -v, --version         Show fitbit-cli version

APIs:
  Specify a date, date range (YYYY-MM-DD[,YYYY-MM-DD]), or relative date.
  Relative dates: yesterday, last-week, last-month, last-N-days/weeks/months (e.g., last-2-days).
  If not provided, defaults to today's date.

  -s, --sleep [DATE[,DATE]|RELATIVE]
                        Show Sleep Log by Date Range.
  -o, --spo2 [DATE[,DATE]|RELATIVE]
                        Show SpO2 Summary by Interval.
  -e, --heart [DATE[,DATE]|RELATIVE]
                        Show Heart Rate Time Series by Date Range.
  -a, --active-zone [DATE[,DATE]|RELATIVE]
                        Show AZM Time Series by Interval.
  -b, --breathing-rate [DATE[,DATE]|RELATIVE]
                        Show Breathing Rate Summary by Interval.
  -u, --user-profile    Show Profile.
  -d, --devices         Show Devices.
  1. Register Fitbit App

    1. Go to https://dev.fitbit.com/apps
    2. Click on "REGISTER AN APP" tab
    3. Follow below example and register an app

    Fitbit logo

  2. Run the following command to set up interactive authentication and store the Fitbit token locally

     fitbit-cli --init-auth

    asciicast

  3. Start using it 😎

fitbit-cli -s
                                            Sleep Data Summary 😴
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Date πŸ“†    ┃ Deep Sleep πŸ› ┃ Light Sleep πŸ’€ ┃ REM Sleep πŸŒ™ ┃ Wake Time ⏰ ┃ Efficiency πŸ’― ┃ Time in Bed πŸ• ┃
┑━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
β”‚ 2025-05-03 β”‚ 129 min      β”‚ 271 min        β”‚ 140 min      β”‚ 66 min       β”‚ 57%           β”‚ 10.1 hr        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

NOTE: The token is valid for only 8 hours, fitbit-cli automatically refreshes the token when it expires.

Local Development

git clone git@github.com:veerendra2/fitbit-cli.git
cd fitbit-cli

python -m venv venv
source venv/bin/activate
python -m pip install -e .

deactivate

About

Fitbit CLI - Access your Fitbit ⌚️ data at your terminal πŸ’»

Topics

Resources

License

Stars

Watchers

Forks

Languages