<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKVerifiableClinicalRecordQuery",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKVerifiableClinicalRecordQuery"
  },
  "title" : "HKVerifiableClinicalRecordQuery"
}
-->

# HKVerifiableClinicalRecordQuery

A query for one-time access to a SMART Health Card or EU Digital COVID Certificate.

```
class HKVerifiableClinicalRecordQuery
```

## Overview> Note:
> To use Swift concurrency when reading verifiable clinical records, see ``doc://com.apple.healthkit/documentation/HealthKit/HKVerifiableClinicalRecordQueryDescriptor``.

Use an [`HKVerifiableClinicalRecordQuery`](/documentation/HealthKit/HKVerifiableClinicalRecordQuery) object to request one-time access to a SMART Health Card or EU Digital COVID Certificate. For example, the following code requests cards that represent immunizations within the last six months.

```swift
// Calculate the start and end dates.
var sixMonthsAgo = DateComponents()
sixMonthsAgo.month = -6

let end = Date()
guard let start = Calendar.current.date(byAdding: sixMonthsAgo, to: end) else {
    fatalError("*** Unable to calculate a date using \(end) and \(sixMonthsAgo) ***")
}

// Create the predicate.
let lastSixMonthsPredicate =
HKQuery.predicateForVerifiableClinicalRecords(withRelevantDateWithin: DateInterval(start: start, end: end))

// Create the query for immunization cards.
let query = HKVerifiableClinicalRecordQuery(
    recordTypes: [HKVerifiableClinicalRecordCredentialType.covid19.rawValue,
                  HKVerifiableClinicalRecordCredentialType.immunization.rawValue],
    sourceTypes: [.smartHealthCard, .euDigitalCOVIDCertificate],
    predicate: lastSixMonthsPredicate) { query, records, error in
        
        if let error = error {
            // Handle errors here.
            fatalError("*** An error occurred: \(error.localizedDescription)***")
        }
        
        if let records = records {
            
            // Use the records here.
            for record in records {
                print(record.recordTypes)
                print(record.itemNames)
                print(record.issuedDate)
                print(record.expirationDate ?? "No expiration date.")
            }
        }
    }

// Run the query.
store.execute(query)
```

Unlike other HealthKit queries, you don’t need to request permission to read verifiable health records before running this query. HealthKit prompts the user for permission to read the records each time you run the query.

> Note:
> Running an ``doc://com.apple.healthkit/documentation/HealthKit/HKVerifiableClinicalRecordQuery`` requires a special entitlement from Apple, or the query fails with an ``doc://com.apple.healthkit/documentation/HealthKit/HKError/Code/errorAuthorizationDenied`` error. To request the entitlement, see [Request Access to the Verifiable Health Records Entitlement](https://developer.apple.com/contact/request/verifiable-health-records/).

## Topics

### Creating Queries

[`init(recordTypes:sourceTypes:predicate:resultsHandler:)`](/documentation/HealthKit/HKVerifiableClinicalRecordQuery/init(recordTypes:sourceTypes:predicate:resultsHandler:))

Creates a query for one-time access to a verifiable clinical record.

[`init(recordTypes:predicate:resultsHandler:)`](/documentation/HealthKit/HKVerifiableClinicalRecordQuery/init(recordTypes:predicate:resultsHandler:))

Creates a query for one-time access to a SMART Health Card.

### Accessing the Metadata

[`recordTypes`](/documentation/HealthKit/HKVerifiableClinicalRecordQuery/recordTypes)

The type of records that this query returns.

[`sourceTypes`](/documentation/HealthKit/HKVerifiableClinicalRecordQuery/sourceTypes)

The format of the verifiable clinical record.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)