<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKDatabase/fetchDatabaseChanges(since:resultsLimit:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:So10CKDatabaseC8CloudKitE20fetchDatabaseChanges5since12resultsLimit17completionHandlerySo19CKServerChangeTokenCSg_SiSgys6ResultOySayAbCE0eM0O12ModificationVG13modifications_SayAO8DeletionVG9deletionsAI06changeN0Sb10moreComingts5Error_pGctF"
  },
  "title" : "fetchDatabaseChanges(since:resultsLimit:completionHandler:)"
}
-->

# fetchDatabaseChanges(since:resultsLimit:completionHandler:)

Fetches all modified record zones and delivers them to a completion handler.

```
@preconcurrency func fetchDatabaseChanges(since changeToken: CKServerChangeToken?, resultsLimit: Int? = nil, completionHandler: @escaping @Sendable (Result<(modifications: [CKDatabase.DatabaseChange.Modification], deletions: [CKDatabase.DatabaseChange.Deletion], changeToken: CKServerChangeToken, moreComing: Bool), any Error>) -> Void)
```

## Parameters

`changeToken`

The change token from the previous execution of this method. If this is your app’s first fetch, or you want to refetch every change in the database’s history, specify `nil`.

`resultsLimit`

The maximum number of changes to return. The server may use a limit lower than this value.

`completionHandler`

The closure to execute with the fetch results.

## Discussion

The completion handler takes a single <doc://com.apple.documentation/documentation/Swift/Result> parameter that contains either a tuple, or an error if the request fails. For example, when the network is unavailable or the device doesn’t have an active iCloud account.

When present, the tuple contains the following named elements:

- `modifications`: An array of database modifications that occur after the time that `changeToken` denotes. Each modification contains details about a modified record zone.
- `deletions`: An array of database deletions that occur after the time that `changeToken` denotes. Each deletion contains details about a deleted or purged record zone.
- `changeToken`: The change token that corresponds to the fetch results’ most recent change.
- `moreComing`: A Boolean value that indicates whether the server has additional changes for you to fetch.

This method fetches record zone changes in a database, which includes new record zones, changed zones — including deleted or purged zones — and zones that contain record changes.

Along with the fetched changes, CloudKit supplies a *change token*, which is an opaque token that denotes a specific point in the database’s history. Store this token and provide it the next time you execute this method. Change tokens conform to <doc://com.apple.documentation/documentation/Foundation/NSSecureCoding> and are safe to cache on-disk. Don’t infer any behavior or order from a token’s contents.

For information on a more configurable way to fetch database changes, see [`CKFetchDatabaseChangesOperation`](/documentation/CloudKit/CKFetchDatabaseChangesOperation).

---

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)