<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebsiteDataStore/fetchDataRecords(ofTypes:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebsiteDataStore(im)fetchDataRecordsOfTypes:completionHandler:"
  },
  "title" : "fetchDataRecords(ofTypes:completionHandler:)"
}
-->

# fetchDataRecords(ofTypes:completionHandler:)

Fetches the specified types of records from the data store.

```
func fetchDataRecords(ofTypes dataTypes: Set<String>, completionHandler: @escaping @MainActor @Sendable ([WKWebsiteDataRecord]) -> Void)
```

## Parameters

`dataTypes`

The types of records to fetch. For a list of all possible types, see [Data Store Record Types](/documentation/WebKit/data-store-record-types). To specify all types, specify the set returned by the [`allWebsiteDataTypes()`](/documentation/WebKit/WKWebsiteDataStore/allWebsiteDataTypes()) method.

`completionHandler`

The completion handler block to execute asynchronously with the results. This block has no return value and takes the following parameter:

- dataRecordArray: An array of [`WKWebsiteDataRecord`](/documentation/WebKit/WKWebsiteDataRecord) objects. Each object in this array corresponds to data for one of the requested types. If no records of the requested types exist, this array is empty.

## Discussion

Call this method to retrieve information about the types of data that the website saves. The returned records don’t include the data itself, but contain information that you can convey to the user. For example, you might use the returned data records to display the cookies a website uses, or to show which websites cache data.

---

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)