Device Presence API


Check the presence and connectivity status of multiple devices.

  • API Reference
  • Test it out
  • POST https://api.pushy.me/devices/presence?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.

    API Request

    Sample Request Body

    {
        "tokens": [
            "a6345d0278adc55d3474f5"
        ]
    }

    Note: Please make sure to send the Content-type: application/json header with your request.

    Request Schema

    Field Description Example
    tokens*
    String[]
    The device tokens to retrieve presence for, limited to 1,000 tokens per request. ["a6345d0278adc55d3474f5"]
    API Response

    Sample Response Body

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

    Field Description Example
    presence
    Object[]
    Array of objects containing device presence info.
    - id
    String
    The device token linked to this presence object. a6f36efb913f1def30c6
    - online
    Boolean
    The device's current connectivity status. false
    - last_active
    Integer
    The device's last connection date (unix timestamp). 1429406442
    - uninstalled
    Boolean (optional)
    When returned, the iOS user has uninstalled your app (detected only after sending a failed notification to the device). true
    - unsubscribed
    Boolean (optional)
    When returned, the Web Push user has unsubscribed from notifications from your website (detected only after sending a failed notification to the device). true
    API Error Reference

    Sample Error Response

    {
        "code": "NO_RESULTS",
        "error": "We could not find any devices with those tokens."
    }
    Error Codes

    A list of endpoint-specific error codes, in addition to the global API errors.

    Error code Description HTTP status code
    NO_RESULTS The device token(s) are invalid, the device(s) were deleted, or the device(s) are not registered to the app whose SECRET_API_KEY you are using to authenticate. 400 Bad Request
  • POST https://api.pushy.me/devices/presence?api_key=SECRET_API_KEY
    URL Param Value
    SECRET_API_KEY
    JSON Params

    JSON Param Value
    tokens*
    String[]
    API Response

    500 CLIENT ERROR

    N/A