Pub/Sub Unsubscribe API


Unsubscribe a device from one or more topics.

  • API Reference
  • Test it out
  • POST https://api.pushy.me/topics/unsubscribe?api_key=SECRET_API_KEY

    Note: Make sure to replace SECRET_API_KEY with your app's Secret API Key, available in the Dashboard. This is a backend API endpoint. Never expose your application's Secret API Key in your client code.

    API Request

    Sample Request Body

    {
        "token": "a6345d0278adc55d3474f5",
        "topics": [
            "news",
            "media"
        ]
    }

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

    Request Schema

    Field Description Example
    token*
    String
    The token of the device to unsubscribe. "a6345d0278adc55d3474f5"
    topics*
    String[]
    An array of topics to unsubscribe the device from. Topics are case-sensitive and must match the following regular expression: [a-zA-Z0-9-_.]+. ["news", "media"]
    API Response

    Sample Response Body

    {
        "success": true
    }
    Response Schema

    Field Description Example
    success
    Boolean
    Returned if the API request was successful. true
    API Error Reference

    Sample Error Response

    {
        "code": "INVALID_DEVICE_TOKEN", 
        "error": "The provided device token is invalid."
    }
    Error Codes

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

    Error code Description HTTP status code
    INVALID_DEVICE_TOKEN The device token provided is invalid or no longer exists, or the device is not registered to the app whose SECRET_API_KEY you are using to authenticate. 400 Bad Request
  • POST https://api.pushy.me/topics/unsubscribe?api_key=SECRET_API_KEY
    URL Param Value
    SECRET_API_KEY
    JSON Params

    JSON Param Value
    token*
    String
    topics*
    String[]
    API Response

    500 CLIENT ERROR

    N/A