Skip to content

Get list of events in stream

GET /v4/stream/{stream}

List events in a stream. The path parameter stream specifies which stream to list events from.

Query parameters

ParameterTypeDescription
start_txinteger<int64>Optional. Starting event ID to list from (inclusive).
end_txinteger<int64>Optional. Ending event ID to list to (inclusive).
limitinteger<int64>Optional. Maximum number of events to return.

Response schema

Array of Event objects, where each Event contains:

FieldTypeDescription
txinteger<int64>Event ID.
dataanyThe event data.
binarybooleanWhether the event data is in binary format. The event data is base64 encoded in the response for binary data, or JSON object for non-binary.

Examples

List recent events

sh
curl --location 'https://api.litebase.io/v4/stream/sample' \
--header "Authorization: Bearer $LITEBASE_API_KEY"

Response:

json
HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "tx": 2,
        "binary": false,
        "data": "base64EncodedData1"
    },
    {
        "tx": 1,
        "binary": false,
        "data": "base64EncodedData2"
    }
]

List with specific event range

sh
curl --location 'https://api.litebase.io/v4/stream/sample?start_tx=1&end_tx=2&limit=1' \
--header "Authorization: Bearer $LITEBASE_API_KEY"

Response:

json
HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "tx": 1,
        "data": "hello world"
    },
    {
        "tx": 2,
        "data": {
            "name": "Braavos",
            "type": "city_created"
        }
    },
    {
        "tx": 3,
        "binary": true,
        "data": "base64EncodedData"
    }
]

Note: The event data is base64 encoded in the response for binary data, or JSON object for non-binary.