Documentation

Device Presence API


Use this API to check the presence and connectivity status of multiple devices.

API Endpoint

POST https://api.pushy.me/devices/presence?api_key=SECRET_API_KEY

Make sure to replace SECRET_API_KEY with your app's Secret API Key listed in the Dashboard.

Note: This is a backend API endpoint. Never expose your application's Secret API Key in your client code.

JSON Post Parameters

Key Description Type
tokens The device tokens whose presence you want to retrieve.
Can also be specified as registration_ids.
A string[] array
API Response

Successful Response Example

{
  "presence": [
    {
      "id": "a6f36efb913f1def30c6",
      "online": false,
      "last_active": 1429406442
    },
    {
      "id": "fe8f7b2c12e83e5b41d2",
      "online": true,
      "last_active": 1468349965
    }
  ]
}

Failure Response Example

{"error":"We could not find any devices with those tokens linked to your app."}
API Response Objects

Key Description Type
presence Metadata about the devices' presence (see below). An object

presence

Key Description Type
id The device token. A string
online The device's current connectivity status. A boolean
last_active The device's last connection date (unix timestamp). An integer
uninstalled
(iOS only, optional)
When returned, the iOS user has uninstalled your app (detected only after sending a failed notification to the device). An optional boolean
unsubscribed
(Web Push only, optional)
When returned, the Web Push visitor has unsubscribed from notifications from your website (detected only after sending a failed notification to the device). An optional boolean