Enable DataSync
This guide shows you how to enable DataSync on a PubNub keyset. DataSync requires Access Manager to be active on the same keyset. Once DataSync is on, you can optionally configure which class versions publish real-time events.
As of 2026-09-21, DataSync is available to new accounts and accounts that are not actively using App Context.
Before you start
- You need admin access to the Admin Portal.
- The keyset you want to use must exist. To create one, refer to Set up your account.
Enable Access Manager on the keyset
DataSync requires Access Manager. Every DataSync request fails without it.
- In the Admin Portal, go to Apps & Keysets and select your app.
- Select the keyset you want to configure.
- In the keyset details, find the Access Manager section and turn it on.
- Save the keyset.
Enable DataSync on the keyset
- In the keyset details, scroll to the Configuration section and open the DataSync tab.
- Turn on Enable DataSync.
- Under Region, select a region for your data storage. The region is locked after you save it and can't be changed later.
- Save the keyset.
Enable events for a class version
Events are off by default. To receive real-time change notifications for a class, you turn on event publishing per class version, per keyset.
- In the keyset's DataSync tab, find the Select entities to sync section.
- Choose which classes publish events. Only the classes you select emit events.
- Enable each class version separately. When you add a new version of a class, events are off for it until you add a rule for the new version too.
- Save.
Enabling a rule isn't retroactive
A rule is read when the write happens and cached for up to five minutes. Turning a rule on can take that long to affect new writes. It never applies to writes that already happened.
Verify the configuration
To confirm DataSync is active, list the entity classes on your keyset with Get all entity class entries. You need a Service Integration API key with the DataSync permission, as described in Define an entity class.
curl 'https://admin-api.pubnub.com/v2/datasync/subkeys/{subKey}/entity-classes' \
-H 'Authorization: {apiKey}' \
-H 'PubNub-Version: 2026-09-17'
A 200 response lists the classes in data. Before you define your own classes, it contains the built-in User and Channel classes, each with level set to Global and version set to 1.
A 403 response with an empty body means the API key doesn't have the DataSync permission for this keyset. If the key is right, check that DataSync and Access Manager are both enabled on the keyset.