Skip to content

Get Started

The Blink API has two surfaces:

  • Transactions (write): signed RuntimeCalls submitted Borsh-encoded to the sequencer. Placing and cancelling orders, managing margin, and transferring funds are all transactions.
  • Read and streaming: a normalized REST and WebSocket API, served by the indexer, for market data and account state.

Base URLs are deployment-specific.

Official SDKs

LanguagePackageScope (v1)
Rustblink-sdktyped REST + WebSocket
TypeScriptblink-sdktyped REST + WebSocket

Both decode the API's integer exchange units safely (values beyond 2^53 arrive as decimal strings) and implement the WebSocket protocol with the documented reconnect semantics. Transaction signing in the SDKs is on the roadmap; today it is provided by the blink-tx-client crate described below.

Submitting a transaction

Transactions are built and signed with the blink-tx-client crate and submitted Borsh-encoded to the sequencer. See Signing Transactions for the wire format, keys, and replay protection.

rust
use blink_tx_client::{TxClient, TxConfig};
use perps_module::CallMessage;

let config = TxConfig::default_with_key("<private-key-hex>".to_string());
let client = TxClient::new_connected("<sequencer-host>", <port>, config).await?;

// A RuntimeCall variant; fields are documented in the Transactions reference.
let call = CallMessage::PlaceOrder { /* ... */ };
let response = client.send_perps_call(call).await?;

All calls are submitted to the single Submit Transaction endpoint and are grouped by module: Accounts, Spot, Perps, Oracle.

Reading state

Market data and account state are served over REST and WebSocket by the indexer. No authentication is required.

bash
# List markets
curl https://api.blink.trade/markets

# A subaccount's open positions
curl https://api.blink.trade/accounts/0x9b08…3e25/subaccounts/0/positions

Reference: Markets & Orderbook · Trades · Accounts, Positions & Orders · Funding & Liquidations · Vaults & BLP · Tokens · System · Explorer.

Streaming

For real-time orderbook, trades, and account updates, connect to the WebSocket API and subscribe to channels.

Next steps