---
title: "Publish a batch of Realtime events"
canonical: "https://bird.com/docs/api/reference/publish-realtime-app-batch"
---

# Publish a batch of Realtime events

`POST /v1/realtime/apps/{realtime_app_id}/batch-events`

Publishes up to 10 events (each to one channel) in a single request.

## Code samples

**TypeScript**

```ts
await bird.realtime.publishBatch("rap_01krdgeqcxet5s7t44vh8rt9mg", {
  events: [
    { event: "order.created", channel: "orders", data: { id: 1 } },
    { event: "order.updated", channel: "orders", data: { id: 2 } },
  ],
});
```

Examples: [TypeScript](/docs/api/reference/publish-realtime-app-batch.ts.md) · [Python](/docs/api/reference/publish-realtime-app-batch.py.md) · [Go](/docs/api/reference/publish-realtime-app-batch.go.md) · [PHP](/docs/api/reference/publish-realtime-app-batch.php.md) · [cURL](/docs/api/reference/publish-realtime-app-batch.curl.md)

## Example response `200`

```json
{
  "data": [
    {
      "channel": "orders-42"
    }
  ]
}
```

## Path parameters

- `realtime_app_id` (string): ID of the Realtime app (`rap_` prefix), as returned when the app was created.

## Request body

- `events` (array of object, required): Up to 10 events per batch.
- `events.event` (string, required): The event name clients bind to. Application event names are free-form; the `bird:` and `bird_internal:` prefixes are reserved for the protocol and rejected.
- `events.channel` (string, required): A Realtime channel name. Only letters, digits, and _ - = @ , . ; Prefix with `private-` or `presence-` for authenticated channels, or `private-encrypted-` for channels whose payloads are end-to-end encrypted with a key only you hold.
- `events.data`: Arbitrary JSON payload delivered as the event data: an object, array, or scalar. Cap: 10 KB serialized.
- `events.exclude_connection_id` (string): Exclude this connection from delivery, to avoid echoing a change back to the client that triggered it. The value is the client's connection id, assigned when its connection is established.
- `events.include` (array of string): Attributes of this event's channel to return alongside the publish (same semantics and validation errors as on the channel endpoints). Requesting attributes counts as one additional message toward usage.

## Response body

- `data` (array of object): Per-event channel attributes at publish time, present only when at least one event asked for them via `include`. Positional: one item per event, in request order.
- `data.member_count` (integer): Distinct members (presence channels only; requires `include=member_count`).
- `data.connection_count` (integer): Connections currently subscribed to this channel (requires `include=connection_count` and the app's connection-counting flag). Channel-scoped: distinct from the app-wide peak connections metric.
- `data.channel` (string, required): A Realtime channel name. Only letters, digits, and _ - = @ , . ; Prefix with `private-` or `presence-` for authenticated channels, or `private-encrypted-` for channels whose payloads are end-to-end encrypted with a key only you hold.

## Related resources

- [Realtime](/realtime-api) (product)
- [Build your first integration](/learn/paths/integration) (course)
- [Send your first realtime event](/docs/get-started/send-your-first-realtime-event) (docs)

[Get an implementation brief](/learn/workspace?topic=realtime)
