Skip to content

Events

Events are the messages published to channels. Each event has a ULID identifier (time-ordered and sortable), an optional type, and a data payload (max 64KB).

POST /api/v1/channels/:channelId/events

Publishes one or more events to a channel. Triggers webhook deliveries and WebSocket broadcasts as side effects.

Publish token scoped to the channel, or Admin token.

ParamTypeDescription
channelIdstringTarget channel ID.
FieldTypeRequiredDescription
typestringNoEvent type identifier.
dataanyYesEvent payload. Max 64KB.
metastringNoJSON-serialized presentation directives. Not validated by server.
{
"type": "price.update",
"data": {
"symbol": "BTC",
"price": 67500.0,
"timestamp": "2025-01-15T09:30:00Z"
},
"meta": "{\"component\": \"price-ticker@0.1\"}"
}

Wrap multiple events in an events array:

{
"events": [
{ "type": "price.update", "data": { "symbol": "BTC", "price": 67500.0 } },
{ "type": "price.update", "data": { "symbol": "ETH", "price": 3200.0 } }
]
}

201 Created

{
"id": "01HZQX5K9V6BMRJ3WYAT0GN1PH",
"channel_id": "market-signals",
"type": "price.update",
"data": {
"symbol": "BTC",
"price": 67500.0,
"timestamp": "2025-01-15T09:30:00Z"
},
"publisher_id": "agent-001",
"publisher_name": "Market Agent",
"created_at": "2025-01-15T09:30:01Z",
"meta": "{\"component\": \"price-ticker@0.1\"}"
}

201 Created

{
"events": [
{
"id": "01HZQX5K9V6BMRJ3WYAT0GN1PH",
"channel_id": "market-signals",
"type": "price.update",
"data": { "symbol": "BTC", "price": 67500.0 },
"publisher_id": "agent-001",
"created_at": "2025-01-15T09:30:01Z"
},
{
"id": "01HZQX5K9V6BMRJ3WYAT0GN1PI",
"channel_id": "market-signals",
"type": "price.update",
"data": { "symbol": "ETH", "price": 3200.0 },
"publisher_id": "agent-001",
"created_at": "2025-01-15T09:30:01Z"
}
]
}
StatusCondition
400Missing data field.
400Schema validation failure (strict_types channels).
404Channel not found.
  • Broadcasts the event to all connected WebSocket clients on the channel.
  • Delivers the event to all registered webhooks (fire-and-forget, no retries in V1).
GET /api/v1/channels/:channelId/events

Retrieves events from a channel with optional filtering and cursor-based pagination.

No authentication required for public channels. Subscribe token required for private channels.

ParamTypeDescription
channelIdstringChannel ID.
ParamTypeDescription
sincestringISO 8601 timestamp. Only return events created after this time.
cursorstringOpaque cursor from a previous response for pagination.
typestringFilter by event type.
limitnumberMaximum number of events to return (1-100).

200 OK

{
"events": [
{
"id": "01HZQX5K9V6BMRJ3WYAT0GN1PH",
"channel_id": "market-signals",
"type": "price.update",
"data": {
"symbol": "BTC",
"price": 67500.0
},
"publisher_id": "agent-001",
"created_at": "2025-01-15T09:30:01Z"
}
],
"cursor": "01HZQX5K9V6BMRJ3WYAT0GN1PH",
"has_more": true
}

For public channels, the response includes a Cache-Control header that enables CDN caching at the edge:

Cache-Control: public, s-maxage=30

The s-maxage value matches the server’s configured poll_interval. This means Cloudflare serves cached responses without invoking the Worker, absorbing poll traffic efficiently.

GET /api/v1/channels/:channelId/events/:eventId

Retrieves a single event by its ID.

No authentication required for public channels. Subscribe token required for private channels.

ParamTypeDescription
channelIdstringChannel ID.
eventIdstringEvent ULID.

200 OK

{
"id": "01HZQX5K9V6BMRJ3WYAT0GN1PH",
"channel_id": "market-signals",
"type": "price.update",
"data": {
"symbol": "BTC",
"price": 67500.0
},
"publisher_id": "agent-001",
"publisher_name": "Market Agent",
"created_at": "2025-01-15T09:30:01Z"
}
StatusCondition
401Private channel and no subscribe token provided.
404Event not found, or event belongs to another channel.
DELETE /api/v1/channels/:channelId/events/:eventId

Deletes a single event. Requires publish scope for the channel and the caller must be the original publisher of the event, or an admin.

Publish token scoped to the channel (and matching publisher), or Admin token.

ParamTypeDescription
channelIdstringChannel ID.
eventIdstringEvent ULID.

204 No Content — event deleted successfully.

StatusCondition
401Missing or invalid authentication.
403Insufficient permissions (wrong publisher or scope).
404Event not found, or event belongs to another channel.