# Script to sync Whoop sleep/recovery data

**URL:** <https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060>\
**Category:** Uncategorized\
**Created:** [26 December 2023 04:46 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060 "2023-12-26T04:46:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jocelyn](https://forum.intervals.icu/user_avatar/forum.intervals.icu/jocelyn/32/30327_2.png) [@Jocelyn](https://forum.intervals.icu/u/Jocelyn)\
**Post date:** [26 December 2023 04:46 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/1 "2023-12-26T04:46:38Z")

</div>

I’ve been using a Whoop band for a few months and wanted to have a way to import the sleep and recovery data to intervals.icu.  
Here’s a simple python script I wrote to do just that, figured I’d share it if anyone is interested:

> <https://gist.github.com/jocelyndrw/8a66b8debcc909510b6319f69f35d523>

By default it will sync today’s wellness data, but you can specify an optional date range to sync more than one day.

By the way, I know it’s possible to first sync Whoop data to Apple health and then use another apps like HealthKit or Breakaway to sync apple health data to intervals, but it doesn’t work for some fields like HRV.

Cheers

---

<div class="post-metadata">

**Author:** ![app4g](https://forum.intervals.icu/user_avatar/forum.intervals.icu/app4g/32/41800_2.png) [@app4g](https://forum.intervals.icu/u/app4g)\
**Post date:** [26 December 2023 07:32 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/2 "2023-12-26T07:32:37Z")

</div>

I would love to support WHOOP data sync as well, tho WHOOP needs a subscription to actually get to the API.

David just ordered a Whoop Device (or at least trying to as they don’t ship to the country he’s in)

---

<div class="post-metadata">

**Author:** ![Joe\_K](https://forum.intervals.icu/user_avatar/forum.intervals.icu/joe_k/32/27063_2.png) [@Joe\_K](https://forum.intervals.icu/u/Joe_K)\
**Post date:** [31 December 2023 15:05 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/3 "2023-12-31T15:05:17Z")

</div>

Traceback (most recent call last):  
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/integrations/requests\_client/oauth2\_session.py”, line 26, in **call**  
req.url, req.headers, req.body = self.prepare(  
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/oauth2/auth.py”, line 99, in prepare  
self.token[‘access\_token’],  
KeyError: ‘access\_token’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “/Users/joe/Desktop/./whoop\_intervalls.py”, line 105, in   
main()  
File “/Users/joe/Desktop/./whoop\_intervalls.py”, line 92, in main  
whoop\_data = get\_whoop\_data(start\_date, end\_date)  
File “/Users/joe/Desktop/./whoop\_intervalls.py”, line 43, in get\_whoop\_data  
recovery\_collection = whoop\_client.get\_recovery\_collection(  
File “/Users/joe/venv/lib/python3.10/site-packages/whoop.py”, line 306, in get\_recovery\_collection  
return self.\_make\_paginated\_request(  
File “/Users/joe/venv/lib/python3.10/site-packages/whoop.py”, line 503, in \_make\_paginated\_request  
response = self.\_make\_request(  
File “/Users/joe/venv/lib/python3.10/site-packages/whoop.py”, line 523, in \_make\_request  
response = self.session.request(  
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/integrations/requests\_client/oauth2\_session.py”, line 109, in request  
return super().request(  
File “/Users/joe/venv/lib/python3.10/site-packages/requests/sessions.py”, line 575, in request  
prep = self.prepare\_request(req)  
File “/Users/joe/venv/lib/python3.10/site-packages/requests/sessions.py”, line 486, in prepare\_request  
p.prepare(  
File “/Users/joe/venv/lib/python3.10/site-packages/requests/models.py”, line 372, in prepare  
self.prepare\_auth(auth, url)  
File “/Users/joe/venv/lib/python3.10/site-packages/requests/models.py”, line 603, in prepare\_auth  
r = auth(self)  
File “/Users/joe/venv/lib/python3.10/site-packages/authlib/integrations/requests\_client/oauth2\_session.py”, line 30, in **call**  
raise UnsupportedTokenTypeError(description=description)  
authlib.integrations.base\_client.errors.UnsupportedTokenTypeError: unsupported\_token\_type: Unsupported token\_type: ‘access\_token’  
(venv) joe@Josts-MacBook-Air Desktop % python ./whoop\_intervalls.py  
File “/Users/joe/Desktop/./whoop\_intervalls.py”, line 36  
INTERVALS\_API\_KEY = os.getenv(1c5r2bz5fxog6rd6elrnsdx0x)  
^  
SyntaxError: invalid decimal literal

???

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [11 June 2024 20:50 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/4 "2024-06-11T20:50:54Z")

</div>

Intervals.icu now has built in WHOOP support:

> [@WHOOP integration added](https://forum.intervals.icu/t/whoop-integration-added/69075):
>
> Intervals.icu now has support for WHOOP. You can sync sleep, resting HR, HRV (rMSSD), recovery, respiration and SpO2. Look for the Whoop box in /settings, tick the wellness metrics you are interested in and click “Connect”: [Screenshot 2024-06-11 at 18.02.43] Your complete history with Whoop is synced when you connect. This is currently limited to 250 users (11 gone already, thanks to everyone who helped test) but hopefully this will be increased when those run out.

---

<div class="post-metadata">

**Author:** ![Jocelyn](https://forum.intervals.icu/user_avatar/forum.intervals.icu/jocelyn/32/30327_2.png) [@Jocelyn](https://forum.intervals.icu/u/Jocelyn)\
**Post date:** [12 June 2024 16:51 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/5 "2024-06-12T16:51:42Z")

</div>

Thank you David!

---

<div class="post-metadata">

**Author:** ![AkkoEleveld](https://forum.intervals.icu/user_avatar/forum.intervals.icu/akkoeleveld/32/63265_2.png) [@AkkoEleveld](https://forum.intervals.icu/u/AkkoEleveld)\
**Post date:** [4 September 2025 04:25 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/6 "2025-09-04T04:25:21Z")

</div>

Hi David, thanks for the guidance, very excited about this feature. Intervals and Whoop are now connected, but not all data ticked is syncing. Only resting heart rate shows on Intervals but it is not correct as compared to Whoop heart rate. Thanks for your help! Note that I am still on a free Whoop membership, could that be the reason? I disconnected and connected already, no luck.

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [4 September 2025 19:50 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/7 "2025-09-04T19:50:05Z")

</div>

If resting HR is not what you expected, it is almost 100% sure that it is imported from multiple sources. And the one that sticks is the one that synced last, not necessarily always the same.  
Check if rHR is syncing from another source.

---

<div class="post-metadata">

**Author:** ![Speedster\_Coaching](https://forum.intervals.icu/user_avatar/forum.intervals.icu/speedster_coaching/32/77889_2.png) [@Speedster\_Coaching](https://forum.intervals.icu/u/Speedster_Coaching)\
**Post date:** [29 March 2026 07:58 UTC](https://forum.intervals.icu/t/script-to-sync-whoop-sleep-recovery-data/56060/8 "2026-03-29T07:58:04Z")

</div>

Where do u place this script to get it to sync to Intervals.icu?
