Skip to main content

Usage

Parameters

key
string | string[]
required
The stream key(s) to read from. Can be a single key or an array of keys.
id
string | string[]
required
The starting ID(s) for each stream. Must match the number of keys:
  • "0" - Read from the beginning of the stream
  • "<ms>-<seq>" - Read entries after this specific ID
  • "$" - Read only new entries (commonly used with BLOCK)
If key is an array, id must also be an array with the same length.
options
object
Optional reading options:

Response

result
unknown[]
An array of stream data. The exact structure depends on the streams read.For single stream reads, returns entries in the format:
Returns an empty array if no entries are found.

Examples

Read from beginning of stream

Read entries after a specific ID

Limit number of entries

Read from multiple streams

Poll for new entries

Read only new entries using $

Processing stream entries

Important Notes

Balanced Keys and IDs

When reading from multiple streams, the number of keys must match the number of IDs:

Entry ID Positioning

XREAD returns entries after the specified ID, not including it:

Special ID Values

IDMeaning
"0"Start from the beginning
"$"Only new entries (none if called once)
"<ms>-<seq>"Start after this specific ID

Return Format

The response format is:
Note that field-value pairs are returned as a flat array, not as an object.

Count Limit

The count option limits entries per stream, not total: