Get started with a free 7-day trial on our Startup plan.

start trial

PushRadar and cURL

The latest version of PushRadar's API is v2, released July 5, 2019.

Welcome to PushRadar's API documentation for cURL. cURL is used in command line scripts to transfer data to or from a server using various protocols. This article covers calling the /broadcast endpoint of the PushRadar API to publish messages to a channel in realtime.


To try out the code samples, you will need a tool that supports cURL. Git Bash is ideal for testing. You can find out more about cURL at

(server)"Hello World!" example

The following example demonstrates broadcasting a "Hello World!" message on a channel called test-channel. Replace your-secret-key with your actual PushRadar secret, which may be obtained from the API page of your dashboard.

  • curl
curl -X POST
     -H "Content-type: application/json"
     -d '{"apiSecret": "your-secret-key",
          "notification": {
            "channel": "test-channel",
            "data": {"message": "Hello World!"}

In the above example, the -X option specifies the request type (followed by PushRadar's API endpoint), -H sets a header stating that the content is encoded as JSON, and -d specifies the content of the request.

(client)Receiving messages

To find out how to receive messages by subscribing to channels, check out the documentation for our JavaScript client library.

(security)Private channels

PushRadar supports private channels, which allow you to ensure that certain channels are only subscribed to by certain users.

The process is as follows. First you must set up an authentication endpoint, a URL that PushRadar will call to authenticate users when they subscribe to a channel. From this endpoint, you will need to check whether the user is allowed to subscribe to the desired channel. If they are, the endpoint should return an authentication token which should be a random string you generate on your server. The endpoint should return a JSON object {"authToken": "random-generated-auth-token"}. The authentication token should also be sent to PushRadar (see below).

The final step is to register your authentication endpoint using the JavaScript client library.

Note:   Private channels must start with the prefix "private-"

Here is example code showing how to send an authentication token to PushRadar:

  • curl
curl -X POST
     -H "Content-type: application/json"
     -d '{"apiSecret": "your-secret-key",
          "channel": "channel-name",
          "authToken": "your-randomly-generated-auth-token"

Lastly, register your authentication endpoint URL using the JavaScript client library:

  • JavaScript
var radar = new PushRadar("your-api-key");