Device Info API
Fetch device info, presence, undelivered notifications, and more by device token.
-
API Reference
-
Test it out
-
GET https://api.pushy.me/devices/DEVICE_TOKEN?api_key=SECRET_API_KEY
Note: Make sure to replace
SECRET_API_KEY
with your app's Secret API Key, available in the Pushy Dashboard (Click your app -> API Authentication tab). This is a backend API endpoint. Never expose your application's Secret API Key in your client code.URL Parameters
Field Description Example DEVICE_TOKEN
The device token, as persisted in Store Device Tokens. a6345d0278adc55d3474f5 API Response
Sample Response Body
{ "device": { "date": 1445207358, "platform": "android" }, "subscriptions": [ "news", "media" ], "presence": { "online": true, "last_active": { "date": 1464006925, "seconds_ago": 215 } }, "pending_notifications": [ { "id": "5742fe0407c3674e226892f9", "date": 1464008196, "payload": { "message": "Hello World!" }, "expiration": 1466600196 } ] }
Response Schema
Field Description Example device
ObjectMetadata object for the device. - date
IntegerThe device's registration date (unix timestamp). 1445207358 - platform
StringThe device platform string identifier. "android" presence
ObjectInformation about the device's presence and last communication. - online
BooleanThe device's current connectivity status. true - last_active
ObjectThe device's last communication info. - date
IntegerThe device's last communication date (unix timestamp). 1464006925 - seconds_ago
IntegerThe device's last communication, in seconds ago. 215 - uninstalled
Boolean (optional)When returned, the iOS device (and/or Android device w/ FCM Fallback Delivery enabled) has uninstalled your app (detected only after sending a failed notification to the device). true - unsubscribed
Boolean (optional)When returned, the Web Push device has unsubscribed from notifications from your website (detected only after sending a failed notification to the device). true pending_notifications
Object[]Pending notifications that have not yet been delivered to the device.
Note: Only supported for Android & Electron devices. iOS & Web Push make it impossible to track notification delivery and will always return an empty array.- id
BooleanThe push notification's unique ID. "5742fe0407c3674e226892f9" - date
IntegerThe creation date of the push notification (unix timestamp). 1464008196 - payload
ObjectThe push notification payload data. {"message": "Hello World!"} - expiration
IntegerThe push notification expiration date (unix timestamp). 1466600196 subscriptions
String[]An array of topics the device is subscribed to. ["news", "weather"] API Error Reference
Sample Error Response
{ "code": "INVALID_DEVICE_TOKEN", "error": "We could not find a device with that token." }
Error Codes
A list of endpoint-specific error codes, in addition to the global API errors.
Error code Description HTTP status code APP_MISMATCH
The device token is registered to a different app than the one whose SECRET_API_KEY
you are using to authenticate.400 Bad Request INVALID_DEVICE_TOKEN
The device token is invalid, or the device was deleted. 400 Bad Request -
GET https://api.pushy.me/devices/DEVICE_TOKEN?api_key=SECRET_API_KEY
API Response
500 CLIENT ERROR
N/A