Documentation

Pub/Sub Subscribe API


Subscribe a device to topics from your backend server.

API Endpoint


POST https://api.pushy.me/devices/subscribe?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
token The token of the device to subscribe. A string
topics An array of topics to subscribe the device to. Topics are case-sensitive and must match the following regular expression: [a-zA-Z0-9-_.]+. A string[] array
Sample POST Body

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

Successful Response Example

{"success": "true"}

Failure Response Example

{"error":"We could not find a device with that token linked to your account."}