Skip to main content

Overview

API Endpoints​

  • /sse/v1: SSE endpoint.
  • /ws/v1: WebSocket endpoint.

Query Parameters​

  • topics: Comma separated list of topics, e.g., starbloom.uniswapv2.0_0_0.pair_Swap, starbloom.uniswapv3.0_0_0.*. Topic names are structured as dot-separated and should support wildcards.
  • format (default: json, options: json | raw): Data format returned by the API.

Stream Filtering​

You can define a filter on the data stream with the following format:

(field_name)=(operator):(value)
  • field_name: The name of the field you want to filter by.
  • operator: A comparison operator. Supported operators include:
    • eq: Equal to (eq operator can be omitted).
    • ne: Not equal to.
    • gt: Greater than.
    • lt: Less than.
    • gte: Greater than or equal to.
    • lte: Less than or equal to.
  • value: The value to compare the field with.

Examples​

SSE​

# Subscribe to swap events of a specific pair in UniswapV2
https://stream.starbloom.ai/sse/v1?topics=starbloom.uniswapv2.0_0_0.pair_Swap&pair=0x8263385fcbd145902bb35d8643a2d7fe35e89291

Websocket​

Use a WebSocket client like wscat to connect:

wscat -c "wss://stream.starbloom.ai/ws/v1"

# Subscribe to swap events of a specific pair in UniswapV2
> {"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": {"topics": ["starbloom.uniswapv2.0_0_0.pair_Swap"], "filters": [{"key": "pair", "value": "0x8263385fcbd145902bb35d8643a2d7fe35e89291"}]}}

# Unsubscribe from specific topics
> {"jsonrpc": "2.0", "id": 2, "method": "unsubscribe", "params": {"topics": ["starbloom.uniswapv2.0_0_0.pair_Swap"]}}

# Unsubscribe from all topics
> {"jsonrpc": "2.0", "id": 3, "method": "unsubscribe"}}

Escaping Field Names​

If a field name conflicts with special keywords (api_key, topics, format), you can escape it using the $ character.

https://stream.starbloom.ai/sse/v1?topics={topics}&$topics={value}