Sei Websocket API
Subscribe/unsubscribe are reserved for websocket events.
Subscribe/unsubscribe are reserved for websocket events.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/sei-websocket-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Tendermint RPC WebSocket API
contact:
name: Tendermint RPC
url: https://github.com/tendermint/tendermint/issues/new/choose
description: 'Tendermint supports the following RPC protocols:
* URI over HTTP
* JSON-RPC 2.0 over HTTP
* JSON-RPC 2.0 over websockets (deprecated)
## Configuration
RPC can be configured by tuning parameters under `[rpc]` table in the
`$TMHOME/config/config.toml` file or by using the `--rpc.X` command-line
flags.'
version: Master
license:
name: Apache 2.0
url: https://github.com/tendermint/tendermint/blob/master/LICENSE
servers:
- url: https://rpc.cosmos.network
description: Cosmos mainnet node to interact with the Tendermint RPC
- url: http://localhost:26657
description: Interact with the Tendermint RPC locally on your device
tags:
- name: Websocket
description: Subscribe/unsubscribe are reserved for websocket events.
paths:
/subscribe:
get:
summary: Subscribe for events via WebSocket
tags:
- Websocket
operationId: subscribe
description: 'To tell which events you want, you need to provide a query. query is a
string, which has a form: "condition AND condition ..." (no OR at the
moment). condition has a form: "key operation operand". key is a string with
a restricted set of possible symbols ( \t\n\r\\()"''=>", ">=", "CONTAINS" AND "EXISTS". operand
can be a string (escaped with single quotes), number, date or time.
Examples:
tm.event = ''NewBlock'' # new blocks
tm.event = ''CompleteProposal'' # node got a complete proposal
tm.event = ''Tx'' AND tx.hash = ''XYZ'' # single transaction
tm.event = ''Tx'' AND tx.height = 5 # all txs of the fifth block
tx.height = 5 # all txs of the fifth block
Tendermint provides a few predefined keys: tm.event, tx.hash and tx.height.
Note for transactions, you can define additional keys by providing events with
DeliverTx response.
import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/pubsub/query"
)
abci.ResponseDeliverTx{
Events: []abci.Event{
{
Type: "rewards.withdraw",
Attributes: []abci.EventAttribute{
{Key: "address", Value: "AddrA", Index: true},
{Key: "source", Value: "SrcX", Index: true},
{Key: "amount", Value: "...", Index: true},
{Key: "balance", Value: "...", Index: true},
},
},
{
Type: "rewards.withdraw",
Attributes: []abci.EventAttribute{
{Key: "address", Value: "AddrB", Index: true},
{Key: "source", Value: "SrcY", Index: true},
{Key: "amount", Value: "...", Index: true},
{Key: "balance", Value: "...", Index: true},
},
},
{
Type: "transfer",
Attributes: []abci.EventAttribute{
{Key: "sender", Value: "AddrC", Index: true},
{Key: "recipient", Value: "AddrD", Index: true},
{Key: "amount", Value: "...", Index: true},
},
},
},
}
All events are indexed by a composite key of the form {eventType}.{evenAttrKey}.
In the above examples, the following keys would be indexed:
- rewards.withdraw.address
- rewards.withdraw.source
- rewards.withdraw.amount
- rewards.withdraw.balance
- transfer.sender
- transfer.recipient
- transfer.amount
Multiple event types with duplicate keys are allowed and are meant to
categorize unique and distinct events. In the above example, all events
indexed under the key `rewards.withdraw.address` will have the following
values stored and queryable:
- AddrA
- AddrB
To create a query for txs where address AddrA withdrew rewards:
query.MustParse("tm.event = ''Tx'' AND rewards.withdraw.address = ''AddrA''")
To create a query for txs where address AddrA withdrew rewards from source Y:
query.MustParse("tm.event = ''Tx'' AND rewards.withdraw.address = ''AddrA'' AND rewards.withdraw.source = ''Y''")
To create a query for txs where AddrA transferred funds:
query.MustParse("tm.event = ''Tx'' AND transfer.sender = ''AddrA''")
The following queries would return no results:
query.MustParse("tm.event = ''Tx'' AND transfer.sender = ''AddrZ''")
query.MustParse("tm.event = ''Tx'' AND rewards.withdraw.address = ''AddrZ''")
query.MustParse("tm.event = ''Tx'' AND rewards.withdraw.source = ''W''")
See list of all possible events here
https://godoc.org/github.com/tendermint/tendermint/types#pkg-constants
For complete query syntax, check out
https://godoc.org/github.com/tendermint/tendermint/libs/pubsub/query.
```go
import rpchttp "github.com/tendermint/rpc/client/http"
import "github.com/tendermint/tendermint/types"
client, err := rpchttp.New("tcp://0.0.0.0:26657", "/websocket")
if err != nil {
// handle error
}
err = client.Start()
if err != nil {
// handle error
}
defer client.Stop()
ctx, cancel := context.WithTimeout(context.Background(), 1 * time.Second)
defer cancel()
query := "tm.event = ''Tx'' AND tx.height = 3"
txs, err := client.Subscribe(ctx, "test-client", query)
if err != nil {
// handle error
}
go func() {
for e := range txs {
fmt.Println("got ", e.Data.(types.EventDataTx))
}
}()
```
NOTE: if you''re not reading events fast enough, Tendermint might
terminate the subscription.'
parameters:
- in: query
name: query
required: true
schema:
type: string
example: tm.event = 'Tx' AND tx.height = 5
description: 'query is a string, which has a form: "condition AND condition ..." (no OR at the
moment). condition has a form: "key operation operand". key is a string with
a restricted set of possible symbols ( \t\n\r\\()"''=>< are not allowed).
operation can be "=", "<", "<=", ">", ">=", "CONTAINS". operand can be a
string (escaped with single quotes), number, date or time.
'
responses:
'200':
description: empty answer
content:
application/json:
schema:
$ref: '#/components/schemas/EmptyResponse'
'500':
description: empty error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/unsubscribe:
get:
summary: Unsubscribe from event on Websocket
tags:
- Websocket
operationId: unsubscribe
description: '```go
client, err := rpchttp.New("tcp://0.0.0.0:26657", "/websocket")
if err != nil {
// handle error
}
err := client.Start()
if err != nil {
// handle error
}
defer client.Stop()
query := "tm.event = ''Tx'' AND tx.height = 3"
err = client.Unsubscribe(context.Background(), "test-client", query)
if err != nil {
// handle error
}
```'
parameters:
- in: query
name: query
required: true
schema:
type: string
example: tm.event = 'Tx' AND tx.height = 5
description: 'query is a string, which has a form: "condition AND condition ..." (no OR at the
moment). condition has a form: "key operation operand". key is a string with
a restricted set of possible symbols ( \t\n\r\\()"''=>< are not allowed).
operation can be "=", "<", "<=", ">", ">=", "CONTAINS". operand can be a
string (escaped with single quotes), number, date or time.
'
responses:
'200':
description: Answer
content:
application/json:
schema:
$ref: '#/components/schemas/EmptyResponse'
'500':
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/unsubscribe_all:
get:
summary: Unsubscribe from all events via WebSocket
tags:
- Websocket
operationId: unsubscribe_all
responses:
'200':
description: empty answer
content:
application/json:
schema:
$ref: '#/components/schemas/EmptyResponse'
'500':
description: empty error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
ErrorResponse:
description: Error Response
allOf:
- $ref: '#/components/schemas/JSONRPC'
- type: object
properties:
error:
type: string
example: Description of failure
JSONRPC:
type: object
properties:
id:
type: integer
example: 0
jsonrpc:
type: string
example: '2.0'
EmptyResponse:
description: Empty Response
allOf:
- $ref: '#/components/schemas/JSONRPC'
- type: object
properties:
result:
type: object
additionalProperties: {}