- APIs over Websockets - Call any Allium API through a persistent websocket connection for faster response times
- Data Streams over Websockets - Subscribe to real-time blockchain data streams (wraps Kafka topics)
APIs over Websockets
APIs over websockets allow you to make API requests through a persistent connection, reducing latency by eliminating the connection overhead of individual HTTP requests.Connection
Connect to the websocket API endpoint with your API key:Request Format
Send requests as JSON messages with the following structure:method(string, required): HTTP method -GET,POST,PUT,PATCH, orDELETEid(string, required): Unique identifier for tracking the request/responsepath(string, required): API endpoint path (e.g.,/api/v1/developer/assets)body(object, optional): Request parameters- For
GETrequests: URL query parameters sent as key-value pairs inbody - For
POST/PUT/PATCH/DELETE: Body parameters sent as key-value pairs inbody
- For
Response Format
Responses are returned as JSON messages:id(string): Matches the request IDstatus(string): Either"success"or"error"data(object): Response data or error message
Example: POST Request with Body Parameters
Example: GET Request with Query Parameters
Concurrency & Rate Limits
- Maximum 1,000 concurrent requests in flight per connection
- However even with the above your account rate limits still apply, so you might not be able to reach 1,000 concurrent requests in flight per connection.
- If you try to exceed this limit, you’ll receive an error response:
Benefits
- Lower latency: No connection overhead for each request
- Request/response matching: Use unique IDs to track async responses
Data Streams over Websockets
Stream real-time blockchain data directly to your application. All Kafka topics are available via websockets for easier integration.Connection
Connect to a data stream by specifying a topic:Available Topics
All Kafka topics are available. Use the format:{blockchain}.{data_type}
Examples:
ethereum.blocksethereum.transactionsethereum.logsbase.dex_tradessolana.transactionshyperliquid.fillsbitcoin.blocks
Starting the Stream
After connecting, send astart message to begin receiving data:
Stopping the Stream
You can pause the stream without disconnecting by sending astop message:
Filtering Data (Optional)
You can filter the stream to only receive messages matching specific criteria. Send a filter with thesetFilter action before starting the stream:
data field contains the filter definition. Filters support comparison operators (=, !=, >, >=, <, <=), the in operator for arrays, the exists operator, and compound AND/OR logic.
Example with compound filter:
See the Filter Syntax documentation for complete details on all operators, nested conditions, and real-world examples.
Receiving Messages
Messages are delivered as JSON:Complete Example: Streaming Ethereum Blocks
Connection Management
Compression
Websocket compression is supported and automatically negotiated:Reconnection
Implement reconnection logic for production applications:Error Handling
Handle common websocket errors:Authentication
Both websocket types require an API key passed in the connection headers:- APIs over Websockets: Requires it to be enabled on your account
- Streams over Websockets: Requires it to be enabled and topic access