Upstash Documentation

Batching

1 min read

Publishing is great for sending one message at a time, but sometimes you want to send a batch of messages at once.

This can be useful to send messages to a single or multiple destinations. QStash provides the batch endpoint to help you with this.

If the format of the messages are valid, the response will be an array of responses for each message in the batch. When batching URL Groups, the response will be an array of responses for each destination in the URL Group. If one message fails to be sent, that message will have an error response, but the other messages will still be sent.

Note
You can publish to destination, URL Group or queue in the same batch request.

Batching messages with destinations#

Info
You can also send messages to the same destination!

Batching messages with URL Groups#

If you have a URL Group, you can batch send with the URL Group as well.

Batching messages with queue#

If you have a queue, you can batch send with the queue. It is the same as publishing to a destination, but you need to set the queue name.

Batching messages with headers and body#

You can provide custom headers and a body for each message in the batch.

The response for this will look like#