Query events for a specific stream with filtering options
GET /api/event-stores/{eventStoreName}/streams/{streamId}/events
Retrieves events for a specific stream with flexible filtering options.
Key Features:
- Filter stream events by type, timeframes, and other criteria
- Paginate results with limit and offset parameters
- Sort by different fields (global_position, created_at, stream_position)
- Get total count for pagination (when include_count=true)
This endpoint is particularly useful for:
- Viewing the history of a specific entity or aggregate
- Debugging issues with a particular stream
- Auditing changes to a specific entity over time
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Event store name (automatically scoped to your organization)
Event store name (automatically scoped to your organization)
Unique identifier for the event stream. Supports hyphen (-), underscore (_), or colon (:) as delimiters. The first segment before the delimiter is used as the stream type.
Unique identifier for the event stream. Supports hyphen (-), underscore (_), or colon (:) as delimiters. The first segment before the delimiter is used as the stream type.
Query Parameters
Section titled “Query Parameters ”Responses
Section titled “ Responses ”Stream events retrieved successfully. If the stream does not exist, returns an empty events array
object
object
object
object
ISO 8601 formatted timestamp in UTC
object
Examples
Basic query result for a stream
Example of query results for a user stream
{ "events": [ { "streamId": "user-123", "streamPosition": 0, "globalPosition": 42, "eventId": "evt_123", "type": "user.created", "data": { "userId": "123", "email": "user@example.com" }, "metadata": { "correlationId": "abc-123" }, "schemaVersion": "1.0.0", "transactionId": "tx_123", "createdAt": "2023-01-15T12:30:45Z" }, { "streamId": "user-123", "streamPosition": 1, "globalPosition": 43, "eventId": "evt_456", "type": "user.updated", "data": { "userId": "123", "email": "updated@example.com" }, "metadata": { "correlationId": "def-456" }, "schemaVersion": "1.0.0", "transactionId": "tx_456", "createdAt": "2023-01-15T13:45:22Z" } ], "pagination": { "limit": 100, "offset": 0, "total": 2, "hasMore": false }}Invalid query parameters
object
object
Unauthorized: Organization ID not found in authentication context
object
Examples
{ "error": "UNAUTHORIZED", "message": "Unauthorized: Organization ID not found in authentication context"}