Skip to Content

REST API

Every Supra node serves a REST API on its RPC host. The SDKs and the Supra CLI call it, and so can any HTTP client.

Base URL

NetworkBase URL
Mainnethttps://rpc-mainnet.supra.com
Testnethttps://rpc-testnet.supra.com
Devnethttps://rpc-devnet.supra.com

The chain ID and the other network parameters are on Network Information. A path is <BASE_URL>/rpc/v<N>/<RESOURCE>, for example https://rpc-testnet.supra.com/rpc/v3/block.

Reference

Each node serves its own reference, which lists the operations of the build that node runs, with their parameters and response headers:

  • <BASE_URL>/docs/ is the interactive reference. Include the trailing slash.
  • <BASE_URL>/docs/api.json is the same reference as an OpenAPI 3 document.

Versions

The path carries the API version, from /rpc/v1 to /rpc/v4. The TypeScript SDK and the Python SDK call /rpc/v3. The operations each version offers depend on the release the network runs, so Devnet can list operations that Testnet and Mainnet do not, and a network can serve an operation that its reference lists only under another version. Check an operation against the target network’s /docs/api.json, and with a request, before depending on it. The availability table in Tracking Balances compares the operations that track an account’s balance across releases.

Paging with x-supra-cursor

The event feeds (GET /rpc/v3/events/{event_type} and /rpc/v4/events/{event_type}) and the account feeds coin_transactions and fa_transactions return the x-supra-cursor response header. Pass its value as the start query parameter of the next request to continue the feed. limit (events) or count (account feeds) sets the page size.

curl --include 'https://rpc-testnet.supra.com/rpc/v3/events/0x1::coin::CoinDeposit?limit=1'

How a feed shows that it has ended depends on the release. Tracking Balances describes how account feeds are paged, including that a page can be empty and still carry a cursor.

Last updated on