---
title: "fetchDataRecords(ofTypes:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebsitedatastore/fetchdatarecords(oftypes:completionhandler:)"
---

# fetchDataRecords(ofTypes:completionHandler:)

Fetches the specified types of records from the data store.

## Declaration

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

```swift
func dataRecords(ofTypes dataTypes: Set<String>) async -> [WKWebsiteDataRecord]
```

## Parameters

- `dataTypes`: The types of records to fetch. For a list of all possible types, see doc://com.apple.webkit/documentation/WebKit/data-store-record-types. To specify all types, specify the set returned by the doc://com.apple.webkit/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:

## Discussion

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.

## See Also

### Retrieving specific types of data

- [allWebsiteDataTypes()](webkit/wkwebsitedatastore/allwebsitedatatypes().md)
