Publishing a message is as easy as sending a HTTP request to the /publish endpoint. All you need is a valid url of your destination.

Send a message via the Upstash Console

Destination URLs must always include the protocol (http:// or https://)

The message

The message you want to send is passed in the request body. Upstash does not use, parse, or validate the body, so you can send any kind of data you want. We suggest you add a Content-Type header to your request to make sure your destination API knows what kind of data you are sending.

Sending custom HTTP headers

In addition to sending the message itself, you can also forward HTTP headers. Simply add them prefixed with Upstash-Forward- and we will include them in the message.

Here’s an example

In this case, we would deliver a POST request to https://example.com with the following body and headers:

// body
{ "hello": "world" }

// headers
My-Header:      my-value
Content-Type:   application/json

What happens after publishing?

When you publish a message, it will be durably stored in an Upstash Redis database. Then we try to deliver the message to your chosen destination API. If your API is down or does not respond with a success status code (200-299), the message will be retried and delivered when it comes back online. You do not need to worry about retrying messages or ensuring that they are delivered.

By default, the multiple messages publshed to QStash are sent to your API in parallel.

Publish to topic

Topics allow you to publish a single message to more than one API endpoints. To learn more about topics , check topics section.

Publishing to a topic is very similar to publishing to a single destination. All you need to do is replace the URL in the /publish endpoint with the topic name.

https://qstash.upstash.io/v2/publish/https://example.com
https://qstash.upstash.io/v2/publish/my-topic

Optional parameters and configuration

QStash supports a number of optional parameters and configuration that you can use to customize the delivery of your message. All configuration is done using HTTP headers.