<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKHealthStore/recalibrateEstimates(sampleType:date:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKHealthStore(im)recalibrateEstimatesForSampleType:atDate:completion:"
  },
  "title" : "recalibrateEstimates(sampleType:date:completion:)"
}
-->

# recalibrateEstimates(sampleType:date:completion:)

Recalibrates the prediction algorithm used to calculate the specified sample type.

```
func recalibrateEstimates(sampleType: HKSampleType, date: Date, completion: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

```
func recalibrateEstimates(sampleType: HKSampleType, date: Date) async throws
```

## Parameters

`sampleType`

The sample type to recalibrate.

`date`

The effective date for the recalibration.

`completion`

A completion block that the system calls after recalibrating the data used by the prediction algorithm. The system passes the following parameters:

- `success`: A Boolean value that indicates whether the system successfully recalibrated the sample type’s estimates.
- `error`: If `success` is <doc://com.apple.documentation/documentation/Swift/false>, this parameter contains error information; otherwise, it’s `nil`.

## Discussion

Your app can use this method to recalibrate HealthKitʼs prediction algorithms after an event that may significantly affect their results. For example, you can recalibrate the [`sixMinuteWalkTestDistance`](/documentation/HealthKit/HKQuantityTypeIdentifier/sixMinuteWalkTestDistance) type to use only data collected after a mobility-impacting health event, such as surgery or an injury. Recalibrating [`sixMinuteWalkTestDistance`](/documentation/HealthKit/HKQuantityTypeIdentifier/sixMinuteWalkTestDistance) after such an event may yield more accurate estimates during the recovery period.

> Warning:
> Before calling this method, your app must include the `com.apple.developer.healthkit.recalibrate-estimates` entitlement. Also, you must request both share and read access to all the data types you pass to the `sampleType` parameter. If you haven’t completed all of these steps, recalibration fails with an ``doc://com.apple.healthkit/documentation/HealthKit/HKError/Code/errorAuthorizationDenied`` error.

Check the [`HKSampleType`](/documentation/HealthKit/HKSampleType) class’s [`allowsRecalibrationForEstimates`](/documentation/HealthKit/HKSampleType/allowsRecalibrationForEstimates) method to see if a given sample type supports recalibrating the algorithm.

The following sample code recalibrates the estimates for the six-minute walk test.

```swift
// Access the HealthKit Store.
let healthStore = HKHealthStore()

// Get the six-minute walk test type.
let sixMinuteWalkType = HKQuantityType(.sixMinuteWalkTestDistance)

// Verify that the type supports resetting estimates.
if sixMinuteWalkType.allowsRecalibrationForEstimates {
    
    // Reset the estimate.
    healthStore.recalibrateEstimates(sampleType: sixMinuteWalkType, date: Date()) { (success, error) in
        
        // Check the success value.
        if !success {
            if let error = error {
                // Handle errors here.
            }
        }
    }
}
```

---

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)