Skip to main content
npayload is launching soon.
npayloadDocs
API ReferenceMessages

Publish messages in batch

Publish multiple messages in a single request. Maximum 100 messages per batch. All messages are published atomically - if any message fails validation, the entire batch is rejected.

POST/v1/channels/{channelId}/messages/batch

Authorization

ApiKeyAuth
AuthorizationBearer <token>

API key authentication. Keys are prefixed with environment:

  • npk_live_ for production
  • npk_test_ for testing/staging

In: header

Path Parameters

channelId*string

Channel ID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.npayload.com/v1/channels/string/messages/batch" \  -H "Content-Type: application/json" \  -d '{    "messages": [      {        "eventType": "order.created",        "payload": {          "orderId": "ord_1",          "amount": 50        }      },      {        "eventType": "order.created",        "payload": {          "orderId": "ord_2",          "amount": 75        }      }    ]  }'
{
  "count": 0,
  "ids": [
    "string"
  ],
  "status": "accepted"
}
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Validation failed",
    "details": {
      "field": "name",
      "reason": "Name is required"
    }
  }
}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}
{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded"
  }
}

Was this page helpful?