Sending push notification with segmentation

Not sure I’m doing it correctly or not, I put an ajax call in to save the device token once it’s registered to my db. like this

push.register(function(token) {

    method: 'POST',
    url: config.hostname + '/api/token/save',
    skipAuthorization: true,
    headers: {
      'owner': config.owner
      data: {token:token}
  }).then(function successCallback(response) {
  push.saveToken(token);  // persist the token in the Ionic Platform

Then in my dashboard I will use those saved token and send to, but I have one doubt. How to avoid sending those device token which has already inactive. Like u have 1000 download and got 1000 device token, but the active user is only around 100, u wouldn’t want send 1000 right?