Apple Health - iOS 16+ sleep handling

This article pertains to: LEGACY API (V1) INFORM (V2)

How are Apple Health sleep records processed by the Validic API?

iOS Native SDK 1.16.2 introduces the new sleep API that Apple introduced in iOS 16.

iOS Native SDK 1.16.3 improves upon our handling to also cover manually entered sleep records.

For those who wear the Apple Watch to bed for sleep tracking purposes, watchOS 9 and iOS 16 bring new functionality – sleep stages. Our Apple Health integration is available to sync the following sleep stage details to Validic:

  • time in bed

  • total sleep duration

  • total awake duration

  • times awoken

  • total light sleep duration (core and unspecified)

  • total deep sleep duration

  • total REM sleep duration

Apple’s guidelines specify that sleep should be defined by in-bed time periods, with sleep stages (light, deep, REM, etc) occurring during an in-bed time range. The Apple Watch follows this approach and Validic’s processing of sleep data assumes that the sleep stages will overlap with an in bed record. Each 3rd party source in Apple Health will report a separate sleep record to Validic. You will be able to tell the original source of the data by looking at the sourcing information in the Validic sleep record.

Please note that Apple allows for a variety of 3rd party sources to report sleep data into the Health app and some sources may not follow Apple’s guidance on sleep reporting. Therefore, you may receive sleep records from some 3rd party sources but not others. If a 3rd party source does not report sleep with in-bed ranges then you will not receive the sleep records from that source.

Important Considerations:

  1. In Apple Health, Sleep samples cannot be edited; they can only be deleted and re-created with different information.

  2. Validic does not currently report any deletion events. Sleep samples that have already been processed will not be deleted from Validic if they are deleted from Apple Health.

  3. In-Bed samples will generate new sleep records in Validic. The In-Bed start and end time will correspond to the start and end time on the Validic sleep record.

  4. Total awake duration (awake_duration) does not contribute to time in bed (in_bed_duration) as this is treated as a period of time when the user got out of bed.

  5. Only sleep stages that correspond with an in-bed time will be processed in Validic. If a user adds a sleep stage (e.g., Asleep time or Awake time) without an in-bed sample, the sleep stages will not be reported in Validic.

    1. This is inline with Apple’s guidelines for how sleep should be reported in Apple Health, but all 3rd party sources may not comply with the guidelines.