---
title: Samples
framework: healthkit
role: collectionGroup
role_heading: API Collection
path: healthkit/samples
---

# Samples

Create and save health and fitness samples.

## Overview

Overview The HealthKit store saves most health and fitness data using HKSample subclasses. All sample subclasses record information at a specified time. If the sample’s startDate and endDate properties are the same, the sample represents a point in time. If the endDate is after the startDate, the sample represents a time interval. HealthKit uses different HKSample subclasses to store different types of data: HKQuantitySample objects store quantities—a numerical value and units. Most HealthKit data types use quantity samples. For example, height, heart rate, and dietary energy consumed all use quantity samples. HKCategorySample objects store a single option selected from a short list. For example, category samples record sleep data (the user can be in bed, asleep, or awake). HKCorrelation samples combine two or more samples into a single value. For example, correlation samples represent food intake and blood pressure samples. A food sample contains any number of nutrition samples, while a blood pressure sample contains both a systolic and a diastolic sample. HealthKit represents specialized data types with sample subclasses such as HKCDADocumentSample, HKWorkoutRoute, and HKWorkout.

## Topics

### Essentials

- [Saving data to HealthKit](healthkit/saving-data-to-healthkit.md)
- [Reading and Writing HealthKit Series Data](healthkit/reading-and-writing-healthkit-series-data.md)

### Basic samples

- [HKCumulativeQuantitySample](healthkit/hkcumulativequantitysample.md)
- [HKDiscreteQuantitySample](healthkit/hkdiscretequantitysample.md)
- [HKQuantitySample](healthkit/hkquantitysample.md)
- [HKCategorySample](healthkit/hkcategorysample.md)
- [HKCorrelation](healthkit/hkcorrelation.md)
- [Units and quantities](healthkit/units-and-quantities.md)
- [Metadata Keys](healthkit/metadata-keys.md)

### Series data

- [HKQuantitySeriesSampleBuilder](healthkit/hkquantityseriessamplebuilder.md)
- [HKHeartbeatSeriesBuilder](healthkit/hkheartbeatseriesbuilder.md)
- [HKHeartbeatSeriesSample](healthkit/hkheartbeatseriessample.md)

### Electrocardiograms

- [HKElectrocardiogram](healthkit/hkelectrocardiogram.md)
- [HKElectrocardiogram.VoltageMeasurement](healthkit/hkelectrocardiogram/voltagemeasurement.md)

### Audiograms

- [HKAudiogramSample](healthkit/hkaudiogramsample.md)
- [HKAudiogramSensitivityPoint](healthkit/hkaudiogramsensitivitypoint.md)

### Medical records

- [Accessing Health Records](healthkit/accessing-health-records.md)
- [Accessing Sample Data in the Simulator](healthkit/accessing-sample-data-in-the-simulator.md)
- [Accessing a User’s Clinical Records](healthkit/accessing-a-user-s-clinical-records.md)
- [Accessing Data from a SMART Health Card](healthkit/accessing-data-from-a-smart-health-card.md)
- [HKClinicalRecord](healthkit/hkclinicalrecord.md)
- [HKFHIRResource](healthkit/hkfhirresource.md)
- [HKVerifiableClinicalRecord](healthkit/hkverifiableclinicalrecord.md)
- [HKVerifiableClinicalRecordSubject](healthkit/hkverifiableclinicalrecordsubject.md)
- [HKCDADocumentSample](healthkit/hkcdadocumentsample.md)
- [HKDocumentSample](healthkit/hkdocumentsample.md)
- [CDA](healthkit/hkdocumenttypeidentifier/cda.md)
- [HKDocumentType](healthkit/hkdocumenttype.md)

### Vision prescriptions

- [HKVisionPrescription](healthkit/hkvisionprescription.md)
- [HKGlassesPrescription](healthkit/hkglassesprescription.md)
- [HKContactsPrescription](healthkit/hkcontactsprescription.md)
- [HKGlassesLensSpecification](healthkit/hkglasseslensspecification.md)
- [HKContactsLensSpecification](healthkit/hkcontactslensspecification.md)
- [HKLensSpecification](healthkit/hklensspecification.md)
- [HKVisionPrism](healthkit/hkvisionprism.md)
- [HKPrescriptionType](healthkit/hkprescriptiontype.md)

### Walking steadiness classifications

- [HKAppleWalkingSteadinessClassification](healthkit/hkapplewalkingsteadinessclassification.md)

### Attachments

- [HKAttachment](healthkit/hkattachment.md)
- [HKAttachmentStore](healthkit/hkattachmentstore.md)
- [HKAttachmentDataReader](healthkit/hkattachmentdatareader.md)

### Digital signatures

- [Adding Digital Signatures](healthkit/adding-digital-signatures.md)

### Abstract superclasses

- [HKQuantitySample](healthkit/hkquantitysample.md)
- [HKSample](healthkit/hksample.md)
- [HKObject](healthkit/hkobject.md)

### Deprecated classes

- [HKCumulativeQuantitySeriesSample](healthkit/hkcumulativequantityseriessample.md)

## See Also

### Health data

- [Saving data to HealthKit](healthkit/saving-data-to-healthkit.md)
- [Reading data from HealthKit](healthkit/reading-data-from-healthkit.md)
- [HKHealthStore](healthkit/hkhealthstore.md)
- [Creating a Mobility Health App](healthkit/creating-a-mobility-health-app.md)
- [Data types](healthkit/data-types.md)
- [Queries](healthkit/queries.md)
- [Visualizing HealthKit State of Mind in visionOS](healthkit/visualizing-healthkit-state-of-mind-in-visionos.md)
- [Logging symptoms associated with a medication](healthkit/logging-symptoms-associated-with-a-medication.md)
