How do I access health clinical records?
Asked on 2024-07-30
1 search
To access health clinical records using HealthKit, you need to follow these steps:
-
Check Health Data Availability: First, ensure that health data is available on the device by using the
isHealthDataAvailablefunction. This is important as availability can vary based on device and OS version. -
Request Authorization: You must request authorization from the user to read or write the specific health data types your app is interested in. This is done through the health data access request function, which will prompt the user to grant your app access to the health data.
-
Handle Guest Users: Be aware that guest users are restricted from authorizing health data access. Any call to health data access request during a guest user session will fail with an error. You should handle this error appropriately by discarding any health data that the guest user has attempted to write.
-
Read and Write Data: Once authorized, your app can read and write health data, including clinical health records such as immunizations and procedures. You can also register your app to receive updates when data changes.
For more detailed information, you can refer to the session Get started with HealthKit in visionOS from WWDC 2024.
Relevant Sessions

Get started with HealthKit in visionOS
Discover how to use HealthKit to create experiences that take full advantage of the spatial canvas. Learn the capabilities of HealthKit on the platform, find out how to bring an existing iPadOS app to visionOS, and explore the special considerations governing HealthKit during a Guest User session. You’ll also learn ways to use SwiftUI, Swift Charts, and Swift concurrency to craft innovative experiences with HealthKit.

Explore wellbeing APIs in HealthKit
Learn how to incorporate mental health and wellbeing into your app using HealthKit. There are new APIs for State of Mind, as well as for Depression Risk and Anxiety Risk. We’ll dive into principles of emotion science to cover how reflecting on feelings can be beneficial, and how State of Mind can be used to represent different types of mood and emotion.
