Is there a way to delete a user via API for OneSignal?

OneSignal intentionally does not support deleting users through the API. It is possible to delete users individually on the dashboard, but this is mainly meant for removing devices for troubleshooting when first setting up OneSignal on your website or app.

Here are the reasons why deleting users via the API is not currently supported:

  1. Users who are unsubscribed may later re-subscribe to notifications. Keeping this user data around allows OneSignal to continue accurately tracking metrics such as session count, usage duration, and tags.
  2. OneSignal's automatic notifications feature is designed to avoid delivering the same notification twice to users who have previously received it. Deleting users could interfere with this mechanism.
  3. Clients often want to see data about unsubscribed users through the OneSignal dashboard or API.
  4. Deleting users who currently have your app installed may cause unexpected behavior when using certain OneSignal methods in your app, such as SendTags.

You can use this line to unsubscribe user from receiving the notifications:

OneSignal.setSubscription(false)

Tags:

Onesignal