<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "CloudKitJS",
  "identifier" : "/documentation/CloudKitJS/CloudKit.Database/fetchDatabaseChanges",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit JS"
    ],
    "preciseIdentifier" : "instm/CloudKit.Database/fetchDatabaseChanges"
  },
  "title" : "fetchDatabaseChanges"
}
-->

# fetchDatabaseChanges

Fetch changed record zones in the database.

```
Promise<CloudKit.DatabaseChangesResponse, CKError> fetchDatabaseChanges(
	optional Object options
);
```

## Parameters

`options`

Options to fetch database changes. This `Dictionary` object has one key:
    
    |Key        |Description                                                                                                                                                                                                                               |
    |-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    |`syncToken`|Identifies a point in the database’s change history. The first time you fetch changes, omit this key and if `moreComing` is `true` in the response, use the `syncToken` in the response in the next request until `moreComing` is `false`.|

## Return Value

A `Promise` object that resolves to a [`CloudKit.DatabaseChangesResponse`](/documentation/CloudKitJS/CloudKit.DatabaseChangesResponse) object, or rejects to a [`CKError`](/documentation/CloudKitJS/CloudKit/CKError) object.

## Discussion

For example, use this method to fetch the zones that changed and then use the [`fetchRecordZoneChanges`](/documentation/CloudKitJS/CloudKit.Database/fetchRecordZoneChanges) method to fetch the changed records in each zone.

```javascript
database.fetchDatabaseChanges().then(function(response) {
   return database.fetchRecordZoneChanges(response.zones)
})
.then(function(response) {
   response.zones.forEach(function(zone) {
       zone.records.forEach(function(record) {
          // Apply the record change
       })
   })
})
```

---

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)