Try it free in the sandbox · first FHIR call in 5 minutesFree · 30 synthetic patients · no cardYour first API call in 2 minutes →
Eight Sleep API: get Eight Sleep data into FHIR without a public API
Eight Sleep has no public API: read its sleep and heart data from Apple Health or Health Connect and store it as FHIR R4 Observations, with code.
Eight Sleep has no public developer API: there is no developer portal and no API documentation. The Eight Sleep app does share data on the phone: sleep data to Apple Health on iPhone, and sleep and heart data to Health Connect on Android. Your app can read it there and store each reading as a LOINC-coded FHIR R4 Observation with one standard API call. Anpheros does not connect to Eight Sleep's cloud itself: your code reads the phone's health store, and Anpheros keeps the record with the person's consent.
Read Eight Sleep data and store it in FHIR
There is no Eight Sleep endpoint to call, so the data is read on the phone: your app reads HealthKit (iPhone) or Health Connect (Android) after the person turns on sharing in the Eight Sleep app, and your backend writes FHIR.
On the phone, read sleepAnalysis from HealthKit, or SleepSessionRecord and HeartRateRecord from Health Connect. The phone code is in Apple Health to FHIR and Health Connect to FHIR.
Then the night's sleep duration as a FHIR Observation in the person's record (sandbox key sk_test_…):
curl -X POST https://platform.anpheros.com/fhir/R4/Observation \
-H "Authorization: Bearer $ANPHEROS_KEY" \
-H "Content-Type: application/fhir+json" \
-H "X-Anpheros-Author-Type: device" \
-d '{"resourceType":"Observation","status":"final",
"category":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/observation-category","code":"activity"}]}],
"code":{"coding":[{"system":"http://loinc.org","code":"93832-4","display":"Sleep duration"}]},
"subject":{"reference":"Patient/<id>"},
"effectivePeriod":{"start":"2026-11-02T22:55:00+01:00","end":"2026-11-03T06:30:00+01:00"},
"valueQuantity":{"value":426,"unit":"min","system":"http://unitsofmeasure.org","code":"min"},
"device":{"display":"Eight Sleep (via Apple Health)"}}'
The same in Python, on your backend: the nights your phone app read become one transaction Bundle.
import os, requests
FHIR = "https://platform.anpheros.com/fhir/R4"
fhir = {"Authorization": f"Bearer {os.environ['ANPHEROS_KEY']}", "Content-Type": "application/fhir+json"}
# What your phone app sends: one entry per night it read from HealthKit or Health Connect
nights = [
{"start": "2026-11-01T23:10:00+01:00", "end": "2026-11-02T06:55:00+01:00", "minutes": 433},
{"start": "2026-11-02T22:55:00+01:00", "end": "2026-11-03T06:30:00+01:00", "minutes": 426},
]
entries = [{
"request": {"method": "POST", "url": "Observation"},
"resource": {
"resourceType": "Observation", "status": "final",
"category": [{"coding": [{"system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "activity"}]}],
"code": {"coding": [{"system": "http://loinc.org", "code": "93832-4", "display": "Sleep duration"}]},
"subject": {"reference": "Patient/<id>"},
"effectivePeriod": {"start": n["start"], "end": n["end"]},
"valueQuantity": {"value": n["minutes"], "unit": "min", "system": "http://unitsofmeasure.org", "code": "min"},
"device": {"display": "Eight Sleep (via Apple Health)"},
},
} for n in nights]
r = requests.post(FHIR, headers=fhir, json={"resourceType": "Bundle", "type": "transaction", "entry": entries})
print(r.status_code, len(entries), "nights saved")
And in JavaScript (Node 18+), the night's heart rate from Health Connect, with minimum and maximum:
const fhir = { Authorization: `Bearer ${process.env.ANPHEROS_KEY}`, 'Content-Type': 'application/fhir+json' };
const bpm = (value) => ({ value, unit: '/min', system: 'http://unitsofmeasure.org', code: '/min' });
// What your Android app sends after reading HeartRateRecord for the night, with Eight Sleep as the source
const night = { start: '2026-11-02T22:55:00+01:00', end: '2026-11-03T06:30:00+01:00', avg: 58, min: 49, max: 77 };
await fetch('https://platform.anpheros.com/fhir/R4/Observation', {
method: 'POST', headers: { ...fhir, 'X-Anpheros-Author-Type': 'device' },
body: JSON.stringify({
resourceType: 'Observation', status: 'final',
category: [{ coding: [{ system: 'http://terminology.hl7.org/CodeSystem/observation-category', code: 'vital-signs' }] }],
code: { coding: [{ system: 'http://loinc.org', code: '8867-4', display: 'Heart rate' }] },
subject: { reference: 'Patient/<id>' },
effectivePeriod: { start: night.start, end: night.end },
valueQuantity: bpm(night.avg),
component: [
{ code: { text: 'minimum' }, valueQuantity: bpm(night.min) },
{ code: { text: 'maximum' }, valueQuantity: bpm(night.max) },
],
device: { display: 'Eight Sleep (via Health Connect)' },
}),
});
The payload shapes (nights, night) are your own: your phone app decides what it sends. The Anpheros side is standard FHIR R4, so the same requests work with any FHIR server.
Ways to get Eight Sleep data into FHIR
| Path | Status | What you need |
|---|---|---|
| Your backend reads an Eight Sleep API, then writes FHIR to Anpheros | Not available | No public API. Eight Sleep publishes no developer portal or API documentation |
| Eight Sleep app → Apple Health → your iPhone app reads HealthKit → Anpheros | Works today | Sleep data; HealthKit permissions. Eight Sleep does not list the exact HealthKit types. See Apple Health to FHIR |
| Eight Sleep app → Health Connect → your Android app → Anpheros | Works today | Sleep and heart data; Health Connect permissions. See Health Connect to FHIR |
| A copy of the person's data from Eight Sleep → your code → Anpheros | Via export | A privacy request by the person, for a copy or a transfer to a third party. The file format is not documented |
| A direct Eight Sleep connector inside Anpheros | On our roadmap | Not available yet. Use the button below to tell us you need it |
What Eight Sleep offers developers
No public API. Eight Sleep has no developer portal, API documentation or application programme. Its privacy policy (updated 22 October 2026) describes sharing only with integrations the person chooses: Apple Health, Google Health Connect and HealthEx, which brings in clinical records. It mentions no API.
Phone health stores. The help center (updated 23 September 2026) says recorded sleep data syncs to Apple Health. On Android, the app shares sleep and heart data with other apps through Health Connect, and imports workouts from it. Eight Sleep does not list the exact data types it writes, so check what your app finds with Eight Sleep as the source.
What the app tracks. Sleep stages, time slept, heart rate, HRV and snoring, according to its store listing. The help center adds movement, respiratory rate and bed and room temperature. Not all of this is documented as shared with Apple Health or Health Connect.
Other routes. Some aggregators describe an Eight Sleep partnership, but Eight Sleep does not document one. Community tools such as Home Assistant integrations reuse the app's private endpoints with the person's password; they are unofficial and not supported by Eight Sleep. A person can ask for a copy of their data, or a transfer to a third party, through Eight Sleep's privacy contact ([email protected]) or its EEA, UK and Switzerland portal.
Sources: Eight Sleep privacy policy, Eight Sleep help: syncing with other apps, Eight Sleep app on Google Play, November 2026.
Eight Sleep data as FHIR Observations
| Eight Sleep data (as it reaches the health store) | LOINC | UCUM unit | Note |
|---|---|---|---|
Sleep duration (sleepAnalysis, SleepSessionRecord) |
93832-4 | min |
one per night |
| Sleep stages, if present | 93831-6, 93830-8, 93829-0 | min |
deep, light, REM |
Heart rate (HeartRateRecord) |
8867-4 | /min |
the night's average, minimum and maximum |
| HRV, if present | see note | ms |
Health Connect stores RMSSD, so not LOINC 80404-7 (SDNN). See Wearable data in FHIR |
| Bed and room temperature | see note | not a body temperature: do not file it under LOINC 8310-5. Sharing is not documented |
Frequently asked questions
Does Eight Sleep have an API?
Not a public one. Eight Sleep publishes no developer portal or API documentation. Its data reaches other apps through Apple Health and Health Connect.
Can I get Eight Sleep data on iPhone?
Yes, through Apple Health. The Eight Sleep app syncs recorded sleep data there, and your app reads it with HealthKit.
Can I get Eight Sleep data on Android?
Yes, through Health Connect. The Eight Sleep app shares sleep and heart data there, and your app reads it with Health Connect permissions.
Can I use an unofficial Eight Sleep API?
Community libraries call the app's private endpoints with the person's password. Eight Sleep does not document or support them, they can stop working at any time, and asking people for their password is a poor fit for health data. The phone's health store is the safer route.
How can a person get a copy of their Eight Sleep data?
By a privacy request to Eight Sleep, for a copy or a transfer to a third party. The format is not documented, so plan to map it yourself.
Does Anpheros connect to Eight Sleep directly?
Not yet. Today your app reads HealthKit or Health Connect and writes standard FHIR to Anpheros. A direct Eight Sleep connector is on our roadmap; tell us with the button on this page if you need it.
Related
- Wearable APIs: every brand compared
- Wearable data in FHIR (Apple Health, Health Connect)
- Apple Health (HealthKit) to FHIR
- Health Connect to FHIR
- Oura API to FHIR · Ultrahuman API to FHIR · Google Health API to FHIR
Ask your AI
Paste this into Claude, ChatGPT, Cursor or Claude Code. Your assistant reads this guide and adapts it to your code.
Read https://developers.anpheros.com/guides/eight-sleep-api.md and help me apply this guide to my own project. Use the Anpheros sandbox (base URL https://platform.anpheros.com) with my API key from the ANPHEROS_KEY environment variable, never written in the code. Give me complete, runnable code, the response I should expect, and how to fix the errors in https://developers.anpheros.com/guides/troubleshooting.md if a call fails.Open in ClaudeOpen in ChatGPTThis guide as MarkdownBuild the whole integration with an AI coding tool
Try it free in the sandbox · first FHIR call in 5 minutesFree · 30 synthetic patients · no cardYour first API call in 2 minutes →