Skip to main content
POST/data-streams/user/{streamSlug}/replay

Replay Stream

Reads a page of a user stream's retained messages, oldest first, between two sequence numbers.

Pass the page's nextCursor as fromSequence to read the next page; hasMore is true while pages come back full.

Needs PROJECT_ADMIN or PROJECT_AUDITOR.

Parameters
streamSlug *path

The stream's slug, unique in the project.

projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Request body
fromSequenceany

Return messages after this stream sequence (exclusive).

Pass the previous page's nextCursor to continue.

Omitted or 0, the read starts at the oldest retained message.

An integer or a string of digits.

One of: integer
or: string
untilSequenceany

Stop at this stream sequence (inclusive).

An integer or a string of digits.

One of: integer
or: string
limitinteger

The most messages to return, 1 to 10000.

Default 100.

Responses
HTTPK9O CodeDescription
200Success
403K9O_RBAC_DENYReading Pulse Streams requires PROJECT_ADMIN or PROJECT_AUDITOR.
404K9O_STREAM_NOT_FOUNDNo active Pulse Stream with that slug in this project.
503K9O_STREAM_UNAVAILABLEPulse Stream messaging is not configured in this deployment, or the project's stream account is not provisioned, so no messages can be read. Retry later.
Response body (200)
data *object

One page of the stream's retained messages.

streamSlug *string

The stream that was read.

events *object[]

The messages in the range, in ascending sequence order.

sequence *string

The message's stream sequence number, as a string of digits.

It is the resume cursor.

subject *string

The full subject the message was published on: the stream's subjectPrefix plus the publish subject suffix (or _).

data *any

The published payload, decoded from JSON: any JSON value.

A message whose bytes are not JSON is delivered as { "_raw": "<base64>" }.

publishedAt *string <date-time>

When the broker accepted the message.

nextCursor *any

The sequence of the last message returned; pass it as fromSequence for the next page.

When the page is empty it echoes the request's fromSequence, or is null if none was sent.

One of: string
or: null
hasMore *boolean

True when the page is full (as many messages as limit), so more may follow.

meta *any
TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.streams.replay('<streamSlug>', {})

Showing example in TypeScript

Request example
{
  "fromSequence": 0,
  "untilSequence": 0,
  "limit": 0
}
Response example (200)
{
  "data": {
    "streamSlug": "string",
    "events": [
      {
        "sequence": "string",
        "subject": "string",
        "publishedAt": "string"
      }
    ],
    "nextCursor": "string",
    "hasMore": false
  }
}

More in Realtime Feeds & Streams