POST
/
v2
/
batch
curl --request POST \
  --url https://qstash.upstash.io/v2/batch \
  --header 'Authorization: Bearer <token>'

You can learn more about batching in the batching section.

API playground is not available for this endpoint. You can use the cURL example below.

Request

The endpoint is POST https://qstash.upstash.io/v2/batch and the body is an array of messages. Each message has the following fields:

destination: string
headers: headers object
body: string

The headers are identical to the headers in the create endpoint.

cURL
curl -XPOST https://qstash.upstash.io/v2/batch   -H "Authorization: Bearer XXX" \
    -H "Content-Type: application/json" \
    -d '
    [
      {
          "destination": "mytopic",
          "headers":{
            "Upstash-Delay":"5s",
            "Upstash-Forward-Hello":"123456"
          },
          "body": "Hello World"
      },
      {
          "destination": "https://example.com/destination1",
          "headers":{
            "Upstash-Delay":"7s",
            "Upstash-Forward-Hello":"789"
          }
      },
      {
          "destination": "https://example.com/destination2",
          "headers":{
            "Upstash-Delay":"9s",
            "Upstash-Forward-Hello":"again"
          }
      }
    ]'

Response

[
  [
    {
      "messageId": "msg_...",
      "url": "https://mytopic-endpoint1.com"
    },
    {
      "messageId": "msg_...",
      "url": "https://mytopic-endpoint2.com"
    }
  ],
  {
    "messageId": "msg_..."
  },
  {
    "messageId": "msg_..."
  }
]