Skip to main content

Usage

Parameters

key
string
required
The key of the stream to read from.
start
string
required
The minimum entry ID to include:
  • "-" - Start from the first entry in the stream
  • "<ms>-<seq>" - Start from this specific ID (inclusive)
  • "<ms>" - Start from this timestamp (equivalent to "<ms>-0")
end
string
required
The maximum entry ID to include:
  • "+" - Include all entries up to the last one
  • "<ms>-<seq>" - Include entries up to this specific ID (inclusive)
  • "<ms>" - Include entries up to this timestamp
count
number
Maximum number of entries to return.

Response

result
Record<string, Record<string, unknown>>
An object where keys are entry IDs and values are objects containing the entry’s field-value pairs.The SDK automatically deserializes values and attempts to parse JSON.Returns an empty object {} if no entries match the range.

Examples

Get all entries

Get entries in a time range

Get entries starting from a specific ID

Get entries up to a specific ID

Limit number of entries

Get entries from last hour

Iterate through entries

Pagination with XRANGE

Get entries in reverse order

Working with complex data

Important Notes

Inclusive Ranges

Both start and end are inclusive:

Special Range Values

ValueMeaning
"-"The minimum ID in the stream
"+"The maximum ID in the stream
"<ms>"Shorthand for "<ms>-0"

Entry ID Format

Entry IDs are strings in the format "<milliseconds>-<sequence>":

Return Format

The SDK deserializes the response into a clean object:

Automatic JSON Parsing

The SDK attempts to parse JSON values:

Performance Considerations

  • Use count to limit results for large streams
  • Specific time ranges are faster than full scans ("-" to "+")
  • For reverse order, consider using XREVRANGE if available
  • Pagination is efficient when using the last ID from previous page