To export Apple Health Time in Daylight to an API, HealthSave reads the time_in_daylight metric from your Apple Watch and exports it to CSV or JSON, or, with Pro, syncs just that metric to a server you run and serves it over REST. It's the one-metric answer to a question Apple's all-or-nothing XML export can't give you.
Why Time in Daylight is hard to get out
Time in Daylight is an Apple Watch metric, HealthKit's time_in_daylight, that estimates how many minutes a day you spend in outdoor-level light, using the watch's ambient light sensor. It's genuinely useful to track for circadian rhythm, sleep, mood, and myopia-related reasons. But Apple gives you no way to pull just that one metric as data: the Health app's only export is the giant export.xml ZIP with everything tangled together, and Time in Daylight is buried inside it.
Export it on its own (free)
Open HealthSave, let it read your HealthKit data, and export Time in Daylight to CSV or JSON from the iOS share sheet, the values your watch recorded, in minutes, as a clean table you can drop into a spreadsheet or a notebook.
Send it to your API (Pro)
With Pro, time_in_daylight background-syncs to a server you run, and you query it like any other metric:
curl -H "x-api-key: YOUR_KEY" \
"https://your-server.example/api/v2/export?metric=time_in_daylight&format=csv&days=90"
There's no HealthSave cloud, the API lives on your hardware. That makes Time in Daylight a first-class series you can chart, correlate against sleep, or feed into your own analysis. See the custom REST API guide for the full endpoint set.
Free vs Pro
| Capability | Tier |
|---|---|
| On-device CSV/JSON export of Time in Daylight | Free |
| Background sync of time_in_daylight to your server | Pro |
| REST API access to the metric | Pro |
Pro is a one-time $24.99, Family Sharing included.
Honest limits
- Needs a compatible Apple Watch (ambient light sensor, Apple Watch SE / Series 6 and later) actually recording the metric.
- It exports what HealthKit has, if your watch didn't capture Time in Daylight, there's nothing to export.
- The API is self-hosted, no hosted backend; you run the server.
- iOS only; background sync and API are Pro ($24.99 one-time).
- Accuracy is your watch's, HealthSave moves the values as recorded.
Related
- Build a custom REST API over your Apple Health data, the full endpoint reference.
- Export HRV and sleep, pair Time in Daylight with the metrics it tends to affect.
- Apple Health data in your homelab.
FAQ
What is Time in Daylight?
It's an Apple Health metric (HealthKit's time_in_daylight) that estimates the minutes per day you spend in outdoor-level light, measured by the Apple Watch ambient light sensor. People track it for circadian rhythm, mood, sleep, and myopia-related reasons.
Can I export just this one metric?
Yes, that's the point. Apple's own export dumps everything into one XML file. HealthSave lets you export time_in_daylight specifically, as clean CSV or JSON, or query it on its own from your REST API.
How do I get it into an API?
With HealthSave Pro, time_in_daylight background-syncs to a server you run, and you pull it with GET /api/v2/export?metric=time_in_daylight&format=csv. There is no hosted backend; the API is on your hardware.
What does my watch need?
Time in Daylight requires an Apple Watch with the ambient light sensor (Apple Watch SE or Series 6 and later). If your watch records it, HealthSave can export it; if it doesn't, there's no data to export.
What are the units?
Minutes of daylight exposure per sample/day, exactly as HealthKit records them. HealthSave exports the values your device captured without reshaping them.
HealthSave is not a medical device. It is for informational purposes only and does not diagnose, treat, cure, or prevent any disease or condition. The accuracy of any health data depends on your wearable device and its sensors. Privacy claims of zero data collection apply to the iOS app; self-host sync sends your data to your own server.
Get HealthSave
Download free to export Time in Daylight on-device, then unlock background sync and the REST API with a one-time Pro purchase.
Download HealthSave on the App Store