Using CURL to Collect Oura Ring Sleep, Activity and Readiness Data

You have probably experienced frustration when trying to gather insights from your sleep, exercise, weight and diet tracking devices. Should I got to bed earlier? Eat more protein? Exercise at a lower intensity? The trouble is that each device tends to have have a customized app or website which makes comparing the data complicated. In this post I’ll showing how the Oura Ring like many trackers offers a REST interface which makes pulling down data from many tracking sites and combining it into one place a possibility. It also allows one to free their data and keep a personal backup.

While this demonstration is based on the Oura Ring aside from the initial setup the process will be quite similar for most fitness trackers.

Step 1: Setup an Application

  • this does require an Oura Ring account
  • website: https://cloud.ouraring.com/docs/
  • click on ‘My Applications
  • Display name: Adafruit REST Demo
  • Website: localhost
  • Click: ‘Save

Step 2: Get a Token

  • click the top URL [server-size flow authorization]
  • accepts the privacy policy
  • click ‘Submit POST request
  • the next page will be one line of text save the value for “access token”
  • mine looked like this: “WGZGSPT6PEDN5RQALOSRY5RKJNCIJ3UB”
  • don’t worry I deleted this before this post went out.

Step 3: Last Nights Sleep Data Using CURL

  • $ curl –header “Authorization: Bearer WGZGSPT6PEDN5RQALOSRY5RKJNCIJ3UB” https://api.ouraring.com/v1/sleep?start=2017-10-01

    {“sleep”: [{“deep”: 6480, “bedtime_start”: “2017-10-01T22:17:01-06:00”, “rmssd”: 57, “light”: 10380, “hypnogram_5min”: “4442111111111121121111222222444244444222222222211111122222243333333222211232333444”, “restless”: 30, “awake”: 4110, “breath_average”: 14, “efficiency”: 83, “hr_5min”: “summary_date”: “2017-10-01”, “score_alignment”: 100, “duration”: 24600, “timezone”: -360, “total”: 20490, “score_efficiency”: 79, “temperature_delta”: -0.03, “score_rem”: 54, “onset_latency”: 900, “rem”: 3630, “bedtime_end”: “2017-10-02T05:07:01-06:00”, “is_longest”: 1, “score”: 75, “hr_lowest”: 51, “score_latency”: 99, “score_total”: 58, “score_disturbances”: 77, “hr_average”: 55.375, “midpoint_time”: 12390, “score_deep”: 97, “rmssd_5min”:

Step 4: Yesterdays Exercise Data Using CURL

  • $ curl –header “Authorization: Bearer WGZGSPT6PEDN5RQALOSRY5RKJNCIJ3UB” https://api.ouraring.com/v1/activity?start=2017-10-01

    {“activity”: [{“met_min_inactive”: 5, “met_min_high”: 115, “score_training_volume”: 100, “score_meet_daily_targets”: 100, “inactivity_alerts”: 0, “score_training_frequency”: 100, “met_min_medium”: 652, “class_5min”: “daily_movement”: 21612, “non_wear”: 132, “summary_date”: “2017-10-01”, “inactive”: 409, “cal_total”: 2938, “timezone”: -360, “rest”: 465, “score_stay_active”: 86, “low”: 248, “day_start”: “2017-10-01T04:00:00-06:00”, “met_min_low”: 179, “high”: 15, “medium”: 171, “met_1min”:

Step 5: Yesterdays Readiness Assessment Using CURL

  • $ curl –header “Authorization: Bearer WGZGSPT6PEDN5RQALOSRY5RKJNCIJ3UB” https://api.ouraring.com/v1/readiness?start=2017-10-01

    {“readiness”: [{“score_previous_night”: 63, “score_temperature”: 100, “summary_date”: “2017-10-01”, “period_id”: 0, “score_sleep_balance”: 64, “score_activity_balance”: 11, “score”: 55, “score_previous_day”: 42, “score_recovery_index”: 77, “

Two Thoughts:

  • I’m only showing one days worth of data and I cropped out the raw data as it is a little overwhelming. If we wanted to see months or years at a time simply adding ‘\&end=2017-10-02′ would provide a start and stop range that is easily adjusted on the command line. 
  • Oura and most other fitness trackers have great apps and websites for us to utilize. However, those of us who want to passively track our data and review it in one location we need to write some code. More posts to come on crossing tracking boundaries.

Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards

Happy New Year 2025
Happy New Year from Adafruit!

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 11/15/2024 Featuring Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: CircuitPython 2025 Wraps, Focus on Using Python, Open Source and More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — The 2024 Recap Issue!

Maker Business – Adafruit Daily — Apple to build another chip at TSMC Arizona

Electronics – Adafruit Daily — Lower power!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


No Comments

No comments yet.

Sorry, the comment form is closed at this time.