Nutifar
NotificationsPush

Register a Device

Register a device token for push delivery

Registering a token

Call this from your client app once you have a platform push token (APNs or FCM):

import { NutifarExpo } from "@nutifar/expo";

const nutifar = new NutifarExpo({ connectToken });

await nutifar.devices.register({
  userId: "user_456",
  token: deviceToken,
  platform: "ios", // or 'android'
});

Device registration uses a scoped connect-token, not your API key — see Authentication for how to issue one from your backend.

Re-registering on token refresh

Platform push tokens can change (app reinstall, OS-level refresh). Call register again whenever your app receives a new token — it's idempotent and will update the existing record rather than create a duplicate.

Notifications.addPushTokenListener((newToken) => {
  nutifar.devices.register({
    userId: "user_456",
    token: newToken,
    platform: "ios",
  });
});

Unregistering a device

Call this on logout, or when the user disables notifications:

await nutifar.devices.unregister({
  userId: "user_456",
  token: deviceToken,
});

Errors

ErrorCause
invalid_tokenToken format doesn't match the declared platform
unauthorizedConnect-token missing the devices:write scope

On this page